mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-03 23:15:44 +01:00
Refactor colorization to support dark theme.
// FREEBIE
This commit is contained in:
@@ -21,6 +21,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
@@ -39,6 +40,7 @@ import android.widget.Toast;
|
||||
import com.afollestad.materialdialogs.AlertDialogWrapper;
|
||||
|
||||
import org.thoughtcrime.securesms.ConversationFragment.SelectionClickListener;
|
||||
import org.thoughtcrime.securesms.color.ThemeType;
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.ThumbnailView;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
@@ -192,14 +194,14 @@ public class ConversationItem extends LinearLayout {
|
||||
private void setBubbleState(MessageRecord messageRecord) {
|
||||
int[] attributes = new int[]{R.attr.conversation_item_bubble_background};
|
||||
TypedArray colors = context.obtainStyledAttributes(attributes);
|
||||
int defaultColor = colors.getColor(0, 0xFFFFFF);
|
||||
int defaultColor = colors.getColor(0, Color.WHITE);
|
||||
|
||||
if (messageRecord.isOutgoing()) {
|
||||
bodyBubble.getBackground().setColorFilter(defaultColor, PorterDuff.Mode.MULTIPLY);
|
||||
} else {
|
||||
bodyBubble.getBackground().setColorFilter(messageRecord.getIndividualRecipient()
|
||||
.getColor()
|
||||
.or(defaultColor),
|
||||
.toConversationColor(ThemeType.getCurrent(context)),
|
||||
PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user