Merge "User should not be able to select unavailable printers." into klp-dev

This commit is contained in:
Svetoslav
2013-09-24 23:15:58 +00:00
committed by Android (Google) Code Review
3 changed files with 21 additions and 10 deletions

View File

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

View File

@ -26,24 +26,24 @@
<string name="save_button">Save</string> <string name="save_button">Save</string>
<!-- Label of the destination widget. [CHAR LIMIT=20] --> <!-- 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] --> <!-- 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] --> <!-- 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] --> <!-- 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] --> <!-- 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] --> <!-- 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> <string name="pages_range_example">e.g. 1&#8211;5, 8, 11&#8211;13</string>
<!-- Title for the pring preview button .[CHAR LIMIT=30] --> <!-- Title for the pring preview button .[CHAR LIMIT=30] -->
@ -56,7 +56,7 @@
<string name="printing_app_crashed">Printing app crashed</string> <string name="printing_app_crashed">Printing app crashed</string>
<!-- Title if the number of pages in a printed document is unknown. [CHAR LIMIT=20] --> <!-- 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] --> <!-- 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> <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); 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 @Override
public Object getItem(int position) { public Object getItem(int position) {
if (mPrinters.isEmpty()) { if (mPrinters.isEmpty()) {
@ -2016,7 +2026,9 @@ public class PrintJobConfigActivity extends Activity {
@Override @Override
public View getDropDownView(int position, View convertView, public View getDropDownView(int position, View convertView,
ViewGroup parent) { ViewGroup parent) {
return getView(position, convertView, parent); View view = getView(position, convertView, parent);
view.setEnabled(isEnabled(position));
return view;
} }
@Override @Override