diff options
Diffstat (limited to '')
12 files changed, 103 insertions, 118 deletions
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 46c16e92..cc4e3eb6 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/AccountSavedThingActivity.java @@ -91,6 +91,8 @@ public class AccountSavedThingActivity extends BaseActivity implements ActivityT mSliderPanel = Slidr.attach(this); } + mViewPager2 = binding.accountSavedThingViewPager2; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); 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 32cbdd4c..deebb612 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/BaseActivity.java @@ -73,6 +73,8 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo public Typeface contentTypeface; @Nullable public SliderPanel mSliderPanel; + @Nullable + public ViewPager2 mViewPager2; @Override protected void onCreate(@Nullable 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 73ef6914..986e82f8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/HistoryActivity.java @@ -94,6 +94,8 @@ public class HistoryActivity extends BaseActivity implements ActivityToolbarInte mSliderPanel = Slidr.attach(this); } + //mViewPager2 = viewPager2; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java index 4326a0a3..5b4f1ff5 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java @@ -316,6 +316,8 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb }); toggle.syncState(); + mViewPager2 = viewPager2; + mBackButtonAction = Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.MAIN_PAGE_BACK_BUTTON_ACTION, "0")); mLockBottomAppBar = mSharedPreferences.getBoolean(SharedPreferencesUtils.LOCK_BOTTOM_APP_BAR, false); mDisableSwipingBetweenTabs = mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_SWIPING_BETWEEN_TABS, false); 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 d31e8c34..2a9b3fe2 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java @@ -63,7 +63,6 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.SearchUserAndSu import ml.docilealligator.infinityforreddit.bottomsheetfragments.SortTimeBottomSheetFragment; 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.PostFragment; @@ -158,6 +157,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect mSliderPanel = Slidr.attach(this); } + mViewPager2 = viewPager2; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); 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 5ff1f7c4..2321b328 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -70,8 +70,6 @@ import ml.docilealligator.infinityforreddit.asynctasks.SwitchAccount; import ml.docilealligator.infinityforreddit.comment.Comment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr; -import ml.docilealligator.infinityforreddit.customviews.slidr.model.SlidrInterface; -import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel; import ml.docilealligator.infinityforreddit.events.NeedForPostListFromPostFragmentEvent; import ml.docilealligator.infinityforreddit.events.ProvidePostListToViewPostDetailActivityEvent; import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent; @@ -186,7 +184,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele private boolean mVolumeKeysNavigateComments; private boolean isNsfwSubreddit; - @Override protected void onCreate(Bundle savedInstanceState) { ((Infinity) getApplication()).getAppComponent().inject(this); @@ -240,6 +237,8 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele mSliderPanel = Slidr.attach(this); } viewPager2.setUserInputEnabled(false); + } else { + super.mViewPager2 = viewPager2; } postFragmentId = getIntent().getLongExtra(EXTRA_POST_FRAGMENT_ID, -1); if (swipeBetweenPosts && posts == null && postFragmentId > 0) { @@ -861,20 +860,6 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele } @Override - public void lockSwipeRightToGoBack() { - if (mSliderPanel != null) { - mSliderPanel.lock(); - } - } - - @Override - public void unlockSwipeRightToGoBack() { - if (mSliderPanel != null) { - mSliderPanel.unlock(); - } - } - - @Override public void onLongPress() { ViewPostDetailFragment fragment = sectionsPagerAdapter.getCurrentFragment(); if (fragment != null) { 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 779a82a5..1c4e340e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java @@ -252,6 +252,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp mSliderPanel = Slidr.attach(this); } + mViewPager2 = viewPager2; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Window window = getWindow(); if (isImmersiveInterface()) { 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 bbc78737..84eb24ff 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java @@ -256,6 +256,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele mSliderPanel = Slidr.attach(this); } + mViewPager2 = viewPager2; + username = getIntent().getStringExtra(EXTRA_USER_NAME_KEY); fragmentManager = getSupportFragmentManager(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java index 51a60082..658fd10c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsListingRecyclerViewAdapter.java @@ -40,12 +40,10 @@ import ml.docilealligator.infinityforreddit.NetworkState; import ml.docilealligator.infinityforreddit.R; import ml.docilealligator.infinityforreddit.SaveThing; import ml.docilealligator.infinityforreddit.VoteThing; -import ml.docilealligator.infinityforreddit.activities.AccountSavedThingActivity; import ml.docilealligator.infinityforreddit.activities.BaseActivity; import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity; import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity; -import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity; import ml.docilealligator.infinityforreddit.bottomsheetfragments.CommentMoreBottomSheetFragment; import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment; import ml.docilealligator.infinityforreddit.comment.Comment; @@ -506,20 +504,12 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment LinearLayoutManagerBugFixed linearLayoutManager = new SwipeLockLinearLayoutManager(mActivity, new SwipeLockInterface() { @Override public void lockSwipe() { - if (mActivity instanceof AccountSavedThingActivity) { - ((AccountSavedThingActivity) mActivity).lockSwipeRightToGoBack(); - } else { - ((ViewUserDetailActivity) mActivity).lockSwipeRightToGoBack(); - } + mActivity.lockSwipeRightToGoBack(); } @Override public void unlockSwipe() { - if (mActivity instanceof AccountSavedThingActivity) { - ((AccountSavedThingActivity) mActivity).unlockSwipeRightToGoBack(); - } else { - ((ViewUserDetailActivity) mActivity).unlockSwipeRightToGoBack(); - } + mActivity.unlockSwipeRightToGoBack(); } }); commentMarkdownView.setLayoutManager(linearLayoutManager); 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 43f5e882..4b4a86a9 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/HistoryPostRecyclerViewAdapter.java @@ -87,8 +87,7 @@ import ml.docilealligator.infinityforreddit.apis.StreamableAPI; import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView; -import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface; -import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager; +import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; import ml.docilealligator.infinityforreddit.databinding.ItemPostCard2GalleryTypeBinding; import ml.docilealligator.infinityforreddit.databinding.ItemPostGalleryGalleryTypeBinding; import ml.docilealligator.infinityforreddit.databinding.ItemPostGalleryTypeBinding; @@ -3155,12 +3154,25 @@ 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) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); - } else { + } + + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(true); + } + mActivity.unlockSwipeRightToGoBack(); + swipeLocked = false; + } else { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(false); + } + mActivity.lockSwipeRightToGoBack(); + swipeLocked = true; } return false; @@ -3168,25 +3180,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy galleryRecyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView); galleryRecyclerView.setRecycledViewPool(mGalleryRecycledViewPool); - SwipeLockLinearLayoutManager layoutManager = new SwipeLockLinearLayoutManager( - mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() { - @Override - public void lockSwipe() { - mActivity.lockSwipeRightToGoBack(); - swipeLocked = true; - } - - @Override - public void unlockSwipe() { - mActivity.unlockSwipeRightToGoBack(); - swipeLocked = false; - } - - @Override - public void setSwipeLocked(boolean swipeLocked) { - PostBaseGalleryTypeViewHolder.this.swipeLocked = swipeLocked; - } - }); + LinearLayoutManagerBugFixed layoutManager = new LinearLayoutManagerBugFixed(mActivity, RecyclerView.HORIZONTAL, false); galleryRecyclerView.setLayoutManager(layoutManager); galleryRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override @@ -4192,7 +4186,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy ImageView noPreviewImageView; PostGalleryTypeImageRecyclerViewAdapter adapter; - private SwipeLockLinearLayoutManager layoutManager; + private LinearLayoutManagerBugFixed layoutManager; Post post; Post.Preview preview; @@ -4226,12 +4220,22 @@ 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) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); - } else { + } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(true); + } + mActivity.unlockSwipeRightToGoBack(); + } else { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(false); + } + mActivity.lockSwipeRightToGoBack(); } return false; @@ -4239,18 +4243,7 @@ public class HistoryPostRecyclerViewAdapter extends PagingDataAdapter<Post, Recy recyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(recyclerView); recyclerView.setRecycledViewPool(mGalleryRecycledViewPool); - layoutManager = new SwipeLockLinearLayoutManager( - mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() { - @Override - public void lockSwipe() { - mActivity.lockSwipeRightToGoBack(); - } - - @Override - public void unlockSwipe() { - mActivity.unlockSwipeRightToGoBack(); - } - }); + layoutManager = new LinearLayoutManagerBugFixed(mActivity, RecyclerView.HORIZONTAL, false); recyclerView.setLayoutManager(layoutManager); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java index 7c1a8b03..1aad70b1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostDetailRecyclerViewAdapter.java @@ -96,6 +96,7 @@ import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottom import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView; +import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface; import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager; import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment; @@ -2421,18 +2422,28 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler mCardViewColor, mCommentColor, mScale); galleryRecyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView); - SwipeLockLinearLayoutManager layoutManager = new SwipeLockLinearLayoutManager( - mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() { - @Override - public void lockSwipe() { + galleryRecyclerView.setOnTouchListener((v, motionEvent) -> { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) { + if (mActivity.mSliderPanel != null) { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); + } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(true); + } + mActivity.unlockSwipeRightToGoBack(); + } else { + if (mActivity.mSliderPanel != null) { + mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); + } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(false); + } mActivity.lockSwipeRightToGoBack(); } - @Override - public void unlockSwipe() { - mActivity.unlockSwipeRightToGoBack(); - } + return false; }); + LinearLayoutManagerBugFixed layoutManager = new LinearLayoutManagerBugFixed(mActivity, RecyclerView.HORIZONTAL, false); galleryRecyclerView.setLayoutManager(layoutManager); galleryRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override 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 4c2e8c0d..ee94325f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/PostRecyclerViewAdapter.java @@ -88,8 +88,7 @@ import ml.docilealligator.infinityforreddit.apis.StreamableAPI; import ml.docilealligator.infinityforreddit.bottomsheetfragments.ShareLinkBottomSheetFragment; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.customviews.AspectRatioGifImageView; -import ml.docilealligator.infinityforreddit.customviews.SwipeLockInterface; -import ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayoutManager; +import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed; import ml.docilealligator.infinityforreddit.databinding.ItemPostCard2GalleryTypeBinding; import ml.docilealligator.infinityforreddit.databinding.ItemPostGalleryGalleryTypeBinding; import ml.docilealligator.infinityforreddit.databinding.ItemPostGalleryTypeBinding; @@ -3293,37 +3292,32 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie mSaveMemoryCenterInsideDownsampleStrategy, mColorAccent, mPrimaryTextColor, mScale); galleryRecyclerView.setAdapter(adapter); galleryRecyclerView.setOnTouchListener((v, motionEvent) -> { - if (mActivity.mSliderPanel != null) { - if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); - } else { + } + + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(true); + } + mActivity.unlockSwipeRightToGoBack(); + swipeLocked = false; + } else { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(false); + } + mActivity.lockSwipeRightToGoBack(); + swipeLocked = true; } return false; }); new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView); galleryRecyclerView.setRecycledViewPool(mGalleryRecycledViewPool); - SwipeLockLinearLayoutManager layoutManager = new SwipeLockLinearLayoutManager( - mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() { - @Override - public void lockSwipe() { - mActivity.lockSwipeRightToGoBack(); - swipeLocked = true; - } - - @Override - public void unlockSwipe() { - mActivity.unlockSwipeRightToGoBack(); - swipeLocked = false; - } - - @Override - public void setSwipeLocked(boolean swipeLocked) { - PostBaseGalleryTypeViewHolder.this.swipeLocked = swipeLocked; - } - }); + LinearLayoutManagerBugFixed layoutManager = new LinearLayoutManagerBugFixed(mActivity, RecyclerView.HORIZONTAL, false); galleryRecyclerView.setLayoutManager(layoutManager); galleryRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override @@ -4377,7 +4371,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie ImageView noPreviewImageView; PostGalleryTypeImageRecyclerViewAdapter adapter; - private SwipeLockLinearLayoutManager layoutManager; + private LinearLayoutManagerBugFixed layoutManager; Post post; Post.Preview preview; @@ -4411,12 +4405,22 @@ 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) { + if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP || motionEvent.getActionMasked() == MotionEvent.ACTION_CANCEL) { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(false); - } else { + } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(true); + } + mActivity.unlockSwipeRightToGoBack(); + } else { + if (mActivity.mSliderPanel != null) { mActivity.mSliderPanel.requestDisallowInterceptTouchEvent(true); } + if (mActivity.mViewPager2 != null) { + mActivity.mViewPager2.setUserInputEnabled(false); + } + mActivity.lockSwipeRightToGoBack(); } return false; @@ -4424,18 +4428,7 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie recyclerView.setAdapter(adapter); new PagerSnapHelper().attachToRecyclerView(recyclerView); recyclerView.setRecycledViewPool(mGalleryRecycledViewPool); - layoutManager = new SwipeLockLinearLayoutManager( - mActivity, RecyclerView.HORIZONTAL, false, new SwipeLockInterface() { - @Override - public void lockSwipe() { - mActivity.lockSwipeRightToGoBack(); - } - - @Override - public void unlockSwipe() { - mActivity.unlockSwipeRightToGoBack(); - } - }); + layoutManager = new LinearLayoutManagerBugFixed(mActivity, RecyclerView.HORIZONTAL, false); recyclerView.setLayoutManager(layoutManager); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override |