Prefix classes
This commit is contained in:
parent
6c16959267
commit
fc2bbeca53
12
plugin.xml
12
plugin.xml
@ -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 -->
|
||||||
|
@ -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,9 +124,9 @@ 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);
|
||||||
@ -148,7 +147,7 @@ class PrintManager {
|
|||||||
|
|
||||||
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();
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
@ -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;
|
Loading…
Reference in New Issue
Block a user