PrintHelperKitkat.java
4.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package android.support.v4.print;
import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.BitmapFactory.Options;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.pdf.PdfDocument.Page;
import android.graphics.pdf.PdfDocument.PageInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.CancellationSignal;
import android.os.CancellationSignal.OnCancelListener;
import android.os.ParcelFileDescriptor;
import android.print.PageRange;
import android.print.PrintAttributes;
import android.print.PrintAttributes.Builder;
import android.print.PrintDocumentAdapter;
import android.print.PrintDocumentAdapter.LayoutResultCallback;
import android.print.PrintDocumentAdapter.WriteResultCallback;
import android.print.PrintDocumentInfo.Builder;
import android.print.pdf.PrintedPdfDocument;
import android.support.annotation.RequiresApi;
import android.util.Log;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@TargetApi(19)
@RequiresApi(19)
public class PrintHelperKitkat
{
final Context a;
BitmapFactory.Options b = null;
final Object c = new Object();
protected boolean d = true;
protected boolean e = true;
int f = 2;
int g = 2;
int h;
protected PrintHelperKitkat(Context paramContext)
{
this.a = paramContext;
}
private Bitmap a(Uri paramUri, BitmapFactory.Options paramOptions)
throws FileNotFoundException
{
localUri = null;
if ((paramUri == null) || (this.a == null)) {
throw new IllegalArgumentException("bad argument to loadBitmap");
}
try
{
paramUri = this.a.getContentResolver().openInputStream(paramUri);
localUri = paramUri;
paramOptions = BitmapFactory.decodeStream(paramUri, null, paramOptions);
if (paramUri != null) {}
try
{
paramUri.close();
return paramOptions;
}
catch (IOException paramUri)
{
Log.w("PrintHelperKitkat", "close fail ", paramUri);
return paramOptions;
}
try
{
localUri.close();
throw paramUri;
}
catch (IOException paramOptions)
{
for (;;)
{
Log.w("PrintHelperKitkat", "close fail ", paramOptions);
}
}
}
finally
{
if (localUri == null) {}
}
}
static boolean a(Bitmap paramBitmap)
{
return paramBitmap.getWidth() <= paramBitmap.getHeight();
}
final Bitmap a(Uri arg1)
throws FileNotFoundException
{
int i = 1;
if ((??? == null) || (this.a == null)) {
throw new IllegalArgumentException("bad argument to getScaledBitmap");
}
??? = new BitmapFactory.Options();
((BitmapFactory.Options)???).inJustDecodeBounds = true;
a(???, (BitmapFactory.Options)???);
int k = ((BitmapFactory.Options)???).outWidth;
int m = ((BitmapFactory.Options)???).outHeight;
if ((k <= 0) || (m <= 0)) {}
do
{
return null;
int j = Math.max(k, m);
while (j > 3500)
{
j >>>= 1;
i <<= 1;
}
} while ((i <= 0) || (Math.min(k, m) / i <= 0));
BitmapFactory.Options localOptions;
synchronized (this.c)
{
this.b = new BitmapFactory.Options();
this.b.inMutable = true;
this.b.inSampleSize = i;
localOptions = this.b;
}
try
{
??? = a(???, localOptions);
synchronized (this.c)
{
this.b = null;
return (Bitmap)???;
}
??? = finally;
throw ???;
}
finally {}
}
protected PrintAttributes.Builder a(PrintAttributes paramPrintAttributes)
{
PrintAttributes.Builder localBuilder = new PrintAttributes.Builder().setMediaSize(paramPrintAttributes.getMediaSize()).setResolution(paramPrintAttributes.getResolution()).setMinMargins(paramPrintAttributes.getMinMargins());
if (paramPrintAttributes.getColorMode() != 0) {
localBuilder.setColorMode(paramPrintAttributes.getColorMode());
}
return localBuilder;
}
public static abstract interface OnPrintFinishCallback
{
public abstract void onFinish();
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/print/PrintHelperKitkat.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/