Search in sources :

Example 31 with PrintJob

use of android.print.PrintJob in project android_packages_apps_Settings by omnirom.

the class PrintSettingPreferenceController method getSummary.

@Override
public CharSequence getSummary() {
    final List<PrintJob> printJobs = mPrintManager.getPrintJobs();
    int numActivePrintJobs = 0;
    if (printJobs != null) {
        for (PrintJob job : printJobs) {
            if (shouldShowToUser(job.getInfo())) {
                numActivePrintJobs++;
            }
        }
    }
    if (numActivePrintJobs > 0) {
        return mContext.getResources().getQuantityString(R.plurals.print_jobs_summary, numActivePrintJobs, numActivePrintJobs);
    } else {
        final List<PrintServiceInfo> services = mPrintManager.getPrintServices(PrintManager.ENABLED_SERVICES);
        if (services == null || services.isEmpty()) {
            return mContext.getText(R.string.print_settings_summary_no_service);
        } else {
            final int count = services.size();
            return mContext.getResources().getQuantityString(R.plurals.print_settings_summary, count, count);
        }
    }
}
Also used : PrintJob(android.print.PrintJob) PrintServiceInfo(android.printservice.PrintServiceInfo)

Aggregations

PrintJob (android.print.PrintJob)31 PrintJobInfo (android.print.PrintJobInfo)11 Test (org.junit.Test)10 ArrayList (java.util.ArrayList)8 MenuItem (android.view.MenuItem)7 PrintDocumentAdapter (android.print.PrintDocumentAdapter)3 PrintManager (android.print.PrintManager)3 Activity (android.app.Activity)2 Intent (android.content.Intent)2 TypedArray (android.content.res.TypedArray)2 Drawable (android.graphics.drawable.Drawable)2 Bundle (android.os.Bundle)2 CancellationSignal (android.os.CancellationSignal)2 ParcelFileDescriptor (android.os.ParcelFileDescriptor)2 PrintAttributes (android.print.PrintAttributes)2 PrintServiceInfo (android.printservice.PrintServiceInfo)2 UiDevice (android.support.test.uiautomator.UiDevice)2 UiObject2 (android.support.test.uiautomator.UiObject2)2 LargeTest (androidx.test.filters.LargeTest)2 UUID (java.util.UUID)2