Merge "Show unavailable printers disabled and grayed out." into klp-dev

This commit is contained in:
Svetoslav Ganov
2013-10-08 16:34:58 +00:00
committed by Android (Google) Code Review
3 changed files with 14 additions and 1 deletions

View File

@@ -37,7 +37,8 @@
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
android:orientation="vertical"
android:duplicateParentState="true">
<TextView
android:id="@+id/title"

View File

@@ -555,6 +555,7 @@ public class PrintJobConfigActivity extends Activity {
// TODO: We need some UI for announcing an error.
mControllerState = CONTROLLER_STATE_FAILED;
Log.e(LOG_TAG, "Received invalid pages from the app");
mEditor.cancel();
PrintJobConfigActivity.this.finish();
}
}
@@ -1152,6 +1153,9 @@ public class PrintJobConfigActivity extends Activity {
if (!mFavoritePrinterSelected && mDestinationSpinnerAdapter.getCount() > 2) {
mFavoritePrinterSelected = true;
mDestinationSpinner.setSelection(0);
// Workaround again the weird spinner behavior to notify for selection
// change on the next layout pass as the current printer is used below.
mCurrentPrinter = (PrinterInfo) mDestinationSpinnerAdapter.getItem(0);
}
// If there is a next printer to select and we succeed selecting

View File

@@ -435,6 +435,8 @@ public final class SelectPrinterFragment extends ListFragment {
R.layout.printer_dropdown_item, parent, false);
}
convertView.setEnabled(isEnabled(position));
CharSequence title = null;
CharSequence subtitle = null;
Drawable icon = null;
@@ -475,6 +477,12 @@ public final class SelectPrinterFragment extends ListFragment {
return convertView;
}
@Override
public boolean isEnabled(int position) {
PrinterInfo printer = (PrinterInfo) getItem(position);
return printer.getStatus() != PrinterInfo.STATUS_UNAVAILABLE;
}
@Override
public Loader<List<PrinterInfo>> onCreateLoader(int id, Bundle args) {
if (id == LOADER_ID_PRINTERS_LOADER) {