Java Code Examples for android.print.PrintJobInfo#STATE_FAILED

The following examples show how to use android.print.PrintJobInfo#STATE_FAILED . 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 vote down vote up
@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 vote down vote up
@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 4 votes vote down vote up
private boolean isInImmutableState() {
    final int state = mCachedInfo.getState();
    return state == PrintJobInfo.STATE_COMPLETED
            || state == PrintJobInfo.STATE_CANCELED
            || state == PrintJobInfo.STATE_FAILED;
}
 
Example 4
Source File: PrintJob.java    From android_9.0.0_r45 with Apache License 2.0 2 votes vote down vote up
/**
 * Gets whether this print job is failed. Such a print job is
 * not successfully printed due to an error. This is a final state.
 *
 * @return Whether the print job is failed.
 *
 * @see #fail(String)
 */
@MainThread
public boolean isFailed() {
    PrintService.throwIfNotCalledOnMainThread();
    return getInfo().getState() == PrintJobInfo.STATE_FAILED;
}