diff options
Diffstat (limited to 'app/src/main/java')
17 files changed, 44 insertions, 26 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java index 0edd6a38..d3980735 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountPostsActivity.java @@ -27,7 +27,6 @@ import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.databinding.ActivityAccountPostsBinding; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -53,7 +52,6 @@ public class AccountPostsActivity extends BaseActivity implements SortTypeSelect SharedPreferences mCurrentAccountSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; - private SliderPanel mSliderPanel; private String mAccessToken; private String mAccountName; private String mUserWhere; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java index 0e60f2d1..46c16e92 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java @@ -35,7 +35,6 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.databinding.ActivityAccountSavedThingBinding; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -71,7 +70,6 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT Executor mExecutor; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; - private SliderPanel mSliderPanel; private String mAccessToken; private String mAccountName; private PostLayoutBottomSheetFragment postLayoutBottomSheetFragment; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java index 34d932ab..32cbdd4c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java @@ -71,7 +71,8 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo public Typeface typeface; public Typeface titleTypeface; public Typeface contentTypeface; - public SliderPanel sliderPanel; + @Nullable + public SliderPanel mSliderPanel; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java index 56cd48ce..3f7079a2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java @@ -124,8 +124,7 @@ public class EditProfileActivity extends BaseActivity { setSupportActionBar(toolbar); if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { - SliderPanel sliderPanel = Slidr.attach(this); - sliderPanel.unlock(); + Slidr.attach(this); } mAccessToken = mCurrentAccountSharedPreferences.getString(SharedPreferencesUtils.ACCESS_TOKEN, null); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java index fc2811e6..8f93faa9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java @@ -121,7 +121,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec applyCustomTheme(); if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { - sliderPanel = Slidr.attach(this); + mSliderPanel = Slidr.attach(this); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java index 4a4477ac..380ef30a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FullMarkdownActivity.java @@ -42,7 +42,6 @@ import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFi import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface; import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.markdown.MarkdownUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; @@ -68,7 +67,6 @@ public class FullMarkdownActivity extends BaseActivity { SharedPreferences mSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; - private SliderPanel mSliderPanel; @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java index a8f1e440..73ef6914 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java @@ -38,7 +38,6 @@ import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.ChangeNSFWEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; import ml.docilealligator.infinityforreddit.fragments.CommentsListingFragment; @@ -74,7 +73,6 @@ public class HistoryActivity extends BaseActivity implements ActivityToolbarInte CustomThemeWrapper mCustomThemeWrapper; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; - private SliderPanel mSliderPanel; private String mAccessToken; private String mAccountName; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java index b2314e5b..15107cc3 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/InboxActivity.java @@ -103,7 +103,6 @@ public class InboxActivity extends BaseActivity implements ActivityToolbarInterf CustomThemeWrapper mCustomThemeWrapper; @Inject Executor mExecutor; - private SliderPanel mSliderPanel; private SectionsPagerAdapter sectionsPagerAdapter; private FragmentManager fragmentManager; private String mAccessToken; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java index d228bd65..d31e8c34 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -138,7 +138,6 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect private boolean mInsertSearchQuerySuccess; private FragmentManager fragmentManager; private SectionsPagerAdapter sectionsPagerAdapter; - private SliderPanel mSliderPanel; private int fabOption; @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java index 22dbd508..194304d1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java @@ -112,7 +112,6 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti CustomThemeWrapper mCustomThemeWrapper; @Inject Executor mExecutor; - private SliderPanel mSliderPanel; private String mAccessToken; private String mAccountName; private boolean mInsertSuccess = false; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java index b4de5df6..3d72c9cc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewMultiRedditDetailActivity.java @@ -170,7 +170,7 @@ public class ViewMultiRedditDetailActivity extends BaseActivity implements SortT applyCustomTheme(); if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { - Slidr.attach(this); + mSliderPanel = Slidr.attach(this); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 68eb7a65..5ff1f7c4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -177,7 +177,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele int loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING; public Map<String, String> authorIcons = new HashMap<>(); private FragmentManager fragmentManager; - private SliderPanel mSliderPanel; private SectionsPagerAdapter sectionsPagerAdapter; private String mAccessToken; private String mAccountName; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java index d8569d9c..779a82a5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -224,7 +224,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp private int unsubscribedColor; private int subscribedColor; private int fabOption; - private SliderPanel mSliderPanel; private MaterialAlertDialogBuilder nsfwWarningBuilder; @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java index 2474a5fa..bbc78737 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -226,7 +226,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele private boolean lockBottomAppBar; private String mMessageFullname; private String mNewAccountName; - private SliderPanel mSliderPanel; //private MaterialAlertDialogBuilder nsfwWarningBuilder; @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java index a4231c83..f07ceaf4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/WikiActivity.java @@ -95,7 +95,6 @@ public class WikiActivity extends BaseActivity { SharedPreferences mSharedPreferences; @Inject CustomThemeWrapper mCustomThemeWrapper; - private SliderPanel mSliderPanel; private String wikiMarkdown; private Markwon markwon; private MarkwonAdapter markwonAdapter; diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java index 18e4f61b..43f5e882 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -67,7 +67,6 @@ import jp.wasabeef.glide.transformations.BlurTransformation; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.FetchGfycatOrRedgifsVideoLinks; import ml.docilealligator.infinityforreddit.FetchStreamableVideo; -import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SaveMemoryCenterInisdeDownsampleStrategy; import ml.docilealligator.infinityforreddit.SaveThing; @@ -3155,6 +3154,17 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface, mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale); + galleryRecyclerView.setOnTouchListener((v, motionEvent) -> { + if (mActivity.mSliderPanel != null) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); + } else { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); + } + } + + return false; + }); galleryRecyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView); galleryRecyclerView.setRecycledViewPool(mGalleryRecycledViewPool); @@ -4215,6 +4225,17 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface, mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale); + recyclerView.setOnTouchListener((v, motionEvent) -> { + if (mActivity.mSliderPanel != null) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); + } else { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); + } + } + + return false; + }); recyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(recyclerView); recyclerView.setRecycledViewPool(mGalleryRecycledViewPool); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java index 66e6870f..4c2e8c0d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -3293,11 +3293,12 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale); galleryRecyclerView.setAdapter(adapter); galleryRecyclerView.setOnTouchListener((v, motionEvent) -> { - mActivity.sliderPanel.requestDisallowInterceptTouchEvent(true); - - switch (motionEvent.getAction() & MotionEvent.ACTION_MASK) { - case MotionEvent.ACTION_UP: - mActivity.sliderPanel.requestDisallowInterceptTouchEvent(false); + if (mActivity.mSliderPanel != null) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); + } else { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); + } } return false; @@ -4409,6 +4410,17 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface, mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale); + recyclerView.setOnTouchListener((v, motionEvent) -> { + if (mActivity.mSliderPanel != null) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); + } else { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); + } + } + + return false; + }); recyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(recyclerView); recyclerView.setRecycledViewPool(mGalleryRecycledViewPool); |