diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-10-09 13:43:55 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-10-09 13:43:55 +0000 |
commit | f12dea156fbe08b3b8ad64d153c8aedc75bf024e (patch) | |
tree | bad0f5f6153f1909a214094394089b285c2d1ee1 /app/src/main/java | |
parent | abd57e23a60b5c9e3afbd706f3ebfef9ff523414 (diff) | |
download | infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.tar infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.tar.gz infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.tar.bz2 infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.tar.lz infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.tar.xz infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.tar.zst infinity-for-reddit-f12dea156fbe08b3b8ad64d153c8aedc75bf024e.zip |
New option: loop video.
Diffstat (limited to '')
6 files changed, 26 insertions, 5 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java index 109d10d3..a7fb97d8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java @@ -210,7 +210,11 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF videoPlayerView.setPlayer(player); dataSourceFactory = new DefaultDataSourceFactory(this, Util.getUserAgent(this, "Infinity")); - player.setRepeatMode(Player.REPEAT_MODE_ALL); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.LOOP_VIDEO, true)) { + player.setRepeatMode(Player.REPEAT_MODE_ALL); + } else { + player.setRepeatMode(Player.REPEAT_MODE_OFF); + } mPostingSnackbar = Snackbar.make(coordinatorLayout, R.string.posting, Snackbar.LENGTH_INDEFINITE); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index 53aa6188..b09b66a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -419,7 +419,11 @@ public class ViewVideoActivity extends AppCompatActivity { } private void preparePlayer(Bundle savedInstanceState) { - player.setRepeatMode(Player.REPEAT_MODE_ALL); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.LOOP_VIDEO, true)) { + player.setRepeatMode(Player.REPEAT_MODE_ALL); + } else { + player.setRepeatMode(Player.REPEAT_MODE_OFF); + } if (resumePosition > 0) { player.seekTo(resumePosition); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java index 65b283e1..99a950e3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java @@ -222,7 +222,11 @@ public class ViewImgurVideoFragment extends Fragment { } private void preparePlayer(Bundle savedInstanceState) { - player.setRepeatMode(Player.REPEAT_MODE_ALL); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.LOOP_VIDEO, true)) { + player.setRepeatMode(Player.REPEAT_MODE_ALL); + } else { + player.setRepeatMode(Player.REPEAT_MODE_OFF); + } wasPlaying = true; boolean muteVideo = mSharedPreferences.getBoolean(SharedPreferencesUtils.MUTE_VIDEO, false); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java index 8c0c2f57..66921637 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java @@ -343,7 +343,11 @@ public class ViewRPANBroadcastFragment extends Fragment { dataSourceFactory = new DefaultHttpDataSourceFactory(Util.getUserAgent(mActivity, "Infinity")); // Prepare the player with the source. player.prepare(new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(Uri.parse(rpanBroadcast.rpanStream.hlsUrl))); - player.setRepeatMode(Player.REPEAT_MODE_ALL); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.LOOP_VIDEO, true)) { + player.setRepeatMode(Player.REPEAT_MODE_ALL); + } else { + player.setRepeatMode(Player.REPEAT_MODE_OFF); + } if (resumePosition > 0) { player.seekTo(resumePosition); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java index de1e5566..7b1867c8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java @@ -226,7 +226,11 @@ public class ViewRedditGalleryVideoFragment extends Fragment { } private void preparePlayer(Bundle savedInstanceState) { - player.setRepeatMode(Player.REPEAT_MODE_ALL); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.LOOP_VIDEO, true)) { + player.setRepeatMode(Player.REPEAT_MODE_ALL); + } else { + player.setRepeatMode(Player.REPEAT_MODE_OFF); + } wasPlaying = true; boolean muteVideo = mSharedPreferences.getBoolean(SharedPreferencesUtils.MUTE_VIDEO, false); 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 6e83f822..361c59f4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -191,6 +191,7 @@ public class SharedPreferencesUtils { public static final String USE_BOTTOM_TOOLBAR_IN_MEDIA_VIEWER = "use_bottom_toolbar_in_media_viewer"; public static final String LOCK_SCREEN_ANIMATION = "lock_screen_animation"; public static final String ENABLE_FOLD_SUPPORT = "enable_fold_support"; + public static final String LOOP_VIDEO = "loop_video"; 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"; |