diff --git a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java index 5c3e5943b..e1f0ab9b5 100644 --- a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java +++ b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java @@ -195,9 +195,9 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi if (recipient.getContactPhoto(this) == null) this.avatar.setScaleType(ImageView.ScaleType.CENTER_INSIDE); else this.avatar.setScaleType(ImageView.ScaleType.CENTER_CROP); - this.avatar.setBackgroundColor(recipient.getColor().toActionBarColor(this)); + this.avatar.setBackgroundColor(recipient.getFallbackAvatarColor(this)); this.toolbarLayout.setTitle(recipient.toShortString()); - this.toolbarLayout.setContentScrimColor(recipient.getColor().toActionBarColor(this)); + this.toolbarLayout.setContentScrimColor(recipient.getFallbackAvatarColor(this)); } @Override @@ -354,7 +354,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi if (aboutDivider != null) getPreferenceScreen().removePreference(aboutDivider); } else { colorPreference.setColors(MaterialColors.CONVERSATION_PALETTE.asConversationColorArray(getActivity())); - colorPreference.setColor(recipient.getColor().toActionBarColor(getActivity())); + colorPreference.setColor(recipient.getFallbackAvatarColor(getActivity())); aboutPreference.setTitle(formatAddress(recipient.getAddress())); aboutPreference.setSummary(recipient.getCustomLabel()); diff --git a/src/org/thoughtcrime/securesms/color/MaterialColor.java b/src/org/thoughtcrime/securesms/color/MaterialColor.java index dccab1e04..6441f3696 100644 --- a/src/org/thoughtcrime/securesms/color/MaterialColor.java +++ b/src/org/thoughtcrime/securesms/color/MaterialColor.java @@ -79,34 +79,6 @@ public enum MaterialColor { : conversationColorLight); } - public int toActionBarColor(@NonNull Context context) { - return context.getResources().getColor(isDarkTheme(context) ? actionBarColorDark - : actionBarColorLight); - } - - public int toStatusBarColor(@NonNull Context context) { - return context.getResources().getColor(isDarkTheme(context) ? statusBarColorDark - : statusBarColorLight); - } - - public int toQuoteBarColorResource(@NonNull Context context, boolean outgoing) { - if (outgoing) { - return conversationColorDark; - } - return R.color.white; - } - - public int toQuoteBackgroundColor(@NonNull Context context, boolean outgoing) { - if (outgoing) { - int color = toConversationColor(context); - int alpha = isDarkTheme(context) ? (int) (0.2 * 255) : (int) (0.4 * 255); - - return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); - } - return context.getResources().getColor(isDarkTheme(context) ? R.color.transparent_black_70 - : R.color.transparent_white_aa); - } - public boolean represents(Context context, int colorValue) { return context.getResources().getColor(conversationColorDark) == colorValue || context.getResources().getColor(conversationColorLight) == colorValue || diff --git a/src/org/thoughtcrime/securesms/components/AvatarImageView.java b/src/org/thoughtcrime/securesms/components/AvatarImageView.java index d45e5cd9c..a5652667c 100644 --- a/src/org/thoughtcrime/securesms/components/AvatarImageView.java +++ b/src/org/thoughtcrime/securesms/components/AvatarImageView.java @@ -49,8 +49,8 @@ public class AvatarImageView extends AppCompatImageView { if (recipient != null) { ContactPhoto contactPhoto = recipient.getContactPhoto(getContext()); requestManager.load(contactPhoto) - .fallback(recipient.getFallbackContactPhotoDrawable(getContext(), inverted)) - .error(recipient.getFallbackContactPhotoDrawable(getContext(), inverted)) + .fallback(recipient.getFallbackAvatarDrawable(getContext())) + .error(recipient.getFallbackAvatarDrawable(getContext())) .diskCacheStrategy(DiskCacheStrategy.ALL) .circleCrop() .into(this); diff --git a/src/org/thoughtcrime/securesms/components/QuoteView.java b/src/org/thoughtcrime/securesms/components/QuoteView.java index 555c4d440..b38cbb688 100644 --- a/src/org/thoughtcrime/securesms/components/QuoteView.java +++ b/src/org/thoughtcrime/securesms/components/QuoteView.java @@ -193,8 +193,8 @@ public class QuoteView extends FrameLayout implements RecipientModifiedListener : author.toShortString()); // We use the raw color resource because Android 4.x was struggling with tints here - quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing)); - rootView.setBackgroundColor(author.getColor().toQuoteBackgroundColor(getContext(), outgoing)); + //quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing)); + //rootView.setBackgroundColor(author.getColor().toQuoteBackgroundColor(getContext(), outgoing)); } private void setQuoteText(@Nullable String body, @NonNull SlideDeck attachments) { diff --git a/src/org/thoughtcrime/securesms/recipients/Recipient.java b/src/org/thoughtcrime/securesms/recipients/Recipient.java index ea3cf40c1..2df69143e 100644 --- a/src/org/thoughtcrime/securesms/recipients/Recipient.java +++ b/src/org/thoughtcrime/securesms/recipients/Recipient.java @@ -331,7 +331,7 @@ public class Recipient implements RecipientModifiedListener { return (getName() == null ? address.serialize() : getName()); } - public synchronized @NonNull Drawable getFallbackContactPhotoDrawable(Context context, boolean inverted) { + public int getFallbackAvatarColor(Context context) { int rgb = 0x00808080; if(address.isDcContact()) { rgb = DcHelper.getContext(context).getContact(address.getDcContactId()).getColor(); @@ -340,7 +340,11 @@ public class Recipient implements RecipientModifiedListener { rgb = DcHelper.getContext(context).getChat(address.getDcChatId()).getColor(); } int argb = Color.argb(0xFF, Color.red(rgb), Color.green(rgb), Color.blue(rgb)); - return getFallbackContactPhoto().asDrawable(context, argb, inverted); + return argb; + } + + public synchronized @NonNull Drawable getFallbackAvatarDrawable(Context context) { + return getFallbackContactPhoto().asDrawable(context, getFallbackAvatarColor(context), false); } public synchronized @NonNull FallbackContactPhoto getFallbackContactPhoto() { diff --git a/src/org/thoughtcrime/securesms/service/DirectShareService.java b/src/org/thoughtcrime/securesms/service/DirectShareService.java index 27a6ce458..06aad3b2f 100644 --- a/src/org/thoughtcrime/securesms/service/DirectShareService.java +++ b/src/org/thoughtcrime/securesms/service/DirectShareService.java @@ -89,7 +89,7 @@ public class DirectShareService extends ChooserTargetService { } private Bitmap getFallbackDrawable(@NonNull Recipient recipient) { - return BitmapUtil.createFromDrawable(recipient.getFallbackContactPhotoDrawable(this, false), + return BitmapUtil.createFromDrawable(recipient.getFallbackAvatarDrawable(this), getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_width), getResources().getDimensionPixelSize(android.R.dimen.notification_large_icon_height)); }