1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-12-23 05:16:58 +00:00

restore stories autoplay; close #1409 (main)

This commit is contained in:
Austin Huang 2021-06-19 12:39:58 -04:00
parent c2ac61986f
commit dcd00ce60b
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
5 changed files with 14 additions and 7 deletions

View File

@ -1029,7 +1029,7 @@ public class StoryViewerFragment extends Fragment {
if (context == null) return;
player = new SimpleExoPlayer.Builder(context).build();
binding.playerView.setPlayer(player);
player.setPlayWhenReady(settingsHelper.getBoolean(PreferenceKeys.AUTOPLAY_VIDEOS));
player.setPlayWhenReady(settingsHelper.getBoolean(PreferenceKeys.AUTOPLAY_VIDEOS_STORIES));
final Uri uri = Uri.parse(url);
final MediaItem mediaItem = MediaItem.fromUri(uri);
@ -1130,7 +1130,7 @@ public class StoryViewerFragment extends Fragment {
if (context == null) return;
player = new SimpleExoPlayer.Builder(context).build();
binding.playerView.setPlayer(player);
player.setPlayWhenReady(settingsHelper.getBoolean(PreferenceKeys.AUTOPLAY_VIDEOS));
player.setPlayWhenReady(settingsHelper.getBoolean(PreferenceKeys.AUTOPLAY_VIDEOS_STORIES));
final Uri uri = Uri.parse(url);
final MediaItem mediaItem = MediaItem.fromUri(uri);

View File

@ -30,8 +30,7 @@ object PreferenceKeys {
const val TOGGLE_KEYWORD_FILTER = "toggle_keyword_filter"
const val DOWNLOAD_PREPEND_USER_NAME = "download_user_name"
const val PLAY_IN_BACKGROUND = "play_in_background"
const val FOLDER_SAVE_TO = "saved_to"
const val AUTOPLAY_VIDEOS = "autoplay_videos"
const val AUTOPLAY_VIDEOS_STORIES = "autoplay_videos"
const val MUTED_VIDEOS = "muted_videos"
const val SHOW_CAPTIONS = "show_captions"
const val CUSTOM_DATE_TIME_FORMAT_ENABLED = "data_time_custom_enabled"

View File

@ -18,6 +18,7 @@ public class StoriesPreferencesFragment extends BasePreferencesFragment {
screen.addPreference(getStorySortPreference(context));
screen.addPreference(getHideMutedReelsPreference(context));
screen.addPreference(getMarkStoriesSeenPreference(context));
screen.addPreference(getAutoPlayPreference(context));
}
private Preference getStorySortPreference(@NonNull final Context context) {
@ -53,4 +54,12 @@ public class StoriesPreferencesFragment extends BasePreferencesFragment {
preference.setIconSpaceReserved(false);
return preference;
}
private Preference getAutoPlayPreference(@NonNull final Context context) {
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
preference.setKey(PreferenceKeys.AUTOPLAY_VIDEOS_STORIES);
preference.setTitle(R.string.autoplay_stories_setting);
preference.setIconSpaceReserved(false);
return preference;
}
}

View File

@ -7,7 +7,6 @@ import androidx.annotation.StringDef
import androidx.appcompat.app.AppCompatDelegate
import java.util.*
import awais.instagrabber.utils.Constants
import awais.instagrabber.fragments.settings.PreferenceKeys
class SettingsHelper(context: Context) {
@ -117,8 +116,7 @@ class SettingsHelper(context: Context) {
@StringDef(
PreferenceKeys.DOWNLOAD_USER_FOLDER,
PreferenceKeys.DOWNLOAD_PREPEND_USER_NAME,
PreferenceKeys.FOLDER_SAVE_TO,
PreferenceKeys.AUTOPLAY_VIDEOS,
PreferenceKeys.AUTOPLAY_VIDEOS_STORIES,
PreferenceKeys.MUTED_VIDEOS,
PreferenceKeys.SHOW_CAPTIONS,
PreferenceKeys.CUSTOM_DATE_TIME_FORMAT_ENABLED,

View File

@ -32,6 +32,7 @@
<string name="hide_muted_reels_setting">Hide muted stories from feed</string>
<string name="dm_mark_as_seen_setting">Mark DM as seen after viewing</string>
<string name="dm_mark_as_seen_setting_summary">Other members will know you viewed it</string>
<string name="autoplay_stories_setting">Autoplay video stories</string>
<string name="activity_setting">Enable activity notifications</string>
<string name="story_sort_setting">Feed stories sort</string>
<string name="error_loading_profile">Error loading profile! Is the username valid? If so, you may be ratelimited.</string>