Commit 1a51f5ce authored by Thomas's avatar Thomas
Browse files

- Fix #1357 add cross-quoting via long press on quote button

parent d256c78c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ public class CrossActionHelper {
                boolean confirmFav = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION_FAV), false);
                boolean confirmBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION), true);
                List<BaseAccount> accounts = new Account(context).getCrossAccounts();
                if (actionType == TypeOfCrossAction.QUOTE_ACTION) {
                    accounts.removeIf(a -> a.api != Account.API.MASTODON && a.api != Account.API.PLEROMA && a.api != Account.API.FRIENDICA);
                }
                if (accounts.size() == 1) {
                    Handler mainHandler = new Handler(Looper.getMainLooper());
                    Runnable myRunnable = () -> {
@@ -364,6 +367,18 @@ public class CrossActionHelper {
                    context.startActivity(intent);
                });
            }
            case QUOTE_ACTION -> {
                Intent intentQuote = new Intent(context, ComposeActivity.class);
                Bundle argsQuote = new Bundle();
                argsQuote.putSerializable(Helper.ARG_QUOTED_MESSAGE, targetedStatus);
                argsQuote.putSerializable(Helper.ARG_ACCOUNT, ownerAccount);
                new CachedBundle(context).insertBundle(argsQuote, Helper.getCurrentAccount(context), bundleId -> {
                    Bundle bundle = new Bundle();
                    bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
                    intentQuote.putExtras(bundle);
                    context.startActivity(intentQuote);
                });
            }
            case COMPOSE -> {
                Intent intentCompose = new Intent(context, ComposeActivity.class);
                Bundle args = new Bundle();
@@ -760,6 +775,7 @@ public class CrossActionHelper {
        REBLOG_ACTION,
        UNREBLOG_ACTION,
        REPLY_ACTION,
        QUOTE_ACTION,
        COMPOSE
    }

+11 −0
Original line number Diff line number Diff line
@@ -1287,6 +1287,17 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
            if(quoteButton.equals(quoteButtonEntryValues[0])) {
                holder.binding.actionButtonQuote.setVisibility(View.VISIBLE);
                holder.binding.actionButtonQuote.setOnClickListener(v -> quote(context, status));
                holder.binding.actionButtonQuote.setOnLongClickListener(v -> {
                    if ("direct".equals(statusToDeal.visibility) || "private".equals(statusToDeal.visibility)) {
                        return true;
                    }
                    if (statusToDeal.quote_approval != null && statusToDeal.quote_approval.current_user != null
                            && statusToDeal.quote_approval.current_user.equalsIgnoreCase("denied")) {
                        return true;
                    }
                    CrossActionHelper.doCrossAction(context, CrossActionHelper.TypeOfCrossAction.QUOTE_ACTION, null, statusToDeal);
                    return true;
                });
            } else {
                holder.binding.actionButtonQuote.setVisibility(View.GONE);
            }