package epson.print.screen; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.IntentFilter; import android.content.ServiceConnection; import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; import com.epson.iprint.prtlogger.Analytics; import com.epson.iprint.prtlogger.PrintLog; import com.epson.mobilephone.common.escpr.MediaInfo; import com.epson.mobilephone.common.wifidirect.NfcTagUtils; import java.io.Serializable; import epson.common.Utils; import epson.print.CommonDefine; import epson.print.EPImageList; import epson.print.IprintApplication; import epson.print.MyPrinter; import epson.print.R; import epson.print.Util.EPLog; import epson.print.service.IEpsonService; import epson.print.service.IEpsonServiceCallback; import epson.print.widgets.CustomTitleAlertDialogBuilder; public class PrintProgress extends Activity implements CommonDefine { private static final int DIALOG_CONFIRM = 1; private static final int DIALOG_INFORM = 0; public static final int END_PRINT = 4; public static final String PARAM_DOCUMENT_MODE = "PRINT_DOCUMENT"; public static final String PARAM_EPSON_COLOR = "epson_color"; public static final String PARAM_EP_IMAGE_LIST = "EPImageList"; public static final String PARAM_PRINT_LOG = "print_log"; public static final String PARAM_PRINT_PROGRESS = "progress-params"; public static final String PREFS_NAME = "PrintSetting"; public static final int RESULT_ERROR = 1000; private static boolean bRestartactivity = false; static int copies = 0; static int curError = 0; static int fileIndex = 0; static boolean isBkRetry = false; static boolean isContinue = false; static boolean isDocument = false; private static final Object lockBCancel = new Object(); private static IEpsonServiceCallback mCallback; private static ServiceConnection mEpsonConnection; private static IEpsonService mEpsonService = null; private static final Object mLock = new Object(); private static final Object mLockInit = new Object(); static ProgressBar mProgressCopies; static ProgressBar mProgressPage; static ProgressBar mProgressPercent; private final int CHECK_PRINTER = 6; private final int CHECK_PRINTER_CONTINUE = 10; private final int CONFIRM = 7; private final int CONFORM_MULTI = 2; private final int CONNECTED_SIMPLEAP = 1; private final int CONTINUE_PRINT = 3; private final int ECC_LIB_ERROR = 9; private final int EPS_DUPLEX_NONE = 0; private final int EPS_JOB_CANCELED = 40; private final int ERROR = 4; private final int FINISH = 5; private final String PERCENT = "PERCENT"; private final int PRINT_NEXT_PAGE = 1; private final int SHOW_COMPLETE_DIALOG = 8; private final int START_PRINT = 2; private final int UPDATE_PERCENT = 0; boolean bCancel = false; private boolean bSearching = false; private boolean bSearchingPrinter = false; private Context context = null; private int curCopy = 1; private int curSheet = 1; int duplex = 0; private boolean isDialogOpen = false; private boolean isRemotePrinter = false; private boolean mApfProgressDisplay; Button mCancelButton; boolean mCanceled = false; TextView mCopies; private volatile boolean mError = false; Handler mHandler = new Handler(new Handler.Callback() { /* JADX WARNING: Can't fix incorrect switch cases order */ /* JADX WARNING: Code restructure failed: missing block: B:40:0x01ec, code lost: 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; */ /* Code decompiled incorrectly, please refer to instructions dump. */ public boolean handleMessage(android.os.Message r10) { /* r9 = this; epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this boolean r0 = r0.mCanceled r1 = 5 r2 = 1 if (r0 == 0) goto L_0x002a int r0 = r10.what if (r0 == r1) goto L_0x0019 r10 = 8 if (r0 == r10) goto L_0x0011 return r2 L_0x0011: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.os.Handler r10 = r10.mHandler r10.sendEmptyMessage(r1) return r2 L_0x0019: epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this android.content.Context r0 = r0.context java.lang.String r3 = "printer" epson.print.screen.PrintProgress r4 = epson.print.screen.PrintProgress.this java.lang.String r4 = r4.printerIp com.epson.mobilephone.common.wifidirect.WiFiDirectManager.disconnect(r0, r3, r4) L_0x002a: epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this boolean r0 = r0.isFinishing() r3 = 4 r4 = 2 if (r0 == 0) goto L_0x0041 int r0 = r10.what if (r0 == 0) goto L_0x0040 if (r0 == r4) goto L_0x0040 if (r0 == r3) goto L_0x0040 switch(r0) { case 6: goto L_0x0040; case 7: goto L_0x0040; case 8: goto L_0x0040; case 9: goto L_0x0040; case 10: goto L_0x0040; default: goto L_0x003f; } L_0x003f: goto L_0x0041 L_0x0040: return r2 L_0x0041: int r0 = r10.what r5 = 100 r7 = 0 switch(r0) { case 0: goto L_0x0429; case 1: goto L_0x0049; case 2: goto L_0x03e1; case 3: goto L_0x0049; case 4: goto L_0x0391; case 5: goto L_0x025d; case 6: goto L_0x01cb; case 7: goto L_0x0049; case 8: goto L_0x016a; case 9: goto L_0x004b; case 10: goto L_0x01f0; default: goto L_0x0049; } L_0x0049: goto L_0x0450 L_0x004b: epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this boolean unused = r0.mError = r2 int r0 = r10.arg1 r1 = -1100(0xfffffffffffffbb4, float:NaN) if (r0 == r1) goto L_0x0151 r1 = -1056(0xfffffffffffffbe0, float:NaN) if (r0 == r1) goto L_0x0105 switch(r0) { case -1209: goto L_0x00c5; case -1208: goto L_0x00c5; default: goto L_0x005d; } L_0x005d: switch(r0) { case -1206: goto L_0x00b1; case -1205: goto L_0x009d; case -1204: goto L_0x0105; case -1203: goto L_0x0089; case -1202: goto L_0x0075; case -1201: goto L_0x0061; case -1200: goto L_0x0105; default: goto L_0x0060; } L_0x0060: return r2 L_0x0061: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r0 = 2131624025(0x7f0e0059, float:1.8875218E38) java.lang.String r10 = r10.getString(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624024(0x7f0e0058, float:1.8875216E38) java.lang.String r0 = r0.getString(r1) goto L_0x0163 L_0x0075: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r0 = 2131624028(0x7f0e005c, float:1.8875224E38) java.lang.String r10 = r10.getString(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624027(0x7f0e005b, float:1.8875222E38) java.lang.String r0 = r0.getString(r1) goto L_0x0163 L_0x0089: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r0 = 2131624023(0x7f0e0057, float:1.8875214E38) java.lang.String r10 = r10.getString(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624022(0x7f0e0056, float:1.8875212E38) java.lang.String r0 = r0.getString(r1) goto L_0x0163 L_0x009d: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r0 = 2131624016(0x7f0e0050, float:1.88752E38) java.lang.String r10 = r10.getString(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624012(0x7f0e004c, float:1.8875192E38) java.lang.String r0 = r0.getString(r1) goto L_0x0163 L_0x00b1: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r0 = 2131624787(0x7f0e0353, float:1.8876764E38) java.lang.String r10 = r10.getString(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624786(0x7f0e0352, float:1.8876762E38) java.lang.String r0 = r0.getString(r1) goto L_0x0163 L_0x00c5: epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624009(0x7f0e0049, float:1.8875186E38) java.lang.String r0 = r0.getString(r1) java.lang.StringBuilder r1 = new java.lang.StringBuilder r1.() epson.print.screen.PrintProgress r3 = epson.print.screen.PrintProgress.this r4 = 2131624007(0x7f0e0047, float:1.8875182E38) java.lang.String r3 = r3.getString(r4) r1.append(r3) java.lang.String r3 = "0X" r1.append(r3) int r10 = r10.arg1 java.lang.String r10 = java.lang.Integer.toHexString(r10) java.lang.String r10 = r10.toUpperCase() r1.append(r10) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r3 = 2131624008(0x7f0e0048, float:1.8875184E38) java.lang.String r10 = r10.getString(r3) r1.append(r10) java.lang.String r10 = r1.toString() r8 = r0 r0 = r10 r10 = r8 goto L_0x0163 L_0x0105: epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624021(0x7f0e0055, float:1.887521E38) java.lang.String r0 = r0.getString(r1) java.lang.StringBuilder r1 = new java.lang.StringBuilder r1.() epson.print.screen.PrintProgress r3 = epson.print.screen.PrintProgress.this r4 = 2131624020(0x7f0e0054, float:1.8875208E38) java.lang.String r3 = r3.getString(r4) r1.append(r3) epson.print.screen.PrintProgress r3 = epson.print.screen.PrintProgress.this r4 = 2131624018(0x7f0e0052, float:1.8875204E38) java.lang.String r3 = r3.getString(r4) r1.append(r3) java.lang.String r3 = "0X" r1.append(r3) int r10 = r10.arg1 java.lang.String r10 = java.lang.Integer.toHexString(r10) java.lang.String r10 = r10.toUpperCase() r1.append(r10) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r3 = 2131624019(0x7f0e0053, float:1.8875206E38) java.lang.String r10 = r10.getString(r3) r1.append(r10) java.lang.String r10 = r1.toString() r8 = r0 r0 = r10 r10 = r8 goto L_0x0163 L_0x0151: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r0 = 2131624032(0x7f0e0060, float:1.8875232E38) java.lang.String r10 = r10.getString(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131624031(0x7f0e005f, float:1.887523E38) java.lang.String r0 = r0.getString(r1) L_0x0163: epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this r1.showErrorDialog(r10, r0) goto L_0x0450 L_0x016a: android.app.AlertDialog$Builder r10 = new android.app.AlertDialog$Builder epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this android.content.Context r0 = r0.context r10.(r0) android.app.AlertDialog$Builder r10 = r10.setCancelable(r7) java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this r3 = 2131624796(0x7f0e035c, float:1.8876782E38) java.lang.String r1 = r1.getString(r3) r0.append(r1) java.lang.String r1 = "\n" r0.append(r1) epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this r3 = 2131624797(0x7f0e035d, float:1.8876784E38) java.lang.String r1 = r1.getString(r3) r0.append(r1) java.lang.String r1 = "\n\n" r0.append(r1) epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this r3 = 2131624798(0x7f0e035e, float:1.8876786E38) java.lang.String r1 = r1.getString(r3) r0.append(r1) java.lang.String r0 = r0.toString() android.app.AlertDialog$Builder r10 = r10.setMessage(r0) epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this r1 = 2131625202(0x7f0e04f2, float:1.8877605E38) java.lang.String r0 = r0.getString(r1) epson.print.screen.PrintProgress$4$1 r1 = new epson.print.screen.PrintProgress$4$1 r1.() android.app.AlertDialog$Builder r10 = r10.setPositiveButton(r0, r1) r10.show() goto L_0x0450 L_0x01cb: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this int unused = r10.curSheet = r2 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this int unused = r10.curCopy = r2 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.content.Context r10 = r10.context java.lang.String r0 = "printer" boolean r10 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.isNeedConnect(r10, r0) if (r10 != 0) goto L_0x01e4 goto L_0x01f0 L_0x01e4: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this java.lang.String r0 = "printer" boolean r10 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.reconnect(r10, r0, r2) if (r10 == 0) goto L_0x01f0 goto L_0x0450 L_0x01f0: epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService if (r10 == 0) goto L_0x0252 java.lang.String r10 = "Epson" java.lang.String r0 = "begin probe printer before printing" epson.print.Util.EPLog.e((java.lang.String) r10, (java.lang.String) r0) // Catch:{ RemoteException -> 0x024c } epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c } epson.print.MyPrinter r10 = epson.print.MyPrinter.getCurPrinter(r10) // Catch:{ RemoteException -> 0x024c } java.lang.String r0 = r10.getPrinterId() // Catch:{ RemoteException -> 0x024c } java.lang.String r1 = r10.getIp() // Catch:{ RemoteException -> 0x024c } if (r0 == 0) goto L_0x0221 int r5 = r10.getLocation() // Catch:{ RemoteException -> 0x024c } if (r5 != r2) goto L_0x0221 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c } boolean unused = r10.bSearching = r2 // Catch:{ RemoteException -> 0x024c } epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x024c } r10.searchPrinters(r0, r1, r2) // Catch:{ RemoteException -> 0x024c } goto L_0x0450 L_0x0221: if (r1 == 0) goto L_0x0238 int r10 = r10.getLocation() // Catch:{ RemoteException -> 0x024c } r5 = 3 if (r10 != r5) goto L_0x0238 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c } boolean unused = r10.bSearching = r2 // Catch:{ RemoteException -> 0x024c } epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x024c } r10.searchPrinters(r0, r1, r4) // Catch:{ RemoteException -> 0x024c } goto L_0x0450 L_0x0238: epson.print.screen.PrintProgress.isContinue = r7 // Catch:{ RemoteException -> 0x024c } r10 = -1351(0xfffffffffffffab9, float:NaN) epson.print.screen.PrintProgress.curError = r10 // Catch:{ RemoteException -> 0x024c } epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c } boolean unused = r10.mError = r2 // Catch:{ RemoteException -> 0x024c } epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x024c } android.os.Handler r10 = r10.mHandler // Catch:{ RemoteException -> 0x024c } r10.sendEmptyMessage(r3) // Catch:{ RemoteException -> 0x024c } goto L_0x0450 L_0x024c: r10 = move-exception r10.printStackTrace() goto L_0x0450 L_0x0252: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.os.Handler r10 = r10.mHandler r0 = 10 r10.sendEmptyMessageDelayed(r0, r5) goto L_0x0450 L_0x025d: java.lang.String r10 = "PrintProgress" java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() java.lang.String r4 = "message FINISH : mError => " r0.append(r4) epson.print.screen.PrintProgress r4 = epson.print.screen.PrintProgress.this boolean r4 = r4.mError r0.append(r4) java.lang.String r4 = " mCanceled =>" r0.append(r4) epson.print.screen.PrintProgress r4 = epson.print.screen.PrintProgress.this boolean r4 = r4.mCanceled r0.append(r4) java.lang.String r0 = r0.toString() epson.print.Util.EPLog.d(r10, r0) epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService if (r10 == 0) goto L_0x032b java.lang.Object r10 = epson.print.screen.PrintProgress.mLock // Catch:{ RemoteException -> 0x02fd } monitor-enter(r10) // Catch:{ RemoteException -> 0x02fd } epson.print.screen.PrintProgress r0 = epson.print.screen.PrintProgress.this // Catch:{ all -> 0x02fa } boolean r0 = r0.bSearchingPrinter // Catch:{ all -> 0x02fa } if (r0 == 0) goto L_0x02b8 boolean r0 = epson.print.screen.PrintProgress.bRestartactivity // Catch:{ all -> 0x02fa } if (r0 != 0) goto L_0x02b8 epson.print.service.IEpsonService r0 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ all -> 0x02fa } boolean r0 = r0.isSearchingPrinter() // Catch:{ all -> 0x02fa } if (r0 == 0) goto L_0x02b8 java.lang.String r0 = "PrintProgress" java.lang.String r4 = "message FINISH: mEpsonService.cancelSearchPrinter()" epson.print.Util.EPLog.e((java.lang.String) r0, (java.lang.String) r4) // Catch:{ all -> 0x02fa } epson.print.service.IEpsonService r0 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ all -> 0x02fa } r0.cancelSearchPrinter() // Catch:{ all -> 0x02fa } r0 = 1 goto L_0x02b9 L_0x02b8: r0 = 0 L_0x02b9: monitor-exit(r10) // Catch:{ all -> 0x02fa } epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x02fd } if (r10 == 0) goto L_0x02df epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x02fd } boolean r10 = r10.isPrinting() // Catch:{ RemoteException -> 0x02fd } if (r10 == 0) goto L_0x02df boolean r10 = epson.print.screen.PrintProgress.bRestartactivity // Catch:{ RemoteException -> 0x02fd } if (r10 != 0) goto L_0x02df java.lang.String r10 = "PrintProgress" java.lang.String r0 = "message FINISH: mEpsonService.confirmCancel(true) call" epson.print.Util.EPLog.d(r10, r0) // Catch:{ RemoteException -> 0x02fd } epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x02fd } r10.confirmCancel(r2) // Catch:{ RemoteException -> 0x02fd } r0 = 1 L_0x02df: if (r0 == 0) goto L_0x0301 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x02fd } boolean r10 = r10.mWaitEpsonServiceForFinish // Catch:{ RemoteException -> 0x02fd } if (r10 == 0) goto L_0x0301 java.lang.String r10 = "PrintProgress" java.lang.String r0 = "on message FINISH: sendEmptyMessageDelayed(FINISH...)" epson.print.Util.EPLog.d(r10, r0) // Catch:{ RemoteException -> 0x02fd } epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x02fd } android.os.Handler r10 = r10.mHandler // Catch:{ RemoteException -> 0x02fd } r4 = 500(0x1f4, double:2.47E-321) r10.sendEmptyMessageDelayed(r1, r4) // Catch:{ RemoteException -> 0x02fd } return r2 L_0x02fa: r0 = move-exception monitor-exit(r10) // Catch:{ all -> 0x02fa } throw r0 // Catch:{ RemoteException -> 0x02fd } L_0x02fd: r10 = move-exception r10.printStackTrace() L_0x0301: epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x0327 } if (r10 == 0) goto L_0x032b java.lang.String r10 = "PrintProgress" java.lang.String r0 = "message FINISH: mEpsonService.unregisterCallback() call" epson.print.Util.EPLog.e((java.lang.String) r10, (java.lang.String) r0) // Catch:{ RemoteException -> 0x0327 } epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService // Catch:{ RemoteException -> 0x0327 } epson.print.service.IEpsonServiceCallback r0 = epson.print.screen.PrintProgress.mCallback // Catch:{ RemoteException -> 0x0327 } r10.unregisterCallback(r0) // Catch:{ RemoteException -> 0x0327 } epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ RemoteException -> 0x0327 } android.content.ServiceConnection r0 = epson.print.screen.PrintProgress.mEpsonConnection // Catch:{ RemoteException -> 0x0327 } r10.unbindService(r0) // Catch:{ RemoteException -> 0x0327 } r10 = 0 epson.print.service.IEpsonService unused = epson.print.screen.PrintProgress.mEpsonService = r10 // Catch:{ RemoteException -> 0x0327 } goto L_0x032b L_0x0327: r10 = move-exception r10.printStackTrace() L_0x032b: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this boolean r10 = r10.mCanceled if (r10 == 0) goto L_0x0333 r3 = 0 goto L_0x033d L_0x0333: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this boolean r10 = r10.mError if (r10 == 0) goto L_0x033d r3 = 1000(0x3e8, float:1.401E-42) L_0x033d: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.app.Activity r10 = r10.getParent() if (r10 != 0) goto L_0x034b epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.setResult(r3) goto L_0x0354 L_0x034b: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.app.Activity r10 = r10.getParent() r10.setResult(r3) L_0x0354: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this boolean unused = r10.bSearching = r7 java.lang.String r10 = "PrintProgress" java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() java.lang.String r1 = "finish with return code => " r0.append(r1) r0.append(r3) java.lang.String r0 = r0.toString() epson.print.Util.EPLog.d(r10, r0) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.content.Context r10 = r10.context java.lang.String r0 = "printer" epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this java.lang.String r1 = r1.printerIp com.epson.mobilephone.common.wifidirect.WiFiDirectManager.disconnect(r10, r0, r1) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.sendPrintLog() epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.setPrintEnd() epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.finish() goto L_0x0450 L_0x0391: java.lang.String r10 = "Epson" java.lang.String r0 = "NOTIFY ERROR" epson.print.Util.EPLog.e((java.lang.String) r10, (java.lang.String) r0) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this boolean r10 = r10.isDialogOpen if (r10 != 0) goto L_0x03b9 java.lang.String r10 = "Epson" java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() java.lang.String r1 = "Show Error code:" r0.append(r1) int r1 = epson.print.screen.PrintProgress.curError r0.append(r1) java.lang.String r0 = r0.toString() epson.print.Util.EPLog.e((java.lang.String) r10, (java.lang.String) r0) goto L_0x03d6 L_0x03b9: java.lang.String r10 = "Epson" java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() java.lang.String r1 = "Remove and show Error code:" r0.append(r1) int r1 = epson.print.screen.PrintProgress.curError r0.append(r1) java.lang.String r0 = r0.toString() epson.print.Util.EPLog.e((java.lang.String) r10, (java.lang.String) r0) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.removeDialog(r7) L_0x03d6: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this boolean unused = r10.isDialogOpen = r2 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.showDialog(r7) goto L_0x0450 L_0x03e1: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this boolean unused = r10.mError = r7 epson.print.service.IEpsonService r10 = epson.print.screen.PrintProgress.mEpsonService if (r10 == 0) goto L_0x03f7 epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this // Catch:{ Exception -> 0x03f2 } r10.startPrint() // Catch:{ Exception -> 0x03f2 } goto L_0x0450 L_0x03f2: r10 = move-exception r10.printStackTrace() goto L_0x0450 L_0x03f7: java.lang.String r10 = "Epson" java.lang.String r0 = "Service or resource file not ready, please wait..." epson.print.Util.EPLog.i(r10, r0) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.widget.TextView r10 = r10.mPercent java.lang.StringBuilder r0 = new java.lang.StringBuilder r0.() epson.print.screen.PrintProgress r1 = epson.print.screen.PrintProgress.this java.lang.String r1 = r1.percentString r0.append(r1) java.lang.String r1 = " 0%" r0.append(r1) java.lang.String r0 = r0.toString() r10.setText(r0) android.widget.ProgressBar r10 = epson.print.screen.PrintProgress.mProgressPercent r10.setProgress(r7) epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this android.os.Handler r10 = r10.mHandler r10.sendEmptyMessageDelayed(r4, r5) goto L_0x0450 L_0x0429: int r0 = r10.arg2 int r10 = r10.arg1 java.lang.StringBuilder r1 = new java.lang.StringBuilder r1.() java.lang.String r3 = "UPDATE_PERCENT " r1.append(r3) r1.append(r0) java.lang.String r1 = r1.toString() epson.print.Util.EPLog.m304d(r1) switch(r10) { case 1: goto L_0x044b; case 2: goto L_0x0445; default: goto L_0x0444; } L_0x0444: goto L_0x0450 L_0x0445: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.updateApfProgress(r0) goto L_0x0450 L_0x044b: epson.print.screen.PrintProgress r10 = epson.print.screen.PrintProgress.this r10.updatePrintProgress(r0) L_0x0450: return r2 */ throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.PrintProgress.C23254.handleMessage(android.os.Message):boolean"); } }); TextView mPage; TextView mPercent; private boolean mPrintProgressDisplay; private ProgressParams mProgressParams; private volatile boolean mWaitEpsonServiceForFinish = false; private String percentString = ""; private String printerIp; private int sheets; public interface ProgressParams extends Serializable { boolean getApfMode(); boolean getEpsonColorMode(); int getOriginalSheetSize(); PrintLog getPrintLog(); PrintSetting getPrintSetting(Context context); PrintSetting.Kind getPrintSettingType(); boolean isPaperLandscape(); boolean print(IEpsonService iEpsonService, boolean z) throws RemoteException; } public static boolean isPrintSuccess(int i) { return i == 4; } /* JADX WARNING: Code restructure failed: missing block: B:10:0x000e, code lost: epson.print.Util.EPLog.e("Epson", "mEpsonService = null"); mCallback = new epson.print.screen.PrintProgress.C23181(r3); mEpsonConnection = new epson.print.screen.PrintProgress.C23232(r3); epson.print.Util.EPLog.e("Epson", "bindService() call"); bindService(new android.content.Intent(r3, epson.print.service.EpsonService.class), mEpsonConnection, 1); epson.print.Util.EPLog.e("Epson", "bindService() finish"); */ /* JADX WARNING: Code restructure failed: missing block: B:18:?, code lost: return; */ /* JADX WARNING: Code restructure failed: missing block: B:19:?, code lost: return; */ /* JADX WARNING: Code restructure failed: missing block: B:9:0x000c, code lost: if (mEpsonService != null) goto L_?; */ /* Code decompiled incorrectly, please refer to instructions dump. */ private void init() { /* r3 = this; java.lang.Object r0 = mLockInit monitor-enter(r0) epson.print.service.IEpsonService r1 = mEpsonService // Catch:{ all -> 0x003f } if (r1 == 0) goto L_0x0009 monitor-exit(r0) // Catch:{ all -> 0x003f } return L_0x0009: monitor-exit(r0) // Catch:{ all -> 0x003f } epson.print.service.IEpsonService r0 = mEpsonService if (r0 != 0) goto L_0x003e java.lang.String r0 = "Epson" java.lang.String r1 = "mEpsonService = null" epson.print.Util.EPLog.e((java.lang.String) r0, (java.lang.String) r1) epson.print.screen.PrintProgress$1 r0 = new epson.print.screen.PrintProgress$1 r0.() mCallback = r0 epson.print.screen.PrintProgress$2 r0 = new epson.print.screen.PrintProgress$2 r0.() mEpsonConnection = r0 java.lang.String r0 = "Epson" java.lang.String r1 = "bindService() call" epson.print.Util.EPLog.e((java.lang.String) r0, (java.lang.String) r1) android.content.Intent r0 = new android.content.Intent java.lang.Class r1 = epson.print.service.EpsonService.class r0.(r3, r1) android.content.ServiceConnection r1 = mEpsonConnection r2 = 1 r3.bindService(r0, r1, r2) java.lang.String r0 = "Epson" java.lang.String r1 = "bindService() finish" epson.print.Util.EPLog.e((java.lang.String) r0, (java.lang.String) r1) L_0x003e: return L_0x003f: r1 = move-exception monitor-exit(r0) // Catch:{ all -> 0x003f } throw r1 */ throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.PrintProgress.init():void"); } protected void onCreate(Bundle bundle) { EPLog.e("Epson", "PrintProgress.java: onCreate() call"); EPLog.e("Epson", "addFlags : FLAG_KEEP_SCREEN_ON "); getWindow().addFlags(128); super.onCreate(bundle); ((IprintApplication) getApplication()).setPrinting(true); Analytics.cleanPrintNumber(this); try { mProgressParams = getParams(getIntent()); int i = 0; Utils.setFInishOnTOuchOutside(this, false); mError = false; curError = 0; mWaitEpsonServiceForFinish = false; synchronized (mLockInit) { EPLog.e("Epson", "PrintProgress.java: onCreate() call init() funciton"); init(); } isDocument = getIntent().getExtras().getBoolean(PARAM_DOCUMENT_MODE, false); PrintSetting printSetting = mProgressParams.getPrintSetting(this); printSetting.loadSettings(); copies = printSetting.copiesValue; duplex = printSetting.duplexValue; sheets = countSheet(printSetting.layoutMultiPageValue, mProgressParams.getOriginalSheetSize()); isRemotePrinter = MyPrinter.isRemotePrinter(this); setContentView(R.layout.progress_layout); context = this; mProgressPercent = (ProgressBar) findViewById(R.id.progress_percent); mPercent = (TextView) findViewById(R.id.percent); mProgressCopies = (ProgressBar) findViewById(R.id.progress_copies); mCopies = (TextView) findViewById(R.id.copies); mPage = (TextView) findViewById(R.id.page); mProgressPage = (ProgressBar) findViewById(R.id.progress_page); if (sheets > 1) { TextView textView = mPage; textView.setText(getString(R.string.page) + ": " + curSheet + CommonDefine.SLASH + sheets); mProgressPage.setProgress((curSheet * 100) / sheets); } else { mProgressPage.setVisibility(4); mPage.setVisibility(4); } if (copies <= 1 || isRemotePrinter) { mProgressCopies.setVisibility(4); mCopies.setVisibility(4); copies = 1; } else { TextView textView2 = mCopies; textView2.setText(getString(R.string.copies) + ": " + curCopy + CommonDefine.SLASH + copies); mProgressCopies.setProgress((curCopy * 100) / copies); } mCancelButton = (Button) findViewById(R.id.cancel_button); mCancelButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { CancelPrint(); } }); bSearching = false; if (isRemotePrinter) { percentString = getString(R.string.epsonconnect_str_remote_print_file_uploading); } else { percentString = getString(R.string.printing); } TextView textView3 = mPercent; textView3.setText(percentString + " 0%"); mProgressPercent.setProgress(0); if (!mProgressParams.getEpsonColorMode()) { i = 8; } findViewById(R.id.epsonColorImageView).setVisibility(i); if (isRemotePrinter) { mHandler.sendEmptyMessage(2); } else { Intent intent = new Intent(); intent.setClass(this, ConfirmMultiScr.class); boolean isPaperLandscape = mProgressParams.isPaperLandscape(); int i2 = printSetting.layoutMultiPageValue; if (i2 == 65536) { if (isPaperLandscape) { intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.drawable.multi_2in1p); } else { intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.drawable.multi_2in1l); } startActivityForResult(intent, 2); } else if (i2 == 131072) { if (isPaperLandscape) { intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.drawable.multi_4in1lz); } else { intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.drawable.multi_4in1pz); } startActivityForResult(intent, 2); } else if (i2 != 262144) { mHandler.sendEmptyMessage(6); } else { if (isPaperLandscape) { intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.drawable.multi_4in1ln); } else { intent.putExtra(ConfirmMultiScr.EXTRA_DRAWABLE_ID, R.drawable.multi_4in1pn); } startActivityForResult(intent, 2); } } EPLog.i("Epson", "printProgress.java: onCreate() finish"); } catch (ClassCastException unused) { finish(); } } private int countSheet(int i, int i2) { if (i == 65536) { int i3 = i2 / 2; return i2 % 2 > 0 ? i3 + 1 : i3; } else if (i != 131072 && i != 262144) { return i2; } else { int i4 = i2 / 4; return i2 % 4 > 0 ? i4 + 1 : i4; } } private void triggerPrint() { mHandler.sendEmptyMessage(2); } protected void onDestroy() { super.onDestroy(); EPLog.e("Epson", "PrintProgress.java: onDestroy()call"); EPLog.e("Epson", "clearFlags : FLAG_KEEP_SCREEN_ON "); getWindow().clearFlags(128); mHandler.removeMessages(1); mHandler.removeMessages(3); mHandler.removeMessages(2); mHandler.removeMessages(4); EPLog.e("Epson", "PrintProgress.java: onDestroy() finish"); } protected void onStop() { super.onStop(); if (mEpsonService == null) { EPLog.e("Epson", "set bRestartactivity = true (2)"); } } protected void onResume() { super.onResume(); EPLog.e("Epson", "PrintProgress.java call onResume()"); NfcTagUtils.enableForegroundDispatch(this, (IntentFilter[]) null, (String[][]) null); } protected void onPause() { super.onPause(); NfcTagUtils.disableForegroundDispatch(this); } private void setPrintEnd() { ((IprintApplication) getApplication()).setPrinting(false); } private void changePrintProgress() { if (sheets > 1) { mProgressPage.setVisibility(0); mPage.setVisibility(0); } if (copies <= 1 || isRemotePrinter) { mCopies.setVisibility(4); } else { mProgressCopies.setVisibility(0); mCopies.setVisibility(0); } if (isRemotePrinter) { percentString = getString(R.string.epsonconnect_str_remote_print_file_uploading); } else { percentString = getString(R.string.printing); } } private void changeApfProgress() { mProgressPage.setVisibility(4); mPage.setVisibility(4); mProgressCopies.setVisibility(4); mProgressCopies.setVisibility(4); mCopies.setVisibility(4); mPercent.setText(R.string.apf_processing); percentString = getString(R.string.apf_processing); } private void updatePrintProgress(int i) { if (!mPrintProgressDisplay) { changePrintProgress(); mPrintProgressDisplay = true; } if (i >= 100) { i = 100; } if (i <= 0) { mProgressPercent.setProgress(0); mPercent.setText(percentString + " 0%"); if (sheets > 1) { mPage.setText(getString(R.string.page) + ": " + curSheet + CommonDefine.SLASH + sheets); mProgressPage.setProgress((curSheet * 100) / sheets); } if (copies > 1) { mCopies.setText(getString(R.string.copies) + ": " + curCopy + CommonDefine.SLASH + copies); mProgressCopies.setProgress((curCopy * 100) / copies); } curSheet++; if (curSheet > sheets) { curSheet = 1; curCopy++; return; } return; } mProgressPercent.setProgress(i); mPercent.setText(percentString + " " + i + "%"); } private void updateApfProgress(int i) { if (!mApfProgressDisplay) { changeApfProgress(); mApfProgressDisplay = true; } mProgressPercent.setProgress(i); TextView textView = mPercent; textView.setText(percentString + " " + i + "%"); } private void startPrint() throws RemoteException { bSearching = false; mProgressParams.print(mEpsonService, isBkRetry); } protected Dialog onCreateDialog(int i) { switch (i) { case 0: EPLog.e("Epson", "show dialog: " + curError + " cancontinue: " + isContinue); removeDialog(1); Integer[] stringId = MediaInfo.ErrorTable.getStringId(curError); if (stringId == null) { stringId = new Integer[]{Integer.valueOf(R.string.NOT_IMPLEMENT), Integer.valueOf(R.string.NOT_IMPLEMENT_TITLE), 1}; } String[] replaceMessage = Utils.replaceMessage(stringId, curError, getApplicationContext()); if (!isContinue) { EPLog.e("Epson", "show str_cancel button"); AlertDialog.Builder negativeButton = new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(replaceMessage[1]).setMessage(replaceMessage[0]).setNegativeButton(getString(R.string.str_cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { try { PrintProgress.mEpsonService.confirmContinueable(false); } catch (RemoteException e) { e.printStackTrace(); } EPLog.e("Epson", "user click str_cancel button"); PrintProgress.curError = 0; boolean unused = isDialogOpen = false; removeDialog(0); mHandler.sendEmptyMessage(5); } }); negativeButton.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { return keyEvent.getKeyCode() == 84; } }); return negativeButton.create(); } AlertDialog.Builder negativeButton2 = new CustomTitleAlertDialogBuilder(this).setTitle((CharSequence) replaceMessage[1]).setMessage(replaceMessage[0]).setCancelable(false).setPositiveButton(getString(R.string.str_continue), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { try { if (PrintProgress.curError == 109) { PrintProgress.isBkRetry = true; triggerPrint(); } PrintProgress.mEpsonService.confirmContinueable(true); PrintProgress.curError = 0; boolean unused = mError = false; } catch (RemoteException e) { e.printStackTrace(); } boolean unused2 = isDialogOpen = false; removeDialog(0); } }).setNegativeButton(getString(R.string.str_cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { boolean unused = isDialogOpen = false; removeDialog(0); try { PrintProgress.mEpsonService.confirmContinueable(false); PrintProgress.curError = 0; } catch (RemoteException e) { e.printStackTrace(); } boolean unused2 = mWaitEpsonServiceForFinish = true; boolean unused3 = mError = true; EPLog.d("PrintProgress", "cont/cancel dialog. cancel clicked"); mHandler.sendEmptyMessage(5); } }); negativeButton2.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { return keyEvent.getKeyCode() == 84; } }); return negativeButton2.create(); case 1: if (isDialogOpen) { return null; } 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() { public void onClick(DialogInterface dialogInterface, int i) { mHandler.removeMessages(1); try { EPLog.e("Epson", "user choice cancel print from GUI"); if ((PrintProgress.mEpsonService != null ? PrintProgress.mEpsonService.confirmCancel(true) : 0) == 0) { synchronized (PrintProgress.lockBCancel) { EPLog.e("Epson", "===> set bCancel = true"); } } } catch (RemoteException e) { e.printStackTrace(); } removeDialog(1); PrintProgress printProgress = PrintProgress.this; printProgress.mCanceled = true; printProgress.mCancelButton.setVisibility(4); mCancelButton.setEnabled(false); if (bSearching) { mHandler.sendEmptyMessage(5); boolean unused = bSearching = false; } } }).setNegativeButton(getString(R.string.str_no), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { removeDialog(1); } }); negativeButton3.setOnKeyListener(new DialogInterface.OnKeyListener() { public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) { return keyEvent.getKeyCode() == 84; } }); return negativeButton3.create(); default: return null; } } protected void onActivityResult(int i, int i2, Intent intent) { super.onActivityResult(i, i2, intent); switch (i) { case 1: switch (i2) { case -1: mHandler.sendEmptyMessage(10); return; case 0: mHandler.sendEmptyMessage(5); return; default: return; } case 2: if (i2 != -1) { mCanceled = true; mHandler.sendEmptyMessage(5); return; } mHandler.sendEmptyMessage(6); return; default: return; } } private void CancelPrint() { try { if (mEpsonService != null) { mEpsonService.cancelPrint(); } } catch (RemoteException e) { e.printStackTrace(); } showDialog(1); } public void onBackPressed() { EPLog.e("Epson", "onBackPressed()call"); } public boolean onKeyDown(int i, KeyEvent keyEvent) { EPLog.e("Epson", "onKeyDown() call"); if (keyEvent.getAction() != 0 || i != 84) { return false; } EPLog.e("Epson", "onKeyDown() KEYCODE_SEARCH key press"); return true; } public void showErrorDialog(String str, String str2) { new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(str).setMessage(str2).setNegativeButton(getString(R.string.f343ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.cancel(); mHandler.sendEmptyMessage(5); } }).create().show(); } private void sendPrintLog() { Analytics.sendPrintLog(this, mProgressParams); } public static Intent getPdfPrintIntent(Context context2, ProgressParams progressParams) { Intent intent = new Intent(context2, PrintProgress.class); intent.putExtra("progress-params", progressParams); return intent; } public static Intent getPrintIntent(@NonNull Context context2, @NonNull EPImageList ePImageList, boolean z, boolean z2, @Nullable PrintLog printLog) { Intent intent = new Intent(context2, PrintProgress.class); intent.putExtra(PARAM_EP_IMAGE_LIST, ePImageList); intent.putExtra(PARAM_DOCUMENT_MODE, z); intent.putExtra(PARAM_EPSON_COLOR, z2); if (printLog != null) { intent.putExtra("print_log", printLog); } return intent; } private static ProgressParams getParams(Intent intent) { ProgressParams progressParams = (ProgressParams) intent.getSerializableExtra("progress-params"); if (progressParams != null) { return progressParams; } return new PrintProgressParams(intent); } }