Try fixing gallery images swipe gesture and Slidr gesture conflicts.

This commit is contained in:
Docile-Alligator 2023-04-26 23:06:21 +08:00
parent ef4ead0434
commit df79433a6a
4 changed files with 17 additions and 1 deletions

View File

@ -48,6 +48,7 @@ import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
import ml.docilealligator.infinityforreddit.CustomFontReceiver;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.slidr.widget.SliderPanel;
import ml.docilealligator.infinityforreddit.font.ContentFontFamily;
import ml.docilealligator.infinityforreddit.font.ContentFontStyle;
import ml.docilealligator.infinityforreddit.font.FontFamily;
@ -70,6 +71,7 @@ public abstract class BaseActivity extends AppCompatActivity implements CustomFo
public Typeface typeface;
public Typeface titleTypeface;
public Typeface contentTypeface;
public SliderPanel sliderPanel;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {

View File

@ -121,7 +121,7 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
applyCustomTheme();
if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) {
Slidr.attach(this);
sliderPanel = Slidr.attach(this);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

View File

@ -3292,6 +3292,16 @@ public class PostRecyclerViewAdapter extends PagingDataAdapter<Post, RecyclerVie
adapter = new PostGalleryTypeImageRecyclerViewAdapter(mGlide, mActivity.typeface,
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);
}
return false;
});
new PagerSnapHelper().attachToRecyclerView(galleryRecyclerView);
galleryRecyclerView.setRecycledViewPool(mGalleryRecycledViewPool);
SwipeLockLinearLayoutManager layoutManager = new SwipeLockLinearLayoutManager(

View File

@ -48,6 +48,10 @@ public class SliderPanel extends FrameLayout {
init();
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {