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:
@@ -3472,6 +3472,9 @@
|
|||||||
<!-- Template for the label of the state for a ongoing print job. [CHAR LIMIT=25] -->
|
<!-- 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>
|
<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] -->
|
<!-- 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>
|
<string name="print_failed_state_title_template">Printer error <xliff:g id="print_job_name" example="foo.jpg">%1$s</xliff:g></string>
|
||||||
|
|
||||||
|
@@ -19,7 +19,6 @@ package com.android.settings.print;
|
|||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.print.PrintJob;
|
import android.print.PrintJob;
|
||||||
@@ -113,9 +112,11 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
|
|||||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
|
|
||||||
|
if (!mPrintJob.getInfo().isCancelling()) {
|
||||||
MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE,
|
MenuItem cancel = menu.add(0, MENU_ITEM_ID_CANCEL, Menu.NONE,
|
||||||
getString(R.string.print_cancel));
|
getString(R.string.print_cancel));
|
||||||
cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
cancel.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
||||||
|
}
|
||||||
|
|
||||||
if (mPrintJob.isFailed()) {
|
if (mPrintJob.isFailed()) {
|
||||||
MenuItem restart = menu.add(0, MENU_ITEM_ID_RESTART, Menu.NONE,
|
MenuItem restart = menu.add(0, MENU_ITEM_ID_RESTART, Menu.NONE,
|
||||||
@@ -169,8 +170,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
|
|||||||
switch (info.getState()) {
|
switch (info.getState()) {
|
||||||
case PrintJobInfo.STATE_QUEUED:
|
case PrintJobInfo.STATE_QUEUED:
|
||||||
case PrintJobInfo.STATE_STARTED: {
|
case PrintJobInfo.STATE_STARTED: {
|
||||||
|
if (!mPrintJob.getInfo().isCancelling()) {
|
||||||
mPrintJobPreference.setTitle(getString(
|
mPrintJobPreference.setTitle(getString(
|
||||||
R.string.print_printing_state_title_template, info.getLabel()));
|
R.string.print_printing_state_title_template, info.getLabel()));
|
||||||
|
} else {
|
||||||
|
mPrintJobPreference.setTitle(getString(
|
||||||
|
R.string.print_cancelling_state_title_template, info.getLabel()));
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PrintJobInfo.STATE_FAILED: {
|
case PrintJobInfo.STATE_FAILED: {
|
||||||
@@ -179,8 +185,13 @@ public class PrintJobSettingsFragment extends SettingsPreferenceFragment {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PrintJobInfo.STATE_BLOCKED: {
|
case PrintJobInfo.STATE_BLOCKED: {
|
||||||
|
if (!mPrintJob.getInfo().isCancelling()) {
|
||||||
mPrintJobPreference.setTitle(getString(
|
mPrintJobPreference.setTitle(getString(
|
||||||
R.string.print_blocked_state_title_template, info.getLabel()));
|
R.string.print_blocked_state_title_template, info.getLabel()));
|
||||||
|
} else {
|
||||||
|
mPrintJobPreference.setTitle(getString(
|
||||||
|
R.string.print_cancelling_state_title_template, info.getLabel()));
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -376,9 +376,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
|
|||||||
switch (printJob.getState()) {
|
switch (printJob.getState()) {
|
||||||
case PrintJobInfo.STATE_QUEUED:
|
case PrintJobInfo.STATE_QUEUED:
|
||||||
case PrintJobInfo.STATE_STARTED: {
|
case PrintJobInfo.STATE_STARTED: {
|
||||||
|
if (!printJob.isCancelling()) {
|
||||||
preference.setTitle(getString(
|
preference.setTitle(getString(
|
||||||
R.string.print_printing_state_title_template,
|
R.string.print_printing_state_title_template,
|
||||||
printJob.getLabel()));
|
printJob.getLabel()));
|
||||||
|
} else {
|
||||||
|
preference.setTitle(getString(
|
||||||
|
R.string.print_cancelling_state_title_template,
|
||||||
|
printJob.getLabel()));
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PrintJobInfo.STATE_FAILED: {
|
case PrintJobInfo.STATE_FAILED: {
|
||||||
@@ -388,9 +394,15 @@ public class PrintSettingsFragment extends SettingsPreferenceFragment implements
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PrintJobInfo.STATE_BLOCKED: {
|
case PrintJobInfo.STATE_BLOCKED: {
|
||||||
|
if (!printJob.isCancelling()) {
|
||||||
preference.setTitle(getString(
|
preference.setTitle(getString(
|
||||||
R.string.print_blocked_state_title_template,
|
R.string.print_blocked_state_title_template,
|
||||||
printJob.getLabel()));
|
printJob.getLabel()));
|
||||||
|
} else {
|
||||||
|
preference.setTitle(getString(
|
||||||
|
R.string.print_cancelling_state_title_template,
|
||||||
|
printJob.getLabel()));
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user