User should not be able to select unavailable printers.

1. If the printer is unavailable we should not allow the user
   to select it. Rather, show it grayed out.

2. Some string changes requeted by translators.

bug:10917222

Change-Id: I370f05f9c8e70e3f077db7eb02cf48e19a59925d
This commit is contained in:
Svetoslav
2013-09-24 15:14:41 -07:00
parent 0d38d0b42f
commit 2a708617df
3 changed files with 21 additions and 10 deletions

View File

@ -47,7 +47,6 @@
android:visibility="gone"
android:textColor="@color/item_text_color"
android:duplicateParentState="true">
</TextView>
</LinearLayout>

View File

@ -26,24 +26,24 @@
<string name="save_button">Save</string>
<!-- Label of the destination widget. [CHAR LIMIT=20] -->
<string name="label_destination">DESTIINATION</string>
<string name="label_destination">Destination</string>
<!-- Label of the copies count widget. [CHAR LIMIT=20] -->
<string name="label_copies">COPIES</string>
<string name="label_copies">Copies</string>
<!-- Label of the paper size widget. [CHAR LIMIT=20] -->
<string name="label_paper_size">PAPER SIZE</string>
<string name="label_paper_size">Paper Size</string>
<!-- Label of the color mode widget. [CHAR LIMIT=20] -->
<string name="label_color">COLOR</string>
<string name="label_color">Color</string>
<!-- Label of the orientation widget. [CHAR LIMIT=20] -->
<string name="label_orientation">ORIENTATION</string>
<string name="label_orientation">Orientation</string>
<!-- Label of the page selection widget. [CHAR LIMIT=20] -->
<string name="label_pages">PAGES (<xliff:g id="page_count" example="5">%1$s</xliff:g>)</string>
<string name="label_pages">Pages (<xliff:g id="page_count" example="5">%1$s</xliff:g>)</string>
<!-- Page range exmple used as a hint of how to specify such. [CHAR LIMIT=15] -->
<!-- Page range exmple used as a hint of how to specify such. [CHAR LIMIT=20] -->
<string name="pages_range_example">e.g. 1&#8211;5, 8, 11&#8211;13</string>
<!-- Title for the pring preview button .[CHAR LIMIT=30] -->
@ -56,7 +56,7 @@
<string name="printing_app_crashed">Printing app crashed</string>
<!-- Title if the number of pages in a printed document is unknown. [CHAR LIMIT=20] -->
<string name="page_count_unknown">unknown</string>
<string name="page_count_unknown">unavailable</string>
<!-- Title for the temporary dialog show while an app is generating a print job. [CHAR LIMIT=30] -->
<string name="generating_print_job">Generating print job</string>

View File

@ -1973,6 +1973,16 @@ public class PrintJobConfigActivity extends Activity {
return Math.min(mPrinters.size() + 2, DEST_ADAPTER_MAX_ITEM_COUNT);
}
@Override
public boolean isEnabled(int position) {
Object item = getItem(position);
if (item instanceof PrinterInfo) {
PrinterInfo printer = (PrinterInfo) item;
return printer.getStatus() != PrinterInfo.STATUS_UNAVAILABLE;
}
return true;
}
@Override
public Object getItem(int position) {
if (mPrinters.isEmpty()) {
@ -2016,7 +2026,9 @@ public class PrintJobConfigActivity extends Activity {
@Override
public View getDropDownView(int position, View convertView,
ViewGroup parent) {
return getView(position, convertView, parent);
View view = getView(position, convertView, parent);
view.setEnabled(isEnabled(position));
return view;
}
@Override