1
0
Fork 0
mirror of https://github.com/KokaKiwi/BarInsta synced 2026-03-05 03:51:36 +00:00

Merge branch 'master' into pr/503

This commit is contained in:
Austin Huang 2021-01-18 22:25:24 -05:00
commit f88aaeb849
No known key found for this signature in database
GPG key ID: 84C23AA04587A91F
38 changed files with 598 additions and 581 deletions

View file

@ -238,6 +238,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
super.onCreate(savedInstanceState);
setStyle(DialogFragment.STYLE_NO_FRAME, R.style.PostViewV2Style);
viewModel = new ViewModelProvider(this).get(PostViewV2ViewModel.class);
captionState = settingsHelper.getBoolean(Constants.SHOW_CAPTIONS) ?
BottomSheetBehavior.STATE_COLLAPSED : BottomSheetBehavior.STATE_HIDDEN;
}
@Nullable
@ -382,7 +384,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
ViewGroup.LayoutParams.MATCH_PARENT));
binding.postImage.requestLayout();
if (bottomSheetBehavior != null) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
bottomSheetBehavior.setState(captionState);
}
return;
}
@ -391,7 +393,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
ViewGroup.LayoutParams.MATCH_PARENT));
binding.sliderParent.requestLayout();
if (bottomSheetBehavior != null) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
bottomSheetBehavior.setState(captionState);
}
return;
}
@ -402,7 +404,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment im
binding.videoPost.thumbnailParent.setLayoutParams(params);
binding.videoPost.thumbnailParent.requestLayout();
if (bottomSheetBehavior != null) {
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
bottomSheetBehavior.setState(captionState);
}
}
}

View file

@ -52,6 +52,7 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
generalCategory.addPreference(getUpdateCheckPreference());
// generalCategory.addPreference(getAutoPlayVideosPreference());
generalCategory.addPreference(getAlwaysMuteVideosPreference());
generalCategory.addPreference(getShowCaptionPreference());
// screen.addPreference(getDivider(context));
// final PreferenceCategory themeCategory = new PreferenceCategory(context);
@ -204,6 +205,17 @@ public class SettingsPreferencesFragment extends BasePreferencesFragment {
return preference;
}
private Preference getShowCaptionPreference() {
final Context context = getContext();
if (context == null) return null;
final SwitchPreferenceCompat preference = new SwitchPreferenceCompat(context);
preference.setKey(Constants.SHOW_CAPTIONS);
preference.setDefaultValue(true);
preference.setTitle(R.string.post_viewer_show_captions);
preference.setIconSpaceReserved(false);
return preference;
}
private Preference getStorySortPreference() {
final Context context = getContext();
if (context == null) return null;

View file

@ -19,6 +19,7 @@ public final class Constants {
public static final String FOLDER_SAVE_TO = "saved_to";
public static final String AUTOPLAY_VIDEOS = "autoplay_videos";
public static final String MUTED_VIDEOS = "muted_videos";
public static final String SHOW_CAPTIONS = "show_captions";
public static final String CUSTOM_DATE_TIME_FORMAT_ENABLED = "data_time_custom_enabled";
public static final String SWAP_DATE_TIME_FORMAT_ENABLED = "swap_date_time_enabled";
public static final String MARK_AS_SEEN = "mark_as_seen";

View file

@ -43,6 +43,7 @@ import static awais.instagrabber.utils.Constants.PREF_SAVED_POSTS_LAYOUT;
import static awais.instagrabber.utils.Constants.PREF_TAGGED_POSTS_LAYOUT;
import static awais.instagrabber.utils.Constants.PREF_TOPIC_POSTS_LAYOUT;
import static awais.instagrabber.utils.Constants.PREV_INSTALL_VERSION;
import static awais.instagrabber.utils.Constants.SHOW_CAPTIONS;
import static awais.instagrabber.utils.Constants.SHOW_QUICK_ACCESS_DIALOG;
import static awais.instagrabber.utils.Constants.SKIPPED_VERSION;
import static awais.instagrabber.utils.Constants.STORY_SORT;
@ -133,7 +134,7 @@ public final class SettingsHelper {
public @interface StringSettings {}
@StringDef({DOWNLOAD_USER_FOLDER, FOLDER_SAVE_TO, AUTOPLAY_VIDEOS, SHOW_QUICK_ACCESS_DIALOG, MUTED_VIDEOS,
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})
public @interface BooleanSettings {}