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