Redo the empty states in print settings
In the end the UI does not change but the new states:
- Are similar to the "empty" states we use in the print spooler
- Use the system print icon
- Use a translucent background icon which works correctly with dark mode
Test: Looked at all changed Settings pages
Fixes: 115830412
Change-Id: I1f5b005674e7072e989355f01ebd3fdaf56c9355
diff --git a/res/drawable-hdpi/ic_grayedout_printer.png b/res/drawable-hdpi/ic_grayedout_printer.png
deleted file mode 100644
index 5e54970..0000000
--- a/res/drawable-hdpi/ic_grayedout_printer.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_grayedout_printer.png b/res/drawable-mdpi/ic_grayedout_printer.png
deleted file mode 100644
index 5e54970..0000000
--- a/res/drawable-mdpi/ic_grayedout_printer.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_grayedout_printer.png b/res/drawable-xhdpi/ic_grayedout_printer.png
deleted file mode 100644
index 5e54970..0000000
--- a/res/drawable-xhdpi/ic_grayedout_printer.png
+++ /dev/null
Binary files differ
diff --git a/res/layout/empty_print_state.xml b/res/layout/empty_print_state.xml
index 361bf3c..43312c8 100644
--- a/res/layout/empty_print_state.xml
+++ b/res/layout/empty_print_state.xml
@@ -14,48 +14,40 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/empty_print_state"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:visibility="gone">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:gravity="center"
+ android:orientation="vertical">
- <LinearLayout
+ <ImageView
+ android:layout_width="120dp"
+ android:layout_height="110dp"
+ android:layout_marginBottom="12dp"
+ android:src="@*android:drawable/ic_print"
+ android:scaleType="fitEnd"
+ android:alpha="0.1"
+ android:tint="?android:colorForeground"
+ android:importantForAccessibility="no" />
+
+ <TextView
+ android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center"
+ android:layout_marginBottom="16dp"
android:gravity="center"
- android:orientation="vertical">
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorSecondary" />
- <ImageView
- android:id="@+id/icon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="12dip"
- android:src="@drawable/ic_grayedout_printer"
- android:contentDescription="@null">
- </ImageView>
+ <Button
+ android:id="@+id/add_new_service"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ style="?android:attr/borderlessButtonStyle"
+ android:textColor="?android:attr/textColorSecondary"
+ android:text="@string/print_menu_item_add_service"
+ android:visibility="gone" />
- <TextView
- android:id="@+id/message"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textColor="?android:attr/textColorSecondary">
- </TextView>
-
- <Button android:id="@+id/add_new_service"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center"
- android:visibility="gone"
- style="?android:attr/buttonBarButtonStyle"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:text="@string/print_menu_item_add_service"
- android:textAllCaps="true"
- />
-
- </LinearLayout>
-
-</FrameLayout>
+</LinearLayout>
diff --git a/res/layout/empty_printers_list_service_enabled.xml b/res/layout/empty_printers_list_service_enabled.xml
index 8cc8db4..481f9c0 100644
--- a/res/layout/empty_printers_list_service_enabled.xml
+++ b/res/layout/empty_printers_list_service_enabled.xml
@@ -14,45 +14,38 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/empty_printers_list_service_enabled"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:visibility="gone">
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginStart="16dp"
+ android:layout_marginEnd="16dp"
+ android:gravity="center"
+ android:orientation="vertical">
- <LinearLayout
+ <ImageView
+ android:layout_width="120dp"
+ android:layout_height="110dp"
+ android:layout_marginBottom="12dp"
+ android:src="@*android:drawable/ic_print"
+ android:scaleType="fitEnd"
+ android:alpha="0.1"
+ android:tint="?android:colorForeground"
+ android:importantForAccessibility="no"/>
+
+ <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_gravity="center"
+ android:layout_marginBottom="16dp"
android:gravity="center"
- android:orientation="vertical">
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textColor="?android:attr/textColorSecondary"
+ android:text="@string/print_searching_for_printers"/>
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="12dip"
- android:src="@drawable/ic_grayedout_printer"
- android:importantForAccessibility="no">
- </ImageView>
+ <ProgressBar
+ android:layout_width="300dp"
+ android:layout_height="wrap_content"
+ android:indeterminate="true"
+ android:importantForAccessibility="no"
+ style="?android:attr/progressBarStyleHorizontal"/>
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="32dip"
- android:layout_marginRight="32dip"
- android:gravity="center"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textColor="?android:attr/textColorSecondary"
- android:text="@string/print_searching_for_printers">
- </TextView>
-
- <ProgressBar
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:indeterminate="true"
- style="?android:attr/progressBarStyleHorizontal">
- </ProgressBar>
-
- </LinearLayout>
-
-</FrameLayout>
+</LinearLayout>
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java
index 759cf3b..58e4ada 100644
--- a/src/com/android/settings/print/PrintServiceSettingsFragment.java
+++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java
@@ -190,8 +190,6 @@
if (emptyView == null) {
emptyView = getActivity().getLayoutInflater().inflate(
R.layout.empty_print_state, contentRoot, false);
- ImageView iconView = (ImageView) emptyView.findViewById(R.id.icon);
- iconView.setContentDescription(getString(R.string.print_service_disabled));
TextView textView = (TextView) emptyView.findViewById(R.id.message);
textView.setText(R.string.print_service_disabled);
contentRoot.addView(emptyView);
@@ -216,8 +214,6 @@
if (emptyView == null) {
emptyView = getActivity().getLayoutInflater().inflate(
R.layout.empty_print_state, contentRoot, false);
- ImageView iconView = (ImageView) emptyView.findViewById(R.id.icon);
- iconView.setContentDescription(getString(R.string.print_no_printers_found));
TextView textView = (TextView) emptyView.findViewById(R.id.message);
textView.setText(R.string.print_no_printers_found);
contentRoot.addView(emptyView);