mirror of
				https://github.com/KokaKiwi/BarInsta
				synced 2025-11-04 13:35:36 +00:00 
			
		
		
		
	made play in background an option per https://redd.it/mmpeg9
This commit is contained in:
		
							parent
							
								
									23a5ae8405
								
							
						
					
					
						commit
						84d82e92d3
					
				@ -334,6 +334,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
 | 
				
			|||||||
        if (bottomSheetBehavior != null) {
 | 
					        if (bottomSheetBehavior != null) {
 | 
				
			||||||
            captionState = bottomSheetBehavior.getState();
 | 
					            captionState = bottomSheetBehavior.getState();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if (settingsHelper.getBoolean(Constants.PLAY_IN_BACKGROUND)) return;
 | 
				
			||||||
        final Media media = viewModel.getMedia();
 | 
					        final Media media = viewModel.getMedia();
 | 
				
			||||||
        if (media == null) return;
 | 
					        if (media == null) return;
 | 
				
			||||||
        switch (media.getMediaType()) {
 | 
					        switch (media.getMediaType()) {
 | 
				
			||||||
 | 
				
			|||||||
@ -17,16 +17,26 @@ public class PostPreferencesFragment extends BasePreferencesFragment {
 | 
				
			|||||||
        final Context context = getContext();
 | 
					        final Context context = getContext();
 | 
				
			||||||
        if (context == null) return;
 | 
					        if (context == null) return;
 | 
				
			||||||
        // generalCategory.addPreference(getAutoPlayVideosPreference(context));
 | 
					        // generalCategory.addPreference(getAutoPlayVideosPreference(context));
 | 
				
			||||||
 | 
					        screen.addPreference(getBackgroundPlayPreference(context));
 | 
				
			||||||
        screen.addPreference(getAlwaysMuteVideosPreference(context));
 | 
					        screen.addPreference(getAlwaysMuteVideosPreference(context));
 | 
				
			||||||
        screen.addPreference(getShowCaptionPreference(context));
 | 
					        screen.addPreference(getShowCaptionPreference(context));
 | 
				
			||||||
        screen.addPreference(getToggleKeywordFilterPreference(context));
 | 
					        screen.addPreference(getToggleKeywordFilterPreference(context));
 | 
				
			||||||
        screen.addPreference(getEditKeywordFilterPreference(context));
 | 
					        screen.addPreference(getEditKeywordFilterPreference(context));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private Preference getAutoPlayVideosPreference(@NonNull final Context context) {
 | 
					//    private Preference getAutoPlayVideosPreference(@NonNull final Context context) {
 | 
				
			||||||
 | 
					//        final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
 | 
				
			||||||
 | 
					//        preference.setKey(Constants.AUTOPLAY_VIDEOS);
 | 
				
			||||||
 | 
					//        preference.setTitle(R.string.post_viewer_autoplay_video);
 | 
				
			||||||
 | 
					//        preference.setIconSpaceReserved(false);
 | 
				
			||||||
 | 
					//        return preference;
 | 
				
			||||||
 | 
					//    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private Preference getBackgroundPlayPreference(@NonNull final Context context) {
 | 
				
			||||||
        final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
 | 
					        final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
 | 
				
			||||||
        preference.setKey(Constants.AUTOPLAY_VIDEOS);
 | 
					        preference.setKey(Constants.PLAY_IN_BACKGROUND);
 | 
				
			||||||
        preference.setTitle(R.string.post_viewer_autoplay_video);
 | 
					        preference.setTitle(R.string.post_viewer_background_play);
 | 
				
			||||||
 | 
					        preference.setTitle(R.string.post_viewer_background_play_summary);
 | 
				
			||||||
        preference.setIconSpaceReserved(false);
 | 
					        preference.setIconSpaceReserved(false);
 | 
				
			||||||
        return preference;
 | 
					        return preference;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -229,7 +229,6 @@ public class DirectItem implements Cloneable, Serializable {
 | 
				
			|||||||
    public LocalDateTime getLocalDateTime() {
 | 
					    public LocalDateTime getLocalDateTime() {
 | 
				
			||||||
        if (localDateTime == null) {
 | 
					        if (localDateTime == null) {
 | 
				
			||||||
            localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
 | 
					            localDateTime = Instant.ofEpochMilli(timestamp / 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
 | 
				
			||||||
            ;
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return localDateTime;
 | 
					        return localDateTime;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@ public final class Constants {
 | 
				
			|||||||
    public static final String DOWNLOAD_USER_FOLDER = "download_user_folder";
 | 
					    public static final String DOWNLOAD_USER_FOLDER = "download_user_folder";
 | 
				
			||||||
    public static final String TOGGLE_KEYWORD_FILTER = "toggle_keyword_filter";
 | 
					    public static final String TOGGLE_KEYWORD_FILTER = "toggle_keyword_filter";
 | 
				
			||||||
    public static final String DOWNLOAD_PREPEND_USER_NAME = "download_user_name";
 | 
					    public static final String DOWNLOAD_PREPEND_USER_NAME = "download_user_name";
 | 
				
			||||||
 | 
					    public static final String PLAY_IN_BACKGROUND = "play_in_background";
 | 
				
			||||||
    // deprecated: public static final String BOTTOM_TOOLBAR = "bottom_toolbar";
 | 
					    // deprecated: public static final String BOTTOM_TOOLBAR = "bottom_toolbar";
 | 
				
			||||||
    public static final String FOLDER_SAVE_TO = "saved_to";
 | 
					    public static final String FOLDER_SAVE_TO = "saved_to";
 | 
				
			||||||
    public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
 | 
					    public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
 | 
				
			||||||
 | 
				
			|||||||
@ -43,6 +43,7 @@ import static awais.instagrabber.utils.Constants.HIDE_MUTED_REELS;
 | 
				
			|||||||
import static awais.instagrabber.utils.Constants.KEYWORD_FILTERS;
 | 
					import static awais.instagrabber.utils.Constants.KEYWORD_FILTERS;
 | 
				
			||||||
import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
 | 
					import static awais.instagrabber.utils.Constants.MARK_AS_SEEN;
 | 
				
			||||||
import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
 | 
					import static awais.instagrabber.utils.Constants.MUTED_VIDEOS;
 | 
				
			||||||
 | 
					import static awais.instagrabber.utils.Constants.PLAY_IN_BACKGROUND;
 | 
				
			||||||
import static awais.instagrabber.utils.Constants.PREF_DARK_THEME;
 | 
					import static awais.instagrabber.utils.Constants.PREF_DARK_THEME;
 | 
				
			||||||
import static awais.instagrabber.utils.Constants.PREF_EMOJI_VARIANTS;
 | 
					import static awais.instagrabber.utils.Constants.PREF_EMOJI_VARIANTS;
 | 
				
			||||||
import static awais.instagrabber.utils.Constants.PREF_HASHTAG_POSTS_LAYOUT;
 | 
					import static awais.instagrabber.utils.Constants.PREF_HASHTAG_POSTS_LAYOUT;
 | 
				
			||||||
@ -164,7 +165,7 @@ public final class SettingsHelper {
 | 
				
			|||||||
    @StringDef({DOWNLOAD_USER_FOLDER, DOWNLOAD_PREPEND_USER_NAME, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
 | 
					    @StringDef({DOWNLOAD_USER_FOLDER, DOWNLOAD_PREPEND_USER_NAME, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
 | 
				
			||||||
                       SHOW_CAPTIONS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, CHECK_ACTIVITY,
 | 
					                       SHOW_CAPTIONS, CUSTOM_DATE_TIME_FORMAT_ENABLED, MARK_AS_SEEN, DM_MARK_AS_SEEN, CHECK_ACTIVITY,
 | 
				
			||||||
                       CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED, PREF_ENABLE_DM_NOTIFICATIONS, PREF_ENABLE_DM_AUTO_REFRESH,
 | 
					                       CHECK_UPDATES, SWAP_DATE_TIME_FORMAT_ENABLED, PREF_ENABLE_DM_NOTIFICATIONS, PREF_ENABLE_DM_AUTO_REFRESH,
 | 
				
			||||||
                       FLAG_SECURE, TOGGLE_KEYWORD_FILTER, PREF_ENABLE_SENTRY, HIDE_MUTED_REELS})
 | 
					                       FLAG_SECURE, TOGGLE_KEYWORD_FILTER, PREF_ENABLE_SENTRY, HIDE_MUTED_REELS, PLAY_IN_BACKGROUND})
 | 
				
			||||||
    public @interface BooleanSettings {}
 | 
					    public @interface BooleanSettings {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})
 | 
					    @StringDef({PREV_INSTALL_VERSION, BROWSER_UA_CODE, APP_UA_CODE, PREF_ENABLE_DM_AUTO_REFRESH_FREQ_NUMBER})
 | 
				
			||||||
 | 
				
			|||||||
@ -59,6 +59,8 @@
 | 
				
			|||||||
    </plurals>
 | 
					    </plurals>
 | 
				
			||||||
    <string name="main_posts_following">%s\nFollowing</string>
 | 
					    <string name="main_posts_following">%s\nFollowing</string>
 | 
				
			||||||
    <string name="post_viewer_autoplay_video">Autoplay videos</string>
 | 
					    <string name="post_viewer_autoplay_video">Autoplay videos</string>
 | 
				
			||||||
 | 
					    <string name="post_viewer_background_play">Continue to play videos in background</string>
 | 
				
			||||||
 | 
					    <string name="post_viewer_background_play_summary">When app is not in focus</string>
 | 
				
			||||||
    <string name="post_viewer_muted_autoplay">Always mute videos</string>
 | 
					    <string name="post_viewer_muted_autoplay">Always mute videos</string>
 | 
				
			||||||
    <string name="post_viewer_show_captions">Always show post captions</string>
 | 
					    <string name="post_viewer_show_captions">Always show post captions</string>
 | 
				
			||||||
    <string name="post_viewer_download_dialog_title">Select what to download</string>
 | 
					    <string name="post_viewer_download_dialog_title">Select what to download</string>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user