mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-08 07:57:28 +00:00
Merge pull request #609 from Zopieux/show-caption-setting
Add a setting to control showing/hidden the post label per default
This commit is contained in:
commit
db7141c506
@ -242,6 +242,8 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
if (feedModel.getItemType() == MediaItemType.MEDIA_TYPE_SLIDER) {
|
||||
sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0);
|
||||
}
|
||||
captionState = settingsHelper.getBoolean(Constants.SHOW_CAPTIONS) ?
|
||||
BottomSheetBehavior.STATE_COLLAPSED : BottomSheetBehavior.STATE_HIDDEN;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -384,7 +386,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
binding.postImage.requestLayout();
|
||||
if (bottomSheetBehavior != null) {
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
bottomSheetBehavior.setState(captionState);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -393,7 +395,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
binding.sliderParent.requestLayout();
|
||||
if (bottomSheetBehavior != null) {
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
bottomSheetBehavior.setState(captionState);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -404,7 +406,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
binding.videoPost.thumbnailParent.setLayoutParams(params);
|
||||
binding.videoPost.thumbnailParent.requestLayout();
|
||||
if (bottomSheetBehavior != null) {
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
bottomSheetBehavior.setState(captionState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -846,7 +848,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
||||
public void onGlobalLayout() {
|
||||
binding.getRoot().getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
if (bottomSheetBehavior == null) return;
|
||||
bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
|
||||
bottomSheetBehavior.setState(captionState);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -17,6 +17,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";
|
||||
|
@ -37,6 +37,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;
|
||||
@ -126,7 +127,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 {}
|
||||
|
||||
|
@ -57,6 +57,7 @@
|
||||
<string name="main_posts_following">%s Following </string>
|
||||
<string name="post_viewer_autoplay_video">Autoplay 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_download_dialog_title">Select what to download</string>
|
||||
<string name="post_viewer_download_current">Current</string>
|
||||
<string name="post_viewer_download_album">Whole Album</string>
|
||||
|
Loading…
Reference in New Issue
Block a user