diff options
| author | 2016-02-01 23:42:05 +0000 | |
|---|---|---|
| committer | 2016-02-01 23:42:05 +0000 | |
| commit | 18fc58f13dc01cac43ea313800cfee14c6aa0cfa (patch) | |
| tree | 92f923bb24272ba8b6749c6b1cdc71fad9d7ace5 | |
| parent | 0829fd4b269aafd0d64a93f00870c124bee877eb (diff) | |
| parent | 443075ab9784f168fc7a73bb09dabf8bf7ab308e (diff) | |
Merge "UI improvements for the print spooler"
6 files changed, 51 insertions, 40 deletions
diff --git a/packages/PrintSpooler/res/color/item_text_color.xml b/packages/PrintSpooler/res/color/item_text_color.xml deleted file mode 100644 index f580fbd75577..000000000000 --- a/packages/PrintSpooler/res/color/item_text_color.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2013 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. ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:state_enabled="true" android:color="#333333" /> - <item android:color="#888888"/> -</selector>
\ No newline at end of file diff --git a/packages/PrintSpooler/res/drawable/ic_info.xml b/packages/PrintSpooler/res/drawable/ic_info.xml index 2ecd1c79d23e..d64435b83e74 100644 --- a/packages/PrintSpooler/res/drawable/ic_info.xml +++ b/packages/PrintSpooler/res/drawable/ic_info.xml @@ -16,9 +16,9 @@ <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" - android:viewportWidth="24.0" - android:viewportHeight="24.0"> + android:viewportWidth="24" + android:viewportHeight="24"> <path - android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM13,17h-2v-6h2v6zM13,9h-2L11,7h2v2z" - android:fillColor="#757575"/> + android:fillColor="@android:color/white" + android:pathData="M11,17l2,0l0,-6l-2,0l0,6.0zm1,-15.0C6.48,2 2,6.48 2,12.0s4.48,10 10,10 10,-4.48 10,-10.0S17.52,2 12,2.0zm0,18.0c-4.41,0 -8,-3.59 -8,-8.0s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8.0zM11,9l2,0L13,7l-2,0l0,2.0z"/> </vector>
\ No newline at end of file diff --git a/packages/PrintSpooler/res/layout/printer_dropdown_item.xml b/packages/PrintSpooler/res/layout/printer_dropdown_item.xml index e0efbc42a627..defbf8db0026 100644 --- a/packages/PrintSpooler/res/layout/printer_dropdown_item.xml +++ b/packages/PrintSpooler/res/layout/printer_dropdown_item.xml @@ -28,7 +28,6 @@ android:layout_width="32dip" android:layout_height="32dip" android:layout_gravity="center_vertical" - android:layout_marginEnd="8dip" android:duplicateParentState="true" android:contentDescription="@null" android:visibility="invisible"> @@ -38,6 +37,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" + android:layout_marginStart="8dip" android:duplicateParentState="true"> <TextView diff --git a/packages/PrintSpooler/res/layout/printer_list_item.xml b/packages/PrintSpooler/res/layout/printer_list_item.xml index 50f44c21656c..1209aa6f0fa2 100644 --- a/packages/PrintSpooler/res/layout/printer_list_item.xml +++ b/packages/PrintSpooler/res/layout/printer_list_item.xml @@ -25,20 +25,22 @@ <ImageView android:id="@+id/icon" - android:layout_width="32dip" - android:layout_height="32dip" + android:layout_width="40dip" + android:layout_height="40dip" android:layout_gravity="center_vertical" - android:layout_marginEnd="8dip" + android:layout_marginTop="8dip" + android:layout_marginBottom="8dip" android:duplicateParentState="true" android:contentDescription="@null" android:visibility="invisible"> </ImageView> - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" + <RelativeLayout + android:layout_width="0dip" android:layout_weight="1" + android:layout_height="wrap_content" + android:layout_gravity="center_vertical" + android:layout_marginStart="16dip" android:duplicateParentState="true"> <TextView @@ -49,7 +51,10 @@ android:singleLine="true" android:ellipsize="end" android:textIsSelectable="false" - android:gravity="top|start" + android:layout_alignParentTop="true" + android:layout_alignParentStart="true" + android:fadingEdge="horizontal" + android:textAlignment="viewStart" android:textColor="?android:attr/textColorPrimary" android:duplicateParentState="true"> </TextView> @@ -58,24 +63,30 @@ android:id="@+id/subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" + android:layout_below="@id/title" + android:layout_alignParentStart="true" android:textAppearance="?android:attr/textAppearanceSmall" android:singleLine="true" android:ellipsize="end" android:textIsSelectable="false" android:visibility="gone" android:textColor="?android:attr/textColorSecondary" + android:textAlignment="viewStart" android:duplicateParentState="true"> </TextView> - </LinearLayout> + </RelativeLayout> <ImageView android:id="@+id/more_info" - android:layout_width="24dip" - android:layout_height="24dip" + android:layout_width="wrap_content" + android:layout_height="wrap_content" android:layout_gravity="center_vertical" + android:paddingLeft="16dip" android:contentDescription="@string/printer_info_desc" android:src="@drawable/ic_info" + android:tint="?android:attr/colorControlNormal" + android:tintMode="src_in" android:visibility="gone"> </ImageView> diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index c59c15310289..1e791219002b 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -62,6 +62,7 @@ import android.text.TextUtils.SimpleStringSplitter; import android.text.TextWatcher; import android.util.ArrayMap; import android.util.Log; +import android.util.TypedValue; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; @@ -2252,10 +2253,17 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat ImageView iconView = (ImageView) convertView.findViewById(R.id.icon); if (icon != null) { - iconView.setImageDrawable(icon); iconView.setVisibility(View.VISIBLE); + if (!isEnabled(position)) { + icon.mutate(); + + TypedValue value = new TypedValue(); + getTheme().resolveAttribute(android.R.attr.disabledAlpha, value, true); + icon.setAlpha((int)(value.getFloat() * 255)); + } + iconView.setImageDrawable(icon); } else { - iconView.setVisibility(View.INVISIBLE); + iconView.setVisibility(View.GONE); } return convertView; diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java index 1aec2531e2ca..4e3932f4fd37 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/SelectPrinterActivity.java @@ -37,6 +37,7 @@ import android.content.pm.ServiceInfo; import android.database.ContentObserver; import android.database.DataSetObserver; import android.graphics.drawable.Drawable; +import android.graphics.drawable.Icon; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -47,6 +48,7 @@ import android.printservice.PrintServiceInfo; import android.provider.Settings; import android.text.TextUtils; import android.util.Log; +import android.util.TypedValue; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; @@ -663,18 +665,28 @@ public final class SelectPrinterActivity extends Activity { @Override public void onClick(View v) { try { - startIntentSender(printer.getInfoIntent().getIntentSender(), null, 0, 0, 0); + startIntentSender(printer.getInfoIntent().getIntentSender(), null, 0, 0, + 0); } catch (SendIntentException e) { Log.e(LOG_TAG, "Could not execute pending info intent: %s", e); } } }); + } else { + moreInfoView.setVisibility(View.GONE); } ImageView iconView = (ImageView) convertView.findViewById(R.id.icon); if (icon != null) { - iconView.setImageDrawable(icon); iconView.setVisibility(View.VISIBLE); + if (!isActionable(position)) { + icon.mutate(); + + TypedValue value = new TypedValue(); + getTheme().resolveAttribute(android.R.attr.disabledAlpha, value, true); + icon.setAlpha((int)(value.getFloat() * 255)); + } + iconView.setImageDrawable(icon); } else { iconView.setVisibility(View.GONE); } |