From 9434f319156e0995a043a71b0b955b907c94dfe1 Mon Sep 17 00:00:00 2001 From: Arne Date: Mon, 9 Dec 2024 23:18:39 +0100 Subject: [PATCH] Clean up swipe logic --- .../eu/siacs/conversations/ui/ConversationFragment.java | 7 +------ .../eu/siacs/conversations/ui/adapter/MessageAdapter.java | 8 +------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index a685bd252..901ee40e8 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -1789,10 +1789,6 @@ public class ConversationFragment extends XmppFragment // if (conversation.getMode() == Conversational.MODE_SINGLE || conversation.getMucOptions().participating()) addReaction(message); }); - messageListAdapter.setOnMessageBoxSwiped(message -> { - quoteMessage(message); - }); - binding.threadIdenticonLayout.setOnClickListener(v -> { boolean wasLocked = conversation.getLockThread(); conversation.setLockThread(false); @@ -2026,7 +2022,6 @@ public class ConversationFragment extends XmppFragment messageListAdapter.setOnInlineImageLongClicked(null); messageListAdapter.setConversationFragment(null); messageListAdapter.setOnMessageBoxClicked(null); - messageListAdapter.setOnMessageBoxSwiped(null); binding.conversationViewPager.setAdapter(null); if (conversation != null) conversation.setupViewPager(null, null, false, null); } @@ -2070,7 +2065,7 @@ public class ConversationFragment extends XmppFragment return false; } - private void setupReply(Message message) { + public void setupReply(Message message) { conversation.setReplyTo(message); if (message == null) { binding.contextPreview.setVisibility(View.GONE); diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index f8aeb5731..a049f9144 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -167,7 +167,6 @@ public class MessageAdapter extends ArrayAdapter { private ConversationFragment mConversationFragment = null; private OnContactPictureClicked mOnContactPictureClickedListener; private OnContactPictureClicked mOnMessageBoxClickedListener; - private OnContactPictureClicked mOnMessageBoxSwipedListener; private OnContactPictureLongClicked mOnContactPictureLongClickedListener; private OnInlineImageLongClicked mOnInlineImageLongClickedListener; private boolean mUseGreenBackground = false; @@ -218,10 +217,6 @@ public class MessageAdapter extends ArrayAdapter { this.mOnMessageBoxClickedListener = listener; } - public void setOnMessageBoxSwiped(OnContactPictureClicked listener) { - this.mOnMessageBoxSwipedListener = listener; - } - public void setConversationFragment(ConversationFragment frag) { mConversationFragment = frag; } @@ -1309,8 +1304,7 @@ public class MessageAdapter extends ArrayAdapter { public void onOpen(SwipeLayout layout) { swipeLayout.refreshDrawableState(); //when the BottomView totally show. - if (mOnMessageBoxSwipedListener != null) - mOnMessageBoxSwipedListener.onContactPictureClicked(message); + mConversationFragment.setupReply(message); swipeLayout.close(true); swipeLayout.setClickToClose(true); }