summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-08-31 06:57:16 -0700
committerRoland Levillain <rpl@google.com>2017-09-04 18:05:19 +0100
commitfc0eb8ccebcc7846db5e8b5c5430070055679bfa (patch)
treea8a23c3202e4161ffd57a71095a404db1bcf5735 /java/com/android/dialer/app/list/PhoneFavoriteTileView.java
parentea7b4dc89590ffa3332766a531e0eab6ffb9aebd (diff)
Update Dialer source to latest internal Google revision.
Previously, Android's Dialer app was developed in an internal Google source control system and only exported to public during AOSP drops. The Dialer team is now switching to a public development model similar to the telephony team. This CL represents all internal Google changes that were committed to Dialer between the public O release and today's tip of tree on internal master. This CL squashes those changes into a single commit. In subsequent changes, changes will be exported on a per-commit basis. (cherry picked from commit 2ca4318cc1ee57dda907ba2069bd61d162b1baef and amended to match paths of dependencies under prebuilts/maven_repo/bumptech/com/github/bumptech/glide/.) This CL was generated using these commands from a repository at stage-stage-master at revision ea7b4dc89590ffa3332766a531e0eab6ffb9aebd ("Merge "Update Dialer source to latest internal Google revision." am: c39ea3c55f -s ours"): git diff --binary 2ca4318cc1ee57dda907ba2069bd61d162b1baef | git apply -R --index git commit -c 2ca4318cc1ee57dda907ba2069bd61d162b1baef Test: make, flash install, run Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8 PiperOrigin-RevId: 167068436
Diffstat (limited to 'java/com/android/dialer/app/list/PhoneFavoriteTileView.java')
-rw-r--r--java/com/android/dialer/app/list/PhoneFavoriteTileView.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
index 30870eb39..e0961be4b 100644
--- a/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
+++ b/java/com/android/dialer/app/list/PhoneFavoriteTileView.java
@@ -18,20 +18,23 @@ package com.android.dialer.app.list;
import android.content.ClipData;
import android.content.Context;
+import android.net.Uri;
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.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.contacts.common.model.ContactLoader;
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.common.LogUtil;
+import com.android.dialer.contactphoto.ContactPhotoManager.DefaultImageRequest;
+import com.android.dialer.lettertile.LetterTileDrawable;
import com.android.dialer.logging.InteractionEvent;
import com.android.dialer.logging.Logger;
@@ -94,11 +97,11 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
isPinned = (entry.pinned != PinnedPositions.UNPINNED);
isStarred = entry.isFavorite;
if (entry != null) {
+ sendViewNotification(getContext(), entry.lookupUri);
// Grab the phone-number to call directly. See {@link onClick()}.
mPhoneNumberString = entry.phoneNumber;
- // If this is a blank entry, don't show anything.
- // TODO krelease: Just hide the view for now. For this to truly look like an empty row
+ // If this is a blank entry, don't show anything. For this to truly look like an empty row
// the entire ContactTileRow needs to be hidden.
if (entry == ContactEntry.BLANK_ENTRY) {
setVisibility(View.INVISIBLE);
@@ -126,6 +129,7 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
CallSpecificAppData.Builder callSpecificAppData =
CallSpecificAppData.newBuilder()
+ .setAllowAssistedDialing(true)
.setCallInitiationType(CallInitiationType.Type.SPEED_DIAL)
.setSpeedDialContactPosition(position);
if (isStarred) {
@@ -186,4 +190,22 @@ public abstract class PhoneFavoriteTileView extends ContactTileView {
public void setPosition(int position) {
this.position = position;
}
+
+ /**
+ * Send a notification using a {@link ContactLoader} to inform the sync adapter that we are
+ * viewing a particular contact, so that it can download the high-res photo.
+ */
+ private static void sendViewNotification(Context context, Uri contactUri) {
+ ContactLoader loader = new ContactLoader(context, contactUri, true /* postViewNotification */);
+ loader.registerListener(
+ 0,
+ (loader1, contact) -> {
+ try {
+ loader1.reset();
+ } catch (RuntimeException e) {
+ LogUtil.e("PhoneFavoriteTileView.onLoadComplete", "error resetting loader", e);
+ }
+ });
+ loader.startLoading();
+ }
}