Add import fragment, rearrange fragments.
+ Add a fragment (and adapter) for displaying numbers from contacts
marked as send to voicemail. This fragment has import functionality.
+ Refactor logic around the Blocked Numbers activity; relocate a lot
of the fragment-specific logic, particularly around actionbars, to
within the fragments themselves.
+ Simplify fragment management logic by using replace instead of
show/hide.
Bug: 23351616
Change-Id: I5c1076d6d001a8401234f57c27ada4bcd90e6c27
diff --git a/res/layout/blocked_number_fragment.xml b/res/layout/blocked_number_fragment.xml
index f8d3030..e41d6bc 100644
--- a/res/layout/blocked_number_fragment.xml
+++ b/res/layout/blocked_number_fragment.xml
@@ -53,28 +53,36 @@
</android.support.v7.widget.CardView>
-
- <LinearLayout
- android:orientation="vertical"
+ <android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:background="@color/background_dialer_white">
+ card_view:cardCornerRadius="0dp">
- <ListView android:id="@+id/blocked_numbers_list"
+ <LinearLayout
+ android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:drawSelectorOnTop="false"
- android:headerDividersEnabled="false" />
+ android:layout_height="wrap_content"
+ android:background="@color/background_dialer_white">
- <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" />
+ <include layout="@layout/blocked_number_header" />
- </LinearLayout>
+ <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>
</LinearLayout>
diff --git a/res/layout/blocked_number_header.xml b/res/layout/blocked_number_header.xml
index 0c8c086..e16efbc 100644
--- a/res/layout/blocked_number_header.xml
+++ b/res/layout/blocked_number_header.xml
@@ -13,12 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.v7.widget.CardView
- 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"
- card_view:cardCornerRadius="0dp">
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView android:id="@+id/textView"
android:layout_width="wrap_content"
@@ -77,4 +72,4 @@
android:layout_marginTop="8dp"
android:text="@string/blockNumber" />
-</android.support.v7.widget.CardView>
+</merge>
diff --git a/res/layout/view_numbers_to_import_fragment.xml b/res/layout/view_numbers_to_import_fragment.xml
new file mode 100644
index 0000000..fae708b
--- /dev/null
+++ b/res/layout/view_numbers_to_import_fragment.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+<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="match_parent"
+ android:orientation="vertical"
+ android:paddingTop="?android:attr/actionBarSize"
+ android:background="@color/blocked_number_background">
+
+ <ListView android:id="@id/android:list"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:headerDividersEnabled="false" />
+
+ <RelativeLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="bottom"
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:background="@android:color/white">
+
+ <Button android:id="@+id/import_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ 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/cancel_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="@android:string/cancel"
+ style="@style/DialerFlatButtonStyle" />
+
+ </RelativeLayout>
+
+</LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 333a99b..9c70dd4 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -826,6 +826,10 @@
<!-- Label for the blocked numbers settings section [CHAR LIMIT=30] -->
<string name="manage_blocked_numbers_label">Blocked numbers</string>
+ <!-- Label for fragment to import numbers from contacts marked as send to voicemail.
+ [CHAR_LIMIT=30] -->
+ <string name="import_send_to_voicemail_numbers_label">Import numbers</string>
+
<!-- Text informing the user they have previously marked contacts to be sent to voicemail.
This will be followed by two buttons, 1) to view who is marked to be sent to voicemail
and 2) importing these settings to Dialer's block list. [CHAR LIMIT=NONE] -->