Add butter bar when blocking is suppressed.
Screenshots:
https://drive.google.com/a/google.com/file/d/0ByV4lfyID02GTVJkei1GMWpSYXpHRlJPNG1yVHpoLUltWTNZ/view?usp=sharing
https://drive.google.com/a/google.com/file/d/0ByV4lfyID02GZGsyRm91anJoT1pHdjFreHhISnR6UXhUcHBV/view?usp=sharing
Bug: 26917087
Change-Id: I83ae16b7d869f342056403e0da41d23b4fc23448
diff --git a/res/drawable-hdpi/ic_status_blocked_orange_40dp.png b/res/drawable-hdpi/ic_status_blocked_orange_40dp.png
new file mode 100644
index 0000000..1b2f272
--- /dev/null
+++ b/res/drawable-hdpi/ic_status_blocked_orange_40dp.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_status_blocked_orange_40dp.png b/res/drawable-mdpi/ic_status_blocked_orange_40dp.png
new file mode 100644
index 0000000..21fd3ec
--- /dev/null
+++ b/res/drawable-mdpi/ic_status_blocked_orange_40dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_status_blocked_orange_40dp.png b/res/drawable-xhdpi/ic_status_blocked_orange_40dp.png
new file mode 100644
index 0000000..d6a746a
--- /dev/null
+++ b/res/drawable-xhdpi/ic_status_blocked_orange_40dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_status_blocked_orange_40dp.png b/res/drawable-xxhdpi/ic_status_blocked_orange_40dp.png
new file mode 100644
index 0000000..301a7a7
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_status_blocked_orange_40dp.png
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_status_blocked_orange_40dp.png b/res/drawable-xxxhdpi/ic_status_blocked_orange_40dp.png
new file mode 100644
index 0000000..aa73d38
--- /dev/null
+++ b/res/drawable-xxxhdpi/ic_status_blocked_orange_40dp.png
Binary files differ
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 64db085..75b8352 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -20,4 +20,9 @@
<color name="dialer_settings_actionbar_text_color">#ffffff</color>
<color name="dialer_settings_actionbar_background_color">@color/theme_color</color>
<color name="dialer_settings_color_dark">#0277bd</color>
+
+ <color name="blocked_numbers_divider_color">#e5e5e5</color>
+ <color name="blocked_numbers_butter_bar_color">#f5f5f5</color>
+ <color name="blocked_numbers_title_text_color">#ba000000</color>
+ <color name="blocked_numbers_secondary_text_color">#89000000</color>
</resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f2b1f5f..be77220 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -26,5 +26,8 @@
<dimen name="blocked_numbers_delete_icon_size">24dp</dimen>
<dimen name="blocked_numbers_progress_bar_padding">100dp</dimen>
<dimen name="blocked_numbers_font_size">16sp</dimen>
+ <dimen name="blocked_numbers_secondary_font_size">14sp</dimen>
<dimen name="blocked_numbers_line_spacing">8sp</dimen>
+ <dimen name="blocked_numbers_secondary_line_spacing">6sp</dimen>
+ <dimen name="blocked_numbers_divider_stroke">1dp</dimen>
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index f1dd67b..22e0adf 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -137,6 +137,13 @@
<string name="non_primary_user">Only the device owner can view and manage blocked numbers.</string>
<!-- Description of icon to delete blocked number. -->
<string name="delete_icon_description">Tab to unblock</string>
+ <!-- Title for butter bar shown when call blocking is disabled. -->
+ <string name="blocked_numbers_butter_bar_title">Blocking temporarily off</string>
+ <!-- Explanation for butter bar shown when call blocking is disabled. -->
+ <string name="blocked_numbers_butter_bar_body">After you dial or text an emergency number, blocking is turned off to ensure that emergency services can contact you.</string>
+ <!-- Button to re-enable blocking shown in butter bar shown when call blocking is disabled. -->
+ <string name="blocked_numbers_butter_bar_button">Re-enable now</string>
+
<!-- DO NOT TRANSLATE. Label for test Subscription 0. -->
<string name="test_account_0_label">Q Mobile</string>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 6760bf7..29c5566 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -59,7 +59,7 @@
<item name="android:src">@drawable/ic_more_vert_24dp</item>
</style>
- <style name="BlockedNumbersAddButton">
+ <style name="BlockedNumbersButton">
<item name="android:textColor">@color/theme_color</item>
<item name="android:textSize">@dimen/blocked_numbers_font_size</item>
<item name="android:textAllCaps">true</item>
@@ -69,4 +69,14 @@
<item name="android:textSize">@dimen/blocked_numbers_font_size</item>
<item name="android:lineSpacingExtra">@dimen/blocked_numbers_line_spacing</item>
</style>
+
+ <style name="BlockedNumbersTitleText" parent="BlockedNumbersText">
+ <item name="android:textColor">@color/blocked_numbers_title_text_color</item>
+ </style>
+
+ <style name="BlockedNumbersSecondaryText">
+ <item name="android:textColor">@color/blocked_numbers_secondary_text_color</item>
+ <item name="android:textSize">@dimen/blocked_numbers_secondary_font_size</item>
+ <item name="android:lineSpacingExtra">@dimen/blocked_numbers_secondary_line_spacing</item>
+ </style>
</resources>
diff --git a/res/xml/activity_blocked_numbers.xml b/res/xml/activity_blocked_numbers.xml
index a79078b..681cf89 100644
--- a/res/xml/activity_blocked_numbers.xml
+++ b/res/xml/activity_blocked_numbers.xml
@@ -15,56 +15,75 @@
~ limitations under the License
-->
-<FrameLayout
+<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingLeft="@dimen/blocked_numbers_large_padding"
- android:paddingRight="@dimen/blocked_numbers_large_padding">
-
- <TextView
- android:id="@+id/non_primary_user"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/non_primary_user"
- android:paddingTop="@dimen/blocked_numbers_large_padding"
- style="@style/BlockedNumbersText"
- android:visibility="gone" />
+ android:layout_height="match_parent"
+ android:fillViewport="true">
<LinearLayout
- android:id="@+id/manage_blocked_ui"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="@dimen/blocked_numbers_large_padding">
+ android:layout_height="match_parent">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/blocked_numbers_msg"
- android:paddingBottom="@dimen/blocked_numbers_extra_large_padding"
- style="@style/BlockedNumbersText" />
+ <include
+ android:id="@+id/butter_bar"
+ layout="@xml/blocking_suppressed_butterbar" />
- <TextView
- android:id="@+id/add_blocked"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/block_number"
- android:paddingBottom="@dimen/blocked_numbers_extra_large_padding"
- style="@style/BlockedNumbersAddButton" />
-
- <ProgressBar
- android:id="@+id/progress_bar"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:indeterminate="true"
- android:layout_marginTop="@dimen/blocked_numbers_progress_bar_padding"
- style="@android:style/Widget.ProgressBar.Large" />
-
- <ListView
- android:id="@android:id/list"
+ <FrameLayout
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:paddingLeft="@dimen/blocked_numbers_large_padding"
+ android:paddingRight="@dimen/blocked_numbers_large_padding">
+
+ <TextView
+ android:id="@+id/non_primary_user"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="@string/non_primary_user"
+ android:paddingTop="@dimen/blocked_numbers_large_padding"
+ style="@style/BlockedNumbersTitleText"
+ android:visibility="gone" />
+
+ <LinearLayout
+ android:id="@+id/manage_blocked_ui"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="@dimen/blocked_numbers_large_padding">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/blocked_numbers_msg"
+ android:paddingBottom="@dimen/blocked_numbers_extra_large_padding"
+ style="@style/BlockedNumbersTitleText" />
+
+ <TextView
+ android:id="@+id/add_blocked"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/block_number"
+ android:paddingBottom="@dimen/blocked_numbers_extra_large_padding"
+ style="@style/BlockedNumbersButton"
+ android:background="?android:attr/selectableItemBackgroundBorderless" />
+
+ <ProgressBar
+ android:id="@+id/progress_bar"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:indeterminate="true"
+ android:layout_marginTop="@dimen/blocked_numbers_progress_bar_padding"
+ style="@android:style/Widget.ProgressBar.Large" />
+
+ <ListView
+ android:id="@android:id/list"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:nestedScrollingEnabled="true"
+ android:paddingBottom="@dimen/blocked_numbers_extra_large_padding" />
+ </LinearLayout>
+ </FrameLayout>
</LinearLayout>
-</FrameLayout>
+</ScrollView>
\ No newline at end of file
diff --git a/res/xml/blocking_suppressed_butterbar.xml b/res/xml/blocking_suppressed_butterbar.xml
new file mode 100644
index 0000000..cd4579e
--- /dev/null
+++ b/res/xml/blocking_suppressed_butterbar.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 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
+ -->
+
+ <RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:background="@color/blocked_numbers_butter_bar_color">
+
+ <ImageView
+ android:id="@+id/icon"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:paddingTop="@dimen/blocked_numbers_large_padding"
+ android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:paddingLeft="@dimen/blocked_numbers_large_padding"
+ android:src="@drawable/ic_status_blocked_orange_40dp"/>
+
+ <TextView
+ android:id="@+id/title"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/icon"
+ android:paddingTop="@dimen/blocked_numbers_large_padding"
+ android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:text="@string/blocked_numbers_butter_bar_title"
+ style="@style/BlockedNumbersTitleText" />
+
+ <TextView
+ android:id="@+id/description"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/icon"
+ android:layout_below="@id/title"
+ android:paddingTop="@dimen/blocked_numbers_large_padding"
+ android:paddingBottom="@dimen/blocked_numbers_large_padding"
+ android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:text="@string/blocked_numbers_butter_bar_body"
+ style="@style/BlockedNumbersSecondaryText" />
+
+ <TextView
+ android:id="@+id/reenable_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_toRightOf="@id/icon"
+ android:layout_below="@id/description"
+ android:paddingRight="@dimen/blocked_numbers_large_padding"
+ android:text="@string/blocked_numbers_butter_bar_button"
+ style="@style/BlockedNumbersButton"
+ android:background="?android:attr/selectableItemBackgroundBorderless" />
+
+ <View
+ xmlns:tools="http://schemas.android.com/tools"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/blocked_numbers_divider_stroke"
+ android:layout_below="@id/reenable_button"
+ android:layout_marginTop="@dimen/blocked_numbers_large_padding"
+ android:background="@color/blocked_numbers_divider_color" />
+</RelativeLayout>
\ No newline at end of file
diff --git a/src/com/android/server/telecom/settings/BlockedNumbersActivity.java b/src/com/android/server/telecom/settings/BlockedNumbersActivity.java
index 8797334..5c46161 100644
--- a/src/com/android/server/telecom/settings/BlockedNumbersActivity.java
+++ b/src/com/android/server/telecom/settings/BlockedNumbersActivity.java
@@ -55,7 +55,11 @@
private BlockedNumbersAdapter mAdapter;
private TextView mAddButton;
private ProgressBar mProgressBar;
+ private RelativeLayout mButterBar;
@Nullable private Button mBlockButton;
+ private TextView mReEnableButton;
+
+ private BroadcastReceiver mBlockingStatusReceiver;
public static void start(Context context) {
Intent intent = new Intent(context, BlockedNumbersActivity.class);
@@ -87,7 +91,6 @@
mAddButton.setOnClickListener(this);
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
-
String[] fromColumns = {BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER};
int[] toViews = {R.id.blocked_number};
mAdapter = new BlockedNumbersAdapter(this, R.xml.layout_blocked_number, null, fromColumns,
@@ -98,10 +101,31 @@
listView.setDivider(null);
listView.setDividerHeight(0);
+ mButterBar = (RelativeLayout) findViewById(R.id.butter_bar);
+ mReEnableButton = (TextView) mButterBar.findViewById(R.id.reenable_button);
+ mReEnableButton.setOnClickListener(this);
+
+ updateButterBar();
+
+ mBlockingStatusReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ updateButterBar();
+ }
+ };
+ registerReceiver(mBlockingStatusReceiver, new IntentFilter(
+ BlockedNumberContract.SystemContract.ACTION_BLOCK_SUPPRESSION_STATE_CHANGED));
+
getLoaderManager().initLoader(0, null, this);
}
@Override
+ protected void onDestroy() {
+ unregisterReceiver(mBlockingStatusReceiver);
+ super.onDestroy();
+ }
+
+ @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
@@ -112,6 +136,14 @@
}
}
+ private void updateButterBar() {
+ if (BlockedNumberContract.SystemContract.getBlockSuppressionStatus(this).isSuppressed) {
+ mButterBar.setVisibility(View.VISIBLE);
+ } else {
+ mButterBar.setVisibility(View.GONE);
+ }
+ }
+
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
return new CursorLoader(this, BlockedNumberContract.BlockedNumbers.CONTENT_URI,
@@ -134,6 +166,9 @@
public void onClick(View view) {
if (view == mAddButton) {
showAddBlockedNumberDialog();
+ } else if (view == mReEnableButton) {
+ BlockedNumberContract.SystemContract.endBlockSuppression(this);
+ mButterBar.setVisibility(View.GONE);
}
}