mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-26 02:48:23 +01:00
Fixed gallery images swipe gesture and Slidr gesture conflicts in all places.
This commit is contained in:
parent
9308bc3714
commit
d65a355bdc
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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) {
|
||||
@ -860,20 +859,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();
|
||||
|
@ -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()) {
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
@ -89,4 +89,4 @@
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ml.docilealligator.infinityforreddit.customviews.SwipeLockLinearLayout>
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue
Block a user