PrintProgress.java 56 KB

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