Refactor colorization to support dark theme.

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2015-06-30 09:16:05 -07:00
parent eacfca37f2
commit ce2f66ad17
32 changed files with 840 additions and 235 deletions

View File

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