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);
}
}
}
Aggregations