aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java
index 369da42b..3ea7ae13 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/HistoryPostFragment.java
@@ -9,6 +9,9 @@ import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@@ -54,6 +57,7 @@ import ml.docilealligator.infinityforreddit.post.HistoryPostViewModel;
import ml.docilealligator.infinityforreddit.postfilter.PostFilter;
import ml.docilealligator.infinityforreddit.postfilter.PostFilterUsage;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
+import ml.docilealligator.infinityforreddit.utils.Utils;
import ml.docilealligator.infinityforreddit.videoautoplay.ExoCreator;
import ml.docilealligator.infinityforreddit.videoautoplay.media.PlaybackInfo;
import ml.docilealligator.infinityforreddit.videoautoplay.media.VolumeInfo;
@@ -356,6 +360,34 @@ public class HistoryPostFragment extends PostFragmentBase implements FragmentCom
view -> mAdapter.retry())));
}
+ @Override
+ public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
+ inflater.inflate(R.menu.history_post_fragment, menu);
+ for (int i = 0; i < menu.size(); i++) {
+ Utils.setTitleWithCustomFontToMenuItem(activity.typeface, menu.getItem(i), null);
+ }
+ lazyModeItem = menu.findItem(R.id.action_lazy_mode_history_post_fragment);
+
+ if (isInLazyMode) {
+ Utils.setTitleWithCustomFontToMenuItem(activity.typeface, lazyModeItem, getString(R.string.action_stop_lazy_mode));
+ } else {
+ Utils.setTitleWithCustomFontToMenuItem(activity.typeface, lazyModeItem, getString(R.string.action_start_lazy_mode));
+ }
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ if (item.getItemId() == R.id.action_lazy_mode_history_post_fragment) {
+ if (isInLazyMode) {
+ stopLazyMode();
+ } else {
+ startLazyMode();
+ }
+ return true;
+ }
+ return false;
+ }
+
private void noPostFound() {
hasPost = false;
if (isInLazyMode) {