From 6512972f30fb0f3aa1ff97939c5af2dd30a0d622 Mon Sep 17 00:00:00 2001 From: luvletter2333 Date: Fri, 18 Feb 2022 15:50:18 +0800 Subject: [PATCH] Allow to toggle noquote when forwarding to multiple targets --- .../java/org/telegram/ui/ChatActivity.java | 2 +- .../java/org/telegram/ui/DialogsActivity.java | 27 ++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java index 4dceb0ea6..e6f6437da 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java @@ -753,7 +753,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not destroyTextureView(); }; - private static boolean noForwardQuote; + public static boolean noForwardQuote; private TLRPC.ChatParticipant selectedParticipant; private Paint scrimPaint; diff --git a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java index 13933ae51..8e632c11f 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/DialogsActivity.java @@ -7230,7 +7230,6 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. ActionBarMenuSubItem sendWithoutSound = new ActionBarMenuSubItem(parentActivity, true, true, resourcesProvider); sendWithoutSound.setTextAndIcon(LocaleController.getString("SendWithoutSound", R.string.SendWithoutSound), R.drawable.baseline_notifications_off_24); sendWithoutSound.setMinimumWidth(AndroidUtilities.dp(196)); - sendPopupLayout2.addView(sendWithoutSound, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); sendWithoutSound.setOnClickListener(v -> { if (sendPopupWindow != null && sendPopupWindow.isShowing()) { sendPopupWindow.dismiss(); @@ -7242,6 +7241,32 @@ public class DialogsActivity extends BaseFragment implements NotificationCenter. delegate.didSelectDialogs(DialogsActivity.this, selectedDialogs, commentView.getFieldText(), false); }); + ActionBarMenuSubItem showSendersNameView = new ActionBarMenuSubItem(parentActivity, true, true, false, resourcesProvider); + showSendersNameView.setTextAndIcon(LocaleController.getString("ShowSendersName", R.string.ShowSendersName), 0); + showSendersNameView.setChecked(!ChatActivity.noForwardQuote); + + ActionBarMenuSubItem hideSendersNameView = new ActionBarMenuSubItem(parentActivity, true, false, true, resourcesProvider); + hideSendersNameView.setTextAndIcon(LocaleController.getString("HideSendersName", R.string.HideSendersName), 0); + hideSendersNameView.setChecked(ChatActivity.noForwardQuote); + showSendersNameView.setOnClickListener(e -> { + if (ChatActivity.noForwardQuote) { + ChatActivity.noForwardQuote = false; + showSendersNameView.setChecked(true); + hideSendersNameView.setChecked(false); + } + }); + hideSendersNameView.setOnClickListener(e -> { + if (!ChatActivity.noForwardQuote) { + ChatActivity.noForwardQuote = true; + showSendersNameView.setChecked(false); + hideSendersNameView.setChecked(true); + } + }); + + sendPopupLayout2.addView(showSendersNameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); + sendPopupLayout2.addView(hideSendersNameView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); + sendPopupLayout2.addView(sendWithoutSound, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48)); + layout.addView(sendPopupLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT)); sendPopupWindow = new ActionBarPopupWindow(layout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);