Prefix classes

This commit is contained in:
Sebastián Katzer 2019-01-29 01:39:49 +01:00
parent 6c16959267
commit fc2bbeca53
4 changed files with 19 additions and 20 deletions

View File

@ -104,17 +104,17 @@
<source-file src="src/android/AssetUtil.java" <source-file src="src/android/AssetUtil.java"
target-dir="src/de/appplant/cordova/plugin/printer" /> target-dir="src/de/appplant/cordova/plugin/printer" />
<source-file src="src/android/Options.java"
target-dir="src/de/appplant/cordova/plugin/printer" />
<source-file src="src/android/PdfAdapter.java"
target-dir="src/de/appplant/cordova/plugin/printer" />
<source-file src="src/android/Printer.java" <source-file src="src/android/Printer.java"
target-dir="src/de/appplant/cordova/plugin/printer" /> target-dir="src/de/appplant/cordova/plugin/printer" />
<source-file src="src/android/PrintManager.java" <source-file src="src/android/PrintManager.java"
target-dir="src/de/appplant/cordova/plugin/printer" /> target-dir="src/de/appplant/cordova/plugin/printer" />
<source-file src="src/android/PrintOptions.java"
target-dir="src/de/appplant/cordova/plugin/printer" />
<source-file src="src/android/PrintPdfAdapter.java"
target-dir="src/de/appplant/cordova/plugin/printer" />
</platform> </platform>
<!-- windows --> <!-- windows -->

View File

@ -24,7 +24,6 @@ package de.appplant.cordova.plugin.printer;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.print.PrintAttributes; import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.print.PrintHelper; import android.support.v4.print.PrintHelper;
@ -125,10 +124,10 @@ class PrintManager {
private void printPdf (String path, JSONObject settings, private void printPdf (String path, JSONObject settings,
@Nullable PrintHelper.OnPrintFinishCallback callback) @Nullable PrintHelper.OnPrintFinishCallback callback)
{ {
Options options = new Options(settings); PrintOptions options = new PrintOptions(settings);
String jobName = options.getJobName(); String jobName = options.getJobName();
PrintDocumentAdapter adapter = new PdfAdapter(path, context); PrintPdfAdapter adapter = new PrintPdfAdapter(path, context);
PrintAttributes attributes = options.toPrintAttributes(); PrintAttributes attributes = options.toPrintAttributes();
getPrintService().print(jobName, adapter, attributes); getPrintService().print(jobName, adapter, attributes);
} }
@ -143,14 +142,14 @@ class PrintManager {
private void printImage (String path, JSONObject settings, private void printImage (String path, JSONObject settings,
@Nullable PrintHelper.OnPrintFinishCallback callback) @Nullable PrintHelper.OnPrintFinishCallback callback)
{ {
AssetUtil decoder = new AssetUtil(context); AssetUtil decoder = new AssetUtil(context);
Bitmap bitmap = decoder.decode(path); Bitmap bitmap = decoder.decode(path);
if (bitmap == null) return; if (bitmap == null) return;
Options options = new Options(settings); PrintOptions options = new PrintOptions(settings);
PrintHelper printer = new PrintHelper(context); PrintHelper printer = new PrintHelper(context);
String jobName = options.getJobName(); String jobName = options.getJobName();
options.decoratePrintHelper(printer); options.decoratePrintHelper(printer);

View File

@ -40,7 +40,7 @@ import static android.support.v4.print.PrintHelper.SCALE_MODE_FIT;
/** /**
* Wrapper for the print job settings. * Wrapper for the print job settings.
*/ */
class Options { class PrintOptions {
// The print job settings // The print job settings
private @NonNull JSONObject spec; private @NonNull JSONObject spec;
@ -50,7 +50,7 @@ class Options {
* *
* @param spec The print job settings. * @param spec The print job settings.
*/ */
Options (@NonNull JSONObject spec) PrintOptions (@NonNull JSONObject spec)
{ {
this.spec = spec; this.spec = spec;
} }

View File

@ -39,7 +39,7 @@ import static android.print.PrintDocumentInfo.CONTENT_TYPE_DOCUMENT;
/** /**
* Document adapter to render and print PDF files. * Document adapter to render and print PDF files.
*/ */
class PdfAdapter extends PrintDocumentAdapter { class PrintPdfAdapter extends PrintDocumentAdapter {
// The application context // The application context
private @NonNull Context context; private @NonNull Context context;
@ -52,7 +52,7 @@ class PdfAdapter extends PrintDocumentAdapter {
* *
* @param context The context where to look for. * @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.path = path;
this.context = context; this.context = context;