summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/glidephotomanager
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2018-04-17 14:48:03 -0700
committerCopybara-Service <copybara-piper@google.com>2018-04-17 15:55:51 -0700
commite00bbaeceb399da24f06c8f1a626cbbf07eab4ad (patch)
tree2f18f4411d650f4a162d03da62936e05bdaa088f /java/com/android/dialer/glidephotomanager
parent9a14f6a71206add856193cd90971d94c39f079fa (diff)
Add RTT transcript screen.
Bug: 67596257 Test: CallDetailsCursorLoaderTest PiperOrigin-RevId: 193259769 Change-Id: I8c6a8eb9a6bf06e9c1c25c45fc035f8db8ae5a65
Diffstat (limited to 'java/com/android/dialer/glidephotomanager')
-rw-r--r--java/com/android/dialer/glidephotomanager/GlidePhotoManager.java10
-rw-r--r--java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java12
2 files changed, 20 insertions, 2 deletions
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<Drawable> request = buildRequest(GlideApp.with(badge), photoInfo);
- request.into(badge);
+ loadContactPhoto(badge, photoInfo);
+ }
+
+ @MainThread
+ @Override
+ public void loadContactPhoto(ImageView imageView, PhotoInfo photoInfo) {
+ Assert.isMainThread();
+ GlideRequest<Drawable> request = buildRequest(GlideApp.with(imageView), photoInfo);
+ request.into(imageView);
}
private GlideRequest<Drawable> buildRequest(GlideRequests requestManager, PhotoInfo photoInfo) {