mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-23 19:26:17 +00:00
Update release channel with material 3 changes.
This commit is contained in:
@@ -43,9 +43,9 @@ class InternalSettingsRepository(context: Context) {
|
||||
body = body,
|
||||
threadId = threadId,
|
||||
messageRanges = bodyRangeList.build(),
|
||||
image = "https://via.placeholder.com/720x480",
|
||||
imageWidth = 720,
|
||||
imageHeight = 480
|
||||
image = "/static/release-notes/signal.png",
|
||||
imageWidth = 1800,
|
||||
imageHeight = 720
|
||||
)
|
||||
|
||||
SignalDatabase.sms.insertBoostRequestMessage(recipientId, threadId)
|
||||
|
||||
@@ -76,7 +76,6 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
|
||||
private TextView body;
|
||||
private MaterialButton actionButton;
|
||||
private Stub<CardView> donateButtonStub;
|
||||
private View background;
|
||||
private ConversationMessage conversationMessage;
|
||||
private Recipient conversationRecipient;
|
||||
@@ -105,10 +104,9 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.body = findViewById(R.id.conversation_update_body);
|
||||
this.actionButton = findViewById(R.id.conversation_update_action);
|
||||
this.donateButtonStub = ViewUtil.findStubById(this, R.id.conversation_update_donate_action);
|
||||
this.background = findViewById(R.id.conversation_update_background);
|
||||
this.body = findViewById(R.id.conversation_update_body);
|
||||
this.actionButton = findViewById(R.id.conversation_update_action);
|
||||
this.background = findViewById(R.id.conversation_update_background);
|
||||
|
||||
body.setOnClickListener(v -> performClick());
|
||||
body.setOnLongClickListener(v -> performLongClick());
|
||||
@@ -190,7 +188,7 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
shouldCollapse(messageRecord, nextMessageRecord),
|
||||
hasWallpaper);
|
||||
|
||||
presentActionButton(hasWallpaper);
|
||||
presentActionButton(hasWallpaper, conversationMessage.getMessageRecord().isBoostRequest());
|
||||
|
||||
updateSelectedState();
|
||||
}
|
||||
@@ -532,37 +530,24 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
eventListener.onBlockJoinRequest(conversationMessage.getMessageRecord().getIndividualRecipient());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
actionButton.setVisibility(GONE);
|
||||
actionButton.setOnClickListener(null);
|
||||
}
|
||||
|
||||
if (conversationMessage.getMessageRecord().isBoostRequest()) {
|
||||
actionButton.setVisibility(GONE);
|
||||
|
||||
CardView donateButton = donateButtonStub.get();
|
||||
TextView buttonText = donateButton.findViewById(R.id.conversation_update_donate_action_button);
|
||||
boolean isSustainer = SignalStore.donationsValues().isLikelyASustainer();
|
||||
|
||||
donateButton.setVisibility(VISIBLE);
|
||||
donateButton.setOnClickListener(v -> {
|
||||
} else if (conversationMessage.getMessageRecord().isBoostRequest()) {
|
||||
actionButton.setVisibility(VISIBLE);
|
||||
actionButton.setOnClickListener(v -> {
|
||||
if (batchSelected.isEmpty() && eventListener != null) {
|
||||
eventListener.onDonateClicked();
|
||||
}
|
||||
});
|
||||
|
||||
if (isSustainer) {
|
||||
buttonText.setText(R.string.ConversationUpdateItem_signal_boost);
|
||||
buttonText.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_boost_outline_16, 0, 0, 0);
|
||||
if (SignalStore.donationsValues().isLikelyASustainer()) {
|
||||
actionButton.setText(R.string.ConversationUpdateItem_signal_boost);
|
||||
actionButton.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.ic_boost_outline_16, 0, 0, 0);
|
||||
} else {
|
||||
buttonText.setText(R.string.ConversationUpdateItem_become_a_sustainer);
|
||||
buttonText.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
|
||||
actionButton.setText(R.string.ConversationUpdateItem_become_a_sustainer);
|
||||
actionButton.setCompoundDrawablesRelativeWithIntrinsicBounds(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
AutoRounder.autoSetCorners(donateButton, donateButton::setRadius);
|
||||
|
||||
} else if (donateButtonStub.resolved()) {
|
||||
donateButtonStub.get().setVisibility(GONE);
|
||||
} else {
|
||||
actionButton.setVisibility(GONE);
|
||||
actionButton.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -642,8 +627,11 @@ public final class ConversationUpdateItem extends FrameLayout
|
||||
}
|
||||
}
|
||||
|
||||
private void presentActionButton(boolean hasWallpaper) {
|
||||
if (hasWallpaper) {
|
||||
private void presentActionButton(boolean hasWallpaper, boolean isBoostRequest) {
|
||||
if (isBoostRequest) {
|
||||
actionButton.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.signal_colorSecondaryContainer)));
|
||||
actionButton.setTextColor(ColorStateList.valueOf(ContextCompat.getColor(getContext(), R.color.signal_colorOnSecondaryContainer)));
|
||||
} else if (hasWallpaper) {
|
||||
actionButton.setBackgroundTintList(AppCompatResources.getColorStateList(getContext(), R.color.conversation_update_item_button_background_wallpaper));
|
||||
actionButton.setTextColor(AppCompatResources.getColorStateList(getContext(), R.color.conversation_update_item_button_text_color_wallpaper));
|
||||
} else {
|
||||
|
||||
@@ -3,7 +3,9 @@ package org.thoughtcrime.securesms.conversation
|
||||
import android.graphics.Typeface
|
||||
import android.text.SpannableString
|
||||
import android.text.Spanned
|
||||
import android.text.style.CharacterStyle
|
||||
import android.text.style.StyleSpan
|
||||
import android.text.style.TypefaceSpan
|
||||
import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList
|
||||
import org.thoughtcrime.securesms.util.PlaceholderURLSpan
|
||||
|
||||
@@ -19,16 +21,15 @@ object MessageStyler {
|
||||
|
||||
for (range in messageRanges.rangesList) {
|
||||
if (range.hasStyle()) {
|
||||
val style = range.style?.let {
|
||||
when (it) {
|
||||
BodyRangeList.BodyRange.Style.BOLD -> Typeface.BOLD
|
||||
BodyRangeList.BodyRange.Style.ITALIC -> Typeface.ITALIC
|
||||
BodyRangeList.BodyRange.Style.UNRECOGNIZED -> Typeface.NORMAL
|
||||
}
|
||||
|
||||
val styleSpan: CharacterStyle? = when (range.style) {
|
||||
BodyRangeList.BodyRange.Style.BOLD -> TypefaceSpan("sans-serif-medium")
|
||||
BodyRangeList.BodyRange.Style.ITALIC -> StyleSpan(Typeface.ITALIC)
|
||||
else -> null
|
||||
}
|
||||
|
||||
if (style != null && style != Typeface.NORMAL) {
|
||||
span.setSpan(StyleSpan(style), range.start, range.start + range.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
if (styleSpan != null) {
|
||||
span.setSpan(styleSpan, range.start, range.start + range.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
}
|
||||
} else if (range.hasLink() && range.link != null) {
|
||||
span.setSpan(PlaceholderURLSpan(range.link), range.start, range.start + range.length, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
|
||||
|
||||
Reference in New Issue
Block a user