aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-05-15 05:41:20 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-05-15 05:41:20 +0000
commitbb36cc79fdded7209a4848c85a37076d2cf7f064 (patch)
treec73bd8f8f752b00ebe5e622744b8b5a068d8528d /app/src/main/java
parent004bd22f675187929ccbf0e787ba6f0568440c50 (diff)
downloadinfinity-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 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java14
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java1
5 files changed, 31 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";