summaryrefslogtreecommitdiffstats
path: root/java/com
diff options
context:
space:
mode:
authorlinyuh <linyuh@google.com>2018-02-21 14:45:47 -0800
committerEric Erfanian <erfanian@google.com>2018-02-22 21:11:45 +0000
commit2c85995b62d919a4a5fd03979b305e4485a2c4be (patch)
tree99a8f8ea35d69e9ce71bb031aefc3c423222c8a0 /java/com
parent99606aa5368e1eea30730a899aacdfdd7a5fd61a (diff)
downloadandroid_packages_apps_Dialer-2c85995b62d919a4a5fd03979b305e4485a2c4be.tar.gz
android_packages_apps_Dialer-2c85995b62d919a4a5fd03979b305e4485a2c4be.tar.bz2
android_packages_apps_Dialer-2c85995b62d919a4a5fd03979b305e4485a2c4be.zip
Use the vector spam icon in the new call log.
Bug: 73123894 Test: GlidePhotoManagerImplTest PiperOrigin-RevId: 186522766 Change-Id: I3950071e6af492e07972619a4933231b4341aaf4
Diffstat (limited to 'java/com')
-rw-r--r--java/com/android/dialer/glidephotomanager/PhotoInfo.java10
-rw-r--r--java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java55
-rw-r--r--java/com/android/dialer/glidephotomanager/impl/res/drawable/ic_report_red_48dp.xml36
3 files changed, 32 insertions, 69 deletions
diff --git a/java/com/android/dialer/glidephotomanager/PhotoInfo.java b/java/com/android/dialer/glidephotomanager/PhotoInfo.java
index e4dd87152..016221f40 100644
--- a/java/com/android/dialer/glidephotomanager/PhotoInfo.java
+++ b/java/com/android/dialer/glidephotomanager/PhotoInfo.java
@@ -61,13 +61,6 @@ public abstract class PhotoInfo {
*/
public abstract boolean isVideo();
- /**
- * Should the result be circularized.
- *
- * <p>Defaults to true.
- */
- public abstract boolean isCircular();
-
/** Builder for {@link PhotoInfo} */
@AutoValue.Builder
public abstract static class Builder {
@@ -92,8 +85,6 @@ public abstract class PhotoInfo {
public abstract Builder setIsVideo(boolean isVideo);
- public abstract Builder setIsCircular(boolean isCircular);
-
public abstract PhotoInfo build();
}
@@ -104,7 +95,6 @@ public abstract class PhotoInfo {
.setIsVoicemail(false)
.setIsBlocked(false)
.setIsSpam(false)
- .setIsCircular(true)
.setIsVideo(false);
}
}
diff --git a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java
index 10c4dfb4c..e14e604a1 100644
--- a/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java
+++ b/java/com/android/dialer/glidephotomanager/impl/GlidePhotoManagerImpl.java
@@ -51,16 +51,7 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager {
Assert.isMainThread();
badge.assignContactUri(parseUri(photoInfo.lookupUri()));
badge.setOverlay(null);
- LetterTileDrawable defaultDrawable = getDefaultDrawable(photoInfo);
- GlideRequest<Drawable> request =
- buildRequest(GlideApp.with(badge), photoInfo)
- .placeholder(defaultDrawable) // when the photo is still loading.
- .fallback(defaultDrawable); // when there's nothing to load.
-
- if (photoInfo.isCircular()) {
- request.circleCrop();
- }
-
+ GlideRequest<Drawable> request = buildRequest(GlideApp.with(badge), photoInfo);
request.into(badge);
}
@@ -68,21 +59,39 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager {
// Warning: Glide ignores extra attributes on BitmapDrawable such as tint and draw the bitmap
// directly so be sure not to set tint in the XML of any drawable referenced below.
- // Whether the number is blocked takes precedence over the spam status.
+ GlideRequest<Drawable> request;
+ boolean circleCrop = true; // Photos are cropped to a circle by default.
+
if (photoInfo.isBlocked()) {
- return requestManager.load(R.drawable.ic_block_grey_48dp);
- }
- if (photoInfo.isSpam()) {
- return requestManager.load(R.drawable.ic_report_red_48dp);
- }
- if (!TextUtils.isEmpty(photoInfo.photoUri())) {
- return requestManager.load(parseUri(photoInfo.photoUri()));
+ // Whether the number is blocked takes precedence over the spam status.
+ request = requestManager.load(R.drawable.ic_block_grey_48dp);
+
+ } else if (photoInfo.isSpam()) {
+ request = requestManager.load(R.drawable.quantum_ic_report_vd_red_24);
+ circleCrop = false; // The spam icon is an octagon so we don't crop it.
+
+ } else if (!TextUtils.isEmpty(photoInfo.photoUri())) {
+ request = requestManager.load(parseUri(photoInfo.photoUri()));
+
+ } else if (photoInfo.photoId() != 0) {
+ request =
+ requestManager.load(ContentUris.withAppendedId(Data.CONTENT_URI, photoInfo.photoId()));
+
+ } else {
+ // load null to indicate fallback should be used.
+ request = requestManager.load((Object) null);
}
- if (photoInfo.photoId() != 0) {
- return requestManager.load(ContentUris.withAppendedId(Data.CONTENT_URI, photoInfo.photoId()));
+
+ LetterTileDrawable defaultDrawable = getDefaultDrawable(photoInfo);
+ request
+ .placeholder(defaultDrawable) // when the photo is still loading.
+ .fallback(defaultDrawable); // when there's nothing to load.
+
+ if (circleCrop) {
+ request.circleCrop();
}
- // load null to indicate fallback should be used.
- return requestManager.load((Object) null);
+
+ return request;
}
/**
@@ -108,7 +117,7 @@ public class GlidePhotoManagerImpl implements GlidePhotoManager {
LetterTileDrawable.SHAPE_CIRCLE,
LetterTileDrawable.getContactTypeFromPrimitives(
photoInfo.isVoicemail(),
- false, // TODO(twyen):implement
+ photoInfo.isSpam(),
photoInfo.isBusiness(),
TelecomManager.PRESENTATION_ALLOWED, // TODO(twyen):implement
false)); // TODO(twyen):implement
diff --git a/java/com/android/dialer/glidephotomanager/impl/res/drawable/ic_report_red_48dp.xml b/java/com/android/dialer/glidephotomanager/impl/res/drawable/ic_report_red_48dp.xml
deleted file mode 100644
index 8a1ddcd99..000000000
--- a/java/com/android/dialer/glidephotomanager/impl/res/drawable/ic_report_red_48dp.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- ~ Copyright (C) 2018 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
- -->
-
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item>
- <shape android:shape="oval">
- <solid android:color="#A52714"/>
- <size
- android:height="48dp"
- android:width="48dp"/>
- </shape>
- </item>
-
- <item
- android:drawable="@drawable/quantum_ic_report_vd_theme_24"
- android:gravity="center"
- android:height="36dp"
- android:width="36dp"/>
-
-</layer-list> \ No newline at end of file