From a7c558afd853f871b07e02a4422e8e1af6507d64 Mon Sep 17 00:00:00 2001 From: FineFindus Date: Fri, 22 Mar 2024 13:21:31 +0100 Subject: [PATCH] feat: support longpressing replyBar --- .../android/fragments/ThreadFragment.java | 12 ++++++++++++ .../ui/displayitems/FooterStatusDisplayItem.java | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java index 8d7e3439d..5e31a1b7a 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ThreadFragment.java @@ -419,6 +419,7 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist replyButtonAva.setOutlineProvider(OutlineProviders.OVAL); replyButtonAva.setClipToOutline(true); replyButton.setOnClickListener(v->openReply()); + replyButton.setOnLongClickListener(this::onReplyLongClick); Account self=AccountSessionManager.get(accountID).self; if(!TextUtils.isEmpty(self.avatar)){ ViewImageLoader.loadWithoutAnimation(replyButtonAva, getResources().getDrawable(R.drawable.image_placeholder), new UrlImageLoaderRequest(self.avatar, V.dp(24), V.dp(24))); @@ -578,6 +579,17 @@ public class ThreadFragment extends StatusListFragment implements ProvidesAssist Nav.go(getActivity(), ComposeFragment.class, args); }); } + private boolean onReplyLongClick(View v) { + if(mainStatus.preview) return false; + if (AccountSessionManager.getInstance().getLoggedInAccounts().size() < 2) return false; + UiUtils.pickAccount(v.getContext(), accountID, R.string.sk_reply_as, R.drawable.ic_fluent_arrow_reply_28_regular, session -> { + UiUtils.lookupStatus(v.getContext(), mainStatus, accountID, session.getID(), status -> { + if (status == null) return; + openReply(); + }); + }, null); + return true; + } public int getSnackbarOffset(){ return replyContainer.getHeight()-lastBottomInset; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java index 78bf0f6f3..a0352cdfb 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FooterStatusDisplayItem.java @@ -227,7 +227,7 @@ public class FooterStatusDisplayItem extends StatusDisplayItem{ return true; } - private void openComposeView(Status status, String accountID) { + private void openComposeView(Status status, String accountID) { item.parentFragment.maybeShowPreReplySheet(status, () ->{ Bundle args=new Bundle(); args.putString("account", accountID);