summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-10-12 18:41:41 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-10-12 18:41:41 +0000
commitd156342c43389367c4528fb395fe3542bfe8d60e (patch)
tree455137d15d16b4673660e466543501a5e878b8e2
parentc7f8899a3ea60fb2c1059b79c18d2b4bc2511c6b (diff)
parent70bb286f79696fc3a3ee8a57a038a9f56087d902 (diff)
Merge "Show blocked contact instead of profile photo." into ub-contactsdialer-a-dev
-rw-r--r--res/drawable-hdpi/ic_block_18dp.pngbin0 -> 392 bytes
-rw-r--r--res/drawable-mdpi/ic_block_18dp.pngbin0 -> 268 bytes
-rw-r--r--res/drawable-mdpi/ic_block_24dp.pngbin335 -> 0 bytes
-rw-r--r--res/drawable-xhdpi/ic_block_18dp.png (renamed from res/drawable-hdpi/ic_block_24dp.png)bin478 -> 478 bytes
-rw-r--r--res/drawable-xhdpi/ic_block_24dp.pngbin665 -> 0 bytes
-rw-r--r--res/drawable-xxhdpi/ic_block_18dp.pngbin0 -> 714 bytes
-rw-r--r--res/drawable-xxxhdpi/ic_block_18dp.png (renamed from res/drawable-xxhdpi/ic_block_24dp.png)bin973 -> 973 bytes
-rw-r--r--res/drawable-xxxhdpi/ic_block_24dp.pngbin1295 -> 0 bytes
-rw-r--r--res/drawable/blocked_contact.xml27
-rw-r--r--res/values/colors.xml1
-rw-r--r--src/com/android/dialer/calllog/CallLogAdapter.java30
-rw-r--r--src/com/android/dialer/calllog/CallLogListItemViewHolder.java7
-rw-r--r--src/com/android/dialer/calllog/CallTypeIconsView.java2
13 files changed, 63 insertions, 4 deletions
diff --git a/res/drawable-hdpi/ic_block_18dp.png b/res/drawable-hdpi/ic_block_18dp.png
new file mode 100644
index 000000000..acab511f6
--- /dev/null
+++ b/res/drawable-hdpi/ic_block_18dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_block_18dp.png b/res/drawable-mdpi/ic_block_18dp.png
new file mode 100644
index 000000000..45b83facf
--- /dev/null
+++ b/res/drawable-mdpi/ic_block_18dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_block_24dp.png b/res/drawable-mdpi/ic_block_24dp.png
deleted file mode 100644
index ec1b33f0e..000000000
--- a/res/drawable-mdpi/ic_block_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_block_24dp.png b/res/drawable-xhdpi/ic_block_18dp.png
index 2ccc89d24..2ccc89d24 100644
--- a/res/drawable-hdpi/ic_block_24dp.png
+++ b/res/drawable-xhdpi/ic_block_18dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_block_24dp.png b/res/drawable-xhdpi/ic_block_24dp.png
deleted file mode 100644
index 7aba97b65..000000000
--- a/res/drawable-xhdpi/ic_block_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_block_18dp.png b/res/drawable-xxhdpi/ic_block_18dp.png
new file mode 100644
index 000000000..1eee12405
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_block_18dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_block_24dp.png b/res/drawable-xxxhdpi/ic_block_18dp.png
index fddfa54b8..fddfa54b8 100644
--- a/res/drawable-xxhdpi/ic_block_24dp.png
+++ b/res/drawable-xxxhdpi/ic_block_18dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_block_24dp.png b/res/drawable-xxxhdpi/ic_block_24dp.png
deleted file mode 100644
index 0378d1bed..000000000
--- a/res/drawable-xxxhdpi/ic_block_24dp.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/blocked_contact.xml b/res/drawable/blocked_contact.xml
new file mode 100644
index 000000000..38c0fc92c
--- /dev/null
+++ b/res/drawable/blocked_contact.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2015 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="@color/blocked_contact_background" />
+ <size android:width="24dp" android:height="24dp" />
+ </shape>
+ </item>
+ <item android:drawable="@drawable/ic_block_18dp" android:gravity="center" />
+</layer-list>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 55970d9e4..a7044c7cb 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -111,6 +111,7 @@
<color name="divider_line_color">#c7c7c7</color>
<!-- Colors for blocked numbers list -->
+ <color name="blocked_contact_background">#afafaf</color>
<color name="blocked_number_primary_text_color">@color/dialtacts_primary_text_color</color>
<color name="blocked_number_secondary_text_color">@color/dialtacts_secondary_text_color</color>
<color name="delete_icon_tint">#6D6D6D</color>
diff --git a/src/com/android/dialer/calllog/CallLogAdapter.java b/src/com/android/dialer/calllog/CallLogAdapter.java
index 316864fe2..703b18f8f 100644
--- a/src/com/android/dialer/calllog/CallLogAdapter.java
+++ b/src/com/android/dialer/calllog/CallLogAdapter.java
@@ -44,13 +44,16 @@ import com.android.dialer.PhoneCallDetails;
import com.android.dialer.R;
import com.android.dialer.contactinfo.ContactInfoCache;
import com.android.dialer.contactinfo.ContactInfoCache.OnContactInfoChangedListener;
+import com.android.dialer.contactinfo.NumberWithCountryIso;
import com.android.dialer.database.FilteredNumberAsyncQueryHandler;
+import com.android.dialer.database.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener;
import com.android.dialer.util.PhoneNumberUtil;
import com.android.dialer.voicemail.VoicemailPlaybackPresenter;
import com.google.common.annotations.VisibleForTesting;
import java.util.HashMap;
+import java.util.Map;
/**
* Adapter class to fill in data for the Call Log.
@@ -85,6 +88,7 @@ public class CallLogAdapter extends GroupingListAdapter
private final FilteredNumberAsyncQueryHandler mFilteredNumberAsyncQueryHandler;
protected ContactInfoCache mContactInfoCache;
+ protected final Map<NumberWithCountryIso, Integer> mBlockedIdCache;
private boolean mIsCallLogActivity;
@@ -248,6 +252,7 @@ public class CallLogAdapter extends GroupingListAdapter
CallTypeHelper callTypeHelper = new CallTypeHelper(resources);
mTelecomCallLogCache = new TelecomCallLogCache(mContext);
+ mBlockedIdCache = new HashMap<NumberWithCountryIso, Integer>();
PhoneCallDetailsHelper phoneCallDetailsHelper =
new PhoneCallDetailsHelper(mContext, resources, mTelecomCallLogCache);
mCallLogListItemHelper =
@@ -296,6 +301,7 @@ public class CallLogAdapter extends GroupingListAdapter
public void invalidateCache() {
mContactInfoCache.invalidate();
+ mBlockedIdCache.clear();
}
public void startCache() {
@@ -456,7 +462,7 @@ public class CallLogAdapter extends GroupingListAdapter
details.objectId = info.objectId;
}
- CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
+ final CallLogListItemViewHolder views = (CallLogListItemViewHolder) viewHolder;
views.info = info;
views.rowId = c.getLong(CallLogQuery.ID);
// Store values used when the actions ViewStub is inflated on expansion.
@@ -492,8 +498,28 @@ public class CallLogAdapter extends GroupingListAdapter
mCurrentlyExpandedPosition = position;
}
+ // Update the photo, once we know whether the user's number is blocked or not.
+ final NumberWithCountryIso blockedIdKey = new NumberWithCountryIso(number, countryIso);
+ if (mBlockedIdCache.containsKey(blockedIdKey)) {
+ views.blockId = mBlockedIdCache.get(blockedIdKey);
+ views.updatePhoto();
+ } else {
+ views.blockId = null;
+ boolean failed = mFilteredNumberAsyncQueryHandler.startBlockedQuery(
+ new OnCheckBlockedListener() {
+ @Override
+ public void onCheckComplete(Integer id) {
+ mBlockedIdCache.put(blockedIdKey, id);
+ views.blockId = id;
+ views.updatePhoto();
+ }
+ }, null, number, countryIso);
+ if (failed) {
+ views.updatePhoto();
+ }
+ }
+
views.showActions(mCurrentlyExpandedPosition == position);
- views.updatePhoto();
mCallLogListItemHelper.setPhoneCallDetails(views, details);
}
diff --git a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
index 5b47d4477..d22947b66 100644
--- a/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
+++ b/src/com/android/dialer/calllog/CallLogListItemViewHolder.java
@@ -528,8 +528,13 @@ public final class CallLogListItemViewHolder extends RecyclerView.ViewHolder
}
public void updatePhoto() {
- quickContactView.assignContactUri(info.lookupUri);
quickContactView.setOverlay(null);
+ quickContactView.assignContactUri(info.lookupUri);
+
+ if (blockId != null) {
+ quickContactView.setImageDrawable(mContext.getDrawable(R.drawable.blocked_contact));
+ return;
+ }
final boolean isVoicemail = mTelecomCallLogCache.isVoicemailNumber(accountHandle, number);
int contactType = ContactPhotoManager.TYPE_DEFAULT;
diff --git a/src/com/android/dialer/calllog/CallTypeIconsView.java b/src/com/android/dialer/calllog/CallTypeIconsView.java
index cfd8f9748..d2be380a5 100644
--- a/src/com/android/dialer/calllog/CallTypeIconsView.java
+++ b/src/com/android/dialer/calllog/CallTypeIconsView.java
@@ -199,7 +199,7 @@ public class CallTypeIconsView extends View {
voicemail = r.getDrawable(R.drawable.ic_call_voicemail_holo_dark);
- blocked = getScaledBitmap(context, R.drawable.ic_block_24dp);
+ blocked = getScaledBitmap(context, R.drawable.ic_block_18dp);
blocked.setColorFilter(r.getColor(R.color.blocked_call), PorterDuff.Mode.MULTIPLY);
videoCall = getScaledBitmap(context, R.drawable.ic_videocam_24dp);