diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-05-15 05:41:20 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-05-15 05:41:20 +0000 |
commit | bb36cc79fdded7209a4848c85a37076d2cf7f064 (patch) | |
tree | c73bd8f8f752b00ebe5e622744b8b5a068d8528d | |
parent | 004bd22f675187929ccbf0e787ba6f0568440c50 (diff) | |
download | infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.tar infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.tar.gz infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.tar.bz2 infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.tar.lz infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.tar.xz infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.tar.zst infinity-for-reddit-bb36cc79fdded7209a4848c85a37076d2cf7f064.zip |
New option: Swipe Vertically to Go Back From Media.
Diffstat (limited to '')
7 files changed, 37 insertions, 16 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java index e82ea47a..3988d3c8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java @@ -135,7 +135,9 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa actionBar.setHomeAsUpIndicator(upArrow); actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.transparentActionBarAndExoPlayerControllerColor))); - Slidr.attach(this, new SlidrConfig.Builder().position(SlidrPosition.VERTICAL).distanceThreshold(0.125f).build()); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA, true)) { + Slidr.attach(this, new SlidrConfig.Builder().position(SlidrPosition.VERTICAL).distanceThreshold(0.125f).build()); + } glide = Glide.with(this); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java index 10866770..c16cef7d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java @@ -133,11 +133,15 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa images = savedInstanceState.getParcelableArrayList(IMGUR_IMAGES_STATE); } - haulerView.setOnDragDismissedListener(dragDirection -> { - int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; - finish(); - overridePendingTransition(0, slide); - }); + if (sharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA, true)) { + haulerView.setOnDragDismissedListener(dragDirection -> { + int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; + finish(); + overridePendingTransition(0, slide); + }); + } else { + haulerView.setDragEnabled(false); + } if (images == null) { fetchImgurMedia(imgurId); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java index 6bcccfa3..267bd56b 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java @@ -105,11 +105,15 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA } subredditName = getIntent().getStringExtra(EXTRA_SUBREDDIT_NAME); - haulerView.setOnDragDismissedListener(dragDirection -> { - int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; - finish(); - overridePendingTransition(0, slide); - }); + if (sharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA, true)) { + haulerView.setOnDragDismissedListener(dragDirection -> { + int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; + finish(); + overridePendingTransition(0, slide); + }); + } else { + haulerView.setDragEnabled(false); + } setupViewPager(); } 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 61a12366..7e44ba9f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -204,11 +204,15 @@ public class ViewVideoActivity extends AppCompatActivity { } } - haulerView.setOnDragDismissedListener(dragDirection -> { - int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; - finish(); - overridePendingTransition(0, slide); - }); + if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA, true)) { + haulerView.setOnDragDismissedListener(dragDirection -> { + int slide = dragDirection == DragDirection.UP ? R.anim.slide_out_up : R.anim.slide_out_down; + finish(); + overridePendingTransition(0, slide); + }); + } else { + haulerView.setDragEnabled(false); + } Intent intent = getIntent(); postTitle = intent.getStringExtra(EXTRA_POST_TITLE); 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 3242c63c..011e40cf 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java @@ -87,6 +87,7 @@ public class SharedPreferencesUtils { public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_PORTRAIT_GALLERY_LAYOUT = "number_of_columns_in_post_feed_portrait_gallery_layout"; public static final String NUMBER_OF_COLUMNS_IN_POST_FEED_LANDSCAPE_GALLERY_LAYOUT = "number_of_columns_in_post_feed_landscape_gallery_layout"; public static final String SWIPE_RIGHT_TO_GO_BACK = "swipe_to_go_back_from_post_detail"; + public static final String SWIPE_VERTICALLY_TO_GO_BACK_FROM_MEDIA = "swipe_vertically_to_go_back_from_media"; public static final String VOLUME_KEYS_NAVIGATE_COMMENTS = "volume_keys_navigate_comments"; public static final String VOLUME_KEYS_NAVIGATE_POSTS = "volume_keys_navigate_posts"; public static final String MUTE_VIDEO = "mute_video"; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6dd4979f..dc7d9493 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -398,6 +398,7 @@ <string name="settings_swap_tap_and_long_title">Swap Tap and Long Press in Comments</string> <string name="settings_swipe_to_go_back_title">Swipe Right to Go Back</string> <string name="settings_swipe_to_go_back_summary">Does Not Apply to All Pages</string> + <string name="settings_swipe_vertically_to_go_back_from_media_title">Swipe Vertically to Go Back From Media</string> <string name="settings_lock_jump_to_next_top_level_comment_button_title">Lock Jump to Next Top-level Comment Button</string> <string name="settings_lock_bottom_app_bar_title">Lock Bottom Navigation Bar</string> <string name="settings_swipe_up_to_hide_jump_to_next_top_level_comment_button_title">Swipe Up to Hide Jump to Next Top-level Comment Button</string> diff --git a/app/src/main/res/xml/gestures_and_buttons_preferences.xml b/app/src/main/res/xml/gestures_and_buttons_preferences.xml index b5c30058..fd49d4c0 100644 --- a/app/src/main/res/xml/gestures_and_buttons_preferences.xml +++ b/app/src/main/res/xml/gestures_and_buttons_preferences.xml @@ -8,6 +8,11 @@ app:summary="@string/settings_swipe_to_go_back_summary" /> <SwitchPreference + app:defaultValue="true" + app:key="swipe_vertically_to_go_back_from_media" + app:title="@string/settings_swipe_vertically_to_go_back_from_media_title" /> + + <SwitchPreference app:defaultValue="false" app:key="lock_jump_to_next_top_level_comment_button" app:title="@string/settings_lock_jump_to_next_top_level_comment_button_title" /> |