Merge pull request #364 from FineFindus/feat/replybar-longpress

feat: support longpressing replyBar
This commit is contained in:
LucasGGamerM 2024-03-22 18:18:50 -03:00 committed by GitHub
commit 7a4387a459
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -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;