Skip to content

Commit

Permalink
feat: support longpressing replyBar
Browse files Browse the repository at this point in the history
  • Loading branch information
FineFindus committed Mar 22, 2024
1 parent 8d6593e commit a7c558a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ public void onViewCreated(View view, Bundle savedInstanceState){
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)));
Expand Down Expand Up @@ -578,6 +579,17 @@ private void openReply(){
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private boolean onReplyLongClick(View v) {
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);
Expand Down

0 comments on commit a7c558a

Please sign in to comment.