Skip to content

Commit

Permalink
fix: do not unarchive by swipe
Browse files Browse the repository at this point in the history
Signed-off-by: Next Alone <[email protected]>
  • Loading branch information
NextAlone committed Jul 1, 2024
1 parent 04e2ee0 commit a315c57
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a315c57

Please sign in to comment.