PrintHelper.java
7.96 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
package android.support.v4.print;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build.VERSION;
import android.print.PrintAttributes.Builder;
import android.print.PrintAttributes.MediaSize;
import android.print.PrintManager;
import ds;
import dt;
import du;
import java.io.FileNotFoundException;
public final class PrintHelper
{
public static final int COLOR_MODE_COLOR = 2;
public static final int COLOR_MODE_MONOCHROME = 1;
public static final int ORIENTATION_LANDSCAPE = 1;
public static final int ORIENTATION_PORTRAIT = 2;
public static final int SCALE_MODE_FILL = 2;
public static final int SCALE_MODE_FIT = 1;
g a;
public PrintHelper(Context paramContext)
{
if (systemSupportsPrint())
{
if (Build.VERSION.SDK_INT >= 24)
{
this.a = new c(paramContext);
return;
}
if (Build.VERSION.SDK_INT >= 23)
{
this.a = new b(paramContext);
return;
}
if (Build.VERSION.SDK_INT >= 20)
{
this.a = new a(paramContext);
return;
}
this.a = new e(paramContext);
return;
}
this.a = new f((byte)0);
}
public static boolean systemSupportsPrint()
{
return Build.VERSION.SDK_INT >= 19;
}
public final int getColorMode()
{
return this.a.b();
}
public final int getOrientation()
{
return this.a.c();
}
public final int getScaleMode()
{
return this.a.a();
}
public final void printBitmap(String paramString, Bitmap paramBitmap)
{
this.a.a(paramString, paramBitmap, null);
}
public final void printBitmap(String paramString, Bitmap paramBitmap, OnPrintFinishCallback paramOnPrintFinishCallback)
{
this.a.a(paramString, paramBitmap, paramOnPrintFinishCallback);
}
public final void printBitmap(String paramString, Uri paramUri)
throws FileNotFoundException
{
this.a.a(paramString, paramUri, null);
}
public final void printBitmap(String paramString, Uri paramUri, OnPrintFinishCallback paramOnPrintFinishCallback)
throws FileNotFoundException
{
this.a.a(paramString, paramUri, paramOnPrintFinishCallback);
}
public final void setColorMode(int paramInt)
{
this.a.b(paramInt);
}
public final void setOrientation(int paramInt)
{
this.a.c(paramInt);
}
public final void setScaleMode(int paramInt)
{
this.a.a(paramInt);
}
public static abstract interface OnPrintFinishCallback
{
public abstract void onFinish();
}
static final class a
extends PrintHelper.d<ds>
{
a(Context paramContext)
{
super();
}
}
static final class b
extends PrintHelper.d<dt>
{
b(Context paramContext)
{
super();
}
}
static final class c
extends PrintHelper.d<du>
{
c(Context paramContext)
{
super();
}
}
static class d<RealHelper extends PrintHelperKitkat>
implements PrintHelper.g
{
private final RealHelper a;
protected d(RealHelper paramRealHelper)
{
this.a = paramRealHelper;
}
public final int a()
{
return this.a.f;
}
public final void a(int paramInt)
{
this.a.f = paramInt;
}
public final void a(String paramString, Bitmap paramBitmap, final PrintHelper.OnPrintFinishCallback paramOnPrintFinishCallback)
{
PrintHelperKitkat.OnPrintFinishCallback local1 = null;
if (paramOnPrintFinishCallback != null) {
local1 = new PrintHelperKitkat.OnPrintFinishCallback()
{
public final void onFinish()
{
paramOnPrintFinishCallback.onFinish();
}
};
}
PrintHelperKitkat localPrintHelperKitkat = this.a;
int i;
PrintManager localPrintManager;
if (paramBitmap != null)
{
i = localPrintHelperKitkat.f;
localPrintManager = (PrintManager)localPrintHelperKitkat.a.getSystemService("print");
if (!PrintHelperKitkat.a(paramBitmap)) {
break label108;
}
}
label108:
for (paramOnPrintFinishCallback = PrintAttributes.MediaSize.UNKNOWN_PORTRAIT;; paramOnPrintFinishCallback = PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE)
{
paramOnPrintFinishCallback = new PrintAttributes.Builder().setMediaSize(paramOnPrintFinishCallback).setColorMode(localPrintHelperKitkat.g).build();
localPrintManager.print(paramString, new PrintHelperKitkat.1(localPrintHelperKitkat, paramString, i, paramBitmap, local1), paramOnPrintFinishCallback);
return;
}
}
public final void a(String paramString, Uri paramUri, final PrintHelper.OnPrintFinishCallback paramOnPrintFinishCallback)
throws FileNotFoundException
{
Object localObject = null;
if (paramOnPrintFinishCallback != null) {
localObject = new PrintHelperKitkat.OnPrintFinishCallback()
{
public final void onFinish()
{
paramOnPrintFinishCallback.onFinish();
}
};
}
paramOnPrintFinishCallback = this.a;
paramUri = new PrintHelperKitkat.3(paramOnPrintFinishCallback, paramString, paramUri, (PrintHelperKitkat.OnPrintFinishCallback)localObject, paramOnPrintFinishCallback.f);
localObject = (PrintManager)paramOnPrintFinishCallback.a.getSystemService("print");
PrintAttributes.Builder localBuilder = new PrintAttributes.Builder();
localBuilder.setColorMode(paramOnPrintFinishCallback.g);
if ((paramOnPrintFinishCallback.h == 1) || (paramOnPrintFinishCallback.h == 0)) {
localBuilder.setMediaSize(PrintAttributes.MediaSize.UNKNOWN_LANDSCAPE);
}
for (;;)
{
((PrintManager)localObject).print(paramString, paramUri, localBuilder.build());
return;
if (paramOnPrintFinishCallback.h == 2) {
localBuilder.setMediaSize(PrintAttributes.MediaSize.UNKNOWN_PORTRAIT);
}
}
}
public final int b()
{
return this.a.g;
}
public final void b(int paramInt)
{
this.a.g = paramInt;
}
public final int c()
{
PrintHelperKitkat localPrintHelperKitkat = this.a;
if (localPrintHelperKitkat.h == 0) {
return 1;
}
return localPrintHelperKitkat.h;
}
public final void c(int paramInt)
{
this.a.h = paramInt;
}
}
static final class e
extends PrintHelper.d<PrintHelperKitkat>
{
e(Context paramContext)
{
super();
}
}
static final class f
implements PrintHelper.g
{
int a = 2;
int b = 2;
int c = 1;
public final int a()
{
return this.a;
}
public final void a(int paramInt)
{
this.a = paramInt;
}
public final void a(String paramString, Bitmap paramBitmap, PrintHelper.OnPrintFinishCallback paramOnPrintFinishCallback) {}
public final void a(String paramString, Uri paramUri, PrintHelper.OnPrintFinishCallback paramOnPrintFinishCallback) {}
public final int b()
{
return this.b;
}
public final void b(int paramInt)
{
this.b = paramInt;
}
public final int c()
{
return this.c;
}
public final void c(int paramInt)
{
this.c = paramInt;
}
}
static abstract interface g
{
public abstract int a();
public abstract void a(int paramInt);
public abstract void a(String paramString, Bitmap paramBitmap, PrintHelper.OnPrintFinishCallback paramOnPrintFinishCallback);
public abstract void a(String paramString, Uri paramUri, PrintHelper.OnPrintFinishCallback paramOnPrintFinishCallback)
throws FileNotFoundException;
public abstract int b();
public abstract void b(int paramInt);
public abstract int c();
public abstract void c(int paramInt);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/android/support/v4/print/PrintHelper.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/