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 /packages/PrintSpooler/src | |
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
Diffstat (limited to 'packages/PrintSpooler/src')
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java | 5 | ||||
-rw-r--r-- | packages/PrintSpooler/src/com/android/printspooler/SelectPrinterFragment.java | 15 |
2 files changed, 17 insertions, 3 deletions
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; } |