From af2a1a2e5f7dcedb4595fb56e65ace002bcd740c Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 24 Jul 2017 11:01:58 -0700 Subject: Move contacts common LetterTile class into its own package. A subsequent change will move the ContactPhotoManager related code, eventually enabling the removal of contacts/common. Bug: 37208805 Test: TAP PiperOrigin-RevId: 161724700 Change-Id: Ice0789951ae544f6e27bcdaab0c032b218c83613 --- .../contacts/common/ContactPhotoManager.java | 2 +- .../contacts/common/dialog/CallSubjectDialog.java | 2 +- .../common/lettertiles/LetterTileDrawable.java | 439 --------------------- .../common/list/PhoneNumberListAdapter.java | 2 +- .../android/contacts/common/res/values/colors.xml | 26 -- .../android/contacts/common/res/values/dimens.xml | 6 - .../app/calllog/CallLogListItemViewHolder.java | 4 +- .../dialer/app/contactinfo/ContactPhotoLoader.java | 2 +- .../app/filterednumber/BlockedNumbersFragment.java | 2 +- .../dialer/app/filterednumber/NumbersAdapter.java | 2 +- .../dialer/app/list/PhoneFavoriteTileView.java | 2 +- java/com/android/dialer/common/AndroidManifest.xml | 15 + .../android/dialer/common/res/values/strings.xml | 15 + .../dialer/contactsfragment/ContactsAdapter.java | 2 +- .../android/dialer/lettertile/AndroidManifest.xml | 18 + .../dialer/lettertile/LetterTileDrawable.java | 439 +++++++++++++++++++++ .../dialer/lettertile/res/values/colors.xml | 40 ++ .../dialer/lettertile/res/values/dimens.xml | 20 + .../cp2/SearchContactViewHolder.java | 2 +- .../nearbyplaces/NearbyPlaceViewHolder.java | 2 +- java/com/android/dialer/shortcuts/IconFactory.java | 2 +- java/com/android/incallui/StatusBarNotifier.java | 4 +- .../incallui/contactgrid/ContactGridManager.java | 2 +- 23 files changed, 563 insertions(+), 487 deletions(-) delete mode 100644 java/com/android/contacts/common/lettertiles/LetterTileDrawable.java create mode 100644 java/com/android/dialer/lettertile/AndroidManifest.xml create mode 100644 java/com/android/dialer/lettertile/LetterTileDrawable.java create mode 100644 java/com/android/dialer/lettertile/res/values/colors.xml create mode 100644 java/com/android/dialer/lettertile/res/values/dimens.xml (limited to 'java/com') diff --git a/java/com/android/contacts/common/ContactPhotoManager.java b/java/com/android/contacts/common/ContactPhotoManager.java index fbf51cc0e..e86050193 100644 --- a/java/com/android/contacts/common/ContactPhotoManager.java +++ b/java/com/android/contacts/common/ContactPhotoManager.java @@ -28,9 +28,9 @@ import android.text.TextUtils; import android.view.View; import android.widget.ImageView; import android.widget.QuickContactBadge; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.contacts.common.util.UriUtils; import com.android.dialer.common.LogUtil; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.PermissionsUtil; /** Asynchronously loads contact photos and maintains a cache of photos. */ diff --git a/java/com/android/contacts/common/dialog/CallSubjectDialog.java b/java/com/android/contacts/common/dialog/CallSubjectDialog.java index 88fac0256..81012e2e9 100644 --- a/java/com/android/contacts/common/dialog/CallSubjectDialog.java +++ b/java/com/android/contacts/common/dialog/CallSubjectDialog.java @@ -45,11 +45,11 @@ import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.R; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.animation.AnimUtils; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.LogUtil; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.ViewUtil; import java.nio.charset.Charset; import java.util.ArrayList; diff --git a/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java b/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java deleted file mode 100644 index 73809c467..000000000 --- a/java/com/android/contacts/common/lettertiles/LetterTileDrawable.java +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Copyright (C) 2013 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.contacts.common.lettertiles; - -import android.content.res.Resources; -import android.content.res.TypedArray; -import android.graphics.Bitmap; -import android.graphics.Bitmap.Config; -import android.graphics.Canvas; -import android.graphics.ColorFilter; -import android.graphics.Outline; -import android.graphics.Paint; -import android.graphics.Paint.Align; -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; -import com.android.contacts.common.R; -import com.android.dialer.common.Assert; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -/** - * A drawable that encapsulates all the functionality needed to display a letter tile to represent a - * contact image. - */ -public class LetterTileDrawable extends Drawable { - - /** - * ContactType indicates the avatar type of the contact. For a person or for the default when no - * name is provided, it is {@link #TYPE_DEFAULT}, otherwise, for a business it is {@link - * #TYPE_BUSINESS}, and voicemail contacts should use {@link #TYPE_VOICEMAIL}. - */ - @Retention(RetentionPolicy.SOURCE) - @IntDef({TYPE_PERSON, TYPE_BUSINESS, TYPE_VOICEMAIL, TYPE_GENERIC_AVATAR, TYPE_SPAM}) - public @interface ContactType {} - - /** Contact type constants */ - public static final int TYPE_PERSON = 1; - public static final int TYPE_BUSINESS = 2; - public static final int TYPE_VOICEMAIL = 3; - /** - * A generic avatar that features the default icon, default color, and no letter. Useful for - * situations where a contact is anonymous. - */ - public static final int TYPE_GENERIC_AVATAR = 4; - public static final int TYPE_SPAM = 5; - public static final int TYPE_CONFERENCE = 6; - @ContactType public static final int TYPE_DEFAULT = TYPE_PERSON; - - /** - * Shape indicates the letter tile shape. It can be either a {@link #SHAPE_CIRCLE}, otherwise, it - * is a {@link #SHAPE_RECTANGLE}. - */ - @Retention(RetentionPolicy.SOURCE) - @IntDef({SHAPE_CIRCLE, SHAPE_RECTANGLE}) - public @interface Shape {} - - /** Shape constants */ - public static final int SHAPE_CIRCLE = 1; - - public static final int SHAPE_RECTANGLE = 2; - - /** 54% opacity */ - private static final int ALPHA = 138; - /** 100% opacity */ - private static final int SPAM_ALPHA = 255; - /** Default icon scale for vector drawable. */ - private static final float VECTOR_ICON_SCALE = 0.7f; - - /** Reusable components to avoid new allocations */ - private final Paint mPaint = new Paint(); - - private final Rect mRect = new Rect(); - private final char[] mFirstChar = new char[1]; - - /** Letter tile */ - @NonNull private final TypedArray mColors; - - private final int mSpamColor; - private final int mDefaultColor; - private final int mTileFontColor; - private final float mLetterToTileRatio; - @NonNull private final Drawable mDefaultPersonAvatar; - @NonNull private final Drawable mDefaultBusinessAvatar; - @NonNull private final Drawable mDefaultVoicemailAvatar; - @NonNull private final Drawable mDefaultSpamAvatar; - @NonNull private final Drawable mDefaultConferenceAvatar; - - @ContactType private int mContactType = TYPE_DEFAULT; - private float mScale = 1.0f; - private float mOffset = 0.0f; - private boolean mIsCircle = false; - - private int mColor; - private Character mLetter = null; - - private String mDisplayName; - - public LetterTileDrawable(final Resources res) { - mColors = res.obtainTypedArray(R.array.letter_tile_colors); - mSpamColor = res.getColor(R.color.spam_contact_background); - mDefaultColor = res.getColor(R.color.letter_tile_default_color); - mTileFontColor = res.getColor(R.color.letter_tile_font_color); - mLetterToTileRatio = res.getFraction(R.dimen.letter_to_tile_ratio, 1, 1); - mDefaultPersonAvatar = - res.getDrawable(R.drawable.product_logo_avatar_anonymous_white_color_120, null); - mDefaultBusinessAvatar = res.getDrawable(R.drawable.quantum_ic_business_vd_theme_24, null); - mDefaultVoicemailAvatar = res.getDrawable(R.drawable.quantum_ic_voicemail_vd_theme_24, null); - mDefaultSpamAvatar = res.getDrawable(R.drawable.quantum_ic_report_vd_theme_24, null); - mDefaultConferenceAvatar = res.getDrawable(R.drawable.quantum_ic_group_vd_theme_24, null); - - mPaint.setTypeface( - Typeface.create(res.getString(R.string.letter_tile_letter_font_family), Typeface.NORMAL)); - mPaint.setTextAlign(Align.CENTER); - mPaint.setAntiAlias(true); - mPaint.setFilterBitmap(true); - mPaint.setDither(true); - mColor = mDefaultColor; - } - - private Rect getScaledBounds(float scale, float offset) { - // The drawable should be drawn in the middle of the canvas without changing its width to - // height ratio. - final Rect destRect = copyBounds(); - // Crop the destination bounds into a square, scaled and offset as appropriate - final int halfLength = (int) (scale * Math.min(destRect.width(), destRect.height()) / 2); - - destRect.set( - destRect.centerX() - halfLength, - (int) (destRect.centerY() - halfLength + offset * destRect.height()), - destRect.centerX() + halfLength, - (int) (destRect.centerY() + halfLength + offset * destRect.height())); - return destRect; - } - - private Drawable getDrawableForContactType(int contactType) { - switch (contactType) { - case TYPE_BUSINESS: - mScale = VECTOR_ICON_SCALE; - return mDefaultBusinessAvatar; - case TYPE_VOICEMAIL: - mScale = VECTOR_ICON_SCALE; - return mDefaultVoicemailAvatar; - case TYPE_SPAM: - mScale = VECTOR_ICON_SCALE; - return mDefaultSpamAvatar; - case TYPE_CONFERENCE: - mScale = VECTOR_ICON_SCALE; - return mDefaultConferenceAvatar; - case TYPE_PERSON: - case TYPE_GENERIC_AVATAR: - default: - return mDefaultPersonAvatar; - } - } - - private static boolean isEnglishLetter(final char c) { - return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'); - } - - @Override - public void draw(@NonNull final Canvas canvas) { - final Rect bounds = getBounds(); - if (!isVisible() || bounds.isEmpty()) { - return; - } - // Draw letter tile. - drawLetterTile(canvas); - } - - public Bitmap getBitmap(int width, int height) { - Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); - this.setBounds(0, 0, width, height); - Canvas canvas = new Canvas(bitmap); - this.draw(canvas); - return bitmap; - } - - private void drawLetterTile(final Canvas canvas) { - // Draw background color. - mPaint.setColor(mColor); - - final Rect bounds = getBounds(); - final int minDimension = Math.min(bounds.width(), bounds.height()); - - if (mIsCircle) { - canvas.drawCircle(bounds.centerX(), bounds.centerY(), minDimension / 2, mPaint); - } else { - canvas.drawRect(bounds, mPaint); - } - - // Draw letter/digit only if the first character is an english letter or there's a override - if (mLetter != null) { - // Draw letter or digit. - mFirstChar[0] = mLetter; - - // Scale text by canvas bounds and user selected scaling factor - mPaint.setTextSize(mScale * mLetterToTileRatio * minDimension); - mPaint.getTextBounds(mFirstChar, 0, 1, mRect); - mPaint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); - mPaint.setColor(mTileFontColor); - mPaint.setAlpha(ALPHA); - - // Draw the letter in the canvas, vertically shifted up or down by the user-defined - // offset - canvas.drawText( - mFirstChar, - 0, - 1, - bounds.centerX(), - bounds.centerY() + mOffset * bounds.height() - mRect.exactCenterY(), - mPaint); - } 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 == mDefaultSpamAvatar ? SPAM_ALPHA : ALPHA); - drawable.draw(canvas); - } - } - - public int getColor() { - return mColor; - } - - public LetterTileDrawable setColor(int color) { - mColor = color; - return this; - } - - /** Returns a deterministic color based on the provided contact identifier string. */ - private int pickColor(final String identifier) { - if (mContactType == TYPE_SPAM) { - return mSpamColor; - } - - if (mContactType == TYPE_VOICEMAIL - || mContactType == TYPE_BUSINESS - || TextUtils.isEmpty(identifier)) { - return mDefaultColor; - } - - // String.hashCode() implementation is not supposed to change across java versions, so - // this should guarantee the same email address always maps to the same color. - // The email should already have been normalized by the ContactRequest. - final int color = Math.abs(identifier.hashCode()) % mColors.length(); - return mColors.getColor(color, mDefaultColor); - } - - @Override - public void setAlpha(final int alpha) { - mPaint.setAlpha(alpha); - } - - @Override - public void setColorFilter(final ColorFilter cf) { - mPaint.setColorFilter(cf); - } - - @Override - public int getOpacity() { - return android.graphics.PixelFormat.OPAQUE; - } - - @Override - public void getOutline(Outline outline) { - if (mIsCircle) { - outline.setOval(getBounds()); - } else { - outline.setRect(getBounds()); - } - - outline.setAlpha(1); - } - - /** - * Scale the drawn letter tile to a ratio of its default size - * - * @param scale The ratio the letter tile should be scaled to as a percentage of its default size, - * from a scale of 0 to 2.0f. The default is 1.0f. - */ - public LetterTileDrawable setScale(float scale) { - mScale = scale; - return this; - } - - /** - * Assigns the vertical offset of the position of the letter tile to the ContactDrawable - * - * @param offset The provided offset must be within the range of -0.5f to 0.5f. If set to -0.5f, - * the letter will be shifted upwards by 0.5 times the height of the canvas it is being drawn - * on, which means it will be drawn with the center of the letter starting at the top edge of - * the canvas. If set to 0.5f, the letter will be shifted downwards by 0.5 times the height of - * the canvas it is being drawn on, which means it will be drawn with the center of the letter - * starting at the bottom edge of the canvas. The default is 0.0f. - */ - public LetterTileDrawable setOffset(float offset) { - Assert.checkArgument(offset >= -0.5f && offset <= 0.5f); - mOffset = offset; - return this; - } - - public LetterTileDrawable setLetter(Character letter) { - mLetter = letter; - return this; - } - - public Character getLetter() { - return this.mLetter; - } - - private LetterTileDrawable setLetterAndColorFromContactDetails( - final String displayName, final String identifier) { - if (!TextUtils.isEmpty(displayName) && isEnglishLetter(displayName.charAt(0))) { - mLetter = Character.toUpperCase(displayName.charAt(0)); - } else { - mLetter = null; - } - mColor = pickColor(identifier); - return this; - } - - private LetterTileDrawable setContactType(@ContactType int contactType) { - mContactType = contactType; - return this; - } - - @ContactType - public int getContactType() { - return this.mContactType; - } - - public LetterTileDrawable setIsCircular(boolean isCircle) { - mIsCircle = isCircle; - return this; - } - - public boolean tileIsCircular() { - return this.mIsCircle; - } - - /** - * Creates a canonical letter tile for use across dialer fragments. - * - * @param displayName The display name to produce the letter in the tile. Null values or numbers - * yield no letter. - * @param identifierForTileColor The string used to produce the tile color. - * @param shape The shape of the tile. - * @param contactType The type of contact, e.g. TYPE_VOICEMAIL. - * @return this - */ - public LetterTileDrawable setCanonicalDialerLetterTileDetails( - @Nullable final String displayName, - @Nullable final String identifierForTileColor, - @Shape final int shape, - final int contactType) { - - this.setIsCircular(shape == SHAPE_CIRCLE); - - /** - * We return quickly under the following conditions: 1. We are asked to draw a default tile, and - * no coloring information is provided, meaning no further initialization is necessary OR 2. - * We've already invoked this method before, set mDisplayName, and found that it has not - * changed. This is useful during events like hangup, when we lose the call state for special - * types of contacts, like voicemail. We keep track of the special case until we encounter a new - * display name. - */ - if (contactType == TYPE_DEFAULT - && ((displayName == null && identifierForTileColor == null) - || (displayName != null && displayName.equals(mDisplayName)))) { - return this; - } - - this.mDisplayName = displayName; - setContactType(contactType); - - // Special contact types receive default color and no letter tile, but special iconography. - if (contactType != TYPE_PERSON) { - this.setLetterAndColorFromContactDetails(null, null); - } else { - if (identifierForTileColor != null) { - this.setLetterAndColorFromContactDetails(displayName, identifierForTileColor); - } else { - this.setLetterAndColorFromContactDetails(displayName, displayName); - } - } - return this; - } - - /** - * Returns the appropriate LetterTileDrawable.TYPE_ based on the given primitive conditions. - * - *

If no special state is detected, yields TYPE_DEFAULT - */ - public static @ContactType int getContactTypeFromPrimitives( - boolean isVoicemailNumber, - boolean isSpam, - boolean isBusiness, - int numberPresentation, - boolean isConference) { - if (isVoicemailNumber) { - return LetterTileDrawable.TYPE_VOICEMAIL; - } else if (isSpam) { - return LetterTileDrawable.TYPE_SPAM; - } else if (isBusiness) { - return LetterTileDrawable.TYPE_BUSINESS; - } else if (numberPresentation == TelecomManager.PRESENTATION_RESTRICTED) { - return LetterTileDrawable.TYPE_GENERIC_AVATAR; - } else if (isConference) { - return LetterTileDrawable.TYPE_CONFERENCE; - } else { - return LetterTileDrawable.TYPE_DEFAULT; - } - } -} diff --git a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java index d1118c3c7..ad0983611 100644 --- a/java/com/android/contacts/common/list/PhoneNumberListAdapter.java +++ b/java/com/android/contacts/common/list/PhoneNumberListAdapter.java @@ -37,7 +37,6 @@ import com.android.contacts.common.compat.CallableCompat; import com.android.contacts.common.compat.DirectoryCompat; import com.android.contacts.common.compat.PhoneCompat; import com.android.contacts.common.extensions.PhoneDirectoryExtenderAccessor; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.contacts.common.list.ContactListItemView.CallToAction; import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.Constants; @@ -47,6 +46,7 @@ import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.enrichedcall.EnrichedCallCapabilities; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.lightbringer.LightbringerComponent; import com.android.dialer.location.GeoUtil; import com.android.dialer.util.CallUtil; diff --git a/java/com/android/contacts/common/res/values/colors.xml b/java/com/android/contacts/common/res/values/colors.xml index 20b28c9d9..ca873414c 100644 --- a/java/com/android/contacts/common/res/values/colors.xml +++ b/java/com/android/contacts/common/res/values/colors.xml @@ -20,8 +20,6 @@ #44ff0000 - #A52714 - #a0ffffff @@ -59,25 +57,6 @@ #fff #000 - - - - #DB4437 - #E91E63 - #9C27B0 - #673AB7 - #3F51B5 - #4285F4 - #039BE5 - #0097A7 - #009688 - #0F9D58 - #689F38 - #EF6C00 - #FF5722 - #757575 - - @@ -104,11 +83,6 @@ this is Blue Grey 700 --> #455A64 - - #cccccc - - #ffffff - @color/dialer_theme_color #ffffff diff --git a/java/com/android/contacts/common/res/values/dimens.xml b/java/com/android/contacts/common/res/values/dimens.xml index 26f095f39..74e1547ba 100644 --- a/java/com/android/contacts/common/res/values/dimens.xml +++ b/java/com/android/contacts/common/res/values/dimens.xml @@ -83,12 +83,6 @@ 20sp 10dip - - 40dp - 20dp - 1dp - 67% - 56dp diff --git a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java index 6b97bd694..9eccdd374 100644 --- a/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java +++ b/java/com/android/dialer/app/calllog/CallLogListItemViewHolder.java @@ -53,8 +53,6 @@ import com.android.contacts.common.ClipboardUtils; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.compat.PhoneNumberUtilsCompat; import com.android.contacts.common.dialog.CallSubjectDialog; -import com.android.contacts.common.lettertiles.LetterTileDrawable; -import com.android.contacts.common.lettertiles.LetterTileDrawable.ContactType; import com.android.contacts.common.util.UriUtils; import com.android.dialer.app.DialtactsActivity; import com.android.dialer.app.R; @@ -75,6 +73,8 @@ import com.android.dialer.compat.CompatUtils; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.dialercontact.SimDetails; +import com.android.dialer.lettertile.LetterTileDrawable; +import com.android.dialer.lettertile.LetterTileDrawable.ContactType; import com.android.dialer.lightbringer.Lightbringer; import com.android.dialer.lightbringer.LightbringerComponent; import com.android.dialer.logging.ContactSource; diff --git a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java index 4c8e32a41..537acd060 100644 --- a/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java +++ b/java/com/android/dialer/app/contactinfo/ContactPhotoLoader.java @@ -25,10 +25,10 @@ import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.v4.graphics.drawable.RoundedBitmapDrawable; import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.app.R; import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.location.GeoUtil; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumbercache.ContactInfoHelper; diff --git a/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java b/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java index f53a45840..db119ab77 100644 --- a/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java +++ b/java/com/android/dialer/app/filterednumber/BlockedNumbersFragment.java @@ -31,7 +31,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.app.R; import com.android.dialer.blocking.BlockedNumbersMigrator; import com.android.dialer.blocking.BlockedNumbersMigrator.Listener; @@ -40,6 +39,7 @@ import com.android.dialer.blocking.FilteredNumbersUtil; import com.android.dialer.blocking.FilteredNumbersUtil.CheckForSendToVoicemailContactListener; import com.android.dialer.blocking.FilteredNumbersUtil.ImportSendToVoicemailContactsListener; import com.android.dialer.database.FilteredNumberContract; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker; public class BlockedNumbersFragment extends ListFragment diff --git a/java/com/android/dialer/app/filterednumber/NumbersAdapter.java b/java/com/android/dialer/app/filterednumber/NumbersAdapter.java index d98395ec7..b8bf86d37 100644 --- a/java/com/android/dialer/app/filterednumber/NumbersAdapter.java +++ b/java/com/android/dialer/app/filterednumber/NumbersAdapter.java @@ -28,10 +28,10 @@ import android.widget.SimpleCursorAdapter; import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.contacts.common.util.UriUtils; import com.android.dialer.app.R; import com.android.dialer.compat.CompatUtils; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.phonenumbercache.ContactInfo; import com.android.dialer.phonenumbercache.ContactInfoHelper; import com.android.dialer.phonenumberutil.PhoneNumberHelper; diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java index 30870eb39..ef884790f 100644 --- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java +++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java @@ -25,13 +25,13 @@ import android.view.View; import android.widget.ImageView; import com.android.contacts.common.ContactPhotoManager.DefaultImageRequest; import com.android.contacts.common.MoreContactUtils; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.contacts.common.list.ContactEntry; import com.android.contacts.common.list.ContactTileView; import com.android.dialer.app.R; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallSpecificAppData; import com.android.dialer.callintent.SpeedDialContactType; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; diff --git a/java/com/android/dialer/common/AndroidManifest.xml b/java/com/android/dialer/common/AndroidManifest.xml index ae43d6693..8892b5871 100644 --- a/java/com/android/dialer/common/AndroidManifest.xml +++ b/java/com/android/dialer/common/AndroidManifest.xml @@ -1,3 +1,18 @@ + diff --git a/java/com/android/dialer/common/res/values/strings.xml b/java/com/android/dialer/common/res/values/strings.xml index 8e9616178..770f42f37 100644 --- a/java/com/android/dialer/common/res/values/strings.xml +++ b/java/com/android/dialer/common/res/values/strings.xml @@ -1,4 +1,19 @@ + Wifi Mobile diff --git a/java/com/android/dialer/contactsfragment/ContactsAdapter.java b/java/com/android/dialer/contactsfragment/ContactsAdapter.java index d8ee3d189..ae2728e99 100644 --- a/java/com/android/dialer/contactsfragment/ContactsAdapter.java +++ b/java/com/android/dialer/contactsfragment/ContactsAdapter.java @@ -27,8 +27,8 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.android.contacts.common.ContactPhotoManager; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.common.Assert; +import com.android.dialer.lettertile.LetterTileDrawable; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/java/com/android/dialer/lettertile/AndroidManifest.xml b/java/com/android/dialer/lettertile/AndroidManifest.xml new file mode 100644 index 000000000..dce6806d4 --- /dev/null +++ b/java/com/android/dialer/lettertile/AndroidManifest.xml @@ -0,0 +1,18 @@ + + + diff --git a/java/com/android/dialer/lettertile/LetterTileDrawable.java b/java/com/android/dialer/lettertile/LetterTileDrawable.java new file mode 100644 index 000000000..c8b75c5a9 --- /dev/null +++ b/java/com/android/dialer/lettertile/LetterTileDrawable.java @@ -0,0 +1,439 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.dialer.lettertile; + +import android.content.res.Resources; +import android.content.res.TypedArray; +import android.graphics.Bitmap; +import android.graphics.Bitmap.Config; +import android.graphics.Canvas; +import android.graphics.ColorFilter; +import android.graphics.Outline; +import android.graphics.Paint; +import android.graphics.Paint.Align; +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; +import com.android.dialer.common.Assert; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +/** + * A drawable that encapsulates all the functionality needed to display a letter tile to represent a + * contact image. + */ +public class LetterTileDrawable extends Drawable { + + /** + * ContactType indicates the avatar type of the contact. For a person or for the default when no + * name is provided, it is {@link #TYPE_DEFAULT}, otherwise, for a business it is {@link + * #TYPE_BUSINESS}, and voicemail contacts should use {@link #TYPE_VOICEMAIL}. + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({TYPE_PERSON, TYPE_BUSINESS, TYPE_VOICEMAIL, TYPE_GENERIC_AVATAR, TYPE_SPAM}) + public @interface ContactType {} + + /** Contact type constants */ + public static final int TYPE_PERSON = 1; + + public static final int TYPE_BUSINESS = 2; + public static final int TYPE_VOICEMAIL = 3; + /** + * A generic avatar that features the default icon, default color, and no letter. Useful for + * situations where a contact is anonymous. + */ + public static final int TYPE_GENERIC_AVATAR = 4; + + public static final int TYPE_SPAM = 5; + public static final int TYPE_CONFERENCE = 6; + @ContactType public static final int TYPE_DEFAULT = TYPE_PERSON; + + /** + * Shape indicates the letter tile shape. It can be either a {@link #SHAPE_CIRCLE}, otherwise, it + * is a {@link #SHAPE_RECTANGLE}. + */ + @Retention(RetentionPolicy.SOURCE) + @IntDef({SHAPE_CIRCLE, SHAPE_RECTANGLE}) + public @interface Shape {} + + /** Shape constants */ + public static final int SHAPE_CIRCLE = 1; + + public static final int SHAPE_RECTANGLE = 2; + + /** 54% opacity */ + private static final int ALPHA = 138; + /** 100% opacity */ + private static final int SPAM_ALPHA = 255; + /** Default icon scale for vector drawable. */ + private static final float VECTOR_ICON_SCALE = 0.7f; + + /** Reusable components to avoid new allocations */ + private final Paint mPaint = new Paint(); + + private final Rect mRect = new Rect(); + private final char[] mFirstChar = new char[1]; + + /** Letter tile */ + @NonNull private final TypedArray mColors; + + private final int mSpamColor; + private final int mDefaultColor; + private final int mTileFontColor; + private final float mLetterToTileRatio; + @NonNull private final Drawable mDefaultPersonAvatar; + @NonNull private final Drawable mDefaultBusinessAvatar; + @NonNull private final Drawable mDefaultVoicemailAvatar; + @NonNull private final Drawable mDefaultSpamAvatar; + @NonNull private final Drawable mDefaultConferenceAvatar; + + @ContactType private int mContactType = TYPE_DEFAULT; + private float mScale = 1.0f; + private float mOffset = 0.0f; + private boolean mIsCircle = false; + + private int mColor; + private Character mLetter = null; + + private String mDisplayName; + + public LetterTileDrawable(final Resources res) { + mColors = res.obtainTypedArray(R.array.letter_tile_colors); + mSpamColor = res.getColor(R.color.spam_contact_background); + mDefaultColor = res.getColor(R.color.letter_tile_default_color); + mTileFontColor = res.getColor(R.color.letter_tile_font_color); + mLetterToTileRatio = res.getFraction(R.dimen.letter_to_tile_ratio, 1, 1); + mDefaultPersonAvatar = + res.getDrawable(R.drawable.product_logo_avatar_anonymous_white_color_120, null); + mDefaultBusinessAvatar = res.getDrawable(R.drawable.quantum_ic_business_vd_theme_24, null); + mDefaultVoicemailAvatar = res.getDrawable(R.drawable.quantum_ic_voicemail_vd_theme_24, null); + mDefaultSpamAvatar = res.getDrawable(R.drawable.quantum_ic_report_vd_theme_24, null); + mDefaultConferenceAvatar = res.getDrawable(R.drawable.quantum_ic_group_vd_theme_24, null); + + mPaint.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL)); + mPaint.setTextAlign(Align.CENTER); + mPaint.setAntiAlias(true); + mPaint.setFilterBitmap(true); + mPaint.setDither(true); + mColor = mDefaultColor; + } + + private Rect getScaledBounds(float scale, float offset) { + // The drawable should be drawn in the middle of the canvas without changing its width to + // height ratio. + final Rect destRect = copyBounds(); + // Crop the destination bounds into a square, scaled and offset as appropriate + final int halfLength = (int) (scale * Math.min(destRect.width(), destRect.height()) / 2); + + destRect.set( + destRect.centerX() - halfLength, + (int) (destRect.centerY() - halfLength + offset * destRect.height()), + destRect.centerX() + halfLength, + (int) (destRect.centerY() + halfLength + offset * destRect.height())); + return destRect; + } + + private Drawable getDrawableForContactType(int contactType) { + switch (contactType) { + case TYPE_BUSINESS: + mScale = VECTOR_ICON_SCALE; + return mDefaultBusinessAvatar; + case TYPE_VOICEMAIL: + mScale = VECTOR_ICON_SCALE; + return mDefaultVoicemailAvatar; + case TYPE_SPAM: + mScale = VECTOR_ICON_SCALE; + return mDefaultSpamAvatar; + case TYPE_CONFERENCE: + mScale = VECTOR_ICON_SCALE; + return mDefaultConferenceAvatar; + case TYPE_PERSON: + case TYPE_GENERIC_AVATAR: + default: + return mDefaultPersonAvatar; + } + } + + private static boolean isEnglishLetter(final char c) { + return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z'); + } + + @Override + public void draw(@NonNull final Canvas canvas) { + final Rect bounds = getBounds(); + if (!isVisible() || bounds.isEmpty()) { + return; + } + // Draw letter tile. + drawLetterTile(canvas); + } + + public Bitmap getBitmap(int width, int height) { + Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888); + this.setBounds(0, 0, width, height); + Canvas canvas = new Canvas(bitmap); + this.draw(canvas); + return bitmap; + } + + private void drawLetterTile(final Canvas canvas) { + // Draw background color. + mPaint.setColor(mColor); + + final Rect bounds = getBounds(); + final int minDimension = Math.min(bounds.width(), bounds.height()); + + if (mIsCircle) { + canvas.drawCircle(bounds.centerX(), bounds.centerY(), minDimension / 2, mPaint); + } else { + canvas.drawRect(bounds, mPaint); + } + + // Draw letter/digit only if the first character is an english letter or there's a override + if (mLetter != null) { + // Draw letter or digit. + mFirstChar[0] = mLetter; + + // Scale text by canvas bounds and user selected scaling factor + mPaint.setTextSize(mScale * mLetterToTileRatio * minDimension); + mPaint.getTextBounds(mFirstChar, 0, 1, mRect); + mPaint.setTypeface(Typeface.create("sans-serif", Typeface.NORMAL)); + mPaint.setColor(mTileFontColor); + mPaint.setAlpha(ALPHA); + + // Draw the letter in the canvas, vertically shifted up or down by the user-defined + // offset + canvas.drawText( + mFirstChar, + 0, + 1, + bounds.centerX(), + bounds.centerY() + mOffset * bounds.height() - mRect.exactCenterY(), + mPaint); + } 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 == mDefaultSpamAvatar ? SPAM_ALPHA : ALPHA); + drawable.draw(canvas); + } + } + + public int getColor() { + return mColor; + } + + public LetterTileDrawable setColor(int color) { + mColor = color; + return this; + } + + /** Returns a deterministic color based on the provided contact identifier string. */ + private int pickColor(final String identifier) { + if (mContactType == TYPE_SPAM) { + return mSpamColor; + } + + if (mContactType == TYPE_VOICEMAIL + || mContactType == TYPE_BUSINESS + || TextUtils.isEmpty(identifier)) { + return mDefaultColor; + } + + // String.hashCode() implementation is not supposed to change across java versions, so + // this should guarantee the same email address always maps to the same color. + // The email should already have been normalized by the ContactRequest. + final int color = Math.abs(identifier.hashCode()) % mColors.length(); + return mColors.getColor(color, mDefaultColor); + } + + @Override + public void setAlpha(final int alpha) { + mPaint.setAlpha(alpha); + } + + @Override + public void setColorFilter(final ColorFilter cf) { + mPaint.setColorFilter(cf); + } + + @Override + public int getOpacity() { + return android.graphics.PixelFormat.OPAQUE; + } + + @Override + public void getOutline(Outline outline) { + if (mIsCircle) { + outline.setOval(getBounds()); + } else { + outline.setRect(getBounds()); + } + + outline.setAlpha(1); + } + + /** + * Scale the drawn letter tile to a ratio of its default size + * + * @param scale The ratio the letter tile should be scaled to as a percentage of its default size, + * from a scale of 0 to 2.0f. The default is 1.0f. + */ + public LetterTileDrawable setScale(float scale) { + mScale = scale; + return this; + } + + /** + * Assigns the vertical offset of the position of the letter tile to the ContactDrawable + * + * @param offset The provided offset must be within the range of -0.5f to 0.5f. If set to -0.5f, + * the letter will be shifted upwards by 0.5 times the height of the canvas it is being drawn + * on, which means it will be drawn with the center of the letter starting at the top edge of + * the canvas. If set to 0.5f, the letter will be shifted downwards by 0.5 times the height of + * the canvas it is being drawn on, which means it will be drawn with the center of the letter + * starting at the bottom edge of the canvas. The default is 0.0f. + */ + public LetterTileDrawable setOffset(float offset) { + Assert.checkArgument(offset >= -0.5f && offset <= 0.5f); + mOffset = offset; + return this; + } + + public LetterTileDrawable setLetter(Character letter) { + mLetter = letter; + return this; + } + + public Character getLetter() { + return this.mLetter; + } + + private LetterTileDrawable setLetterAndColorFromContactDetails( + final String displayName, final String identifier) { + if (!TextUtils.isEmpty(displayName) && isEnglishLetter(displayName.charAt(0))) { + mLetter = Character.toUpperCase(displayName.charAt(0)); + } else { + mLetter = null; + } + mColor = pickColor(identifier); + return this; + } + + private LetterTileDrawable setContactType(@ContactType int contactType) { + mContactType = contactType; + return this; + } + + @ContactType + public int getContactType() { + return this.mContactType; + } + + public LetterTileDrawable setIsCircular(boolean isCircle) { + mIsCircle = isCircle; + return this; + } + + public boolean tileIsCircular() { + return this.mIsCircle; + } + + /** + * Creates a canonical letter tile for use across dialer fragments. + * + * @param displayName The display name to produce the letter in the tile. Null values or numbers + * yield no letter. + * @param identifierForTileColor The string used to produce the tile color. + * @param shape The shape of the tile. + * @param contactType The type of contact, e.g. TYPE_VOICEMAIL. + * @return this + */ + public LetterTileDrawable setCanonicalDialerLetterTileDetails( + @Nullable final String displayName, + @Nullable final String identifierForTileColor, + @Shape final int shape, + final int contactType) { + + this.setIsCircular(shape == SHAPE_CIRCLE); + + /** + * We return quickly under the following conditions: 1. We are asked to draw a default tile, and + * no coloring information is provided, meaning no further initialization is necessary OR 2. + * We've already invoked this method before, set mDisplayName, and found that it has not + * changed. This is useful during events like hangup, when we lose the call state for special + * types of contacts, like voicemail. We keep track of the special case until we encounter a new + * display name. + */ + if (contactType == TYPE_DEFAULT + && ((displayName == null && identifierForTileColor == null) + || (displayName != null && displayName.equals(mDisplayName)))) { + return this; + } + + this.mDisplayName = displayName; + setContactType(contactType); + + // Special contact types receive default color and no letter tile, but special iconography. + if (contactType != TYPE_PERSON) { + this.setLetterAndColorFromContactDetails(null, null); + } else { + if (identifierForTileColor != null) { + this.setLetterAndColorFromContactDetails(displayName, identifierForTileColor); + } else { + this.setLetterAndColorFromContactDetails(displayName, displayName); + } + } + return this; + } + + /** + * Returns the appropriate LetterTileDrawable.TYPE_ based on the given primitive conditions. + * + *

If no special state is detected, yields TYPE_DEFAULT + */ + public static @ContactType int getContactTypeFromPrimitives( + boolean isVoicemailNumber, + boolean isSpam, + boolean isBusiness, + int numberPresentation, + boolean isConference) { + if (isVoicemailNumber) { + return LetterTileDrawable.TYPE_VOICEMAIL; + } else if (isSpam) { + return LetterTileDrawable.TYPE_SPAM; + } else if (isBusiness) { + return LetterTileDrawable.TYPE_BUSINESS; + } else if (numberPresentation == TelecomManager.PRESENTATION_RESTRICTED) { + return LetterTileDrawable.TYPE_GENERIC_AVATAR; + } else if (isConference) { + return LetterTileDrawable.TYPE_CONFERENCE; + } else { + return LetterTileDrawable.TYPE_DEFAULT; + } + } +} diff --git a/java/com/android/dialer/lettertile/res/values/colors.xml b/java/com/android/dialer/lettertile/res/values/colors.xml new file mode 100644 index 000000000..406b4900b --- /dev/null +++ b/java/com/android/dialer/lettertile/res/values/colors.xml @@ -0,0 +1,40 @@ + + + + + #DB4437 + #E91E63 + #9C27B0 + #673AB7 + #3F51B5 + #4285F4 + #039BE5 + #0097A7 + #009688 + #0F9D58 + #689F38 + #EF6C00 + #FF5722 + #757575 + + + #A52714 + + #cccccc + + #ffffff + \ No newline at end of file diff --git a/java/com/android/dialer/lettertile/res/values/dimens.xml b/java/com/android/dialer/lettertile/res/values/dimens.xml new file mode 100644 index 000000000..c804431e1 --- /dev/null +++ b/java/com/android/dialer/lettertile/res/values/dimens.xml @@ -0,0 +1,20 @@ + + + + + 67% + \ No newline at end of file diff --git a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java index d3df02f79..36c206e76 100644 --- a/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java +++ b/java/com/android/dialer/searchfragment/cp2/SearchContactViewHolder.java @@ -31,10 +31,10 @@ import android.widget.ImageView; import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.callintent.CallInitiationType.Type; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.Assert; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.searchfragment.common.Projections; import com.android.dialer.searchfragment.common.QueryBoldingUtil; import com.android.dialer.searchfragment.common.R; diff --git a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java index b6e5a9013..0fc227dfd 100644 --- a/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java +++ b/java/com/android/dialer/searchfragment/nearbyplaces/NearbyPlaceViewHolder.java @@ -25,9 +25,9 @@ import android.view.View; import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.searchfragment.common.Projections; import com.android.dialer.searchfragment.common.QueryBoldingUtil; import com.android.dialer.searchfragment.common.R; diff --git a/java/com/android/dialer/shortcuts/IconFactory.java b/java/com/android/dialer/shortcuts/IconFactory.java index 4ec964c7b..7aad1129a 100644 --- a/java/com/android/dialer/shortcuts/IconFactory.java +++ b/java/com/android/dialer/shortcuts/IconFactory.java @@ -33,8 +33,8 @@ import android.support.annotation.RequiresApi; import android.support.annotation.WorkerThread; import android.support.v4.graphics.drawable.RoundedBitmapDrawable; import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.common.Assert; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.DrawableConverter; import java.io.InputStream; diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index 53017a10e..cf564c66b 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -60,8 +60,6 @@ import android.text.TextUtils; import android.text.style.ForegroundColorSpan; import com.android.contacts.common.ContactsUtils; import com.android.contacts.common.ContactsUtils.UserType; -import com.android.contacts.common.lettertiles.LetterTileDrawable; -import com.android.contacts.common.lettertiles.LetterTileDrawable.ContactType; import com.android.contacts.common.preference.ContactsPreferences; import com.android.contacts.common.util.BitmapUtil; import com.android.contacts.common.util.ContactDisplayUtils; @@ -69,6 +67,8 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.enrichedcall.EnrichedCallManager; import com.android.dialer.enrichedcall.Session; +import com.android.dialer.lettertile.LetterTileDrawable; +import com.android.dialer.lettertile.LetterTileDrawable.ContactType; import com.android.dialer.multimedia.MultimediaData; import com.android.dialer.notification.NotificationChannelId; import com.android.dialer.oem.MotorolaUtils; diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java index 502cc52b8..a6d7d95f0 100644 --- a/java/com/android/incallui/contactgrid/ContactGridManager.java +++ b/java/com/android/incallui/contactgrid/ContactGridManager.java @@ -30,8 +30,8 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.ViewAnimator; import com.android.contacts.common.compat.PhoneNumberUtilsCompat; -import com.android.contacts.common.lettertiles.LetterTileDrawable; import com.android.dialer.common.Assert; +import com.android.dialer.lettertile.LetterTileDrawable; import com.android.dialer.util.DrawableConverter; import com.android.incallui.incall.protocol.ContactPhotoType; import com.android.incallui.incall.protocol.PrimaryCallState; -- cgit v1.2.3