From fc2bbeca53a1a8f61690499ee68a4ab5630dda13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Tue, 29 Jan 2019 01:39:49 +0100 Subject: [PATCH] Prefix classes --- plugin.xml | 12 ++++++------ src/android/PrintManager.java | 19 +++++++++---------- .../{Options.java => PrintOptions.java} | 4 ++-- .../{PdfAdapter.java => PrintPdfAdapter.java} | 4 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) rename src/android/{Options.java => PrintOptions.java} (98%) rename src/android/{PdfAdapter.java => PrintPdfAdapter.java} (96%) diff --git a/plugin.xml b/plugin.xml index cc43cca..32bf1f0 100644 --- a/plugin.xml +++ b/plugin.xml @@ -104,17 +104,17 @@ - - - - + + + + diff --git a/src/android/PrintManager.java b/src/android/PrintManager.java index 68a9c7e..3b2c645 100644 --- a/src/android/PrintManager.java +++ b/src/android/PrintManager.java @@ -24,7 +24,6 @@ package de.appplant.cordova.plugin.printer; import android.content.Context; import android.graphics.Bitmap; import android.print.PrintAttributes; -import android.print.PrintDocumentAdapter; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.print.PrintHelper; @@ -125,10 +124,10 @@ class PrintManager { private void printPdf (String path, JSONObject settings, @Nullable PrintHelper.OnPrintFinishCallback callback) { - Options options = new Options(settings); - String jobName = options.getJobName(); - PrintDocumentAdapter adapter = new PdfAdapter(path, context); - PrintAttributes attributes = options.toPrintAttributes(); + PrintOptions options = new PrintOptions(settings); + String jobName = options.getJobName(); + PrintPdfAdapter adapter = new PrintPdfAdapter(path, context); + PrintAttributes attributes = options.toPrintAttributes(); getPrintService().print(jobName, adapter, attributes); } @@ -143,14 +142,14 @@ class PrintManager { private void printImage (String path, JSONObject settings, @Nullable PrintHelper.OnPrintFinishCallback callback) { - AssetUtil decoder = new AssetUtil(context); - Bitmap bitmap = decoder.decode(path); + AssetUtil decoder = new AssetUtil(context); + Bitmap bitmap = decoder.decode(path); if (bitmap == null) return; - Options options = new Options(settings); - PrintHelper printer = new PrintHelper(context); - String jobName = options.getJobName(); + PrintOptions options = new PrintOptions(settings); + PrintHelper printer = new PrintHelper(context); + String jobName = options.getJobName(); options.decoratePrintHelper(printer); diff --git a/src/android/Options.java b/src/android/PrintOptions.java similarity index 98% rename from src/android/Options.java rename to src/android/PrintOptions.java index 5fb5b9d..5895cad 100644 --- a/src/android/Options.java +++ b/src/android/PrintOptions.java @@ -40,7 +40,7 @@ import static android.support.v4.print.PrintHelper.SCALE_MODE_FIT; /** * Wrapper for the print job settings. */ -class Options { +class PrintOptions { // The print job settings private @NonNull JSONObject spec; @@ -50,7 +50,7 @@ class Options { * * @param spec The print job settings. */ - Options (@NonNull JSONObject spec) + PrintOptions (@NonNull JSONObject spec) { this.spec = spec; } diff --git a/src/android/PdfAdapter.java b/src/android/PrintPdfAdapter.java similarity index 96% rename from src/android/PdfAdapter.java rename to src/android/PrintPdfAdapter.java index fce2dad..df099b9 100644 --- a/src/android/PdfAdapter.java +++ b/src/android/PrintPdfAdapter.java @@ -39,7 +39,7 @@ import static android.print.PrintDocumentInfo.CONTENT_TYPE_DOCUMENT; /** * Document adapter to render and print PDF files. */ -class PdfAdapter extends PrintDocumentAdapter { +class PrintPdfAdapter extends PrintDocumentAdapter { // The application context private @NonNull Context context; @@ -52,7 +52,7 @@ class PdfAdapter extends PrintDocumentAdapter { * * @param context The context where to look for. */ - PdfAdapter (@NonNull String path, @NonNull Context context) + PrintPdfAdapter (@NonNull String path, @NonNull Context context) { this.path = path; this.context = context;