summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-06-05 13:35:02 -0700
committerEric Erfanian <erfanian@google.com>2017-06-07 20:44:54 +0000
commit91ce7d2a476bd04fe525049a37a2f8b2824e9724 (patch)
treeb9bbc285430ffb5363a70eb27e382c38f5a85b7a /java/com/android/dialer/app/list/PhoneFavoriteTileView.java
parent75233ff03785f24789b32039ac2c208805b7e506 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/158012278. 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/152373142 (4/06/2017) to cl/158012278 (6/05/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. Change-Id: I4d3f14b5140e2e51bead9497bc118a205b3ebe76
Diffstat (limited to 'java/com/android/dialer/app/list/PhoneFavoriteTileView.java')
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteTileView.java38
1 files changed, 33 insertions, 5 deletions
diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
index db89cf3dc..835b448bd 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
@@ -18,16 +18,22 @@ package com.android.dialer.app.list;
import android.content.ClipData;
import android.content.Context;
+import android.provider.ContactsContract.PinnedPositions;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
-import com.android.contacts.common.ContactPhotoManager;
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.logging.InteractionEvent;
+import com.android.dialer.logging.Logger;
/**
* A light version of the {@link com.android.contacts.common.list.ContactTileView} that is used in
@@ -42,7 +48,6 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
// tile is long pressed.
static final String DRAG_PHONE_FAVORITE_TILE = "PHONE_FAVORITE_TILE";
private static final String TAG = PhoneFavoriteTileView.class.getSimpleName();
- private static final boolean DEBUG = false;
// These parameters instruct the photo manager to display the default image/letter at 70% of
// its normal size, and vertically offset upwards 12% towards the top of the letter tile, to
// make room for the contact name and number label at the bottom of the image.
@@ -55,6 +60,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
private View mShadowOverlay;
/** Users' most frequent phone number. */
private String mPhoneNumberString;
+ private boolean isPinned;
+ private boolean isStarred;
public PhoneFavoriteTileView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -83,6 +90,8 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
super.loadFromContact(entry);
// Set phone number to null in case we're reusing the view.
mPhoneNumberString = null;
+ isPinned = (entry.pinned != PinnedPositions.UNPINNED);
+ isStarred = entry.isFavorite;
if (entry != null) {
// Grab the phone-number to call directly. See {@link onClick()}.
mPhoneNumberString = entry.phoneNumber;
@@ -113,16 +122,35 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
if (mListener == null) {
return;
}
+
+ CallSpecificAppData.Builder callSpecificAppData =
+ CallSpecificAppData.newBuilder()
+ .setCallInitiationType(CallInitiationType.Type.SPEED_DIAL)
+ .setSpeedDialContactPosition(
+ ((PhoneFavoriteListView) v.getParent()).getPositionForView(v));
+ if (isStarred) {
+ callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.STARRED_CONTACT);
+ } else {
+ callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.FREQUENT_CONTACT);
+ }
+ if (isPinned) {
+ callSpecificAppData.addSpeedDialContactType(SpeedDialContactType.Type.PINNED_CONTACT);
+ }
+
if (TextUtils.isEmpty(mPhoneNumberString)) {
// Copy "superclass" implementation
+ Logger.get(getContext())
+ .logInteraction(InteractionEvent.Type.SPEED_DIAL_CLICK_CONTACT_WITH_AMBIGUOUS_NUMBER);
mListener.onContactSelected(
- getLookupUri(), MoreContactUtils.getTargetRectFromView(PhoneFavoriteTileView.this));
+ getLookupUri(),
+ MoreContactUtils.getTargetRectFromView(PhoneFavoriteTileView.this),
+ callSpecificAppData.build());
} else {
// When you tap a frequently-called contact, you want to
// call them at the number that you usually talk to them
// at (i.e. the one displayed in the UI), regardless of
// whether that's their default number.
- mListener.onCallNumberDirectly(mPhoneNumberString);
+ mListener.onCallNumberDirectly(mPhoneNumberString, callSpecificAppData.build());
}
}
};
@@ -133,7 +161,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
return new DefaultImageRequest(
displayName,
lookupKey,
- ContactPhotoManager.TYPE_DEFAULT,
+ LetterTileDrawable.TYPE_DEFAULT,
DEFAULT_IMAGE_LETTER_SCALE,
DEFAULT_IMAGE_LETTER_OFFSET,
false);