summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-10-21 01:27:04 -0700
committerAndrew Lee <anwlee@google.com>2015-10-21 01:27:04 -0700
commitd625d28ec6cf22c128d0ef0b8e64a9fff4b64aec (patch)
tree107564f429b2d5211cca417d1dba9f5ee5f077c2 /res
parent9af1b36e999036f4045b07285962cfdb7bfbcca7 (diff)
Fix scrolling in blocked numbers list.
+ Add elements as header, so they scroll with the list. + Shuffle around some layouts to make this work correctly. + Replace default ListView divider with custom drawable, to achieve the desired effect of removing the divider on the first list item. + Override BlockedNumberAdapter to never report itself as empty. Otherwise, the header will disappear. + Tweak some padding. Bug: 25134186 Change-Id: I07711437fea2d3042d3987983667ab5316d51fcc
Diffstat (limited to 'res')
-rw-r--r--res/drawable/blocked_number_item_background.xml29
-rw-r--r--res/layout/blocked_number_fragment.xml68
-rw-r--r--res/layout/blocked_number_header.xml147
-rw-r--r--res/layout/blocked_number_item.xml2
-rw-r--r--res/layout/view_numbers_to_import_fragment.xml1
5 files changed, 139 insertions, 108 deletions
diff --git a/res/drawable/blocked_number_item_background.xml b/res/drawable/blocked_number_item_background.xml
new file mode 100644
index 000000000..acfea20b8
--- /dev/null
+++ b/res/drawable/blocked_number_item_background.xml
@@ -0,0 +1,29 @@
+<?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="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>
diff --git a/res/layout/blocked_number_fragment.xml b/res/layout/blocked_number_fragment.xml
index e41d6bc80..b98b58fc5 100644
--- a/res/layout/blocked_number_fragment.xml
+++ b/res/layout/blocked_number_fragment.xml
@@ -14,7 +14,6 @@
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/blocked_number_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -22,67 +21,18 @@
android:paddingTop="?android:attr/actionBarSize"
android:background="@color/blocked_number_background">
- <android.support.v7.widget.CardView
- android:id="@+id/hide_blocked_calls_setting"
+ <ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginBottom="8dp"
- card_view:cardCornerRadius="0dp">
+ android:divider="@null"
+ android:headerDividersEnabled="false" />
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:gravity="center_vertical"
- android:padding="16dp"
- android:paddingEnd="8dp">
-
- <TextView
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/blocked_call_settings_hide_setting"
- style="@style/BlockedNumbersDescriptionTextStyle" />
-
- <Switch android:id="@+id/hide_blocked_calls_switch"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="40dp" />
-
- </LinearLayout>
-
- </android.support.v7.widget.CardView>
-
- <android.support.v7.widget.CardView
+ <TextView android:id="@android:id/empty"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- card_view:cardCornerRadius="0dp">
-
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@color/background_dialer_white">
-
- <include layout="@layout/blocked_number_header" />
-
- <ListView android:id="@id/android:list"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="1"
- android:drawSelectorOnTop="false"
- android:headerDividersEnabled="false" />
-
- <TextView android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="@dimen/blocked_number_horizontal_margin"
- android:paddingTop="@dimen/blocked_number_top_margin"
- android:paddingBottom="@dimen/blocked_number_bottom_margin"
- android:text="@string/listNoBlockedNumbers" />
-
- </LinearLayout>
-
- </android.support.v7.widget.CardView>
+ android:layout_height="match_parent"
+ android:paddingStart="@dimen/blocked_number_horizontal_margin"
+ android:paddingTop="@dimen/blocked_number_top_margin"
+ android:paddingBottom="@dimen/blocked_number_bottom_margin"
+ android:text="@string/listNoBlockedNumbers" />
</LinearLayout>
diff --git a/res/layout/blocked_number_header.xml b/res/layout/blocked_number_header.xml
index e16efbcf4..3fcdf398b 100644
--- a/res/layout/blocked_number_header.xml
+++ b/res/layout/blocked_number_header.xml
@@ -13,63 +13,114 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:card_view="http://schemas.android.com/apk/res-auto"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
- <TextView android:id="@+id/textView"
- android:layout_width="wrap_content"
+ <android.support.v7.widget.CardView
+ android:id="@+id/hide_blocked_calls_setting"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/blockList"
- android:textColor="@color/blocked_number_header_color"
- android:padding="@dimen/blocked_number_container_padding"
- style="@android:style/TextAppearance.Material.Subhead" />
+ android:layout_marginBottom="8dp"
+ card_view:cardCornerRadius="0dp">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:gravity="center_vertical"
+ android:padding="16dp"
+ android:paddingEnd="8dp"
+ android:background="@android:color/white">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:text="@string/blocked_call_settings_hide_setting"
+ style="@style/BlockedNumbersDescriptionTextStyle" />
- <RelativeLayout android:id="@+id/import_settings"
+ <Switch android:id="@+id/hide_blocked_calls_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="40dp" />
+
+ </LinearLayout>
+
+ </android.support.v7.widget.CardView>
+
+ <android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:visibility="gone">
+ card_view:cardCornerRadius="0dp">
- <TextView android:id="@+id/import_description"
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/blocked_call_settings_import_description"
- android:textSize="@dimen/blocked_number_settings_description_text_size"
- android:paddingStart="@dimen/blocked_number_container_padding"
- android:paddingEnd="@dimen/blocked_number_container_padding"
- style="@style/BlockedNumbersDescriptionTextStyle" />
-
- <Button android:id="@+id/import_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/import_description"
- android:layout_alignParentEnd="true"
- android:layout_marginEnd="@dimen/blocked_number_container_padding"
- android:text="@string/blocked_call_settings_import_button"
- style="@style/DialerFlatButtonStyle" />
-
- <Button android:id="@+id/view_numbers_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_below="@id/import_description"
- android:layout_toLeftOf="@id/import_button"
- android:text="@string/blocked_call_settings_view_numbers_button"
- style="@style/DialerFlatButtonStyle" />
+ android:orientation="vertical"
+ android:background="@android:color/white">
- <View
- android:layout_width="match_parent"
- android:layout_height="1dp"
- android:layout_below="@id/import_button"
- android:background="@color/divider_line_color"
- android:layout_marginTop="8dp"
- android:layout_marginBottom="8dp" />
+ <TextView android:id="@+id/textView"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/blockList"
+ android:textColor="@color/blocked_number_header_color"
+ android:padding="@dimen/blocked_number_container_padding"
+ style="@android:style/TextAppearance.Material.Subhead" />
- </RelativeLayout>
+ <RelativeLayout android:id="@+id/import_settings"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="gone">
- <Button android:id="@+id/add_number_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="end"
- android:layout_marginEnd="@dimen/blocked_number_container_padding"
- android:layout_marginTop="8dp"
- android:text="@string/blockNumber" />
+ <TextView android:id="@+id/import_description"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/blocked_call_settings_import_description"
+ android:textSize="@dimen/blocked_number_settings_description_text_size"
+ android:paddingStart="@dimen/blocked_number_container_padding"
+ android:paddingEnd="@dimen/blocked_number_container_padding"
+ style="@style/BlockedNumbersDescriptionTextStyle" />
+
+ <Button android:id="@+id/import_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/import_description"
+ android:layout_alignParentEnd="true"
+ android:layout_marginEnd="@dimen/blocked_number_container_padding"
+ android:text="@string/blocked_call_settings_import_button"
+ style="@style/DialerFlatButtonStyle" />
+
+ <Button android:id="@+id/view_numbers_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/import_description"
+ android:layout_toLeftOf="@id/import_button"
+ android:text="@string/blocked_call_settings_view_numbers_button"
+ style="@style/DialerFlatButtonStyle" />
+
+ <View
+ android:layout_width="match_parent"
+ android:layout_height="1dp"
+ android:layout_below="@id/import_button"
+ android:background="@color/divider_line_color"
+ android:layout_marginTop="8dp"
+ android:layout_marginBottom="8dp" />
+
+ </RelativeLayout>
+
+ <Button android:id="@+id/add_number_button"
+ android:layout_width="wrap_content"
+ 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" />
+
+ </LinearLayout>
+
+ </android.support.v7.widget.CardView>
-</merge>
+</LinearLayout>
diff --git a/res/layout/blocked_number_item.xml b/res/layout/blocked_number_item.xml
index 6c87533f1..79ca42e14 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="@color/background_dialer_white">
+ android:background="@drawable/blocked_number_item_background">
<QuickContactBadge
android:id="@+id/quick_contact_photo"
diff --git a/res/layout/view_numbers_to_import_fragment.xml b/res/layout/view_numbers_to_import_fragment.xml
index fae708bf1..c79e69af9 100644
--- a/res/layout/view_numbers_to_import_fragment.xml
+++ b/res/layout/view_numbers_to_import_fragment.xml
@@ -25,6 +25,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
+ android:divider="@null"
android:headerDividersEnabled="false" />
<RelativeLayout