diff options
author | Svetoslav <svetoslavganov@google.com> | 2013-10-02 19:30:32 -0700 |
---|---|---|
committer | Svetoslav <svetoslavganov@google.com> | 2013-10-02 19:30:43 -0700 |
commit | 39e71de6b49d1cb67ce30b411cede8d4f40dc765 (patch) | |
tree | 9d760b1d7ead2ba0030b4501ce5c67049f7fb6d1 | |
parent | 9907a109ced54cffc7b4f5e9e81365c78df1f1a9 (diff) | |
download | frameworks_base-39e71de6b49d1cb67ce30b411cede8d4f40dc765.zip frameworks_base-39e71de6b49d1cb67ce30b411cede8d4f40dc765.tar.gz frameworks_base-39e71de6b49d1cb67ce30b411cede8d4f40dc765.tar.bz2 |
Print UI tweaks as per UX request.
1. Limit the width of the dropdown of the printers list.
2. Add icons the the list in the all pritners activity.
3. Update the empty state view for the all printers activity.
bug:10983508
Change-Id: I19effcf32770fdda278009a060b5170a3f29988e
4 files changed, 28 insertions, 9 deletions
diff --git a/packages/PrintSpooler/res/layout/select_printer_activity.xml b/packages/PrintSpooler/res/layout/select_printer_activity.xml index e86e9aa..2792dcf 100644 --- a/packages/PrintSpooler/res/layout/select_printer_activity.xml +++ b/packages/PrintSpooler/res/layout/select_printer_activity.xml @@ -38,25 +38,30 @@ android:layout_gravity="center" android:gravity="center" android:orientation="vertical"> - + <ImageView - android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="12dip" android:src="@*android:drawable/ic_grayedout_printer" - android:contentDescription="@string/print_no_printers_found"> + android:contentDescription="@string/print_searching_for_printers"> </ImageView> <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" - android:text="@string/print_no_printers_found"> + android:text="@string/print_searching_for_printers"> </TextView> + <ProgressBar + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:indeterminate="true" + style="@android:style/Widget.Holo.ProgressBar.Horizontal"> + </ProgressBar> + </LinearLayout> </FrameLayout> diff --git a/packages/PrintSpooler/res/values/strings.xml b/packages/PrintSpooler/res/values/strings.xml index 41775a1..5b947ba 100644 --- a/packages/PrintSpooler/res/values/strings.xml +++ b/packages/PrintSpooler/res/values/strings.xml @@ -84,7 +84,7 @@ <string name="choose_print_service">Choose print service</string> <!-- Title for the prompt shown as a placeholder if no printers are found while searching. [CHAR LIMIT=50] --> - <string name="print_no_printers_found">No printers found</string> + <string name="print_searching_for_printers">Searching for printers</string> <!-- Notifications --> diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java index 8474115..0c593ef 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java @@ -1613,7 +1613,6 @@ public class PrintJobConfigActivity extends Activity { mCopiesEditText = (EditText) findViewById(R.id.copies_edittext); mCopiesEditText.setText(MIN_COPIES_STRING); mCopiesEditText.addTextChangedListener(mCopiesTextWatcher); - mCopiesEditText.selectAll(); if (!TextUtils.equals(mCopiesEditText.getText(), MIN_COPIES_STRING)) { mIgnoreNextCopiesChange = true; } @@ -1622,6 +1621,7 @@ public class PrintJobConfigActivity extends Activity { // Destination. mDestinationSpinner = (Spinner) findViewById(R.id.destination_spinner); + mDestinationSpinner.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT); mDestinationSpinner.setAdapter(mDestinationSpinnerAdapter); mDestinationSpinner.setOnItemSelectedListener(mOnItemSelectedListener); if (mDestinationSpinnerAdapter.getCount() > 0 && mController.hasStarted()) { @@ -1954,7 +1954,6 @@ public class PrintJobConfigActivity extends Activity { && TextUtils.isEmpty(mCopiesEditText.getText())) { mIgnoreNextCopiesChange = true; mCopiesEditText.setText(String.valueOf(MIN_COPIES)); - mCopiesEditText.selectAll(); mCopiesEditText.requestFocus(); } @@ -2151,6 +2150,8 @@ public class PrintJobConfigActivity extends Activity { R.layout.printer_dropdown_item, parent, false); } + convertView.getLayoutParams().width = mDestinationSpinner.getWidth(); + CharSequence title = null; CharSequence subtitle = null; Drawable icon = null; diff --git a/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java b/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java index c888e2c..114c151 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java +++ b/packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java @@ -36,6 +36,7 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; +import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.print.PrintManager; @@ -53,6 +54,7 @@ import android.widget.ArrayAdapter; import android.widget.BaseAdapter; import android.widget.Filter; import android.widget.Filterable; +import android.widget.ImageView; import android.widget.ListView; import android.widget.SearchView; import android.widget.TextView; @@ -357,11 +359,12 @@ public final class SelectPrinterFragment extends ListFragment { public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = getActivity().getLayoutInflater().inflate( - R.layout.spinner_dropdown_item, parent, false); + R.layout.printer_dropdown_item, parent, false); } CharSequence title = null; CharSequence subtitle = null; + Drawable icon = null; PrinterInfo printer = (PrinterInfo) getItem(position); title = printer.getName(); @@ -370,6 +373,7 @@ public final class SelectPrinterFragment extends ListFragment { PackageInfo packageInfo = pm.getPackageInfo(printer.getId() .getServiceName().getPackageName(), 0); subtitle = packageInfo.applicationInfo.loadLabel(pm); + icon = packageInfo.applicationInfo.loadIcon(pm); } catch (NameNotFoundException nnfe) { /* ignore */ } @@ -386,6 +390,15 @@ public final class SelectPrinterFragment extends ListFragment { subtitleView.setVisibility(View.GONE); } + + ImageView iconView = (ImageView) convertView.findViewById(R.id.icon); + if (icon != null) { + iconView.setImageDrawable(icon); + iconView.setVisibility(View.VISIBLE); + } else { + iconView.setVisibility(View.GONE); + } + return convertView; } |