From a315c57fbe5b548f55118bf3add704214e3de8cf Mon Sep 17 00:00:00 2001 From: Next Alone <12210746+NextAlone@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:21:47 +0800 Subject: [PATCH] fix: do not unarchive by swipe Signed-off-by: Next Alone <12210746+NextAlone@users.noreply.github.com> --- .../java/androidx/recyclerview/widget/ItemTouchHelper.java | 7 +++++++ .../src/main/java/org/telegram/ui/DialogsActivity.java | 6 ------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java index 78f569481e..03111cb667 100644 --- a/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java +++ b/TMessagesProj/src/main/java/androidx/recyclerview/widget/ItemTouchHelper.java @@ -40,11 +40,13 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder; import org.telegram.messenger.AndroidUtilities; +import org.telegram.ui.Cells.DialogCell; import java.util.ArrayList; import java.util.List; import tw.nekomimi.nekogram.NekoConfig; +import xyz.nextalone.nagram.NaConfig; /** * This is a utility class to add swipe to dismiss and drag & drop support to RecyclerView. @@ -1257,6 +1259,11 @@ public boolean isIdle() { } public int checkHorizontalSwipe(ViewHolder viewHolder, int flags) { + if (viewHolder != null && viewHolder.itemView instanceof DialogCell) { + if (((DialogCell) viewHolder.itemView).getCurrentDialogFolderId() == 0 && NaConfig.INSTANCE.getDoNotUnarchiveBySwipe().Bool()) { + return 0; + } + } if ((flags & (LEFT | RIGHT)) != 0) { final int dirFlag = mDx > 0 ? RIGHT : LEFT; if (mVelocityTracker != null && mActivePointerId > -1) { diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index 151d579b43..9e04a1a690 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -2671,12 +2671,6 @@ public long getAnimationDuration(RecyclerView recyclerView, int animationType, f @Override public float getSwipeThreshold(RecyclerView.ViewHolder viewHolder) { - if (viewHolder != null && viewHolder.itemView instanceof DialogCell) { - if (((DialogCell) viewHolder.itemView).getCurrentDialogFolderId() == 0 - && NaConfig.INSTANCE.getDoNotUnarchiveBySwipe().Bool()) { - return 1.0f; - } - } return 0.45f; }