PrintProgress.java 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189
  1. package epson.print.screen;
  2. import android.app.Activity;
  3. import android.app.AlertDialog;
  4. import android.app.Dialog;
  5. import android.content.Context;
  6. import android.content.DialogInterface;
  7. import android.content.Intent;
  8. import android.content.IntentFilter;
  9. import android.content.ServiceConnection;
  10. import android.os.Bundle;
  11. import android.os.Handler;
  12. import android.os.RemoteException;
  13. import android.support.annotation.NonNull;
  14. import android.support.annotation.Nullable;
  15. import android.view.KeyEvent;
  16. import android.view.View;
  17. import android.widget.Button;
  18. import android.widget.ProgressBar;
  19. import android.widget.TextView;
  20. import com.epson.iprint.prtlogger.Analytics;
  21. import com.epson.iprint.prtlogger.PrintLog;
  22. import com.epson.mobilephone.common.escpr.MediaInfo;
  23. import com.epson.mobilephone.common.wifidirect.NfcTagUtils;
  24. import epson.common.Utils;
  25. import epson.print.R;
  26. import epson.print.CommonDefine;
  27. import epson.print.EPImageList;
  28. import epson.print.IprintApplication;
  29. import epson.print.MyPrinter;
  30. import epson.print.Util.EPLog;
  31. import epson.print.screen.PrintSetting;
  32. import epson.print.service.IEpsonService;
  33. import epson.print.service.IEpsonServiceCallback;
  34. import epson.print.widgets.CustomTitleAlertDialogBuilder;
  35. import java.io.Serializable;
  36. public class PrintProgress extends Activity implements CommonDefine {
  37. private static final int DIALOG_CONFIRM = 1;
  38. private static final int DIALOG_INFORM = 0;
  39. public static final int END_PRINT = 4;
  40. public static final String PARAM_DOCUMENT_MODE = "PRINT_DOCUMENT";
  41. public static final String PARAM_EPSON_COLOR = "epson_color";
  42. public static final String PARAM_EP_IMAGE_LIST = "EPImageList";
  43. public static final String PARAM_PRINT_LOG = "print_log";
  44. public static final String PARAM_PRINT_PROGRESS = "progress-params";
  45. public static final String PREFS_NAME = "PrintSetting";
  46. public static final int RESULT_ERROR = 1000;
  47. /* access modifiers changed from: private */
  48. public static boolean bRestartactivity = false;
  49. static int copies = 0;
  50. static int curError = 0;
  51. static int fileIndex = 0;
  52. static boolean isBkRetry = false;
  53. static boolean isContinue = false;
  54. static boolean isDocument = false;
  55. /* access modifiers changed from: private */
  56. public static final Object lockBCancel = new Object();
  57. /* access modifiers changed from: private */
  58. public static IEpsonServiceCallback mCallback;
  59. /* access modifiers changed from: private */
  60. public static ServiceConnection mEpsonConnection;
  61. /* access modifiers changed from: private */
  62. public static IEpsonService mEpsonService = null;
  63. /* access modifiers changed from: private */
  64. public static final Object mLock = new Object();
  65. private static final Object mLockInit = new Object();
  66. static ProgressBar mProgressCopies;
  67. static ProgressBar mProgressPage;
  68. static ProgressBar mProgressPercent;
  69. private final int CHECK_PRINTER = 6;
  70. private final int CHECK_PRINTER_CONTINUE = 10;
  71. private final int CONFIRM = 7;
  72. private final int CONFORM_MULTI = 2;
  73. private final int CONNECTED_SIMPLEAP = 1;
  74. private final int CONTINUE_PRINT = 3;
  75. private final int ECC_LIB_ERROR = 9;
  76. private final int EPS_DUPLEX_NONE = 0;
  77. private final int EPS_JOB_CANCELED = 40;
  78. private final int ERROR = 4;
  79. private final int FINISH = 5;
  80. private final String PERCENT = "PERCENT";
  81. private final int PRINT_NEXT_PAGE = 1;
  82. private final int SHOW_COMPLETE_DIALOG = 8;
  83. private final int START_PRINT = 2;
  84. private final int UPDATE_PERCENT = 0;
  85. boolean bCancel = false;
  86. /* access modifiers changed from: private */
  87. public boolean bSearching = false;
  88. /* access modifiers changed from: private */
  89. public boolean bSearchingPrinter = false;
  90. /* access modifiers changed from: private */
  91. public Context context = null;
  92. /* access modifiers changed from: private */
  93. public int curCopy = 1;
  94. /* access modifiers changed from: private */
  95. public int curSheet = 1;
  96. int duplex = 0;
  97. /* access modifiers changed from: private */
  98. public boolean isDialogOpen = false;
  99. /* access modifiers changed from: private */
  100. public boolean isRemotePrinter = false;
  101. private boolean mApfProgressDisplay;
  102. Button mCancelButton;
  103. boolean mCanceled = false;
  104. TextView mCopies;
  105. /* access modifiers changed from: private */
  106. public volatile boolean mError = false;
  107. Handler mHandler = new Handler(new Handler.Callback() {
  108. /* JADX WARNING: Can't fix incorrect switch cases order */
  109. /* JADX WARNING: Code restructure failed: missing block: B:40:0x01ec, code lost:
  110. if (com.epson.mobilephone.common.wifidirect.WiFiDirectManager.reconnect(r9.this$0, com.epson.mobilephone.common.wifidirect.WiFiDirectManager.DEVICE_TYPE_PRINTER, 1) == false) goto L_0x01f0;
  111. */
  112. /* Code decompiled incorrectly, please refer to instructions dump. */
  113. public boolean handleMessage(android.os.Message r10) {
  114. /*
  115. r9 = this;
  116. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  117. boolean r0 = r0.mCanceled
  118. r1 = 5
  119. r2 = 1
  120. if (r0 == 0) goto L_0x002a
  121. int r0 = r10.what
  122. if (r0 == r1) goto L_0x0019
  123. r10 = 8
  124. if (r0 == r10) goto L_0x0011
  125. return r2
  126. L_0x0011:
  127. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  128. android.os.Handler r10 = r10.mHandler
  129. r10.sendEmptyMessage(r1)
  130. return r2
  131. L_0x0019:
  132. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  133. android.content.Context r0 = r0.context
  134. java.lang.String r3 = "printer"
  135. epson.print.screen.PrintProgress r4 = epson.print.screen.PrintProgress.this
  136. java.lang.String r4 = r4.printerIp
  137. com.epson.mobilephone.common.wifidirect.WiFiDirectManager.disconnect(r0, r3, r4)
  138. L_0x002a:
  139. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  140. boolean r0 = r0.isFinishing()
  141. r3 = 4
  142. r4 = 2
  143. if (r0 == 0) goto L_0x0041
  144. int r0 = r10.what
  145. if (r0 == 0) goto L_0x0040
  146. if (r0 == r4) goto L_0x0040
  147. if (r0 == r3) goto L_0x0040
  148. switch(r0) {
  149. case 6: goto L_0x0040;
  150. case 7: goto L_0x0040;
  151. case 8: goto L_0x0040;
  152. case 9: goto L_0x0040;
  153. case 10: goto L_0x0040;
  154. default: goto L_0x003f;
  155. }
  156. L_0x003f:
  157. goto L_0x0041
  158. L_0x0040:
  159. return r2
  160. L_0x0041:
  161. int r0 = r10.what
  162. r5 = 100
  163. r7 = 0
  164. switch(r0) {
  165. case 0: goto L_0x0429;
  166. case 1: goto L_0x0049;
  167. case 2: goto L_0x03e1;
  168. case 3: goto L_0x0049;
  169. case 4: goto L_0x0391;
  170. case 5: goto L_0x025d;
  171. case 6: goto L_0x01cb;
  172. case 7: goto L_0x0049;
  173. case 8: goto L_0x016a;
  174. case 9: goto L_0x004b;
  175. case 10: goto L_0x01f0;
  176. default: goto L_0x0049;
  177. }
  178. L_0x0049:
  179. goto L_0x0450
  180. L_0x004b:
  181. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  182. boolean unused = r0.mError = r2
  183. int r0 = r10.arg1
  184. r1 = -1100(0xfffffffffffffbb4, float:NaN)
  185. if (r0 == r1) goto L_0x0151
  186. r1 = -1056(0xfffffffffffffbe0, float:NaN)
  187. if (r0 == r1) goto L_0x0105
  188. switch(r0) {
  189. case -1209: goto L_0x00c5;
  190. case -1208: goto L_0x00c5;
  191. default: goto L_0x005d;
  192. }
  193. L_0x005d:
  194. switch(r0) {
  195. case -1206: goto L_0x00b1;
  196. case -1205: goto L_0x009d;
  197. case -1204: goto L_0x0105;
  198. case -1203: goto L_0x0089;
  199. case -1202: goto L_0x0075;
  200. case -1201: goto L_0x0061;
  201. case -1200: goto L_0x0105;
  202. default: goto L_0x0060;
  203. }
  204. L_0x0060:
  205. return r2
  206. L_0x0061:
  207. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  208. r0 = 2131624025(0x7f0e0059, float:1.8875218E38)
  209. java.lang.String r10 = r10.getString(r0)
  210. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  211. r1 = 2131624024(0x7f0e0058, float:1.8875216E38)
  212. java.lang.String r0 = r0.getString(r1)
  213. goto L_0x0163
  214. L_0x0075:
  215. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  216. r0 = 2131624028(0x7f0e005c, float:1.8875224E38)
  217. java.lang.String r10 = r10.getString(r0)
  218. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  219. r1 = 2131624027(0x7f0e005b, float:1.8875222E38)
  220. java.lang.String r0 = r0.getString(r1)
  221. goto L_0x0163
  222. L_0x0089:
  223. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  224. r0 = 2131624023(0x7f0e0057, float:1.8875214E38)
  225. java.lang.String r10 = r10.getString(r0)
  226. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  227. r1 = 2131624022(0x7f0e0056, float:1.8875212E38)
  228. java.lang.String r0 = r0.getString(r1)
  229. goto L_0x0163
  230. L_0x009d:
  231. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  232. r0 = 2131624016(0x7f0e0050, float:1.88752E38)
  233. java.lang.String r10 = r10.getString(r0)
  234. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  235. r1 = 2131624012(0x7f0e004c, float:1.8875192E38)
  236. java.lang.String r0 = r0.getString(r1)
  237. goto L_0x0163
  238. L_0x00b1:
  239. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  240. r0 = 2131624787(0x7f0e0353, float:1.8876764E38)
  241. java.lang.String r10 = r10.getString(r0)
  242. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  243. r1 = 2131624786(0x7f0e0352, float:1.8876762E38)
  244. java.lang.String r0 = r0.getString(r1)
  245. goto L_0x0163
  246. L_0x00c5:
  247. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  248. r1 = 2131624009(0x7f0e0049, float:1.8875186E38)
  249. java.lang.String r0 = r0.getString(r1)
  250. java.lang.StringBuilder r1 = new java.lang.StringBuilder
  251. r1.<init>()
  252. epson.print.screen.PrintProgress r3 = epson.print.screen.PrintProgress.this
  253. r4 = 2131624007(0x7f0e0047, float:1.8875182E38)
  254. java.lang.String r3 = r3.getString(r4)
  255. r1.append(r3)
  256. java.lang.String r3 = "0X"
  257. r1.append(r3)
  258. int r10 = r10.arg1
  259. java.lang.String r10 = java.lang.Integer.toHexString(r10)
  260. java.lang.String r10 = r10.toUpperCase()
  261. r1.append(r10)
  262. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  263. r3 = 2131624008(0x7f0e0048, float:1.8875184E38)
  264. java.lang.String r10 = r10.getString(r3)
  265. r1.append(r10)
  266. java.lang.String r10 = r1.toString()
  267. r8 = r0
  268. r0 = r10
  269. r10 = r8
  270. goto L_0x0163
  271. L_0x0105:
  272. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  273. r1 = 2131624021(0x7f0e0055, float:1.887521E38)
  274. java.lang.String r0 = r0.getString(r1)
  275. java.lang.StringBuilder r1 = new java.lang.StringBuilder
  276. r1.<init>()
  277. epson.print.screen.PrintProgress r3 = epson.print.screen.PrintProgress.this
  278. r4 = 2131624020(0x7f0e0054, float:1.8875208E38)
  279. java.lang.String r3 = r3.getString(r4)
  280. r1.append(r3)
  281. epson.print.screen.PrintProgress r3 = epson.print.screen.PrintProgress.this
  282. r4 = 2131624018(0x7f0e0052, float:1.8875204E38)
  283. java.lang.String r3 = r3.getString(r4)
  284. r1.append(r3)
  285. java.lang.String r3 = "0X"
  286. r1.append(r3)
  287. int r10 = r10.arg1
  288. java.lang.String r10 = java.lang.Integer.toHexString(r10)
  289. java.lang.String r10 = r10.toUpperCase()
  290. r1.append(r10)
  291. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  292. r3 = 2131624019(0x7f0e0053, float:1.8875206E38)
  293. java.lang.String r10 = r10.getString(r3)
  294. r1.append(r10)
  295. java.lang.String r10 = r1.toString()
  296. r8 = r0
  297. r0 = r10
  298. r10 = r8
  299. goto L_0x0163
  300. L_0x0151:
  301. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  302. r0 = 2131624032(0x7f0e0060, float:1.8875232E38)
  303. java.lang.String r10 = r10.getString(r0)
  304. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  305. r1 = 2131624031(0x7f0e005f, float:1.887523E38)
  306. java.lang.String r0 = r0.getString(r1)
  307. L_0x0163:
  308. epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this
  309. r1.showErrorDialog(r10, r0)
  310. goto L_0x0450
  311. L_0x016a:
  312. android.app.AlertDialog$Builder r10 = new android.app.AlertDialog$Builder
  313. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  314. android.content.Context r0 = r0.context
  315. r10.<init>(r0)
  316. android.app.AlertDialog$Builder r10 = r10.setCancelable(r7)
  317. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  318. r0.<init>()
  319. epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this
  320. r3 = 2131624796(0x7f0e035c, float:1.8876782E38)
  321. java.lang.String r1 = r1.getString(r3)
  322. r0.append(r1)
  323. java.lang.String r1 = "\n"
  324. r0.append(r1)
  325. epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this
  326. r3 = 2131624797(0x7f0e035d, float:1.8876784E38)
  327. java.lang.String r1 = r1.getString(r3)
  328. r0.append(r1)
  329. java.lang.String r1 = "\n\n"
  330. r0.append(r1)
  331. epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this
  332. r3 = 2131624798(0x7f0e035e, float:1.8876786E38)
  333. java.lang.String r1 = r1.getString(r3)
  334. r0.append(r1)
  335. java.lang.String r0 = r0.toString()
  336. android.app.AlertDialog$Builder r10 = r10.setMessage(r0)
  337. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this
  338. r1 = 2131625202(0x7f0e04f2, float:1.8877605E38)
  339. java.lang.String r0 = r0.getString(r1)
  340. epson.print.screen.PrintProgress$4$1 r1 = new epson.print.screen.PrintProgress$4$1
  341. r1.<init>()
  342. android.app.AlertDialog$Builder r10 = r10.setPositiveButton(r0, r1)
  343. r10.show()
  344. goto L_0x0450
  345. L_0x01cb:
  346. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  347. int unused = r10.curSheet = r2
  348. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  349. int unused = r10.curCopy = r2
  350. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  351. android.content.Context r10 = r10.context
  352. java.lang.String r0 = "printer"
  353. boolean r10 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.isNeedConnect(r10, r0)
  354. if (r10 != 0) goto L_0x01e4
  355. goto L_0x01f0
  356. L_0x01e4:
  357. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  358. java.lang.String r0 = "printer"
  359. boolean r10 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.reconnect(r10, r0, r2)
  360. if (r10 == 0) goto L_0x01f0
  361. goto L_0x0450
  362. L_0x01f0:
  363. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService
  364. if (r10 == 0) goto L_0x0252
  365. java.lang.String r10 = "Epson"
  366. java.lang.String r0 = "begin probe printer before printing"
  367. epson.print.Util.EPLog.m307e((java.lang.String) r10, (java.lang.String) r0) // Catch:{ RemoteException -> 0x024c }
  368. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c }
  369. epson.print.MyPrinter r10 = epson.print.MyPrinter.getCurPrinter(r10) // Catch:{ RemoteException -> 0x024c }
  370. java.lang.String r0 = r10.getPrinterId() // Catch:{ RemoteException -> 0x024c }
  371. java.lang.String r1 = r10.getIp() // Catch:{ RemoteException -> 0x024c }
  372. if (r0 == 0) goto L_0x0221
  373. int r5 = r10.getLocation() // Catch:{ RemoteException -> 0x024c }
  374. if (r5 != r2) goto L_0x0221
  375. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c }
  376. boolean unused = r10.bSearching = r2 // Catch:{ RemoteException -> 0x024c }
  377. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x024c }
  378. r10.searchPrinters(r0, r1, r2) // Catch:{ RemoteException -> 0x024c }
  379. goto L_0x0450
  380. L_0x0221:
  381. if (r1 == 0) goto L_0x0238
  382. int r10 = r10.getLocation() // Catch:{ RemoteException -> 0x024c }
  383. r5 = 3
  384. if (r10 != r5) goto L_0x0238
  385. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c }
  386. boolean unused = r10.bSearching = r2 // Catch:{ RemoteException -> 0x024c }
  387. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x024c }
  388. r10.searchPrinters(r0, r1, r4) // Catch:{ RemoteException -> 0x024c }
  389. goto L_0x0450
  390. L_0x0238:
  391. epson.print.screen.PrintProgress.isContinue = r7 // Catch:{ RemoteException -> 0x024c }
  392. r10 = -1351(0xfffffffffffffab9, float:NaN)
  393. epson.print.screen.PrintProgress.curError = r10 // Catch:{ RemoteException -> 0x024c }
  394. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c }
  395. boolean unused = r10.mError = r2 // Catch:{ RemoteException -> 0x024c }
  396. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c }
  397. android.os.Handler r10 = r10.mHandler // Catch:{ RemoteException -> 0x024c }
  398. r10.sendEmptyMessage(r3) // Catch:{ RemoteException -> 0x024c }
  399. goto L_0x0450
  400. L_0x024c:
  401. r10 = move-exception
  402. r10.printStackTrace()
  403. goto L_0x0450
  404. L_0x0252:
  405. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  406. android.os.Handler r10 = r10.mHandler
  407. r0 = 10
  408. r10.sendEmptyMessageDelayed(r0, r5)
  409. goto L_0x0450
  410. L_0x025d:
  411. java.lang.String r10 = "PrintProgress"
  412. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  413. r0.<init>()
  414. java.lang.String r4 = "message FINISH : mError => "
  415. r0.append(r4)
  416. epson.print.screen.PrintProgress r4 = epson.print.screen.PrintProgress.this
  417. boolean r4 = r4.mError
  418. r0.append(r4)
  419. java.lang.String r4 = " mCanceled =>"
  420. r0.append(r4)
  421. epson.print.screen.PrintProgress r4 = epson.print.screen.PrintProgress.this
  422. boolean r4 = r4.mCanceled
  423. r0.append(r4)
  424. java.lang.String r0 = r0.toString()
  425. epson.print.Util.EPLog.m305d(r10, r0)
  426. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService
  427. if (r10 == 0) goto L_0x032b
  428. java.lang.Object r10 = epson.print.screen.PrintProgress.mLock // Catch:{ RemoteException -> 0x02fd }
  429. monitor-enter(r10) // Catch:{ RemoteException -> 0x02fd }
  430. epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this // Catch:{ all -> 0x02fa }
  431. boolean r0 = r0.bSearchingPrinter // Catch:{ all -> 0x02fa }
  432. if (r0 == 0) goto L_0x02b8
  433. boolean r0 = epson.print.screen.PrintProgress.bRestartactivity // Catch:{ all -> 0x02fa }
  434. if (r0 != 0) goto L_0x02b8
  435. epson.print.service.IEpsonService r0 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ all -> 0x02fa }
  436. boolean r0 = r0.isSearchingPrinter() // Catch:{ all -> 0x02fa }
  437. if (r0 == 0) goto L_0x02b8
  438. java.lang.String r0 = "PrintProgress"
  439. java.lang.String r4 = "message FINISH: mEpsonService.cancelSearchPrinter()"
  440. epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r4) // Catch:{ all -> 0x02fa }
  441. epson.print.service.IEpsonService r0 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ all -> 0x02fa }
  442. r0.cancelSearchPrinter() // Catch:{ all -> 0x02fa }
  443. r0 = 1
  444. goto L_0x02b9
  445. L_0x02b8:
  446. r0 = 0
  447. L_0x02b9:
  448. monitor-exit(r10) // Catch:{ all -> 0x02fa }
  449. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x02fd }
  450. if (r10 == 0) goto L_0x02df
  451. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x02fd }
  452. boolean r10 = r10.isPrinting() // Catch:{ RemoteException -> 0x02fd }
  453. if (r10 == 0) goto L_0x02df
  454. boolean r10 = epson.print.screen.PrintProgress.bRestartactivity // Catch:{ RemoteException -> 0x02fd }
  455. if (r10 != 0) goto L_0x02df
  456. java.lang.String r10 = "PrintProgress"
  457. java.lang.String r0 = "message FINISH: mEpsonService.confirmCancel(true) call"
  458. epson.print.Util.EPLog.m305d(r10, r0) // Catch:{ RemoteException -> 0x02fd }
  459. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x02fd }
  460. r10.confirmCancel(r2) // Catch:{ RemoteException -> 0x02fd }
  461. r0 = 1
  462. L_0x02df:
  463. if (r0 == 0) goto L_0x0301
  464. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x02fd }
  465. boolean r10 = r10.mWaitEpsonServiceForFinish // Catch:{ RemoteException -> 0x02fd }
  466. if (r10 == 0) goto L_0x0301
  467. java.lang.String r10 = "PrintProgress"
  468. java.lang.String r0 = "on message FINISH: sendEmptyMessageDelayed(FINISH...)"
  469. epson.print.Util.EPLog.m305d(r10, r0) // Catch:{ RemoteException -> 0x02fd }
  470. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x02fd }
  471. android.os.Handler r10 = r10.mHandler // Catch:{ RemoteException -> 0x02fd }
  472. r4 = 500(0x1f4, double:2.47E-321)
  473. r10.sendEmptyMessageDelayed(r1, r4) // Catch:{ RemoteException -> 0x02fd }
  474. return r2
  475. L_0x02fa:
  476. r0 = move-exception
  477. monitor-exit(r10) // Catch:{ all -> 0x02fa }
  478. throw r0 // Catch:{ RemoteException -> 0x02fd }
  479. L_0x02fd:
  480. r10 = move-exception
  481. r10.printStackTrace()
  482. L_0x0301:
  483. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x0327 }
  484. if (r10 == 0) goto L_0x032b
  485. java.lang.String r10 = "PrintProgress"
  486. java.lang.String r0 = "message FINISH: mEpsonService.unregisterCallback() call"
  487. epson.print.Util.EPLog.m307e((java.lang.String) r10, (java.lang.String) r0) // Catch:{ RemoteException -> 0x0327 }
  488. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x0327 }
  489. epson.print.service.IEpsonServiceCallback r0 = epson.print.screen.PrintProgress.mCallback // Catch:{ RemoteException -> 0x0327 }
  490. r10.unregisterCallback(r0) // Catch:{ RemoteException -> 0x0327 }
  491. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x0327 }
  492. android.content.ServiceConnection r0 = epson.print.screen.PrintProgress.mEpsonConnection // Catch:{ RemoteException -> 0x0327 }
  493. r10.unbindService(r0) // Catch:{ RemoteException -> 0x0327 }
  494. r10 = 0
  495. epson.print.service.IEpsonService unused = epson.print.screen.PrintProgress.mEpsonService = r10 // Catch:{ RemoteException -> 0x0327 }
  496. goto L_0x032b
  497. L_0x0327:
  498. r10 = move-exception
  499. r10.printStackTrace()
  500. L_0x032b:
  501. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  502. boolean r10 = r10.mCanceled
  503. if (r10 == 0) goto L_0x0333
  504. r3 = 0
  505. goto L_0x033d
  506. L_0x0333:
  507. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  508. boolean r10 = r10.mError
  509. if (r10 == 0) goto L_0x033d
  510. r3 = 1000(0x3e8, float:1.401E-42)
  511. L_0x033d:
  512. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  513. android.app.Activity r10 = r10.getParent()
  514. if (r10 != 0) goto L_0x034b
  515. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  516. r10.setResult(r3)
  517. goto L_0x0354
  518. L_0x034b:
  519. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  520. android.app.Activity r10 = r10.getParent()
  521. r10.setResult(r3)
  522. L_0x0354:
  523. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  524. boolean unused = r10.bSearching = r7
  525. java.lang.String r10 = "PrintProgress"
  526. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  527. r0.<init>()
  528. java.lang.String r1 = "finish with return code => "
  529. r0.append(r1)
  530. r0.append(r3)
  531. java.lang.String r0 = r0.toString()
  532. epson.print.Util.EPLog.m305d(r10, r0)
  533. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  534. android.content.Context r10 = r10.context
  535. java.lang.String r0 = "printer"
  536. epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this
  537. java.lang.String r1 = r1.printerIp
  538. com.epson.mobilephone.common.wifidirect.WiFiDirectManager.disconnect(r10, r0, r1)
  539. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  540. r10.sendPrintLog()
  541. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  542. r10.setPrintEnd()
  543. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  544. r10.finish()
  545. goto L_0x0450
  546. L_0x0391:
  547. java.lang.String r10 = "Epson"
  548. java.lang.String r0 = "NOTIFY ERROR"
  549. epson.print.Util.EPLog.m307e((java.lang.String) r10, (java.lang.String) r0)
  550. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  551. boolean r10 = r10.isDialogOpen
  552. if (r10 != 0) goto L_0x03b9
  553. java.lang.String r10 = "Epson"
  554. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  555. r0.<init>()
  556. java.lang.String r1 = "Show Error code:"
  557. r0.append(r1)
  558. int r1 = epson.print.screen.PrintProgress.curError
  559. r0.append(r1)
  560. java.lang.String r0 = r0.toString()
  561. epson.print.Util.EPLog.m307e((java.lang.String) r10, (java.lang.String) r0)
  562. goto L_0x03d6
  563. L_0x03b9:
  564. java.lang.String r10 = "Epson"
  565. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  566. r0.<init>()
  567. java.lang.String r1 = "Remove and show Error code:"
  568. r0.append(r1)
  569. int r1 = epson.print.screen.PrintProgress.curError
  570. r0.append(r1)
  571. java.lang.String r0 = r0.toString()
  572. epson.print.Util.EPLog.m307e((java.lang.String) r10, (java.lang.String) r0)
  573. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  574. r10.removeDialog(r7)
  575. L_0x03d6:
  576. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  577. boolean unused = r10.isDialogOpen = r2
  578. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  579. r10.showDialog(r7)
  580. goto L_0x0450
  581. L_0x03e1:
  582. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  583. boolean unused = r10.mError = r7
  584. epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService
  585. if (r10 == 0) goto L_0x03f7
  586. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ Exception -> 0x03f2 }
  587. r10.startPrint() // Catch:{ Exception -> 0x03f2 }
  588. goto L_0x0450
  589. L_0x03f2:
  590. r10 = move-exception
  591. r10.printStackTrace()
  592. goto L_0x0450
  593. L_0x03f7:
  594. java.lang.String r10 = "Epson"
  595. java.lang.String r0 = "Service or resource file not ready, please wait..."
  596. epson.print.Util.EPLog.m313i(r10, r0)
  597. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  598. android.widget.TextView r10 = r10.mPercent
  599. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  600. r0.<init>()
  601. epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this
  602. java.lang.String r1 = r1.percentString
  603. r0.append(r1)
  604. java.lang.String r1 = " 0%"
  605. r0.append(r1)
  606. java.lang.String r0 = r0.toString()
  607. r10.setText(r0)
  608. android.widget.ProgressBar r10 = epson.print.screen.PrintProgress.mProgressPercent
  609. r10.setProgress(r7)
  610. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  611. android.os.Handler r10 = r10.mHandler
  612. r10.sendEmptyMessageDelayed(r4, r5)
  613. goto L_0x0450
  614. L_0x0429:
  615. int r0 = r10.arg2
  616. int r10 = r10.arg1
  617. java.lang.StringBuilder r1 = new java.lang.StringBuilder
  618. r1.<init>()
  619. java.lang.String r3 = "UPDATE_PERCENT "
  620. r1.append(r3)
  621. r1.append(r0)
  622. java.lang.String r1 = r1.toString()
  623. epson.print.Util.EPLog.m304d(r1)
  624. switch(r10) {
  625. case 1: goto L_0x044b;
  626. case 2: goto L_0x0445;
  627. default: goto L_0x0444;
  628. }
  629. L_0x0444:
  630. goto L_0x0450
  631. L_0x0445:
  632. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  633. r10.updateApfProgress(r0)
  634. goto L_0x0450
  635. L_0x044b:
  636. epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this
  637. r10.updatePrintProgress(r0)
  638. L_0x0450:
  639. return r2
  640. */
  641. throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.PrintProgress.C23254.handleMessage(android.os.Message):boolean");
  642. }
  643. });
  644. TextView mPage;
  645. TextView mPercent;
  646. private boolean mPrintProgressDisplay;
  647. private ProgressParams mProgressParams;
  648. /* access modifiers changed from: private */
  649. public volatile boolean mWaitEpsonServiceForFinish = false;
  650. /* access modifiers changed from: private */
  651. public String percentString = "";
  652. /* access modifiers changed from: private */
  653. public String printerIp;
  654. private int sheets;
  655. public interface ProgressParams extends Serializable {
  656. boolean getApfMode();
  657. boolean getEpsonColorMode();
  658. int getOriginalSheetSize();
  659. PrintLog getPrintLog();
  660. PrintSetting getPrintSetting(Context context);
  661. PrintSetting.Kind getPrintSettingType();
  662. boolean isPaperLandscape();
  663. boolean print(IEpsonService iEpsonService, boolean z) throws RemoteException;
  664. }
  665. public static boolean isPrintSuccess(int i) {
  666. return i == 4;
  667. }
  668. /* JADX WARNING: Code restructure failed: missing block: B:10:0x000e, code lost:
  669. epson.print.Util.EPLog.m307e("Epson", "mEpsonService = null");
  670. mCallback = new epson.print.screen.PrintProgress.C23181(r3);
  671. mEpsonConnection = new epson.print.screen.PrintProgress.C23232(r3);
  672. epson.print.Util.EPLog.m307e("Epson", "bindService() call");
  673. bindService(new android.content.Intent(r3, epson.print.service.EpsonService.class), mEpsonConnection, 1);
  674. epson.print.Util.EPLog.m307e("Epson", "bindService() finish");
  675. */
  676. /* JADX WARNING: Code restructure failed: missing block: B:18:?, code lost:
  677. return;
  678. */
  679. /* JADX WARNING: Code restructure failed: missing block: B:19:?, code lost:
  680. return;
  681. */
  682. /* JADX WARNING: Code restructure failed: missing block: B:9:0x000c, code lost:
  683. if (mEpsonService != null) goto L_?;
  684. */
  685. /* Code decompiled incorrectly, please refer to instructions dump. */
  686. private void init() {
  687. /*
  688. r3 = this;
  689. java.lang.Object r0 = mLockInit
  690. monitor-enter(r0)
  691. epson.print.service.IEpsonService r1 = mEpsonService // Catch:{ all -> 0x003f }
  692. if (r1 == 0) goto L_0x0009
  693. monitor-exit(r0) // Catch:{ all -> 0x003f }
  694. return
  695. L_0x0009:
  696. monitor-exit(r0) // Catch:{ all -> 0x003f }
  697. epson.print.service.IEpsonService r0 = mEpsonService
  698. if (r0 != 0) goto L_0x003e
  699. java.lang.String r0 = "Epson"
  700. java.lang.String r1 = "mEpsonService = null"
  701. epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1)
  702. epson.print.screen.PrintProgress$1 r0 = new epson.print.screen.PrintProgress$1
  703. r0.<init>()
  704. mCallback = r0
  705. epson.print.screen.PrintProgress$2 r0 = new epson.print.screen.PrintProgress$2
  706. r0.<init>()
  707. mEpsonConnection = r0
  708. java.lang.String r0 = "Epson"
  709. java.lang.String r1 = "bindService() call"
  710. epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1)
  711. android.content.Intent r0 = new android.content.Intent
  712. java.lang.Class<epson.print.service.EpsonService> r1 = epson.print.service.EpsonService.class
  713. r0.<init>(r3, r1)
  714. android.content.ServiceConnection r1 = mEpsonConnection
  715. r2 = 1
  716. r3.bindService(r0, r1, r2)
  717. java.lang.String r0 = "Epson"
  718. java.lang.String r1 = "bindService() finish"
  719. epson.print.Util.EPLog.m307e((java.lang.String) r0, (java.lang.String) r1)
  720. L_0x003e:
  721. return
  722. L_0x003f:
  723. r1 = move-exception
  724. monitor-exit(r0) // Catch:{ all -> 0x003f }
  725. throw r1
  726. */
  727. throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.PrintProgress.init():void");
  728. }
  729. /* access modifiers changed from: protected */
  730. public void onCreate(Bundle bundle) {
  731. EPLog.m307e("Epson", "PrintProgress.java: onCreate() call");
  732. EPLog.m307e("Epson", "addFlags : FLAG_KEEP_SCREEN_ON ");
  733. getWindow().addFlags(128);
  734. super.onCreate(bundle);
  735. ((IprintApplication) getApplication()).setPrinting(true);
  736. Analytics.cleanPrintNumber(this);
  737. try {
  738. this.mProgressParams = getParams(getIntent());
  739. int i = 0;
  740. Utils.setFInishOnTOuchOutside(this, false);
  741. this.mError = false;
  742. curError = 0;
  743. this.mWaitEpsonServiceForFinish = false;
  744. synchronized (mLockInit) {
  745. EPLog.m307e("Epson", "PrintProgress.java: onCreate() call init() funciton");
  746. init();
  747. }
  748. isDocument = getIntent().getExtras().getBoolean(PARAM_DOCUMENT_MODE, false);
  749. PrintSetting printSetting = this.mProgressParams.getPrintSetting(this);
  750. printSetting.loadSettings();
  751. copies = printSetting.copiesValue;
  752. this.duplex = printSetting.duplexValue;
  753. this.sheets = countSheet(printSetting.layoutMultiPageValue, this.mProgressParams.getOriginalSheetSize());
  754. this.isRemotePrinter = MyPrinter.isRemotePrinter(this);
  755. setContentView(R.layout.progress_layout);
  756. this.context = this;
  757. mProgressPercent = (ProgressBar) findViewById(R.id.progress_percent);
  758. this.mPercent = (TextView) findViewById(R.id.percent);
  759. mProgressCopies = (ProgressBar) findViewById(R.id.progress_copies);
  760. this.mCopies = (TextView) findViewById(R.id.copies);
  761. this.mPage = (TextView) findViewById(R.id.page);
  762. mProgressPage = (ProgressBar) findViewById(R.id.progress_page);
  763. if (this.sheets > 1) {
  764. TextView textView = this.mPage;
  765. textView.setText(getString(R.string.page) + ": " + this.curSheet + CommonDefine.SLASH + this.sheets);
  766. mProgressPage.setProgress((this.curSheet * 100) / this.sheets);
  767. } else {
  768. mProgressPage.setVisibility(4);
  769. this.mPage.setVisibility(4);
  770. }
  771. if (copies <= 1 || this.isRemotePrinter) {
  772. mProgressCopies.setVisibility(4);
  773. this.mCopies.setVisibility(4);
  774. copies = 1;
  775. } else {
  776. TextView textView2 = this.mCopies;
  777. textView2.setText(getString(R.string.copies) + ": " + this.curCopy + CommonDefine.SLASH + copies);
  778. mProgressCopies.setProgress((this.curCopy * 100) / copies);
  779. }
  780. this.mCancelButton = (Button) findViewById(R.id.cancel_button);
  781. this.mCancelButton.setOnClickListener(new View.OnClickListener() {
  782. public void onClick(View view) {
  783. PrintProgress.this.CancelPrint();
  784. }
  785. });
  786. this.bSearching = false;
  787. if (this.isRemotePrinter) {
  788. this.percentString = getString(R.string.epsonconnect_str_remote_print_file_uploading);
  789. } else {
  790. this.percentString = getString(R.string.printing);
  791. }
  792. TextView textView3 = this.mPercent;
  793. textView3.setText(this.percentString + " 0%");
  794. mProgressPercent.setProgress(0);
  795. if (!this.mProgressParams.getEpsonColorMode()) {
  796. i = 8;
  797. }
  798. findViewById(R.id.epsonColorImageView).setVisibility(i);
  799. if (this.isRemotePrinter) {
  800. this.mHandler.sendEmptyMessage(2);
  801. } else {
  802. Intent intent = new Intent();
  803. intent.setClass(this, ConfirmMultiScr.class);
  804. boolean isPaperLandscape = this.mProgressParams.isPaperLandscape();
  805. int i2 = printSetting.layoutMultiPageValue;
  806. if (i2 == 65536) {
  807. if (isPaperLandscape) {
  808. intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.C2136drawable.multi_2in1p);
  809. } else {
  810. intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.C2136drawable.multi_2in1l);
  811. }
  812. startActivityForResult(intent, 2);
  813. } else if (i2 == 131072) {
  814. if (isPaperLandscape) {
  815. intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.C2136drawable.multi_4in1lz);
  816. } else {
  817. intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.C2136drawable.multi_4in1pz);
  818. }
  819. startActivityForResult(intent, 2);
  820. } else if (i2 != 262144) {
  821. this.mHandler.sendEmptyMessage(6);
  822. } else {
  823. if (isPaperLandscape) {
  824. intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.C2136drawable.multi_4in1ln);
  825. } else {
  826. intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.C2136drawable.multi_4in1pn);
  827. }
  828. startActivityForResult(intent, 2);
  829. }
  830. }
  831. EPLog.m313i("Epson", "printProgress.java: onCreate() finish");
  832. } catch (ClassCastException unused) {
  833. finish();
  834. }
  835. }
  836. private int countSheet(int i, int i2) {
  837. if (i == 65536) {
  838. int i3 = i2 / 2;
  839. return i2 % 2 > 0 ? i3 + 1 : i3;
  840. } else if (i != 131072 && i != 262144) {
  841. return i2;
  842. } else {
  843. int i4 = i2 / 4;
  844. return i2 % 4 > 0 ? i4 + 1 : i4;
  845. }
  846. }
  847. /* access modifiers changed from: private */
  848. public void triggerPrint() {
  849. this.mHandler.sendEmptyMessage(2);
  850. }
  851. /* access modifiers changed from: protected */
  852. public void onDestroy() {
  853. super.onDestroy();
  854. EPLog.m307e("Epson", "PrintProgress.java: onDestroy()call");
  855. EPLog.m307e("Epson", "clearFlags : FLAG_KEEP_SCREEN_ON ");
  856. getWindow().clearFlags(128);
  857. this.mHandler.removeMessages(1);
  858. this.mHandler.removeMessages(3);
  859. this.mHandler.removeMessages(2);
  860. this.mHandler.removeMessages(4);
  861. EPLog.m307e("Epson", "PrintProgress.java: onDestroy() finish");
  862. }
  863. /* access modifiers changed from: protected */
  864. public void onStop() {
  865. super.onStop();
  866. if (mEpsonService == null) {
  867. EPLog.m307e("Epson", "set bRestartactivity = true (2)");
  868. }
  869. }
  870. /* access modifiers changed from: protected */
  871. public void onResume() {
  872. super.onResume();
  873. EPLog.m307e("Epson", "PrintProgress.java call onResume()");
  874. NfcTagUtils.enableForegroundDispatch(this, (IntentFilter[]) null, (String[][]) null);
  875. }
  876. /* access modifiers changed from: protected */
  877. public void onPause() {
  878. super.onPause();
  879. NfcTagUtils.disableForegroundDispatch(this);
  880. }
  881. /* access modifiers changed from: private */
  882. public void setPrintEnd() {
  883. ((IprintApplication) getApplication()).setPrinting(false);
  884. }
  885. private void changePrintProgress() {
  886. if (this.sheets > 1) {
  887. mProgressPage.setVisibility(0);
  888. this.mPage.setVisibility(0);
  889. }
  890. if (copies <= 1 || this.isRemotePrinter) {
  891. this.mCopies.setVisibility(4);
  892. } else {
  893. mProgressCopies.setVisibility(0);
  894. this.mCopies.setVisibility(0);
  895. }
  896. if (this.isRemotePrinter) {
  897. this.percentString = getString(R.string.epsonconnect_str_remote_print_file_uploading);
  898. } else {
  899. this.percentString = getString(R.string.printing);
  900. }
  901. }
  902. private void changeApfProgress() {
  903. mProgressPage.setVisibility(4);
  904. this.mPage.setVisibility(4);
  905. mProgressCopies.setVisibility(4);
  906. mProgressCopies.setVisibility(4);
  907. this.mCopies.setVisibility(4);
  908. this.mPercent.setText(R.string.apf_processing);
  909. this.percentString = getString(R.string.apf_processing);
  910. }
  911. /* access modifiers changed from: private */
  912. public void updatePrintProgress(int i) {
  913. if (!this.mPrintProgressDisplay) {
  914. changePrintProgress();
  915. this.mPrintProgressDisplay = true;
  916. }
  917. if (i >= 100) {
  918. i = 100;
  919. }
  920. if (i <= 0) {
  921. mProgressPercent.setProgress(0);
  922. this.mPercent.setText(this.percentString + " 0%");
  923. if (this.sheets > 1) {
  924. this.mPage.setText(getString(R.string.page) + ": " + this.curSheet + CommonDefine.SLASH + this.sheets);
  925. mProgressPage.setProgress((this.curSheet * 100) / this.sheets);
  926. }
  927. if (copies > 1) {
  928. this.mCopies.setText(getString(R.string.copies) + ": " + this.curCopy + CommonDefine.SLASH + copies);
  929. mProgressCopies.setProgress((this.curCopy * 100) / copies);
  930. }
  931. this.curSheet++;
  932. if (this.curSheet > this.sheets) {
  933. this.curSheet = 1;
  934. this.curCopy++;
  935. return;
  936. }
  937. return;
  938. }
  939. mProgressPercent.setProgress(i);
  940. this.mPercent.setText(this.percentString + " " + i + "%");
  941. }
  942. /* access modifiers changed from: private */
  943. public void updateApfProgress(int i) {
  944. if (!this.mApfProgressDisplay) {
  945. changeApfProgress();
  946. this.mApfProgressDisplay = true;
  947. }
  948. mProgressPercent.setProgress(i);
  949. TextView textView = this.mPercent;
  950. textView.setText(this.percentString + " " + i + "%");
  951. }
  952. /* access modifiers changed from: private */
  953. public void startPrint() throws RemoteException {
  954. this.bSearching = false;
  955. this.mProgressParams.print(mEpsonService, isBkRetry);
  956. }
  957. /* access modifiers changed from: protected */
  958. public Dialog onCreateDialog(int i) {
  959. switch (i) {
  960. case 0:
  961. EPLog.m307e("Epson", "show dialog: " + curError + " cancontinue: " + isContinue);
  962. removeDialog(1);
  963. Integer[] stringId = MediaInfo.ErrorTable.getStringId(curError);
  964. if (stringId == null) {
  965. stringId = new Integer[]{Integer.valueOf(R.string.NOT_IMPLEMENT), Integer.valueOf(R.string.NOT_IMPLEMENT_TITLE), 1};
  966. }
  967. String[] replaceMessage = Utils.replaceMessage(stringId, curError, getApplicationContext());
  968. if (!isContinue) {
  969. EPLog.m307e("Epson", "show str_cancel button");
  970. AlertDialog.Builder negativeButton = new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(replaceMessage[1]).setMessage(replaceMessage[0]).setNegativeButton(getString(R.string.str_cancel), new DialogInterface.OnClickListener() {
  971. public void onClick(DialogInterface dialogInterface, int i) {
  972. try {
  973. PrintProgress.mEpsonService.confirmContinueable(false);
  974. } catch (RemoteException e) {
  975. e.printStackTrace();
  976. }
  977. EPLog.m307e("Epson", "user click str_cancel button");
  978. PrintProgress.curError = 0;
  979. boolean unused = PrintProgress.this.isDialogOpen = false;
  980. PrintProgress.this.removeDialog(0);
  981. PrintProgress.this.mHandler.sendEmptyMessage(5);
  982. }
  983. });
  984. negativeButton.setOnKeyListener(new DialogInterface.OnKeyListener() {
  985. public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
  986. return keyEvent.getKeyCode() == 84;
  987. }
  988. });
  989. return negativeButton.create();
  990. }
  991. AlertDialog.Builder negativeButton2 = new CustomTitleAlertDialogBuilder(this).setTitle((CharSequence) replaceMessage[1]).setMessage(replaceMessage[0]).setCancelable(false).setPositiveButton(getString(R.string.str_continue), new DialogInterface.OnClickListener() {
  992. public void onClick(DialogInterface dialogInterface, int i) {
  993. try {
  994. if (PrintProgress.curError == 109) {
  995. PrintProgress.isBkRetry = true;
  996. PrintProgress.this.triggerPrint();
  997. }
  998. PrintProgress.mEpsonService.confirmContinueable(true);
  999. PrintProgress.curError = 0;
  1000. boolean unused = PrintProgress.this.mError = false;
  1001. } catch (RemoteException e) {
  1002. e.printStackTrace();
  1003. }
  1004. boolean unused2 = PrintProgress.this.isDialogOpen = false;
  1005. PrintProgress.this.removeDialog(0);
  1006. }
  1007. }).setNegativeButton(getString(R.string.str_cancel), new DialogInterface.OnClickListener() {
  1008. public void onClick(DialogInterface dialogInterface, int i) {
  1009. boolean unused = PrintProgress.this.isDialogOpen = false;
  1010. PrintProgress.this.removeDialog(0);
  1011. try {
  1012. PrintProgress.mEpsonService.confirmContinueable(false);
  1013. PrintProgress.curError = 0;
  1014. } catch (RemoteException e) {
  1015. e.printStackTrace();
  1016. }
  1017. boolean unused2 = PrintProgress.this.mWaitEpsonServiceForFinish = true;
  1018. boolean unused3 = PrintProgress.this.mError = true;
  1019. EPLog.m305d("PrintProgress", "cont/cancel dialog. cancel clicked");
  1020. PrintProgress.this.mHandler.sendEmptyMessage(5);
  1021. }
  1022. });
  1023. negativeButton2.setOnKeyListener(new DialogInterface.OnKeyListener() {
  1024. public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
  1025. return keyEvent.getKeyCode() == 84;
  1026. }
  1027. });
  1028. return negativeButton2.create();
  1029. case 1:
  1030. if (this.isDialogOpen) {
  1031. return null;
  1032. }
  1033. AlertDialog.Builder negativeButton3 = new AlertDialog.Builder(this).setTitle((CharSequence) null).setCancelable(false).setMessage(getString(R.string.str_msg_scan_cancel)).setPositiveButton(getString(R.string.str_yes), new DialogInterface.OnClickListener() {
  1034. public void onClick(DialogInterface dialogInterface, int i) {
  1035. PrintProgress.this.mHandler.removeMessages(1);
  1036. try {
  1037. EPLog.m307e("Epson", "user choice cancel print from GUI");
  1038. if ((PrintProgress.mEpsonService != null ? PrintProgress.mEpsonService.confirmCancel(true) : 0) == 0) {
  1039. synchronized (PrintProgress.lockBCancel) {
  1040. EPLog.m307e("Epson", "===> set bCancel = true");
  1041. }
  1042. }
  1043. } catch (RemoteException e) {
  1044. e.printStackTrace();
  1045. }
  1046. PrintProgress.this.removeDialog(1);
  1047. PrintProgress printProgress = PrintProgress.this;
  1048. printProgress.mCanceled = true;
  1049. printProgress.mCancelButton.setVisibility(4);
  1050. PrintProgress.this.mCancelButton.setEnabled(false);
  1051. if (PrintProgress.this.bSearching) {
  1052. PrintProgress.this.mHandler.sendEmptyMessage(5);
  1053. boolean unused = PrintProgress.this.bSearching = false;
  1054. }
  1055. }
  1056. }).setNegativeButton(getString(R.string.str_no), new DialogInterface.OnClickListener() {
  1057. public void onClick(DialogInterface dialogInterface, int i) {
  1058. PrintProgress.this.removeDialog(1);
  1059. }
  1060. });
  1061. negativeButton3.setOnKeyListener(new DialogInterface.OnKeyListener() {
  1062. public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
  1063. return keyEvent.getKeyCode() == 84;
  1064. }
  1065. });
  1066. return negativeButton3.create();
  1067. default:
  1068. return null;
  1069. }
  1070. }
  1071. /* access modifiers changed from: protected */
  1072. public void onActivityResult(int i, int i2, Intent intent) {
  1073. super.onActivityResult(i, i2, intent);
  1074. switch (i) {
  1075. case 1:
  1076. switch (i2) {
  1077. case -1:
  1078. this.mHandler.sendEmptyMessage(10);
  1079. return;
  1080. case 0:
  1081. this.mHandler.sendEmptyMessage(5);
  1082. return;
  1083. default:
  1084. return;
  1085. }
  1086. case 2:
  1087. if (i2 != -1) {
  1088. this.mCanceled = true;
  1089. this.mHandler.sendEmptyMessage(5);
  1090. return;
  1091. }
  1092. this.mHandler.sendEmptyMessage(6);
  1093. return;
  1094. default:
  1095. return;
  1096. }
  1097. }
  1098. /* access modifiers changed from: private */
  1099. public void CancelPrint() {
  1100. try {
  1101. if (mEpsonService != null) {
  1102. mEpsonService.cancelPrint();
  1103. }
  1104. } catch (RemoteException e) {
  1105. e.printStackTrace();
  1106. }
  1107. showDialog(1);
  1108. }
  1109. public void onBackPressed() {
  1110. EPLog.m307e("Epson", "onBackPressed()call");
  1111. }
  1112. public boolean onKeyDown(int i, KeyEvent keyEvent) {
  1113. EPLog.m307e("Epson", "onKeyDown() call");
  1114. if (keyEvent.getAction() != 0 || i != 84) {
  1115. return false;
  1116. }
  1117. EPLog.m307e("Epson", "onKeyDown() KEYCODE_SEARCH key press");
  1118. return true;
  1119. }
  1120. public void showErrorDialog(String str, String str2) {
  1121. new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(str).setMessage(str2).setNegativeButton(getString(R.string.f343ok), new DialogInterface.OnClickListener() {
  1122. public void onClick(DialogInterface dialogInterface, int i) {
  1123. dialogInterface.cancel();
  1124. PrintProgress.this.mHandler.sendEmptyMessage(5);
  1125. }
  1126. }).create().show();
  1127. }
  1128. /* access modifiers changed from: private */
  1129. public void sendPrintLog() {
  1130. Analytics.sendPrintLog(this, this.mProgressParams);
  1131. }
  1132. public static Intent getPdfPrintIntent(Context context2, ProgressParams progressParams) {
  1133. Intent intent = new Intent(context2, PrintProgress.class);
  1134. intent.putExtra("progress-params", progressParams);
  1135. return intent;
  1136. }
  1137. public static Intent getPrintIntent(@NonNull Context context2, @NonNull EPImageList ePImageList, boolean z, boolean z2, @Nullable PrintLog printLog) {
  1138. Intent intent = new Intent(context2, PrintProgress.class);
  1139. intent.putExtra(PARAM_EP_IMAGE_LIST, ePImageList);
  1140. intent.putExtra(PARAM_DOCUMENT_MODE, z);
  1141. intent.putExtra(PARAM_EPSON_COLOR, z2);
  1142. if (printLog != null) {
  1143. intent.putExtra("print_log", printLog);
  1144. }
  1145. return intent;
  1146. }
  1147. private static ProgressParams getParams(Intent intent) {
  1148. ProgressParams progressParams = (ProgressParams) intent.getSerializableExtra("progress-params");
  1149. if (progressParams != null) {
  1150. return progressParams;
  1151. }
  1152. return new PrintProgressParams(intent);
  1153. }
  1154. }