show "Edit Message" instead of "Me" in edition mode

This commit is contained in:
adbenitez 2025-02-20 02:17:52 +01:00
parent 441f943190
commit fce62453d1
5 changed files with 24 additions and 7 deletions

View file

@ -1440,7 +1440,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
msg.getTimestamp(), msg.getTimestamp(),
author, author,
text, text,
slideDeck); slideDeck,
false);
inputPanel.clickOnComposeInput(); inputPanel.clickOnComposeInput();
} }
@ -1458,7 +1459,8 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
msg.getTimestamp(), msg.getTimestamp(),
author, author,
text, text,
slideDeck); slideDeck,
true);
setDraftText(msg.getText()); setDraftText(msg.getText());
inputPanel.clickOnComposeInput(); inputPanel.clickOnComposeInput();

View file

@ -717,7 +717,8 @@ public class ConversationItem extends BaseConversationItem
author, author,
quoteTxt, quoteTxt,
slideDeck, slideDeck,
current.getType() == DcMsg.DC_MSG_STICKER); current.getType() == DcMsg.DC_MSG_STICKER,
false);
quoteView.setVisibility(View.VISIBLE); quoteView.setVisibility(View.VISIBLE);
quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT; quoteView.getLayoutParams().width = ViewGroup.LayoutParams.WRAP_CONTENT;

View file

@ -120,9 +120,10 @@ public class InputPanel extends ConstraintLayout
long id, long id,
@NonNull Recipient author, @NonNull Recipient author,
@NonNull CharSequence body, @NonNull CharSequence body,
@NonNull SlideDeck attachments) @NonNull SlideDeck attachments,
@NonNull boolean isEdit)
{ {
this.quoteView.setQuote(glideRequests, msg, author, body, attachments, false); this.quoteView.setQuote(glideRequests, msg, author, body, attachments, false, isEdit);
int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight() int originalHeight = this.quoteView.getVisibility() == VISIBLE ? this.quoteView.getMeasuredHeight()
: 0; : 0;

View file

@ -60,6 +60,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
private SlideDeck attachments; private SlideDeck attachments;
private int messageType; private int messageType;
private boolean hasSticker; private boolean hasSticker;
private boolean isEdit;
public QuoteView(Context context) { public QuoteView(Context context) {
super(context); super(context);
@ -114,13 +115,15 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
@Nullable Recipient author, @Nullable Recipient author,
@Nullable CharSequence body, @Nullable CharSequence body,
@NonNull SlideDeck attachments, @NonNull SlideDeck attachments,
boolean hasSticker) boolean hasSticker,
boolean isEdit)
{ {
quotedMsg = msg; quotedMsg = msg;
this.author = author != null ? author.getDcContact() : null; this.author = author != null ? author.getDcContact() : null;
this.body = body; this.body = body;
this.attachments = attachments; this.attachments = attachments;
this.hasSticker = hasSticker; this.hasSticker = hasSticker;
this.isEdit = isEdit;
if (hasSticker) { if (hasSticker) {
this.setBackgroundResource(R.drawable.conversation_item_update_background); this.setBackgroundResource(R.drawable.conversation_item_update_background);
@ -144,7 +147,12 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
} }
private void setQuoteAuthor(@Nullable Recipient author) { private void setQuoteAuthor(@Nullable Recipient author) {
if (author == null) { if (isEdit) {
authorView.setVisibility(VISIBLE);
authorView.setTextColor(getEditColor());
quoteBarView.setBackgroundColor(getEditColor());
authorView.setText(getContext().getString(R.string.edit_message));
} else if (author == null) {
authorView.setVisibility(GONE); authorView.setVisibility(GONE);
quoteBarView.setBackgroundColor(getForwardedColor()); quoteBarView.setBackgroundColor(getForwardedColor());
} else if (quotedMsg.isForwarded()) { } else if (quotedMsg.isForwarded()) {
@ -272,4 +280,8 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
private int getForwardedColor() { private int getForwardedColor() {
return getResources().getColor(hasSticker? R.color.core_dark_05 : R.color.unknown_sender); return getResources().getColor(hasSticker? R.color.core_dark_05 : R.color.unknown_sender);
} }
private int getEditColor() {
return getResources().getColor(R.color.delta_accent);
}
} }

View file

@ -1071,6 +1071,7 @@
<string name="global_menu_file_desktop">File</string> <string name="global_menu_file_desktop">File</string>
<string name="global_menu_file_quit_desktop">Quit</string> <string name="global_menu_file_quit_desktop">Quit</string>
<string name="global_menu_edit_desktop">Edit</string> <string name="global_menu_edit_desktop">Edit</string>
<string name="edit_message">Edit Message</string>
<string name="message_edited">edited</string> <string name="message_edited">edited</string>
<string name="global_menu_edit_undo_desktop">Undo</string> <string name="global_menu_edit_undo_desktop">Undo</string>
<string name="global_menu_edit_redo_desktop">Redo</string> <string name="global_menu_edit_redo_desktop">Redo</string>