diff options
author | Eric Erfanian <erfanian@google.com> | 2017-06-19 12:40:59 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-06-19 20:00:08 +0000 |
commit | ea7890cd5e829ed3f0b5f726561c569690af2030 (patch) | |
tree | 235ab5ab9f9215782c29ef350d275fe12e7b2f74 /java/com/android/contacts/common/lettertiles | |
parent | 91ce7d2a476bd04fe525049a37a2f8b2824e9724 (diff) |
Update AOSP Dialer source from internal google3 repository at
cl/159428781.
Test: make, treehugger
This CL updates the AOSP Dialer source with all the changes that have
gone into the private google3 repository. This includes all the
changes from cl/158012278 (6/05/2017) to cl/159428781 (6/19/2017).
This goal of these drops is to keep the AOSP source in sync with the
internal google3 repository. Currently these sync are done by hand
with very minor modifications to the internal source code.
See the Android.mk file for list of modifications.
Our current goal is to do frequent drops (daily if possible) and
eventually switched to an automated process.
Merged-In: Ie60a84b3936efd0ea3d95d7c86bf96d2b1663030
Change-Id: If1fa394df2609f0d38b4f794c83f4db3f1006484
Diffstat (limited to 'java/com/android/contacts/common/lettertiles')
-rw-r--r-- | java/com/android/contacts/common/lettertiles/LetterTileDrawable.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java b/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java index 5e77b696b..5c401fe38 100644 --- a/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java +++ b/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java @@ -29,6 +29,7 @@ import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.support.annotation.IntDef; +import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.telecom.TelecomManager; import android.text.TextUtils; @@ -124,10 +125,16 @@ public class LetterTileDrawable extends Drawable { sLetterToTileRatio = res.getFraction(R.dimen.letter_to_tile_ratio, 1, 1); sDefaultPersonAvatar = res.getDrawable(R.drawable.product_logo_avatar_anonymous_white_color_120, null); + Assert.isNotNull(sDefaultPersonAvatar, "sDefaultPersonAvatar is null"); sDefaultBusinessAvatar = res.getDrawable(R.drawable.quantum_ic_business_vd_theme_24, null); + Assert.isNotNull(sDefaultBusinessAvatar, "sDefaultBusinessAvatar is null"); sDefaultVoicemailAvatar = res.getDrawable(R.drawable.quantum_ic_voicemail_vd_theme_24, null); + Assert.isNotNull(sDefaultVoicemailAvatar, "sDefaultVoicemailAvatar is null"); sDefaultSpamAvatar = res.getDrawable(R.drawable.quantum_ic_report_vd_theme_24, null); + Assert.isNotNull(sDefaultSpamAvatar, "sDefaultSpamAvatar is null"); sDefaultConferenceAvatar = res.getDrawable(R.drawable.quantum_ic_group_vd_theme_24, null); + Assert.isNotNull(sDefaultConferenceAvatar, "sDefaultConferenceAvatar is null"); + sPaint.setTypeface( Typeface.create(res.getString(R.string.letter_tile_letter_font_family), Typeface.NORMAL)); sPaint.setTextAlign(Align.CENTER); @@ -180,7 +187,7 @@ public class LetterTileDrawable extends Drawable { } @Override - public void draw(final Canvas canvas) { + public void draw(@NonNull final Canvas canvas) { final Rect bounds = getBounds(); if (!isVisible() || bounds.isEmpty()) { return; @@ -235,6 +242,11 @@ public class LetterTileDrawable extends Drawable { } else { // Draw the default image if there is no letter/digit to be drawn Drawable drawable = getDrawableForContactType(mContactType); + if (drawable == null) { + throw Assert.createIllegalStateFailException( + "Unable to find drawable for contact type " + mContactType); + } + drawable.setBounds(getScaledBounds(mScale, mOffset)); drawable.setAlpha(drawable == sDefaultSpamAvatar ? SPAM_ALPHA : ALPHA); drawable.draw(canvas); |