From e00bbaeceb399da24f06c8f1a626cbbf07eab4ad Mon Sep 17 00:00:00 2001 From: wangqi Date: Tue, 17 Apr 2018 14:48:03 -0700 Subject: Add RTT transcript screen. Bug: 67596257 Test: CallDetailsCursorLoaderTest PiperOrigin-RevId: 193259769 Change-Id: I8c6a8eb9a6bf06e9c1c25c45fc035f8db8ae5a65 --- .../android/dialer/glidephotomanager/GlidePhotoManager.java | 10 ++++++++++ .../dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'java/com/android/dialer/glidephotomanager') diff --git a/java/com/android/dialer/glidephotomanager/GlidePhotoManager.java b/java/com/android/dialer/glidephotomanager/GlidePhotoManager.java index 519a39481..de16c387d 100644 --- a/java/com/android/dialer/glidephotomanager/GlidePhotoManager.java +++ b/java/com/android/dialer/glidephotomanager/GlidePhotoManager.java @@ -17,6 +17,7 @@ package com.android.dialer.glidephotomanager; import android.support.annotation.MainThread; +import android.widget.ImageView; import android.widget.QuickContactBadge; /** Class to load photo for call/contacts */ @@ -30,4 +31,13 @@ public interface GlidePhotoManager { */ @MainThread void loadQuickContactBadge(QuickContactBadge badge, PhotoInfo photoInfo); + + /** + * Load {@code photoInfo} into the {@code imageView}. The loading is performed in the background + * and a placeholder will be used appropriately. {@code imageView} must be already attached to an + * activity/fragment, and the load will be automatically canceled if the lifecycle of the activity + * ends. + */ + @MainThread + void loadContactPhoto(ImageView imageView, PhotoInfo photoInfo); } diff --git a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java index 202307a29..562177c48 100644 --- a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java +++ b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java @@ -25,6 +25,7 @@ import android.support.annotation.MainThread; import android.support.annotation.Nullable; import android.telecom.TelecomManager; import android.text.TextUtils; +import android.widget.ImageView; import android.widget.QuickContactBadge; import com.android.dialer.common.Assert; import com.android.dialer.glide.GlideApp; @@ -54,8 +55,15 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager { ? DefaultLookupUriGenerator.generateUri(photoInfo) : parseUri(photoInfo.getLookupUri())); badge.setOverlay(null); - GlideRequest request = buildRequest(GlideApp.with(badge), photoInfo); - request.into(badge); + loadContactPhoto(badge, photoInfo); + } + + @MainThread + @Override + public void loadContactPhoto(ImageView imageView, PhotoInfo photoInfo) { + Assert.isMainThread(); + GlideRequest request = buildRequest(GlideApp.with(imageView), photoInfo); + request.into(imageView); } private GlideRequest buildRequest(GlideRequests requestManager, PhotoInfo photoInfo) { -- cgit v1.2.3