summaryrefslogtreecommitdiff
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
parent99606aa5368e1eea30730a899aacdfdd7a5fd61a (diff)
Use the vector spam icon in the new call log.
Bug: 73123894 Test: GlidePhotoManagerImplTest PiperOrigin-RevId: 186522766 Change-Id: I3950071e6af492e07972619a4933231b4341aaf4
-rw-r--r--assets/quantum/res/drawable/quantum_ic_report_vd_red_24.xml36
-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
4 files changed, 68 insertions, 69 deletions
diff --git a/assets/quantum/res/drawable/quantum_ic_report_vd_red_24.xml b/assets/quantum/res/drawable/quantum_ic_report_vd_red_24.xml
new file mode 100644
index 000000000..a64db13c7
--- /dev/null
+++ b/assets/quantum/res/drawable/quantum_ic_report_vd_red_24.xml
@@ -0,0 +1,36 @@
+<!--
+ ~ 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
+ -->
+
+<!-- A custom-made "report" icon for Dialer -->
+<vector
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportHeight="40.0"
+ android:viewportWidth="40.0">
+ <path
+ android:fillColor="#D50000"
+ android:fillType="nonZero"
+ android:pathData="M27.87,1L39,12.13L39,27.87L27.87,39L12.13,39L1,27.87L1,12.13L12.13,1L27.87,1Z"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1"/>
+ <path
+ android:fillColor="#FFFFFF"
+ android:fillType="evenOdd"
+ android:pathData="M20,30.6C18.56,30.6 17.4,29.44 17.4,28C17.4,26.56 18.56,25.4 20,25.4C21.44,25.4 22.6,26.56 22.6,28C22.6,29.44 21.44,30.6 20,30.6ZM22,22L18,22L18,10L22,10L22,22Z"
+ android:strokeColor="#00000000"
+ android:strokeWidth="1"/>
+</vector>
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