Java Code Examples for android.print.PrintJobInfo#STATE_STARTED
The following examples show how to use
android.print.PrintJobInfo#STATE_STARTED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrintManagerDelegateImpl.java From 365browser with Apache License 2.0 | 5 votes |
@RemovableInRelease private void dumpJobStatesForDebug() { List<PrintJob> printJobs = mPrintManager.getPrintJobs(); String[] states = new String[printJobs.size()]; for (int i = 0; i < printJobs.size(); i++) { String stateString; switch (printJobs.get(i).getInfo().getState()) { case PrintJobInfo.STATE_CREATED: stateString = "STATE_CREATED"; break; case PrintJobInfo.STATE_QUEUED: stateString = "STATE_QUEUED"; break; case PrintJobInfo.STATE_STARTED: stateString = "STATE_STARTED"; break; case PrintJobInfo.STATE_BLOCKED: stateString = "STATE_BLOCKED"; break; case PrintJobInfo.STATE_FAILED: stateString = "STATE_FAILED"; break; case PrintJobInfo.STATE_COMPLETED: stateString = "STATE_COMPLETED"; break; case PrintJobInfo.STATE_CANCELED: stateString = "STATE_CANCELED"; break; default: stateString = "STATE_UNKNOWN"; break; } states[i] = stateString; } Log.v(TAG, "Initiating new print with states in queue: {%s}", TextUtils.join(", ", states)); }
Example 2
Source File: TemplatePrinterActivity.java From commcare-android with Apache License 2.0 | 5 votes |
@Override public void onFinish() { delegate.onFinish(); String printDialogTitle = Localization.get("print.dialog.title"); String msg = ""; boolean printInitiated = false; switch (printJob.getInfo().getState()) { case PrintJobInfo.STATE_BLOCKED: msg = Localization.get("printjob.blocked"); break; case PrintJobInfo.STATE_CANCELED: msg = Localization.get("printjob.not.started"); break; case PrintJobInfo.STATE_COMPLETED: msg = Localization.get("printing.done"); printInitiated = true; break; case PrintJobInfo.STATE_FAILED: msg = Localization.get("print.error"); break; case PrintJobInfo.STATE_CREATED: case PrintJobInfo.STATE_QUEUED: case PrintJobInfo.STATE_STARTED: msg = Localization.get("printjob.started"); printInitiated = true; } TemplatePrinterUtils.showPrintStatusDialog(activity, printDialogTitle, msg, printInitiated); }
Example 3
Source File: PrintJob.java From android_9.0.0_r45 with Apache License 2.0 | 3 votes |
/** * Blocks the print job. You should call this method if {@link #isStarted()} returns true and * you need to block the print job. For example, the user has to add some paper to continue * printing. To resume the print job call {@link #start()}. To change the reason call * {@link #setStatus(CharSequence)}. * * @param reason The human readable, short, and translated reason why the print job is blocked. * @return Whether the job was blocked. * * @see #isStarted() * @see #isBlocked() */ @MainThread public boolean block(@Nullable String reason) { PrintService.throwIfNotCalledOnMainThread(); PrintJobInfo info = getInfo(); final int state = info.getState(); if (state == PrintJobInfo.STATE_STARTED || state == PrintJobInfo.STATE_BLOCKED) { return setState(PrintJobInfo.STATE_BLOCKED, reason); } return false; }
Example 4
Source File: PrintJob.java From android_9.0.0_r45 with Apache License 2.0 | 2 votes |
/** * Gets whether this print job is started. Such a print job is * being printed and can be completed or canceled or failed. * * @return Whether the print job is started. * * @see #complete() * @see #cancel() * @see #fail(String) */ @MainThread public boolean isStarted() { PrintService.throwIfNotCalledOnMainThread(); return getInfo().getState() == PrintJobInfo.STATE_STARTED; }