summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSvetoslav <svetoslavganov@google.com>2013-10-14 17:31:26 -0700
committerSvetoslav <svetoslavganov@google.com>2013-10-14 17:36:19 -0700
commit2fa010cf5bf76af826776ada8a35cf8fe2945b64 (patch)
tree584d9634aa86df651a061d8f7ee188c85de37aa1
parent2f0ec7af06e206b1747b93efbd65d88189fc2df1 (diff)
Update the message for unavailable printers.
If a printer disappears or we do not get its capabilities, we show the user a message that the printer is unavailable. This message was appended after the printer name but they tend to be very long and the user does not see that the printer is not available due to ellipsis. Now we append the message after the subtitle which tends to be much shorter. bug:10983508 Change-Id: Ib3f7ad3bd82ff6decd49dc45461fb5131338e8c2
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
index 3a23b3ec5516..2997707c8cab 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/PrintJobConfigActivity.java
@@ -2175,10 +2175,17 @@ public class PrintJobConfigActivity extends Activity {
mIsPosted = false;
if (mDestinationSpinner.getSelectedItemPosition() >= 0) {
View itemView = mDestinationSpinner.getSelectedView();
- TextView titleView = (TextView) itemView.findViewById(R.id.title);
- String title = getString(R.string.printer_unavailable,
- mCurrentPrinter.getName());
- titleView.setText(title);
+ TextView titleView = (TextView) itemView.findViewById(R.id.subtitle);
+ try {
+ PackageInfo packageInfo = getPackageManager().getPackageInfo(
+ mCurrentPrinter.getId().getServiceName().getPackageName(), 0);
+ CharSequence service = packageInfo.applicationInfo.loadLabel(
+ getPackageManager());
+ String subtitle = getString(R.string.printer_unavailable, service.toString());
+ titleView.setText(subtitle);
+ } catch (NameNotFoundException nnfe) {
+ /* ignore */
+ }
}
}
}