Fully colorize conversations.

1. Switch from 300 to 500 colors.

2. Colorize incoming conversation bubbles.

3. Colorize recipeint preference activity toolbar.

4. Support inverted colors in avatars.

5. Make status bar icons tint according to secondary color.

// FREEBIE
This commit is contained in:
Moxie Marlinspike
2015-06-29 15:33:36 -07:00
parent 99c9c73c9d
commit 78289ded8f
40 changed files with 270 additions and 128 deletions

View File

@@ -2,12 +2,14 @@ package org.thoughtcrime.securesms.components;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.provider.ContactsContract;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import org.thoughtcrime.securesms.R;
import org.thoughtcrime.securesms.contacts.avatars.ContactColors;
import org.thoughtcrime.securesms.contacts.avatars.ContactPhotoFactory;
import org.thoughtcrime.securesms.recipients.Recipient;
@@ -16,6 +18,8 @@ import org.thoughtcrime.securesms.recipients.Recipients;
public class AvatarImageView extends ImageView {
private boolean inverted;
public AvatarImageView(Context context) {
super(context);
setScaleType(ScaleType.CENTER_CROP);
@@ -24,15 +28,21 @@ public class AvatarImageView extends ImageView {
public AvatarImageView(Context context, AttributeSet attrs) {
super(context, attrs);
setScaleType(ScaleType.CENTER_CROP);
if (attrs != null) {
TypedArray typedArray = context.getTheme().obtainStyledAttributes(attrs, R.styleable.AvatarImageView, 0, 0);
inverted = typedArray.getBoolean(0, false);
typedArray.recycle();
}
}
public void setAvatar(@Nullable Recipients recipients, boolean quickContactEnabled) {
if (recipients != null) {
int backgroundColor = recipients.getColor().or(ContactColors.UNKNOWN_COLOR);
setImageDrawable(recipients.getContactPhoto().asDrawable(getContext(), backgroundColor));
setImageDrawable(recipients.getContactPhoto().asDrawable(getContext(), backgroundColor, inverted));
setAvatarClickHandler(recipients, quickContactEnabled);
} else {
setImageDrawable(ContactPhotoFactory.getDefaultContactPhoto(null).asDrawable(getContext(), ContactColors.UNKNOWN_COLOR));
setImageDrawable(ContactPhotoFactory.getDefaultContactPhoto(null).asDrawable(getContext(), ContactColors.UNKNOWN_COLOR, inverted));
setOnClickListener(null);
}
}