aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2022-06-11 11:56:55 +0000
committerDocile-Alligator <chineseperson5@gmail.com>2022-06-11 11:56:55 +0000
commit92cb309bf603a69a143412900bfb5c45349b92a9 (patch)
tree603968ca9a017eaa5ce005bf1dc35a41663a14f8
parent5d07ad2d3b3e532c1897f09dcae4d3641d89beac (diff)
downloadinfinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.tar
infinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.tar.gz
infinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.tar.bz2
infinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.tar.lz
infinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.tar.xz
infinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.tar.zst
infinity-for-reddit-92cb309bf603a69a143412900bfb5c45349b92a9.zip
New option: Settings->Video->Easier to Watch in Full Screen.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeEasierToWatchInFullScreenEvent.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java9
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--app/src/main/res/xml/video_preferences.xml5
8 files changed, 43 insertions, 2 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
index 1afbf635..bf6fabe9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java
@@ -174,6 +174,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
private boolean mHideTheNumberOfComments;
private boolean mSeparatePostAndComments;
private boolean mLegacyAutoplayVideoControllerUI;
+ private boolean mEasierToWatchInFullScreen;
private PostDetailRecyclerViewAdapterCallback mPostDetailRecyclerViewAdapterCallback;
private int mColorAccent;
@@ -313,6 +314,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
.build();
mSeparatePostAndComments = separatePostAndComments;
mLegacyAutoplayVideoControllerUI = sharedPreferences.getBoolean(SharedPreferencesUtils.LEGACY_AUTOPLAY_VIDEO_CONTROLLER_UI, false);
+ mEasierToWatchInFullScreen = sharedPreferences.getBoolean(SharedPreferencesUtils.EASIER_TO_WATCH_IN_FULL_SCREEN, false);
mAccessToken = accessToken;
mAccountName = accountName;
mPost = post;
@@ -1727,7 +1729,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
playerView.setOnClickListener(view -> {
- if (playerView.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && playerView.isControllerVisible()) {
fullscreenButton.performClick();
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
index b17b800a..41d09e99 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java
@@ -211,6 +211,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
private boolean mLegacyAutoplayVideoControllerUI;
private boolean mFixedHeightPreviewInCard;
private boolean mHideTextPostContent;
+ private boolean mEasierToWatchInFullScreen;
private Drawable mCommentIcon;
private ExoCreator mExoCreator;
private Callback mCallback;
@@ -289,6 +290,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
mLegacyAutoplayVideoControllerUI = sharedPreferences.getBoolean(SharedPreferencesUtils.LEGACY_AUTOPLAY_VIDEO_CONTROLLER_UI, false);
mFixedHeightPreviewInCard = sharedPreferences.getBoolean(SharedPreferencesUtils.FIXED_HEIGHT_PREVIEW_IN_CARD, false);
mHideTextPostContent = sharedPreferences.getBoolean(SharedPreferencesUtils.HIDE_TEXT_POST_CONTENT, false);
+ mEasierToWatchInFullScreen = sharedPreferences.getBoolean(SharedPreferencesUtils.EASIER_TO_WATCH_IN_FULL_SCREEN, false);
mPostLayout = postLayout;
mDefaultLinkPostLayout = Integer.parseInt(sharedPreferences.getString(SharedPreferencesUtils.DEFAULT_LINK_POST_LAYOUT_KEY, "-1"));
@@ -1812,6 +1814,10 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
}
}
+ public void setEasierToWatchInFullScreen(boolean easierToWatchInFullScreen) {
+ this.mEasierToWatchInFullScreen = easierToWatchInFullScreen;
+ }
+
@Override
public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
if (holder instanceof PostBaseViewHolder) {
@@ -2808,7 +2814,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
previewImageView.setOnClickListener(view -> fullscreenButton.performClick());
videoPlayer.setOnClickListener(view -> {
- if (videoPlayer.isControllerVisible()) {
+ if (mEasierToWatchInFullScreen && videoPlayer.isControllerVisible()) {
fullscreenButton.performClick();
}
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeEasierToWatchInFullScreenEvent.java b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeEasierToWatchInFullScreenEvent.java
new file mode 100644
index 00000000..30a3cef8
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/events/ChangeEasierToWatchInFullScreenEvent.java
@@ -0,0 +1,9 @@
+package ml.docilealligator.infinityforreddit.events;
+
+public class ChangeEasierToWatchInFullScreenEvent {
+ public boolean easierToWatchInFullScreen;
+
+ public ChangeEasierToWatchInFullScreenEvent(boolean easierToWatchInFullScreen) {
+ this.easierToWatchInFullScreen = easierToWatchInFullScreen;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index 48f1dbd5..de518519 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -94,6 +94,7 @@ import ml.docilealligator.infinityforreddit.events.ChangeDataSavingModeEvent;
import ml.docilealligator.infinityforreddit.events.ChangeDefaultLinkPostLayoutEvent;
import ml.docilealligator.infinityforreddit.events.ChangeDefaultPostLayoutEvent;
import ml.docilealligator.infinityforreddit.events.ChangeDisableImagePreviewEvent;
+import ml.docilealligator.infinityforreddit.events.ChangeEasierToWatchInFullScreenEvent;
import ml.docilealligator.infinityforreddit.events.ChangeEnableSwipeActionSwitchEvent;
import ml.docilealligator.infinityforreddit.events.ChangeFixedHeightPreviewInCardEvent;
import ml.docilealligator.infinityforreddit.events.ChangeHidePostFlairEvent;
@@ -2106,6 +2107,13 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
}
+ @Subscribe
+ public void onChangeEasierToWatchInFullScreenEvent(ChangeEasierToWatchInFullScreenEvent event) {
+ if (mAdapter != null) {
+ mAdapter.setEasierToWatchInFullScreen(event.easierToWatchInFullScreen);
+ }
+ }
+
private void refreshAdapter() {
int previousPosition = -1;
if (mLinearLayoutManager != null) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java
index 2eb3f6e7..9802e3cb 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/VideoPreferenceFragment.java
@@ -18,6 +18,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.customviews.CustomFontPreferenceFragmentCompat;
import ml.docilealligator.infinityforreddit.events.ChangeAutoplayNsfwVideosEvent;
+import ml.docilealligator.infinityforreddit.events.ChangeEasierToWatchInFullScreenEvent;
import ml.docilealligator.infinityforreddit.events.ChangeMuteAutoplayingVideosEvent;
import ml.docilealligator.infinityforreddit.events.ChangeMuteNSFWVideoEvent;
import ml.docilealligator.infinityforreddit.events.ChangeRememberMutingOptionInPostFeedEvent;
@@ -46,6 +47,7 @@ public class VideoPreferenceFragment extends CustomFontPreferenceFragmentCompat
SwitchPreference rememberMutingOptionInPostFeedSwitchPreference = findPreference(SharedPreferencesUtils.REMEMBER_MUTING_OPTION_IN_POST_FEED);
SwitchPreference muteNSFWVideosSwitchPreference = findPreference(SharedPreferencesUtils.MUTE_NSFW_VIDEO);
SwitchPreference autoplayNsfwVideosSwitchPreference = findPreference(SharedPreferencesUtils.AUTOPLAY_NSFW_VIDEOS);
+ SwitchPreference easierToWatchInFullScreenSwitchPreference = findPreference(SharedPreferencesUtils.EASIER_TO_WATCH_IN_FULL_SCREEN);
SeekBarPreference startAutoplayVisibleAreaOffsetPortrait = findPreference(SharedPreferencesUtils.START_AUTOPLAY_VISIBLE_AREA_OFFSET_PORTRAIT);
SeekBarPreference startAutoplayVisibleAreaOffsetLandscape = findPreference(SharedPreferencesUtils.START_AUTOPLAY_VISIBLE_AREA_OFFSET_LANDSCAPE);
@@ -61,6 +63,13 @@ public class VideoPreferenceFragment extends CustomFontPreferenceFragmentCompat
});
}
+ if (easierToWatchInFullScreenSwitchPreference != null) {
+ easierToWatchInFullScreenSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
+ EventBus.getDefault().post(new ChangeEasierToWatchInFullScreenEvent((Boolean) newValue));
+ return true;
+ });
+ }
+
if (muteNSFWVideosSwitchPreference != null) {
muteNSFWVideosSwitchPreference.setOnPreferenceChangeListener((preference, newValue) -> {
EventBus.getDefault().post(new ChangeMuteNSFWVideoEvent((Boolean) newValue));
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
index 37c0924b..a6d27c62 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -210,6 +210,7 @@ public class SharedPreferencesUtils {
public static final String HIDE_UPVOTE_RATIO = "hide_upvote_ratio";
public static final String POST_FEED_MAX_RESOLUTION = "post_feed_max_resolution";
public static final String REDDIT_VIDEO_DEFAULT_RESOLUTION = "reddit_video_default_resolution";
+ public static final String EASIER_TO_WATCH_IN_FULL_SCREEN = "easier_to_watch_in_full_screen";
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8ed74ced..2748afcd 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -641,6 +641,7 @@
<string name="settings_post_feed_max_resolution_warning_title">Increase the value to show previews in higher resolution, but the app may crash unexpectedly.</string>
<string name="settings_post_feed_max_resolution_title">Post Feed Preview Max Resolution (Width * Height)</string>
<string name="settings_reddit_video_default_resolution">Reddit Video Default Resolution</string>
+ <string name="settings_easier_to_watch_in_full_screen_title">Easier to Watch in Full Screen</string>
<string name="no_link_available">Cannot get the link</string>
diff --git a/app/src/main/res/xml/video_preferences.xml b/app/src/main/res/xml/video_preferences.xml
index 8b1663fc..ffc2a7f6 100644
--- a/app/src/main/res/xml/video_preferences.xml
+++ b/app/src/main/res/xml/video_preferences.xml
@@ -77,6 +77,11 @@
app:key="autoplay_nsfw_videos"
app:title="@string/settings_autoplay_nsfw_videos_title" />
+ <ml.docilealligator.infinityforreddit.customviews.CustomFontSwitchPreference
+ app:defaultValue="false"
+ app:key="easier_to_watch_in_full_screen"
+ app:title="@string/settings_easier_to_watch_in_full_screen_title" />
+
<ml.docilealligator.infinityforreddit.customviews.CustomFontSeekBarPreference
app:defaultValue="75"
android:max="100"