Update release channel with material 3 changes.

fork-5.53.8
Cody Henthorne 2022-06-27 10:10:13 -04:00
rodzic 8b806a8ac5
commit 7a0bd3315b
7 zmienionych plików z 33 dodań i 129 usunięć

Wyświetl plik

@ -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)

Wyświetl plik

@ -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 {

Wyświetl plik

@ -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)

Wyświetl plik

@ -1,22 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="154dp"
android:height="28dp"
android:viewportWidth="154"
android:viewportHeight="28">
<path
android:pathData="M0,0h154v28h-154z">
<aapt:attr name="android:fillColor">
<gradient
android:startY="-11.219"
android:startX="76.8858"
android:endY="38.8231"
android:endX="67.4908"
android:type="linear">
<item android:offset="0" android:color="#FF3370FF"/>
<item android:offset="0.537474" android:color="#FF3D68DE"/>
<item android:offset="1" android:color="#FF9845E8"/>
</gradient>
</aapt:attr>
</path>
</vector>

Wyświetl plik

@ -2,7 +2,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/signal_background_primary">
android:background="@color/signal_colorSurface2">
<com.google.android.material.button.MaterialButton
android:id="@+id/conversation_activity_unmute_button"
@ -12,10 +12,4 @@
android:minHeight="60dp"
android:text="@string/conversation_muted__unmute" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_gravity="top"
android:background="@color/signal_divider_minor" />
</FrameLayout>

Wyświetl plik

@ -42,14 +42,6 @@
tools:text="Learn more"
tools:visibility="visible" />
<ViewStub
android:id="@+id/conversation_update_donate_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginBottom="4dp"
android:layout="@layout/conversation_item_update_donate" />
</LinearLayout>
</org.thoughtcrime.securesms.conversation.ConversationUpdateItem>

Wyświetl plik

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:foreground="?selectableItemBackground"
android:padding="0dp"
android:visibility="visible"
app:cardCornerRadius="18dp"
tools:visibility="visible">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:padding="0dp"
android:scaleType="fitXY"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/conversation_update_donate_action_button"
app:layout_constraintStart_toStartOf="@+id/conversation_update_donate_action_button"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/donate_update_item_background" />
<TextView
android:id="@+id/conversation_update_donate_action_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawablePadding="4dp"
android:fontFamily="sans-serif-medium"
android:paddingHorizontal="12dp"
android:textColor="@color/white"
android:textSize="13sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:drawableStart="@drawable/ic_boost_outline_16"
tools:text="Signal Boost" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>