Merge remote-tracking branch 'origin/main'

This commit is contained in:
Hosted Weblate
2024-11-25 14:44:35 +01:00
5 changed files with 16 additions and 15 deletions
+2 -2
View File
@@ -166,10 +166,10 @@ public class DcMsg {
public native String getError ();
public native String getOverrideSenderName();
public String getSenderName(DcContact dcContact, boolean markOverride) {
public String getSenderName(DcContact dcContact) {
String overrideName = getOverrideSenderName();
if (overrideName != null) {
return (markOverride ? "~" : "") + overrideName;
return "~" + overrideName;
} else {
return dcContact.getDisplayName();
}
@@ -24,7 +24,6 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@@ -427,7 +426,7 @@ public class ConversationFragment extends MessageSelectorFragment
if (msg.getFromId() != prevMsg.getFromId() && !singleMsg) {
DcContact contact = dcContext.getContact(msg.getFromId());
result.append(msg.getSenderName(contact, false)).append(":\n");
result.append(msg.getSenderName(contact)).append(":\n");
}
if (msg.getType() == DcMsg.DC_MSG_TEXT || (singleMsg && !msg.getText().isEmpty())) {
result.append(msg.getText());
@@ -22,12 +22,10 @@ import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.os.Build;
import android.text.SpannableString;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
@@ -791,14 +789,14 @@ public class ConversationItem extends BaseConversationItem
if (messageRecord.isForwarded()) {
if (showSender && dcContact !=null) {
this.groupSender.setText(context.getString(R.string.forwarded_by, messageRecord.getSenderName(dcContact, false)));
this.groupSender.setText(context.getString(R.string.forwarded_by, messageRecord.getSenderName(dcContact)));
} else {
this.groupSender.setText(context.getString(R.string.forwarded_message));
}
this.groupSender.setTextColor(context.getResources().getColor(R.color.unknown_sender));
}
else if (showSender && dcContact !=null) {
this.groupSender.setText(messageRecord.getSenderName(dcContact, true));
this.groupSender.setText(messageRecord.getSenderName(dcContact));
this.groupSender.setTextColor(Util.rgbToArgbColor(dcContact.getColor()));
}
}
@@ -4,7 +4,6 @@ package org.thoughtcrime.securesms.components;
import android.content.Context;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Build;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -16,7 +15,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import com.annimon.stream.Stream;
import com.b44t.messenger.DcContact;
@@ -155,7 +153,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
if (contact == null) {
authorView.setText(getContext().getString(R.string.forwarded_message));
} else {
authorView.setText(getContext().getString(R.string.forwarded_by, quotedMsg.getSenderName(contact, false)));
authorView.setText(getContext().getString(R.string.forwarded_by, quotedMsg.getSenderName(contact)));
}
authorView.setTextColor(getForwardedColor());
quoteBarView.setBackgroundColor(getForwardedColor());
@@ -166,7 +164,7 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
quoteBarView.setBackgroundColor(getForwardedColor());
} else {
authorView.setVisibility(VISIBLE);
authorView.setText(quotedMsg.getSenderName(contact, true));
authorView.setText(quotedMsg.getSenderName(contact));
if (hasSticker) {
authorView.setTextColor(getResources().getColor(R.color.core_dark_05));
quoteBarView.setBackgroundColor(getResources().getColor(R.color.core_dark_05));
@@ -345,11 +345,17 @@ public class NotificationCenter {
String shortLine = privacy.isDisplayMessage()? dcMsg.getSummarytext(2000) : context.getString(R.string.notify_new_message);
if (dcChat.isMultiUser() && privacy.isDisplayContact()) {
shortLine = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId()), false) + ": " + shortLine;
shortLine = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId())) + ": " + shortLine;
}
String tickerLine = shortLine;
if (!dcChat.isMultiUser() && privacy.isDisplayContact()) {
tickerLine = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId()), false) + ": " + tickerLine;
tickerLine = dcMsg.getSenderName(dcContext.getContact(dcMsg.getFromId())) + ": " + tickerLine;
if (dcMsg.getOverrideSenderName() != null) {
// There is an "overridden" display name on the message, so, we need to prepend the display name to the message,
// i.e. set the shortLine to be the same as the tickerLine.
shortLine = tickerLine;
}
}
maybeAddNotification(accountId, dcChat, msgId, shortLine, tickerLine, true);
@@ -549,7 +555,7 @@ public class NotificationCenter {
lines = new ArrayList<>();
accountInbox.put(chatId, lines);
}
lines.add(tickerLine);
lines.add(shortLine);
for (int l = 0; l < lines.size(); l++) {
inboxStyle.addLine(lines.get(l));