Show correct message for a print job that is being canceled.

1. If a print job is being canceled we now show appropriate
   message that matches what the notification shows.

2. If a print job is being canceled we do not show the cancel
   button.

bug:11696928

Change-Id: I0fc4f8226c4aa9acd6a4b65811f4228e56018315
This commit is contained in:
Svetoslav
2013-11-14 18:15:15 -08:00
parent 9b28d5a0c3
commit 97e962cd36
3 changed files with 40 additions and 14 deletions

View File

@@ -3472,6 +3472,9 @@
<!-- Template for the label of the state for a ongoing print job. [CHAR LIMIT=25] -->
<string name="print_printing_state_title_template">Printing <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>
<!-- Template for the label for a cancelling print job. [CHAR LIMIT=25] -->
<string name="print_cancelling_state_title_template" msgid="1821759594704703197">Cancelling <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>
<!-- Template for the label of the state for a failed print job. [CHAR LIMIT=25] -->
<string name="print_failed_state_title_template">Printer error <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>

View File

@@ -19,7 +19,6 @@ package com.android.settings.print;
import android.app.ActivityManager;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.print.PrintJob;
@@ -113,9 +112,11 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
if (!mPrintJob.getInfo().isCancelling()) {
MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE,
getString(R.string.print_cancel));
cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}
if (mPrintJob.isFailed()) {
MenuItem restart = menu.add(0, MENU_ITEM_ID_RESTART, Menu.NONE,
@@ -169,8 +170,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
switch (info.getState()) {
case PrintJobInfo.STATE_QUEUED:
case PrintJobInfo.STATE_STARTED: {
if (!mPrintJob.getInfo().isCancelling()) {
mPrintJobPreference.setTitle(getString(
R.string.print_printing_state_title_template, info.getLabel()));
} else {
mPrintJobPreference.setTitle(getString(
R.string.print_cancelling_state_title_template, info.getLabel()));
}
} break;
case PrintJobInfo.STATE_FAILED: {
@@ -179,8 +185,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
} break;
case PrintJobInfo.STATE_BLOCKED: {
if (!mPrintJob.getInfo().isCancelling()) {
mPrintJobPreference.setTitle(getString(
R.string.print_blocked_state_title_template, info.getLabel()));
} else {
mPrintJobPreference.setTitle(getString(
R.string.print_cancelling_state_title_template, info.getLabel()));
}
} break;
}

View File

@@ -376,9 +376,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
switch (printJob.getState()) {
case PrintJobInfo.STATE_QUEUED:
case PrintJobInfo.STATE_STARTED: {
if (!printJob.isCancelling()) {
preference.setTitle(getString(
R.string.print_printing_state_title_template,
printJob.getLabel()));
} else {
preference.setTitle(getString(
R.string.print_cancelling_state_title_template,
printJob.getLabel()));
}
} break;
case PrintJobInfo.STATE_FAILED: {
@@ -388,9 +394,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
} break;
case PrintJobInfo.STATE_BLOCKED: {
if (!printJob.isCancelling()) {
preference.setTitle(getString(
R.string.print_blocked_state_title_template,
printJob.getLabel()));
} else {
preference.setTitle(getString(
R.string.print_cancelling_state_title_template,
printJob.getLabel()));
}
} break;
}