diff options
Diffstat (limited to '')
8 files changed, 32 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"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 11e062eb..93686697 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -594,6 +594,7 @@ <string name="settings_disable_nsfw_forever_title">Disable NSFW Forever</string> <string name="settings_show_only_one_comment_level_indicator">Show Only One Comment Level Indicator</string> <string name="settings_video_player_automatic_landscape_orientation">Switch to Landscape Orientation in Video Player Automatically</string> + <string name="settings_loop_video_title">Loop Video</string> <string name="settings_remember_muting_option_in_post_feed">Remember Muting Option in Post Feed</string> <string name="settings_post_details_title">Post Details</string> <string name="settings_separate_post_and_comments_in_portrait_mode_title">Separate Post And Comments in Portrait Mode</string> diff --git a/app/src/main/res/xml/video_preferences.xml b/app/src/main/res/xml/video_preferences.xml index decf2674..7b2ebbdb 100644 --- a/app/src/main/res/xml/video_preferences.xml +++ b/app/src/main/res/xml/video_preferences.xml @@ -30,6 +30,11 @@ app:key="video_player_automatic_landscape_orientation" app:title="@string/settings_video_player_automatic_landscape_orientation" /> + <SwitchPreference + app:defaultValue="true" + app:key="loop_video" + app:title="@string/settings_loop_video_title" /> + <PreferenceCategory app:title="@string/settings_video_autoplay_title" /> |