diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsRepository.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsRepository.kt index 45a625d5d..88afc0e3e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsRepository.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/internal/InternalSettingsRepository.kt @@ -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) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java index ee0e7cff6..45f37c061 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/ConversationUpdateItem.java @@ -76,7 +76,6 @@ public final class ConversationUpdateItem extends FrameLayout private TextView body; private MaterialButton actionButton; - private Stub 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 { diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/MessageStyler.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/MessageStyler.kt index 3518986fa..ac06bd01d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/MessageStyler.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/MessageStyler.kt @@ -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) diff --git a/app/src/main/res/drawable/donate_update_item_background.xml b/app/src/main/res/drawable/donate_update_item_background.xml deleted file mode 100644 index e9dc949af..000000000 --- a/app/src/main/res/drawable/donate_update_item_background.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - diff --git a/app/src/main/res/layout/conversation_activity_unmute.xml b/app/src/main/res/layout/conversation_activity_unmute.xml index 4b6792409..7fc6dabb1 100644 --- a/app/src/main/res/layout/conversation_activity_unmute.xml +++ b/app/src/main/res/layout/conversation_activity_unmute.xml @@ -2,7 +2,7 @@ + android:background="@color/signal_colorSurface2"> - - diff --git a/app/src/main/res/layout/conversation_item_update.xml b/app/src/main/res/layout/conversation_item_update.xml index 6b03caea4..ba197f3b4 100644 --- a/app/src/main/res/layout/conversation_item_update.xml +++ b/app/src/main/res/layout/conversation_item_update.xml @@ -42,14 +42,6 @@ tools:text="Learn more" tools:visibility="visible" /> - - diff --git a/app/src/main/res/layout/conversation_item_update_donate.xml b/app/src/main/res/layout/conversation_item_update_donate.xml deleted file mode 100644 index 1c5783ece..000000000 --- a/app/src/main/res/layout/conversation_item_update_donate.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - -