Merge "Always hide blocked calls." into ub-contactsdialer-a-dev
diff --git a/res/drawable/blocked_number_item_background.xml b/res/drawable/ic_blocked_numbers_settings_add.xml
similarity index 63%
rename from res/drawable/blocked_number_item_background.xml
rename to res/drawable/ic_blocked_numbers_settings_add.xml
index acfea20..adcf906 100644
--- a/res/drawable/blocked_number_item_background.xml
+++ b/res/drawable/ic_blocked_numbers_settings_add.xml
@@ -15,15 +15,6 @@
      limitations under the License.
 -->
 
-<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
-    <item>
-        <shape android:shape="rectangle">
-            <solid android:color="@color/divider_line_color" />
-        </shape>
-    </item>
-    <item android:bottom="1dp">
-        <shape android:shape="rectangle">
-            <solid android:color="@android:color/white" />
-        </shape>
-    </item>
-</layer-list>
+<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
+    android:src="@drawable/ic_add_24dp"
+    android:tint="@color/blocked_number_icon_tint" />
diff --git a/res/layout/blocked_number_header.xml b/res/layout/blocked_number_header.xml
index bbb9c10..50a3dc8 100644
--- a/res/layout/blocked_number_header.xml
+++ b/res/layout/blocked_number_header.xml
@@ -101,18 +101,29 @@
                     android:layout_height="1dp"
                     android:layout_below="@id/import_button"
                     android:background="@color/divider_line_color"
-                    android:layout_marginTop="8dp"
-                    android:layout_marginBottom="8dp" />
+                    android:layout_marginTop="8dp" />
 
             </RelativeLayout>
 
-            <Button android:id="@+id/add_number_button"
-                android:layout_width="wrap_content"
+            <TextView android:id="@+id/add_number_textview"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
-                android:layout_gravity="end"
-                android:layout_marginEnd="@dimen/blocked_number_container_padding"
-                android:layout_marginBottom="8dp"
-                android:text="@string/blockNumber" />
+                android:background="?android:attr/selectableItemBackground"
+                android:textColor="@color/blocked_number_primary_text_color"
+                android:textSize="@dimen/blocked_number_primary_text_size"
+                android:paddingTop="24dp"
+                android:paddingBottom="24dp"
+                android:paddingEnd="@dimen/blocked_number_container_padding"
+                android:paddingStart="24dp"
+                android:drawableStart="@drawable/ic_blocked_numbers_settings_add"
+                android:drawablePadding="24dp"
+                android:text="@string/addBlockedNumber" />
+
+            <View
+                android:layout_width="match_parent"
+                android:layout_height="1dp"
+                android:layout_marginStart="72dp"
+                android:background="@color/divider_line_color" />
 
         </LinearLayout>
 
diff --git a/res/layout/blocked_number_item.xml b/res/layout/blocked_number_item.xml
index 79ca42e..82e2207 100644
--- a/res/layout/blocked_number_item.xml
+++ b/res/layout/blocked_number_item.xml
@@ -25,7 +25,7 @@
     android:gravity="center_vertical"
     android:orientation="horizontal"
     android:focusable="true"
-    android:background="@drawable/blocked_number_item_background">
+    android:background="@android:color/white">
 
     <QuickContactBadge
         android:id="@+id/quick_contact_photo"
@@ -69,7 +69,7 @@
         android:background="?android:attr/selectableItemBackgroundBorderless"
         android:src="@drawable/ic_remove"
         android:scaleType="center"
-        android:tint="@color/delete_icon_tint"
+        android:tint="@color/blocked_number_icon_tint"
         android:contentDescription="@string/description_blocked_number_list_delete" />
 
 </LinearLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 76bc093..2ca697f 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -127,7 +127,7 @@
     <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>
+    <color name="blocked_number_icon_tint">#616161</color>
     <color name="blocked_number_background">#E0E0E0</color>
     <color name="blocked_number_accent_color">#42A5F5</color>
     <color name="blocked_number_block_color">#F44336</color>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 773626f..4d4fb1e 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -872,7 +872,7 @@
     <string name="description_blocked_number_list_delete">Unblock number</string>
 
     <!-- Button to bring up UI to add a number to the blocked call list. [CHAR LIMIT=40] -->
-    <string name="blockNumber">Add number</string>
+    <string name="addBlockedNumber">Add number</string>
 
     <!-- Heading for the block list in the "Spam and blocked cal)ls" settings. [CHAR LIMIT=64] -->
     <string name="blockList">Block list</string>
diff --git a/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java b/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java
index b7b2639..a2a716f 100644
--- a/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java
+++ b/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java
@@ -73,7 +73,7 @@
 
         getActivity().findViewById(R.id.import_button).setOnClickListener(this);;
         getActivity().findViewById(R.id.view_numbers_button).setOnClickListener(this);
-        getActivity().findViewById(R.id.add_number_button).setOnClickListener(this);
+        getActivity().findViewById(R.id.add_number_textview).setOnClickListener(this);
     }
 
     @Override
@@ -158,7 +158,7 @@
         }
 
         switch (view.getId()) {
-            case R.id.add_number_button:
+            case R.id.add_number_textview:
                 activity.showSearchUi();
                 break;
             case R.id.view_numbers_button:
diff --git a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java
index ddb70de..fa6aa7e 100644
--- a/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java
+++ b/src/com/android/dialer/filterednumber/FilteredNumbersUtil.java
@@ -234,7 +234,7 @@
      * Use {@code FilteredNumberAsyncQueryHandler} to asynchronously check if a number is blocked.
      */
     public static boolean shouldBlockVoicemail(
-            Context context, String number, String countryIso, long dateMs) {
+            Context context, String number, String countryIso, long voicemailDateMs) {
         final String normalizedNumber = PhoneNumberUtils.formatNumberToE164(number, countryIso);
         if (TextUtils.isEmpty(normalizedNumber)) {
             return false;
@@ -255,7 +255,8 @@
                 cursor.moveToFirst();
 
                 // Block if number is found and it was added before this voicemail was received.
-                shouldBlock = cursor.getCount() > 0 && dateMs > cursor.getLong(0);
+                final long numberBlockedTimeMs = cursor.getLong(0);
+                shouldBlock = cursor.getCount() > 0 && voicemailDateMs > numberBlockedTimeMs;
             } finally {
                 cursor.close();
             }
@@ -317,7 +318,8 @@
                         .setContentTitle(context.getString(
                                 R.string.call_blocking_disabled_notification_title))
                         .setContentText(context.getString(
-                                R.string.call_blocking_disabled_notification_text));
+                                R.string.call_blocking_disabled_notification_text))
+                        .setAutoCancel(true);
 
                 final Intent contentIntent =
                         new Intent(context, BlockedNumbersSettingsActivity.class);