SearchPrinterScr.java 65 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281
  1. package epson.print.screen;
  2. import android.app.AlertDialog;
  3. import android.app.Dialog;
  4. import android.content.ComponentName;
  5. import android.content.Context;
  6. import android.content.DialogInterface;
  7. import android.content.Intent;
  8. import android.content.ServiceConnection;
  9. import android.net.Uri;
  10. import android.os.Bundle;
  11. import android.os.Handler;
  12. import android.os.IBinder;
  13. import android.os.Message;
  14. import android.os.RemoteException;
  15. import android.view.ContextMenu;
  16. import android.view.MenuItem;
  17. import android.view.View;
  18. import android.view.ViewGroup;
  19. import android.widget.AdapterView;
  20. import android.widget.Button;
  21. import android.widget.ListView;
  22. import android.widget.ProgressBar;
  23. import android.widget.RadioButton;
  24. import android.widget.TextView;
  25. import com.epson.mobilephone.common.EpLog;
  26. import com.epson.mobilephone.common.escpr.MediaInfo;
  27. import com.epson.mobilephone.common.wifidirect.ActivityWiFiDirectStart;
  28. import com.epson.mobilephone.common.wifidirect.ActivityiPrintConnect;
  29. import com.epson.mobilephone.common.wifidirect.MacAddrUtils;
  30. import com.epson.mobilephone.common.wifidirect.SearchWiFiDirectPrinterTask;
  31. import com.epson.mobilephone.common.wifidirect.WiFiControl;
  32. import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
  33. import com.epson.mobilephone.common.wifidirect.WiFiDirectPrinterListUtils;
  34. import com.epson.mobilephone.common.wifidirect.escprLib;
  35. import epson.common.Constants;
  36. import epson.common.Utils;
  37. import epson.maintain.activity.PrinterNotFoundDialogCreator;
  38. import epson.print.ActivityIACommon;
  39. import epson.print.R;
  40. import epson.print.CommonDefine;
  41. import epson.print.CustomLayoutDialogFragment;
  42. import epson.print.CustomTitleDialogFragment;
  43. import epson.print.MyPrinter;
  44. import epson.print.Util.EPLog;
  45. import epson.print.service.EpsonService;
  46. import epson.print.service.IEpsonService;
  47. import epson.print.service.IEpsonServiceCallback;
  48. import epson.print.widgets.AbstractListBuilder;
  49. import epson.print.widgets.CustomTitleAlertDialogBuilder;
  50. import epson.print.widgets.ListControlHelper;
  51. import epson.print.widgets.PrinterInfoBuilder;
  52. import epson.print.widgets.PrinterInfoECBuilder;
  53. import epson.print.widgets.PrinterInfoIpBuilder;
  54. import java.util.ArrayList;
  55. import java.util.Locale;
  56. public class SearchPrinterScr extends ActivityIACommon implements CustomTitleDialogFragment.Callback {
  57. private static final int DELAY = 100;
  58. private static final int DIALOG_ID_PRINTER_NOT_FOUND_WITH_WEB_GUIDANCE = 1;
  59. private static final int DIALOG_INFORM = 0;
  60. private static final String DIALOG_TAG_PRINTER_NOT_FOUND = "printer_not_found_dialog";
  61. private static final String EXTRA_PRINTER = "myprinter";
  62. private static final String EXTRA_SIMPLEAP = "simpleap";
  63. private static final int Menu_Delete = 1;
  64. private static final int Menu_Edit = 2;
  65. private static final String TAG = "SearchPrinterScr";
  66. /* access modifiers changed from: private */
  67. public static boolean foundPrinter = false;
  68. /* access modifiers changed from: private */
  69. public static final Object mLock = new Object();
  70. private final int CANCEL_FIND_PRINTER = 2;
  71. private final int CONNECT_SIMPLEAP = 10;
  72. private final int DELETE_PRINTER = 7;
  73. private final int EDIT_IPPRINTER = 11;
  74. private final int EDIT_PRINTER = 8;
  75. private final int FOUND_SIMPLEAP = 9;
  76. private final int INFORM_DIALOG = 5;
  77. private final String PRINTER_COMMON_DEVICENAME = "common_devicename";
  78. private final String PRINTER_ID = "id";
  79. private final String PRINTER_IP = escprLib.PRINTER_IP;
  80. private final String PRINTER_NAME = "name";
  81. private final String PRINTER_SERIAL_NO = escprLib.PRINTER_SERIAL_NO;
  82. private final int PROBE_PRINTER = 12;
  83. private final int SEARCH_PRINTER = 1;
  84. private final int SEARCH_PRINTER_P2P = 14;
  85. private final int SELECT_PRINTER = 4;
  86. private final int SHOW_PRINTER_NOT_FOUND_DIALOG = 13;
  87. private final int UPDATE_PRINTER = 3;
  88. private boolean bCheckWiFiStatus = false;
  89. private String connectionInfo = null;
  90. int curError;
  91. ListControlHelper helper = null;
  92. /* access modifiers changed from: private */
  93. public boolean isDialogOpen = false;
  94. /* access modifiers changed from: private */
  95. public volatile boolean isFinishSearchPrinter = true;
  96. /* access modifiers changed from: private */
  97. public Boolean isFocused = true;
  98. private boolean isJapaneseLocale = false;
  99. /* access modifiers changed from: private */
  100. public volatile boolean isSearchSimpleAp = false;
  101. private AdapterView.AdapterContextMenuInfo listItemIndex;
  102. View mAboutRemoteButton;
  103. private boolean mActivityForegroundLifetime;
  104. Button mAddButton;
  105. AbstractListBuilder mBuilder;
  106. /* access modifiers changed from: private */
  107. public IEpsonServiceCallback mCallback = new IEpsonServiceCallback.Stub() {
  108. public void onGetInkState() throws RemoteException {
  109. }
  110. public void onGetStatusState() throws RemoteException {
  111. }
  112. public void onNotifyEndJob(int i) throws RemoteException {
  113. }
  114. public void onNotifyProgress(int i, int i2) throws RemoteException {
  115. }
  116. public void onFindPrinterResult(String str, String str2, String str3, String str4, String str5) throws RemoteException {
  117. EpLog.m77i(str);
  118. int access$200 = SearchPrinterScr.this.printer_location;
  119. if (access$200 == 1) {
  120. Message obtain = Message.obtain();
  121. obtain.what = 3;
  122. Bundle bundle = new Bundle();
  123. bundle.putString("name", str);
  124. bundle.putString(escprLib.PRINTER_IP, str2);
  125. bundle.putString("id", str3);
  126. bundle.putString(escprLib.PRINTER_SERIAL_NO, str4);
  127. bundle.putString("common_devicename", str5);
  128. obtain.setData(bundle);
  129. SearchPrinterScr.this.mHandler.sendMessage(obtain);
  130. } else if (access$200 == 3) {
  131. MyPrinter unused = SearchPrinterScr.this.probedPrinter = new MyPrinter(str, str2, str3, str4);
  132. }
  133. }
  134. public void onNotifyContinueable(int i) throws RemoteException {
  135. if (SearchPrinterScr.this.progress != null && SearchPrinterScr.this.progress.isShowing()) {
  136. SearchPrinterScr.this.progress.dismiss();
  137. }
  138. if (SearchPrinterScr.this.selectedPrinter != null && SearchPrinterScr.this.probedPrinter != null && SearchPrinterScr.this.printer_location == 3) {
  139. if (SearchPrinterScr.this.probedPrinter.getPrinterId().equals(SearchPrinterScr.this.selectedPrinter.getPrinterId())) {
  140. Message obtainMessage = SearchPrinterScr.this.mHandler.obtainMessage();
  141. obtainMessage.what = 4;
  142. obtainMessage.obj = SearchPrinterScr.this.selectedPrinter;
  143. SearchPrinterScr.this.mHandler.sendMessage(obtainMessage);
  144. return;
  145. }
  146. SearchPrinterScr searchPrinterScr = SearchPrinterScr.this;
  147. searchPrinterScr.curError = -500001;
  148. searchPrinterScr.mHandler.sendEmptyMessage(5);
  149. }
  150. }
  151. public void onNotifyError(int i, int i2, boolean z) throws RemoteException {
  152. if (!SearchPrinterScr.this.isSearchSimpleAp) {
  153. synchronized (SearchPrinterScr.mLock) {
  154. boolean unused = SearchPrinterScr.foundPrinter = Utils.getPrefBoolean(SearchPrinterScr.this.getApplicationContext(), "PrintSetting", CommonDefine.RE_SEARCH);
  155. if ((i2 == -1300 || i2 == -1351) && !SearchPrinterScr.foundPrinter) {
  156. i2 = -1100;
  157. } else if ((i2 == -1300 || i2 == -1351 || i2 == -1100) && SearchPrinterScr.foundPrinter) {
  158. i2 = -11001;
  159. }
  160. }
  161. SearchPrinterScr searchPrinterScr = SearchPrinterScr.this;
  162. searchPrinterScr.curError = i2;
  163. searchPrinterScr.mHandler.sendEmptyMessage(13);
  164. if (SearchPrinterScr.this.progress != null && SearchPrinterScr.this.progress.isShowing()) {
  165. SearchPrinterScr.this.progress.dismiss();
  166. }
  167. Boolean unused2 = SearchPrinterScr.this.isFocused = true;
  168. }
  169. }
  170. };
  171. /* access modifiers changed from: private */
  172. public Context mContext = null;
  173. /* access modifiers changed from: private */
  174. public int mDeletePos = -1;
  175. private ServiceConnection mEpsonConnection = new ServiceConnection() {
  176. public void onServiceDisconnected(ComponentName componentName) {
  177. try {
  178. SearchPrinterScr.this.mEpsonService.unregisterCallback(SearchPrinterScr.this.mCallback);
  179. } catch (RemoteException e) {
  180. e.printStackTrace();
  181. }
  182. IEpsonService unused = SearchPrinterScr.this.mEpsonService = null;
  183. }
  184. public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
  185. IEpsonService unused = SearchPrinterScr.this.mEpsonService = IEpsonService.Stub.asInterface(iBinder);
  186. if (SearchPrinterScr.this.mEpsonService != null) {
  187. try {
  188. SearchPrinterScr.this.mEpsonService.registerCallback(SearchPrinterScr.this.mCallback);
  189. } catch (RemoteException e) {
  190. e.printStackTrace();
  191. }
  192. }
  193. }
  194. };
  195. /* access modifiers changed from: private */
  196. public IEpsonService mEpsonService = null;
  197. Handler mHandler = new Handler(new Handler.Callback() {
  198. /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v46, resolved type: java.lang.Object} */
  199. /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r2v22, resolved type: epson.print.MyPrinter} */
  200. /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r10v60, resolved type: java.lang.Object} */
  201. /* JADX DEBUG: Multi-variable search result rejected for TypeSearchVarInfo{r2v29, resolved type: epson.print.MyPrinter} */
  202. /* JADX WARNING: Multi-variable type inference failed */
  203. /* Code decompiled incorrectly, please refer to instructions dump. */
  204. public boolean handleMessage(android.os.Message r10) {
  205. /*
  206. r9 = this;
  207. int r0 = r10.what
  208. r1 = 8
  209. r2 = 0
  210. r3 = -1
  211. r4 = 0
  212. r5 = 1
  213. switch(r0) {
  214. case 1: goto L_0x036b;
  215. case 2: goto L_0x0365;
  216. case 3: goto L_0x02c1;
  217. case 4: goto L_0x0247;
  218. case 5: goto L_0x0219;
  219. case 6: goto L_0x000b;
  220. case 7: goto L_0x0166;
  221. case 8: goto L_0x0122;
  222. case 9: goto L_0x00c6;
  223. case 10: goto L_0x000b;
  224. case 11: goto L_0x0080;
  225. case 12: goto L_0x0036;
  226. case 13: goto L_0x002b;
  227. case 14: goto L_0x000d;
  228. default: goto L_0x000b;
  229. }
  230. L_0x000b:
  231. goto L_0x0379
  232. L_0x000d:
  233. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  234. android.os.Handler r0 = r10.mHandler
  235. r1 = 9
  236. r2 = 60
  237. com.epson.mobilephone.common.wifidirect.SearchWiFiDirectPrinterTask r0 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.searchWiFiDirectPrinter(r10, r0, r1, r2)
  238. com.epson.mobilephone.common.wifidirect.SearchWiFiDirectPrinterTask unused = r10.searchWiFiDirectPrinter = r0
  239. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  240. com.epson.mobilephone.common.wifidirect.SearchWiFiDirectPrinterTask r10 = r10.searchWiFiDirectPrinter
  241. if (r10 != 0) goto L_0x0379
  242. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  243. boolean unused = r10.isSearchSimpleAp = r4
  244. goto L_0x0379
  245. L_0x002b:
  246. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  247. android.support.v4.app.DialogFragment r0 = r10.getPrinterNotFoundDialog()
  248. r10.showPrinterNotFoundDialog(r0)
  249. goto L_0x0379
  250. L_0x0036:
  251. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  252. java.lang.Object r10 = r10.obj
  253. epson.print.MyPrinter r10 = (epson.print.MyPrinter) r10
  254. epson.print.MyPrinter unused = r0.selectedPrinter = r10
  255. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  256. epson.print.MyPrinter unused = r10.probedPrinter = r2
  257. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  258. epson.print.screen.WorkingDialog r10 = r10.progress
  259. if (r10 != 0) goto L_0x0053
  260. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  261. epson.print.screen.WorkingDialog r0 = new epson.print.screen.WorkingDialog
  262. r0.<init>(r10)
  263. r10.progress = r0
  264. L_0x0053:
  265. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  266. epson.print.screen.WorkingDialog r10 = r10.progress
  267. r10.show()
  268. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this // Catch:{ RemoteException -> 0x007a }
  269. epson.print.service.IEpsonService r10 = r10.mEpsonService // Catch:{ RemoteException -> 0x007a }
  270. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this // Catch:{ RemoteException -> 0x007a }
  271. epson.print.MyPrinter r0 = r0.selectedPrinter // Catch:{ RemoteException -> 0x007a }
  272. java.lang.String r0 = r0.getPrinterId() // Catch:{ RemoteException -> 0x007a }
  273. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this // Catch:{ RemoteException -> 0x007a }
  274. epson.print.MyPrinter r1 = r1.selectedPrinter // Catch:{ RemoteException -> 0x007a }
  275. java.lang.String r1 = r1.getIp() // Catch:{ RemoteException -> 0x007a }
  276. r2 = 2
  277. r10.searchPrinters(r0, r1, r2) // Catch:{ RemoteException -> 0x007a }
  278. goto L_0x0379
  279. L_0x007a:
  280. r10 = move-exception
  281. r10.printStackTrace()
  282. goto L_0x0379
  283. L_0x0080:
  284. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  285. r0.interruptSearch()
  286. java.lang.Object r0 = r10.obj
  287. if (r0 == 0) goto L_0x008e
  288. java.lang.Object r10 = r10.obj
  289. r2 = r10
  290. epson.print.MyPrinter r2 = (epson.print.MyPrinter) r2
  291. L_0x008e:
  292. android.content.Intent r10 = new android.content.Intent
  293. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  294. java.lang.Class<epson.print.screen.ActivityIpPrinterSetting> r1 = epson.print.screen.ActivityIpPrinterSetting.class
  295. r10.<init>(r0, r1)
  296. android.os.Bundle r0 = new android.os.Bundle
  297. r0.<init>()
  298. if (r2 == 0) goto L_0x00ae
  299. java.lang.String r1 = r2.getIp()
  300. if (r1 == 0) goto L_0x00ae
  301. java.lang.String r1 = "PRINTER_KEY"
  302. java.lang.String r2 = r2.getPrinterId()
  303. r0.putString(r1, r2)
  304. goto L_0x00b5
  305. L_0x00ae:
  306. java.lang.String r1 = "PRINTER_IP"
  307. java.lang.String r2 = ""
  308. r0.putString(r1, r2)
  309. L_0x00b5:
  310. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this
  311. int unused = r1.mDeletePos = r3
  312. r10.putExtras(r0)
  313. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  314. r1 = 11
  315. r0.startActivityForResult(r10, r1)
  316. goto L_0x0379
  317. L_0x00c6:
  318. android.os.Bundle r10 = r10.getData()
  319. if (r10 == 0) goto L_0x00f7
  320. boolean r0 = r10.isEmpty()
  321. if (r0 != 0) goto L_0x00f7
  322. java.lang.String r0 = "ssid"
  323. java.lang.String r0 = r10.getString(r0)
  324. java.lang.String r1 = "name"
  325. java.lang.String r1 = r10.getString(r1)
  326. java.lang.String r2 = "addr_infra"
  327. java.lang.String r10 = r10.getString(r2)
  328. if (r1 != 0) goto L_0x00e7
  329. r1 = r0
  330. L_0x00e7:
  331. epson.print.MyPrinter r2 = new epson.print.MyPrinter
  332. java.lang.String r3 = ""
  333. r2.<init>(r1, r0, r10, r3)
  334. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this
  335. com.epson.mobilephone.common.wifidirect.WiFiDirectPrinterListUtils r1 = r1.wiFiDirectPrinterListUtils
  336. r1.addPrinter(r2, r4, r0, r10)
  337. goto L_0x0379
  338. L_0x00f7:
  339. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  340. boolean unused = r10.isSearchSimpleAp = r4
  341. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  342. boolean r10 = r10.isFinishSearchPrinter
  343. if (r10 == 0) goto L_0x0379
  344. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  345. r10.displaySearchResult()
  346. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  347. epson.print.widgets.AbstractListBuilder r10 = r10.mBuilder
  348. java.util.Vector r10 = r10.getData()
  349. int r10 = r10.size()
  350. if (r10 != 0) goto L_0x0379
  351. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  352. android.os.Handler r10 = r10.mHandler
  353. r0 = 13
  354. r10.sendEmptyMessage(r0)
  355. goto L_0x0379
  356. L_0x0122:
  357. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  358. r0.interruptSearch()
  359. java.lang.Object r0 = r10.obj
  360. if (r0 == 0) goto L_0x0130
  361. java.lang.Object r10 = r10.obj
  362. r2 = r10
  363. epson.print.MyPrinter r2 = (epson.print.MyPrinter) r2
  364. L_0x0130:
  365. android.content.Intent r10 = new android.content.Intent
  366. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  367. java.lang.Class<epson.print.screen.ActivityPrinterSetting> r5 = epson.print.screen.ActivityPrinterSetting.class
  368. r10.<init>(r0, r5)
  369. android.os.Bundle r0 = new android.os.Bundle
  370. r0.<init>()
  371. if (r2 == 0) goto L_0x0150
  372. java.lang.String r5 = r2.getEmailAddress()
  373. if (r5 == 0) goto L_0x0150
  374. java.lang.String r5 = "PRINTER_EMAIL_ADDRESS"
  375. java.lang.String r2 = r2.getEmailAddress()
  376. r0.putString(r5, r2)
  377. goto L_0x0157
  378. L_0x0150:
  379. java.lang.String r2 = "PRINTER_EMAIL_ADDRESS"
  380. java.lang.String r5 = ""
  381. r0.putString(r2, r5)
  382. L_0x0157:
  383. epson.print.screen.SearchPrinterScr r2 = epson.print.screen.SearchPrinterScr.this
  384. int unused = r2.mDeletePos = r3
  385. r10.putExtras(r0)
  386. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  387. r0.startActivityForResult(r10, r1)
  388. goto L_0x0379
  389. L_0x0166:
  390. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  391. int r10 = r10.mDeletePos
  392. if (r10 < 0) goto L_0x0379
  393. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  394. int r10 = r10.printer_location
  395. switch(r10) {
  396. case 2: goto L_0x01bc;
  397. case 3: goto L_0x0179;
  398. default: goto L_0x0177;
  399. }
  400. L_0x0177:
  401. goto L_0x01fe
  402. L_0x0179:
  403. epson.print.EPPrinterManager r10 = new epson.print.EPPrinterManager
  404. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  405. android.content.Context r0 = r0.mContext
  406. r10.<init>(r0)
  407. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  408. epson.print.widgets.AbstractListBuilder r0 = r0.mBuilder
  409. java.util.Vector r0 = r0.getData()
  410. epson.print.screen.SearchPrinterScr r2 = epson.print.screen.SearchPrinterScr.this
  411. int r2 = r2.mDeletePos
  412. java.lang.Object r0 = r0.elementAt(r2)
  413. epson.print.MyPrinter r0 = (epson.print.MyPrinter) r0
  414. java.lang.String r0 = r0.getPrinterId()
  415. r10.deleteIpPrinterInfo(r0)
  416. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  417. epson.print.widgets.AbstractListBuilder r10 = r10.mBuilder
  418. android.widget.BaseAdapter r10 = r10.getAdapter()
  419. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  420. epson.print.widgets.AbstractListBuilder r0 = r0.mBuilder
  421. java.util.Vector r0 = r0.getData()
  422. epson.print.screen.SearchPrinterScr r2 = epson.print.screen.SearchPrinterScr.this
  423. int r2 = r2.mDeletePos
  424. r0.remove(r2)
  425. r10.notifyDataSetChanged()
  426. goto L_0x01fe
  427. L_0x01bc:
  428. epson.print.EPPrinterManager r10 = new epson.print.EPPrinterManager
  429. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  430. android.content.Context r0 = r0.mContext
  431. r10.<init>(r0)
  432. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  433. epson.print.widgets.AbstractListBuilder r0 = r0.mBuilder
  434. java.util.Vector r0 = r0.getData()
  435. epson.print.screen.SearchPrinterScr r2 = epson.print.screen.SearchPrinterScr.this
  436. int r2 = r2.mDeletePos
  437. java.lang.Object r0 = r0.elementAt(r2)
  438. epson.print.MyPrinter r0 = (epson.print.MyPrinter) r0
  439. java.lang.String r0 = r0.getEmailAddress()
  440. r10.deleteRemotePrinterInfo(r0)
  441. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  442. epson.print.widgets.AbstractListBuilder r10 = r10.mBuilder
  443. android.widget.BaseAdapter r10 = r10.getAdapter()
  444. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  445. epson.print.widgets.AbstractListBuilder r0 = r0.mBuilder
  446. java.util.Vector r0 = r0.getData()
  447. epson.print.screen.SearchPrinterScr r2 = epson.print.screen.SearchPrinterScr.this
  448. int r2 = r2.mDeletePos
  449. r0.remove(r2)
  450. r10.notifyDataSetChanged()
  451. L_0x01fe:
  452. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  453. r10.displaySearchResult()
  454. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  455. int r10 = r10.printer_location
  456. if (r10 == r5) goto L_0x0212
  457. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  458. android.widget.Button r10 = r10.mSearchButton
  459. r10.setVisibility(r1)
  460. L_0x0212:
  461. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  462. int unused = r10.mDeletePos = r3
  463. goto L_0x0379
  464. L_0x0219:
  465. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  466. boolean r10 = r10.isDialogOpen
  467. if (r10 != 0) goto L_0x0379
  468. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  469. boolean unused = r10.isDialogOpen = r5
  470. java.lang.String r10 = "SearchPrinterScr"
  471. java.lang.StringBuilder r0 = new java.lang.StringBuilder
  472. r0.<init>()
  473. java.lang.String r1 = "mHandler curError = "
  474. r0.append(r1)
  475. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this
  476. int r1 = r1.curError
  477. r0.append(r1)
  478. java.lang.String r0 = r0.toString()
  479. epson.print.Util.EPLog.m313i(r10, r0)
  480. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  481. r10.showDialog(r4)
  482. goto L_0x0379
  483. L_0x0247:
  484. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  485. boolean r0 = r0.isFinishSearchPrinter
  486. if (r0 != 0) goto L_0x0257
  487. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  488. epson.print.service.IEpsonService r0 = r0.mEpsonService
  489. if (r0 != 0) goto L_0x025f
  490. L_0x0257:
  491. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  492. boolean r0 = r0.isSearchSimpleAp
  493. if (r0 == 0) goto L_0x0282
  494. L_0x025f:
  495. java.lang.String r0 = "SearchPrinterScr"
  496. java.lang.String r1 = "cancelSearch for SELECT_PRINTER"
  497. epson.print.Util.EPLog.m313i(r0, r1)
  498. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  499. r0.interruptSearch()
  500. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  501. android.os.Handler r0 = r0.mHandler
  502. int r1 = r10.what
  503. java.lang.Object r10 = r10.obj
  504. android.os.Message r10 = r0.obtainMessage(r1, r10)
  505. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this
  506. android.os.Handler r0 = r0.mHandler
  507. r1 = 200(0xc8, double:9.9E-322)
  508. r0.sendMessageDelayed(r10, r1)
  509. goto L_0x0379
  510. L_0x0282:
  511. java.lang.Object r10 = r10.obj
  512. epson.print.MyPrinter r10 = (epson.print.MyPrinter) r10
  513. android.content.Intent r0 = new android.content.Intent
  514. r0.<init>()
  515. java.lang.String r1 = "myprinter"
  516. r0.putExtra(r1, r10)
  517. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this
  518. int r1 = r1.printer_location
  519. if (r1 != r5) goto L_0x02ae
  520. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this
  521. java.lang.String r10 = r10.getPrinterId()
  522. java.lang.String r10 = com.epson.mobilephone.common.wifidirect.MacAddrUtils.getMacAddressFromPrinterId(r10)
  523. java.lang.String r10 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.getCurConnectInfo(r1, r10)
  524. if (r10 == 0) goto L_0x02b5
  525. java.lang.String r1 = "simpleap"
  526. r0.putExtra(r1, r10)
  527. goto L_0x02b5
  528. L_0x02ae:
  529. java.lang.String r10 = "simpleap"
  530. java.lang.String r1 = ""
  531. r0.putExtra(r10, r1)
  532. L_0x02b5:
  533. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  534. r10.setResult(r3, r0)
  535. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  536. r10.finish()
  537. goto L_0x0379
  538. L_0x02c1:
  539. android.os.Bundle r10 = r10.getData()
  540. java.lang.String r0 = "name"
  541. java.lang.String r0 = r10.getString(r0)
  542. if (r0 == 0) goto L_0x033f
  543. java.lang.String r1 = "FINISH"
  544. boolean r0 = r0.contentEquals(r1)
  545. if (r0 != 0) goto L_0x033f
  546. java.lang.Object r0 = epson.print.screen.SearchPrinterScr.mLock
  547. monitor-enter(r0)
  548. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this // Catch:{ all -> 0x033c }
  549. java.util.ArrayList r1 = r1.printerList // Catch:{ all -> 0x033c }
  550. java.lang.String r2 = "id"
  551. java.lang.String r2 = r10.getString(r2) // Catch:{ all -> 0x033c }
  552. boolean r1 = r1.contains(r2) // Catch:{ all -> 0x033c }
  553. if (r1 == 0) goto L_0x02ef
  554. monitor-exit(r0) // Catch:{ all -> 0x033c }
  555. goto L_0x0379
  556. L_0x02ef:
  557. epson.print.MyPrinter r1 = new epson.print.MyPrinter // Catch:{ all -> 0x033c }
  558. java.lang.String r2 = "name"
  559. java.lang.String r2 = r10.getString(r2) // Catch:{ all -> 0x033c }
  560. java.lang.String r6 = "ip"
  561. java.lang.String r6 = r10.getString(r6) // Catch:{ all -> 0x033c }
  562. java.lang.String r7 = "id"
  563. java.lang.String r7 = r10.getString(r7) // Catch:{ all -> 0x033c }
  564. java.lang.String r8 = "serial_no"
  565. java.lang.String r8 = r10.getString(r8) // Catch:{ all -> 0x033c }
  566. r1.<init>(r2, r6, r7, r8) // Catch:{ all -> 0x033c }
  567. java.lang.String r2 = "common_devicename"
  568. java.lang.String r2 = r10.getString(r2) // Catch:{ all -> 0x033c }
  569. r1.setCommonDeviceName(r2) // Catch:{ all -> 0x033c }
  570. epson.print.screen.SearchPrinterScr r2 = epson.print.screen.SearchPrinterScr.this // Catch:{ all -> 0x033c }
  571. com.epson.mobilephone.common.wifidirect.WiFiDirectPrinterListUtils r2 = r2.wiFiDirectPrinterListUtils // Catch:{ all -> 0x033c }
  572. java.lang.String r6 = r1.getIp() // Catch:{ all -> 0x033c }
  573. java.lang.String r7 = r1.getPrinterId() // Catch:{ all -> 0x033c }
  574. java.lang.String r7 = com.epson.mobilephone.common.wifidirect.MacAddrUtils.getMacAddressFromPrinterId(r7) // Catch:{ all -> 0x033c }
  575. r2.addPrinter(r1, r3, r6, r7) // Catch:{ all -> 0x033c }
  576. epson.print.screen.SearchPrinterScr r1 = epson.print.screen.SearchPrinterScr.this // Catch:{ all -> 0x033c }
  577. java.util.ArrayList r1 = r1.printerList // Catch:{ all -> 0x033c }
  578. java.lang.String r2 = "id"
  579. java.lang.String r10 = r10.getString(r2) // Catch:{ all -> 0x033c }
  580. r1.add(r10) // Catch:{ all -> 0x033c }
  581. boolean unused = epson.print.screen.SearchPrinterScr.foundPrinter = r5 // Catch:{ all -> 0x033c }
  582. monitor-exit(r0) // Catch:{ all -> 0x033c }
  583. goto L_0x0379
  584. L_0x033c:
  585. r10 = move-exception
  586. monitor-exit(r0) // Catch:{ all -> 0x033c }
  587. throw r10
  588. L_0x033f:
  589. java.lang.Object r10 = epson.print.screen.SearchPrinterScr.mLock
  590. monitor-enter(r10)
  591. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this // Catch:{ all -> 0x0362 }
  592. boolean r0 = r0.isFinishSearchPrinter // Catch:{ all -> 0x0362 }
  593. if (r0 == 0) goto L_0x034e
  594. monitor-exit(r10) // Catch:{ all -> 0x0362 }
  595. goto L_0x0379
  596. L_0x034e:
  597. epson.print.screen.SearchPrinterScr r0 = epson.print.screen.SearchPrinterScr.this // Catch:{ all -> 0x0362 }
  598. boolean unused = r0.isFinishSearchPrinter = r5 // Catch:{ all -> 0x0362 }
  599. monitor-exit(r10) // Catch:{ all -> 0x0362 }
  600. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  601. boolean r10 = r10.isSearchSimpleAp
  602. if (r10 != 0) goto L_0x0379
  603. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  604. r10.displaySearchResult()
  605. goto L_0x0379
  606. L_0x0362:
  607. r0 = move-exception
  608. monitor-exit(r10) // Catch:{ all -> 0x0362 }
  609. throw r0
  610. L_0x0365:
  611. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  612. r10.interruptSearch()
  613. goto L_0x0379
  614. L_0x036b:
  615. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  616. int r10 = r10.printer_location
  617. if (r10 == r5) goto L_0x0374
  618. goto L_0x0379
  619. L_0x0374:
  620. epson.print.screen.SearchPrinterScr r10 = epson.print.screen.SearchPrinterScr.this
  621. r10.search()
  622. L_0x0379:
  623. return r4
  624. */
  625. throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.SearchPrinterScr.C234613.handleMessage(android.os.Message):boolean");
  626. }
  627. });
  628. RadioButton mIpButton;
  629. boolean mIsClickSelect = false;
  630. ViewGroup mLayout;
  631. private TextView mListEmptyMessageTextView;
  632. /* access modifiers changed from: private */
  633. public ListView mListView;
  634. RadioButton mLocalButton;
  635. ProgressBar mProgressBar;
  636. RadioButton mRemoteButton;
  637. Button mSearchButton;
  638. TextView mTextDetail;
  639. View mWiFiSettingButton;
  640. private String printerEmailAddress = "";
  641. private String printerId = "";
  642. private String printerKey = "";
  643. /* access modifiers changed from: private */
  644. public ArrayList<String> printerList = new ArrayList<>();
  645. /* access modifiers changed from: private */
  646. public volatile int printer_location = 0;
  647. /* access modifiers changed from: private */
  648. public MyPrinter probedPrinter = null;
  649. WorkingDialog progress;
  650. /* access modifiers changed from: private */
  651. public SearchWiFiDirectPrinterTask searchWiFiDirectPrinter = null;
  652. /* access modifiers changed from: private */
  653. public MyPrinter selectedPrinter = null;
  654. WiFiDirectPrinterListUtils wiFiDirectPrinterListUtils = null;
  655. /* access modifiers changed from: protected */
  656. public void onCreate(Bundle bundle) {
  657. super.onCreate(bundle);
  658. if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.JAPAN.getLanguage()) || Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.JAPANESE.getLanguage())) {
  659. this.isJapaneseLocale = true;
  660. } else {
  661. this.isJapaneseLocale = false;
  662. }
  663. if (this.mEpsonService == null) {
  664. bindService(new Intent(this, EpsonService.class), this.mEpsonConnection, 1);
  665. }
  666. this.mLayout = (ViewGroup) getLayoutInflater().inflate(R.layout.search_printer_layout, (ViewGroup) null);
  667. addWiFiSetupButton();
  668. addAboutRemoteButton();
  669. this.mListEmptyMessageTextView = (TextView) this.mLayout.findViewById(R.id.list_empty_message);
  670. this.mListView = (ListView) this.mLayout.findViewById(16908298);
  671. Intent intent = getIntent();
  672. this.printer_location = intent.getIntExtra(Constants.PRINTER_LOCATION, 1);
  673. if (this.printer_location == 0) {
  674. this.printer_location = 1;
  675. }
  676. switch (this.printer_location) {
  677. case 2:
  678. this.printerEmailAddress = intent.getStringExtra(Constants.PRINTER_EMAIL_ADDRESS);
  679. break;
  680. case 3:
  681. this.printerKey = intent.getStringExtra(Constants.PRINTER_ID);
  682. break;
  683. default:
  684. this.printerId = intent.getStringExtra(Constants.PRINTER_ID);
  685. this.connectionInfo = intent.getStringExtra(EXTRA_SIMPLEAP);
  686. break;
  687. }
  688. buildElements();
  689. setContentView((View) this.mLayout);
  690. this.mContext = this;
  691. this.mIsClickSelect = false;
  692. if (this.printer_location != 1) {
  693. displaySearchResult();
  694. this.mSearchButton.setVisibility(8);
  695. ((TextView) this.mLayout.findViewById(R.id.empty)).setVisibility(8);
  696. }
  697. setNotFoundPrinterButton();
  698. setBleWifiSetupButton();
  699. setActionBar((int) R.string.title_addprint, true);
  700. }
  701. private void setBleWifiSetupButton() {
  702. this.mLayout.findViewById(R.id.ble_wifi_setting).setVisibility(8);
  703. }
  704. private void setNotFoundPrinterButton() {
  705. this.mLayout.findViewById(R.id.not_found_printer_epsonsn).setOnClickListener(new View.OnClickListener() {
  706. public void onClick(View view) {
  707. SearchPrinterScr searchPrinterScr = SearchPrinterScr.this;
  708. searchPrinterScr.startActivity(PrinterNotFoundDialogCreator.getStartIntent(searchPrinterScr.getApplicationContext()));
  709. }
  710. });
  711. }
  712. /* access modifiers changed from: package-private */
  713. public void addWiFiSetupButton() {
  714. this.mWiFiSettingButton = this.mLayout.findViewById(R.id.rlWifiSettings);
  715. if (this.isJapaneseLocale) {
  716. ((TextView) this.mWiFiSettingButton).setText(R.string.str_goto_wifidirect_settings);
  717. } else {
  718. ((TextView) this.mWiFiSettingButton).setText(R.string.str_wifidirect_settings);
  719. }
  720. this.mWiFiSettingButton.setOnClickListener(new View.OnClickListener() {
  721. public void onClick(View view) {
  722. SearchPrinterScr.this.startWifiPrinterSelect();
  723. }
  724. });
  725. }
  726. /* access modifiers changed from: private */
  727. public void startWifiPrinterSelect() {
  728. startActivityForResult(new Intent(this, ActivityWiFiDirectStart.class), 10);
  729. }
  730. /* access modifiers changed from: package-private */
  731. public void addAboutRemoteButton() {
  732. this.mAboutRemoteButton = this.mLayout.findViewById(R.id.AboutRemoteFrame);
  733. this.mAboutRemoteButton.setOnClickListener(new View.OnClickListener() {
  734. public void onClick(View view) {
  735. SearchPrinterScr.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://www.epsonconnect.com/iguide/")));
  736. }
  737. });
  738. }
  739. /* access modifiers changed from: private */
  740. public void buildElements() {
  741. this.mSearchButton = (Button) this.mLayout.findViewById(R.id.function_button);
  742. this.mProgressBar = (ProgressBar) this.mLayout.findViewById(R.id.progress_bar);
  743. this.mAddButton = (Button) this.mLayout.findViewById(R.id.edit_button);
  744. this.mTextDetail = (TextView) this.mLayout.findViewById(R.id.detail);
  745. searchButtonSetEnabled(false);
  746. this.mProgressBar.setVisibility(0);
  747. this.mAddButton.setVisibility(8);
  748. this.mTextDetail.setVisibility(0);
  749. this.mWiFiSettingButton.setVisibility(0);
  750. this.mLocalButton = (RadioButton) this.mLayout.findViewById(R.id.btn_local);
  751. this.mIpButton = (RadioButton) this.mLayout.findViewById(R.id.btn_ip);
  752. this.mRemoteButton = (RadioButton) this.mLayout.findViewById(R.id.btn_remote);
  753. Utils.setDrawble2TextView(this, this.mLocalButton, R.C2136drawable.printer_selector_icon_local);
  754. Utils.setDrawble2TextView(this, this.mIpButton, R.C2136drawable.printer_selector_icon_ip);
  755. Utils.setDrawble2TextView(this, this.mRemoteButton, R.C2136drawable.printer_selector_icon_remote);
  756. TextView textView = null;
  757. switch (this.printer_location) {
  758. case 1:
  759. this.mListView.setEmptyView((View) null);
  760. this.mListEmptyMessageTextView.setText((CharSequence) null);
  761. this.mListEmptyMessageTextView.setVisibility(8);
  762. this.mBuilder = new PrinterInfoBuilder(getBaseContext(), this.mLayout, 0);
  763. this.mBuilder.setResource(WiFiDirectPrinterListUtils.getCurPrinterString(this, this.printerId, this.connectionInfo));
  764. this.helper = new ListControlHelper((PrinterInfoBuilder) this.mBuilder);
  765. this.wiFiDirectPrinterListUtils = new WiFiDirectPrinterListUtils(this, this.mBuilder.getData(), this.helper, this.connectionInfo);
  766. this.mLocalButton.setChecked(true);
  767. this.mTextDetail.setText(R.string.str_detailtext_local);
  768. this.mLayout.findViewById(R.id.not_found_printer_epsonsn).setVisibility(0);
  769. break;
  770. case 2:
  771. this.mAddButton.setVisibility(0);
  772. this.mListEmptyMessageTextView.setText(R.string.printer_list_empty_message);
  773. textView = this.mListEmptyMessageTextView;
  774. this.mBuilder = new PrinterInfoECBuilder(getBaseContext(), this.mLayout);
  775. this.mBuilder.setResource(this.printerEmailAddress);
  776. this.mRemoteButton.setChecked(true);
  777. this.mTextDetail.setText(R.string.str_detailtext_remote);
  778. this.mSearchButton.setVisibility(8);
  779. this.mLayout.findViewById(R.id.not_found_printer_epsonsn).setVisibility(8);
  780. this.mWiFiSettingButton.setVisibility(8);
  781. break;
  782. case 3:
  783. this.mAddButton.setVisibility(0);
  784. this.mListEmptyMessageTextView.setText(R.string.printer_list_empty_message);
  785. textView = this.mListEmptyMessageTextView;
  786. this.mBuilder = new PrinterInfoIpBuilder(getBaseContext(), this.mLayout, 0);
  787. this.mBuilder.setResource(this.printerKey);
  788. this.mIpButton.setChecked(true);
  789. this.mTextDetail.setText(R.string.str_detailtext_ip);
  790. this.mSearchButton.setVisibility(8);
  791. this.mLayout.findViewById(R.id.not_found_printer_epsonsn).setVisibility(8);
  792. this.mWiFiSettingButton.setVisibility(8);
  793. break;
  794. }
  795. this.mBuilder.build();
  796. this.mBuilder.refresh();
  797. this.mListView.setEmptyView(textView);
  798. if (this.printer_location == 2) {
  799. this.mAboutRemoteButton.setVisibility(0);
  800. } else {
  801. this.mAboutRemoteButton.setVisibility(8);
  802. }
  803. this.mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  804. public void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
  805. if (SearchPrinterScr.this.isFocused.booleanValue()) {
  806. Boolean unused = SearchPrinterScr.this.isFocused = false;
  807. SearchPrinterScr searchPrinterScr = SearchPrinterScr.this;
  808. searchPrinterScr.mIsClickSelect = true;
  809. Message obtainMessage = searchPrinterScr.mHandler.obtainMessage();
  810. obtainMessage.obj = SearchPrinterScr.this.mBuilder.getData().elementAt(i);
  811. int access$200 = SearchPrinterScr.this.printer_location;
  812. if (access$200 == 1) {
  813. String ip = ((MyPrinter) obtainMessage.obj).getIp();
  814. if (!WiFiControl.ConnectType.NONE.equals(WiFiDirectManager.getConnectType(SearchPrinterScr.this, ip))) {
  815. SearchPrinterScr.this.interruptSearch();
  816. WiFiDirectManager.connect(SearchPrinterScr.this, ip, 10);
  817. } else {
  818. obtainMessage.what = 4;
  819. }
  820. } else if (access$200 != 3) {
  821. obtainMessage.what = 4;
  822. } else {
  823. obtainMessage.what = 12;
  824. }
  825. SearchPrinterScr.this.mHandler.sendMessageDelayed(obtainMessage, 100);
  826. }
  827. }
  828. });
  829. this.mListView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
  830. public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long j) {
  831. if (SearchPrinterScr.this.printer_location == 1) {
  832. return true;
  833. }
  834. int unused = SearchPrinterScr.this.mDeletePos = i;
  835. SearchPrinterScr searchPrinterScr = SearchPrinterScr.this;
  836. searchPrinterScr.registerForContextMenu(searchPrinterScr.mListView);
  837. return false;
  838. }
  839. });
  840. this.mAddButton.setOnClickListener(new View.OnClickListener() {
  841. public void onClick(View view) {
  842. switch (SearchPrinterScr.this.printer_location) {
  843. case 2:
  844. if (SearchPrinterScr.this.mBuilder.getData().size() >= 32) {
  845. new AlertDialog.Builder(SearchPrinterScr.this.mContext).setCancelable(false).setTitle(SearchPrinterScr.this.getString(R.string.epsonconnect_err_regist_remote_printer_max_size_title)).setMessage(SearchPrinterScr.this.getString(R.string.epsonconnect_err_regist_remote_printer_max_size)).setPositiveButton(SearchPrinterScr.this.getString(R.string.str_yes), new DialogInterface.OnClickListener() {
  846. public void onClick(DialogInterface dialogInterface, int i) {
  847. }
  848. }).show();
  849. return;
  850. } else if (SearchPrinterScr.this.getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).getBoolean(Constants.ENABLE_SHOW_WARNING, true)) {
  851. AlertDialog.Builder cancelable = new AlertDialog.Builder(SearchPrinterScr.this.mContext).setCancelable(false);
  852. cancelable.setMessage(SearchPrinterScr.this.getString(R.string.epsonconnect_str_remote_print_warning) + "\n\n" + SearchPrinterScr.this.getString(R.string.epsonconnect_str_remote_print_warning2)).setPositiveButton(SearchPrinterScr.this.getString(R.string.str_yes), new DialogInterface.OnClickListener() {
  853. public void onClick(DialogInterface dialogInterface, int i) {
  854. Message message = new Message();
  855. message.what = 8;
  856. message.obj = null;
  857. SearchPrinterScr.this.mHandler.sendMessage(message);
  858. }
  859. }).setNegativeButton(SearchPrinterScr.this.getString(R.string.str_no), new DialogInterface.OnClickListener() {
  860. public void onClick(DialogInterface dialogInterface, int i) {
  861. }
  862. }).show();
  863. return;
  864. } else {
  865. Message message = new Message();
  866. message.what = 8;
  867. message.obj = null;
  868. SearchPrinterScr.this.mHandler.sendMessage(message);
  869. return;
  870. }
  871. case 3:
  872. if (SearchPrinterScr.this.mBuilder.getData().size() >= 32) {
  873. new AlertDialog.Builder(SearchPrinterScr.this.mContext).setCancelable(false).setTitle(SearchPrinterScr.this.getString(R.string.epsonconnect_err_regist_remote_printer_max_size_title)).setMessage(SearchPrinterScr.this.getString(R.string.epsonconnect_err_regist_remote_printer_max_size)).setPositiveButton(SearchPrinterScr.this.getString(R.string.str_yes), new DialogInterface.OnClickListener() {
  874. public void onClick(DialogInterface dialogInterface, int i) {
  875. }
  876. }).show();
  877. return;
  878. }
  879. Message message2 = new Message();
  880. message2.what = 11;
  881. message2.obj = null;
  882. SearchPrinterScr.this.mHandler.sendMessage(message2);
  883. return;
  884. default:
  885. return;
  886. }
  887. }
  888. });
  889. this.mSearchButton.setOnClickListener(new View.OnClickListener() {
  890. public void onClick(View view) {
  891. if (SearchPrinterScr.this.printer_location == 1) {
  892. SearchPrinterScr.this.mHandler.sendEmptyMessageDelayed(1, 100);
  893. }
  894. }
  895. });
  896. this.mLocalButton.setOnClickListener(new View.OnClickListener() {
  897. public void onClick(View view) {
  898. if (SearchPrinterScr.this.printer_location != 1) {
  899. SearchPrinterScr.this.mAddButton.setVisibility(8);
  900. ((TextView) SearchPrinterScr.this.mLayout.findViewById(R.id.empty)).setVisibility(0);
  901. SearchPrinterScr.this.interruptSearch();
  902. int unused = SearchPrinterScr.this.printer_location = 1;
  903. SearchPrinterScr.this.buildElements();
  904. SearchPrinterScr.this.mHandler.sendEmptyMessageDelayed(1, 100);
  905. }
  906. }
  907. });
  908. this.mRemoteButton.setOnClickListener(new View.OnClickListener() {
  909. public void onClick(View view) {
  910. if (SearchPrinterScr.this.printer_location != 2) {
  911. int unused = SearchPrinterScr.this.printer_location = 2;
  912. SearchPrinterScr.this.interruptSearch();
  913. ((TextView) SearchPrinterScr.this.mLayout.findViewById(R.id.empty)).setVisibility(8);
  914. SearchPrinterScr.this.mBuilder.refresh();
  915. SearchPrinterScr.this.buildElements();
  916. SearchPrinterScr.this.displaySearchResult();
  917. SearchPrinterScr.this.mSearchButton.setVisibility(8);
  918. }
  919. }
  920. });
  921. this.mIpButton.setOnClickListener(new View.OnClickListener() {
  922. public void onClick(View view) {
  923. if (SearchPrinterScr.this.printer_location != 3) {
  924. int unused = SearchPrinterScr.this.printer_location = 3;
  925. SearchPrinterScr.this.interruptSearch();
  926. ((TextView) SearchPrinterScr.this.mLayout.findViewById(R.id.empty)).setVisibility(8);
  927. SearchPrinterScr.this.mBuilder.refresh();
  928. SearchPrinterScr.this.buildElements();
  929. SearchPrinterScr.this.displaySearchResult();
  930. SearchPrinterScr.this.mSearchButton.setVisibility(8);
  931. }
  932. }
  933. });
  934. }
  935. public void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
  936. super.onCreateContextMenu(contextMenu, view, contextMenuInfo);
  937. contextMenu.setHeaderTitle(R.string.str_edit_bookmark);
  938. contextMenu.add(0, 1, 0, R.string.str_delete);
  939. contextMenu.add(0, 2, 0, R.string.str_edit_bookmark);
  940. }
  941. public boolean onContextItemSelected(MenuItem menuItem) {
  942. this.listItemIndex = (AdapterView.AdapterContextMenuInfo) menuItem.getMenuInfo();
  943. if (this.listItemIndex == null) {
  944. return true;
  945. }
  946. switch (menuItem.getItemId()) {
  947. case 1:
  948. new AlertDialog.Builder(this.mContext).setCancelable(false).setTitle(getString(R.string.delete_file)).setIcon(getResources().getDrawable(R.C2136drawable.delete_file)).setNegativeButton(getString(R.string.str_ok), new DialogInterface.OnClickListener() {
  949. public void onClick(DialogInterface dialogInterface, int i) {
  950. Message obtainMessage = SearchPrinterScr.this.mHandler.obtainMessage();
  951. obtainMessage.what = 7;
  952. SearchPrinterScr.this.mHandler.sendMessageDelayed(obtainMessage, 100);
  953. }
  954. }).setPositiveButton(getString(R.string.str_cancel), new DialogInterface.OnClickListener() {
  955. public void onClick(DialogInterface dialogInterface, int i) {
  956. }
  957. }).show();
  958. break;
  959. case 2:
  960. Message message = new Message();
  961. switch (this.printer_location) {
  962. case 2:
  963. message.what = 8;
  964. break;
  965. case 3:
  966. message.what = 11;
  967. break;
  968. }
  969. message.obj = this.mBuilder.getData().elementAt(this.mDeletePos);
  970. this.mHandler.sendMessage(message);
  971. break;
  972. }
  973. return true;
  974. }
  975. /* access modifiers changed from: protected */
  976. public void onDestroy() {
  977. this.mBuilder.destructor();
  978. super.onDestroy();
  979. unbindEpsonService();
  980. }
  981. public void onBackPressed() {
  982. super.onBackPressed();
  983. interruptSearch();
  984. finish();
  985. }
  986. /* access modifiers changed from: protected */
  987. public void onResume() {
  988. super.onResume();
  989. EPLog.m305d(TAG, "onResume()");
  990. this.mActivityForegroundLifetime = true;
  991. dismissPrinterNotFoundDialog();
  992. if (this.printer_location == 1) {
  993. this.mHandler.sendEmptyMessageDelayed(1, 100);
  994. EPLog.m305d(TAG, "Send CHECK_PRINTER Message.");
  995. }
  996. }
  997. /* access modifiers changed from: protected */
  998. public void onPause() {
  999. EPLog.m305d(TAG, "onPause()");
  1000. super.onPause();
  1001. this.mActivityForegroundLifetime = false;
  1002. interruptSearch();
  1003. removeAllDialog();
  1004. }
  1005. /* access modifiers changed from: protected */
  1006. public void onActivityResult(int i, int i2, Intent intent) {
  1007. super.onActivityResult(i, i2, intent);
  1008. interruptSearch();
  1009. switch (i) {
  1010. case 8:
  1011. if (i2 == -1) {
  1012. Intent intent2 = new Intent();
  1013. intent2.putExtra(EXTRA_PRINTER, (MyPrinter) intent.getParcelableExtra(ActivityPrinterSetting.KEY_MYPRINTER));
  1014. setResult(-1, intent2);
  1015. finish();
  1016. return;
  1017. }
  1018. return;
  1019. case 10:
  1020. if (i2 == -1) {
  1021. MyPrinter myPrinter = new MyPrinter(intent.getStringExtra("name"), intent.getStringExtra(escprLib.PRINTER_IP), intent.getStringExtra("id"), intent.getStringExtra(escprLib.PRINTER_SERIAL_NO));
  1022. Intent intent3 = new Intent();
  1023. intent3.putExtra(EXTRA_PRINTER, myPrinter);
  1024. String curConnectInfo = WiFiDirectManager.getCurConnectInfo(this, MacAddrUtils.getMacAddressFromPrinterId(myPrinter.getPrinterId()));
  1025. if (this.printer_location != 1 || curConnectInfo == null) {
  1026. intent3.putExtra(EXTRA_SIMPLEAP, "");
  1027. } else {
  1028. intent3.putExtra(EXTRA_SIMPLEAP, curConnectInfo);
  1029. }
  1030. intent.getBooleanExtra(ActivityiPrintConnect.FINISH_EAYSETUP, false);
  1031. setResult(-1, intent3);
  1032. finish();
  1033. return;
  1034. }
  1035. this.isFocused = true;
  1036. this.mIsClickSelect = false;
  1037. return;
  1038. case 11:
  1039. if (i2 == -1) {
  1040. MyPrinter myPrinter2 = new MyPrinter(intent.getStringExtra(Constants.PRINTER_NAME), intent.getStringExtra(Constants.PRINTER_IP), intent.getStringExtra(Constants.PRINTER_ID), intent.getStringExtra(Constants.PRINTER_SERIAL_NO), "", 3);
  1041. Intent intent4 = new Intent();
  1042. intent4.putExtra(EXTRA_PRINTER, myPrinter2);
  1043. setResult(-1, intent4);
  1044. finish();
  1045. return;
  1046. }
  1047. return;
  1048. default:
  1049. return;
  1050. }
  1051. }
  1052. /* access modifiers changed from: private */
  1053. public void search() {
  1054. interruptSearch();
  1055. synchronized (mLock) {
  1056. this.printerList.clear();
  1057. this.mBuilder.refresh();
  1058. this.wiFiDirectPrinterListUtils.clearPrinterInfoList();
  1059. }
  1060. this.mIsClickSelect = false;
  1061. this.isFinishSearchPrinter = false;
  1062. searchButtonSetEnabled(false);
  1063. this.mProgressBar.setVisibility(0);
  1064. ((TextView) this.mLayout.findViewById(R.id.empty)).setText(getString(R.string.searching_text));
  1065. this.isFocused = true;
  1066. if (WiFiDirectManager.getCurSSID(this) != null) {
  1067. this.mHandler.sendEmptyMessageDelayed(14, 5000);
  1068. this.isSearchSimpleAp = true;
  1069. } else if (WiFiDirectManager.isWifiEnabled(this)) {
  1070. this.mHandler.sendEmptyMessage(14);
  1071. this.isSearchSimpleAp = true;
  1072. } else {
  1073. boolean z = this.bCheckWiFiStatus;
  1074. if (!z && !z) {
  1075. this.bCheckWiFiStatus = true;
  1076. WiFiDirectManager.enableWiFi(this, -1);
  1077. return;
  1078. }
  1079. }
  1080. WiFiDirectManager.setPriorityToSimpleAP(this, true);
  1081. if (this.mEpsonService != null) {
  1082. try {
  1083. synchronized (mLock) {
  1084. this.isFinishSearchPrinter = false;
  1085. }
  1086. this.mEpsonService.searchPrinters((String) null, (String) null, 1);
  1087. } catch (RemoteException e) {
  1088. e.printStackTrace();
  1089. }
  1090. } else {
  1091. this.mHandler.sendEmptyMessageDelayed(1, 100);
  1092. }
  1093. }
  1094. /* access modifiers changed from: private */
  1095. public void interruptSearch() {
  1096. EPLog.m305d(TAG, "interruptSearch()");
  1097. this.mHandler.removeMessages(1);
  1098. this.mHandler.removeMessages(14);
  1099. this.mHandler.removeMessages(3);
  1100. this.mHandler.removeMessages(9);
  1101. this.mHandler.removeMessages(13);
  1102. SearchWiFiDirectPrinterTask searchWiFiDirectPrinterTask = this.searchWiFiDirectPrinter;
  1103. if (searchWiFiDirectPrinterTask != null) {
  1104. searchWiFiDirectPrinterTask.interrupt();
  1105. this.searchWiFiDirectPrinter = null;
  1106. }
  1107. this.isSearchSimpleAp = false;
  1108. IEpsonService iEpsonService = this.mEpsonService;
  1109. if (iEpsonService != null) {
  1110. try {
  1111. iEpsonService.cancelSearchPrinter();
  1112. } catch (RemoteException e) {
  1113. e.printStackTrace();
  1114. }
  1115. }
  1116. WorkingDialog workingDialog = this.progress;
  1117. if (workingDialog != null && workingDialog.isShowing()) {
  1118. this.progress.dismiss();
  1119. }
  1120. this.isFocused = true;
  1121. }
  1122. public void displaySearchResult() {
  1123. if (!this.mIsClickSelect) {
  1124. if (this.mBuilder.getData().size() <= 0) {
  1125. ((TextView) this.mLayout.findViewById(R.id.empty)).setText(getString(R.string.EPS_PRNERR_COMM_TITLE1));
  1126. } else if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.JAPAN.getLanguage()) || Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.JAPANESE.getLanguage())) {
  1127. ((TextView) this.mLayout.findViewById(R.id.empty)).setText(getString(R.string.numberOfPrintersAvailable));
  1128. } else {
  1129. ((TextView) this.mLayout.findViewById(R.id.empty)).setText(String.format(getString(R.string.numberOfPrintersAvailable), new Object[]{Integer.valueOf(this.mBuilder.getData().size())}));
  1130. }
  1131. }
  1132. this.mBuilder.getAdapter().notifyDataSetChanged();
  1133. this.mProgressBar.setVisibility(8);
  1134. searchButtonSetEnabled(true);
  1135. this.isFinishSearchPrinter = true;
  1136. }
  1137. /* access modifiers changed from: private */
  1138. public DialogFragment getPrinterNotFoundDialog() {
  1139. String str;
  1140. boolean prefBoolean = Utils.getPrefBoolean(getApplicationContext(), "PrintSetting", CommonDefine.RE_SEARCH);
  1141. int i = R.string.EPS_PRNERR_COMM_TITLE4;
  1142. if (prefBoolean) {
  1143. this.curError = -11001;
  1144. String ssid = Utils.getSSID(this);
  1145. if (!Utils.isConnectedWifi(this) || ssid == null) {
  1146. return CustomLayoutDialogFragment.newInstance(1, getString(R.string.EPS_PRNERR_COMM4), (int) R.string.EPS_PRNERR_COMM_TITLE4, 0, (int) R.string.str_btn_close);
  1147. }
  1148. str = String.format(getString(R.string.EPS_ERR_PRINTER_NOT_FOUND_RESEARCH2), new Object[]{ssid});
  1149. } else {
  1150. this.curError = -1100;
  1151. i = R.string.EPS_PRNERR_COMM_TITLE1;
  1152. str = getString(R.string.EPS_PRNERR_COMM1);
  1153. }
  1154. return CustomLayoutDialogFragment.newInstance(1, str + "\n\n" + getString(R.string.confirm_browse_wlan_setup_info), i, (int) R.string.browse_site, (int) R.string.str_btn_close);
  1155. }
  1156. /* access modifiers changed from: private */
  1157. public void showPrinterNotFoundDialog(DialogFragment dialogFragment) {
  1158. if (this.mActivityForegroundLifetime) {
  1159. dialogFragment.show(getSupportFragmentManager(), DIALOG_TAG_PRINTER_NOT_FOUND);
  1160. }
  1161. }
  1162. /* access modifiers changed from: protected */
  1163. public Dialog onCreateDialog(int i) {
  1164. if (i != 0) {
  1165. return null;
  1166. }
  1167. EPLog.m313i(TAG, "DIALOG_INFORM curError = " + this.curError);
  1168. int i2 = this.curError;
  1169. if (i2 == -1100 || i2 == -11001) {
  1170. if (Utils.getPrefBoolean(getApplicationContext(), "PrintSetting", CommonDefine.RE_SEARCH)) {
  1171. this.curError = -11001;
  1172. } else {
  1173. this.curError = -1100;
  1174. }
  1175. }
  1176. Integer[] stringId = MediaInfo.ErrorTable.getStringId(this.curError);
  1177. if (stringId == null) {
  1178. stringId = new Integer[]{Integer.valueOf(R.string.NOT_IMPLEMENT), Integer.valueOf(R.string.NOT_IMPLEMENT_TITLE)};
  1179. }
  1180. String string = getString(stringId[0].intValue());
  1181. String ssid = Utils.getSSID(this);
  1182. if (Utils.isConnectedWifi(this) && this.curError == -11001 && ssid != null) {
  1183. string = String.format(getString(R.string.EPS_ERR_PRINTER_NOT_FOUND_RESEARCH), new Object[]{ssid});
  1184. }
  1185. return new CustomTitleAlertDialogBuilder(this).setTitle((CharSequence) getString(stringId[1].intValue())).setMessage(string).setCancelable(false).setNegativeButton(getString(R.string.str_ok), new DialogInterface.OnClickListener() {
  1186. public void onClick(DialogInterface dialogInterface, int i) {
  1187. SearchPrinterScr.this.removeDialog(0);
  1188. boolean unused = SearchPrinterScr.this.isDialogOpen = false;
  1189. }
  1190. }).create();
  1191. }
  1192. private void dismissPrinterNotFoundDialog() {
  1193. DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(DIALOG_TAG_PRINTER_NOT_FOUND);
  1194. if (dialogFragment != null) {
  1195. dialogFragment.dismiss();
  1196. }
  1197. }
  1198. /* access modifiers changed from: package-private */
  1199. /* JADX WARNING: Failed to process nested try/catch */
  1200. /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0004 */
  1201. /* Code decompiled incorrectly, please refer to instructions dump. */
  1202. public void removeAllDialog() {
  1203. /*
  1204. r1 = this;
  1205. r0 = 0
  1206. r1.removeDialog(r0) // Catch:{ IllegalArgumentException -> 0x0004 }
  1207. L_0x0004:
  1208. r1.dismissPrinterNotFoundDialog() // Catch:{ Exception -> 0x0007 }
  1209. L_0x0007:
  1210. return
  1211. */
  1212. throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.SearchPrinterScr.removeAllDialog():void");
  1213. }
  1214. public void searchButtonSetEnabled(boolean z) {
  1215. this.mSearchButton.setVisibility(0);
  1216. if (z) {
  1217. this.mSearchButton.setEnabled(true);
  1218. } else {
  1219. this.mSearchButton.setEnabled(false);
  1220. }
  1221. }
  1222. /* access modifiers changed from: package-private */
  1223. public void unbindEpsonService() {
  1224. if (this.mEpsonService != null) {
  1225. if (!this.isFinishSearchPrinter) {
  1226. this.mHandler.sendEmptyMessageDelayed(2, 200);
  1227. }
  1228. try {
  1229. this.mEpsonService.unregisterCallback(this.mCallback);
  1230. unbindService(this.mEpsonConnection);
  1231. } catch (RemoteException e) {
  1232. e.printStackTrace();
  1233. }
  1234. }
  1235. }
  1236. public void onLocalPositiveCallback(int i) {
  1237. if (i == 1) {
  1238. startActivity(PrinterNotFoundDialogCreator.getStartIntent(this));
  1239. this.isDialogOpen = false;
  1240. }
  1241. }
  1242. public void onLocalNegativeCallback(int i) {
  1243. this.isDialogOpen = false;
  1244. }
  1245. }