MaintainActivity.java 96 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899
  1. package epson.maintain.activity;
  2. import android.app.AlertDialog;
  3. import android.app.Dialog;
  4. import android.arch.lifecycle.Observer;
  5. import android.arch.lifecycle.ViewModelProviders;
  6. import android.content.ComponentName;
  7. import android.content.Context;
  8. import android.content.DialogInterface;
  9. import android.content.Intent;
  10. import android.content.ServiceConnection;
  11. import android.content.SharedPreferences;
  12. import android.content.res.Configuration;
  13. import android.content.res.Resources;
  14. import android.graphics.Point;
  15. import android.net.Uri;
  16. import android.os.AsyncTask;
  17. import android.os.Bundle;
  18. import android.os.Handler;
  19. import android.os.IBinder;
  20. import android.os.Message;
  21. import android.os.RemoteException;
  22. import android.support.annotation.ColorRes;
  23. import android.support.p000v4.app.DialogFragment;
  24. import android.support.p000v4.app.FragmentActivity;
  25. import android.support.p000v4.content.ContextCompat;
  26. import android.support.p000v4.view.ViewCompat;
  27. import android.view.Display;
  28. import android.view.LayoutInflater;
  29. import android.view.View;
  30. import android.view.ViewGroup;
  31. import android.widget.Button;
  32. import android.widget.ImageView;
  33. import android.widget.LinearLayout;
  34. import android.widget.RelativeLayout;
  35. import android.widget.Switch;
  36. import android.widget.TextView;
  37. import com.epson.iprint.prtlogger.Analytics;
  38. import com.epson.mobilephone.common.EpLog;
  39. import com.epson.mobilephone.common.escpr.MediaInfo;
  40. import com.epson.mobilephone.common.maintain2.BatteryInfoEx;
  41. import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
  42. import com.epson.mobilephone.common.maintain2.MaintainPrinterInfo2;
  43. import com.epson.mobilephone.common.wifidirect.MacAddrUtils;
  44. import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
  45. import epson.common.Constants;
  46. import epson.common.DialogProgress;
  47. import epson.common.EventWrapper;
  48. import epson.common.IPAddressUtils;
  49. import epson.common.Utils;
  50. import epson.epsonconnectregistration.ActivityECConfiguration;
  51. import epson.maintain.BatteryInfoAdapter;
  52. import epson.print.ActivityIACommon;
  53. import epson.print.R;
  54. import epson.print.CommonDefine;
  55. import epson.print.MyPrinter;
  56. import epson.print.Util.AsyncTaskExecutor;
  57. import epson.print.Util.EPLog;
  58. import epson.print.inkrpln.InkRplnInfoClient;
  59. import epson.print.inkrpln.InkRplnProgressDialog;
  60. import epson.print.inkrpln.InkRplnRepository;
  61. import epson.print.inkrpln.JumpUrlProgressActivity;
  62. import epson.print.screen.WorkingDialog;
  63. import epson.print.service.EpsonService;
  64. import epson.print.service.IEpsonService;
  65. import epson.print.service.IEpsonServiceCallback;
  66. import java.util.Arrays;
  67. public class MaintainActivity extends ActivityIACommon implements View.OnClickListener, MediaInfo {
  68. private static final int CANCEL_LOADCONFIG = 14;
  69. private static final int CLEANING_ERROR = 10;
  70. private static final int DELAY_TIME_MAINTAIN = 10;
  71. private static final String DIALOG_PROGRESS = "dialog_progress";
  72. private static final String DIALOG_TAG_NOZZLE_GUIDANCE = "dialog_nozzle_guidance";
  73. private static final int EC_BUTTON_HIDE = 2;
  74. private static final int EC_BUTTON_INVALID = 1;
  75. private static final int EC_BUTTON_VALID = 0;
  76. private static final int EPS_COMM_BID = 2;
  77. private static final int EPS_ERR_COMM_ERROR = -1100;
  78. private static final int EPS_LANG_ESCPR = 1;
  79. private static final int EPS_MNT_CLEANING = 2;
  80. private static final int EPS_MNT_NOZZLE = 3;
  81. private static final int EPS_PRNERR_CEMPTY = 103;
  82. private static final int EPS_PRNERR_CFAIL = 104;
  83. private static final int EPS_PRNERR_COMM = 102;
  84. private static final int EPS_PRNERR_DISABEL_CLEANING = 108;
  85. private static final int EPS_PRNERR_INKOUT = 6;
  86. private static final String[] GAGA_DEVICE_ID_ARRAY = {"LX-10000F", "LX-7000F", "WF-C20590 Series", "WF-C17590 Series", "LX-10000FK", "LX-10010MF", "WF-M20590 Series", "LX-10050KF", "LX-10050MF", "LX-6050MF", "LX-7550MF", "WF-C20600 Series", "WF-C20750 Series", "WF-C21000 Series"};
  87. private static final int GET_PRINTER_NAME = 8;
  88. private static final int HANDLE_ERROR = 4;
  89. public static final int ITEM_HEIGHT = 40;
  90. private static final int LOGIN_STATUS_COMM_ERROR = -1;
  91. private static final int LOGIN_STATUS_LOGIN_FAILED = -2;
  92. private static final int LOGIN_STATUS_LOGIN_SUCCEEDED = 0;
  93. private static final int MAINTAIN_OK = 1;
  94. private static final int MAINTAIN_START = 0;
  95. private static final int MAX_WAIT_CONNECTING_3G = 10;
  96. private static final int MESSAGE_MAINTENANCE_BOX_INFO = 16;
  97. private static final int NO_PRINTER_NAME = 9;
  98. private static final String PREFS_NAME = "PrintSetting";
  99. private static final int PROBE_ERROR = 7;
  100. private static final String PROBE_RESULT = "PROBE_ERROR";
  101. private static final int REQUEST_CODE_INK_DS_DIALOG = 100;
  102. private static final int REQUEST_CODE_SELECT_PRINTER = 101;
  103. private static final int START_LOADCONFIG = 6;
  104. private static final String TAG = "MAINTAIN";
  105. private static final int UPDATE_BATTERY = 15;
  106. private static final int UPDATE_INK = 3;
  107. private static final int UPDATE_MAINTENANCE_LABEL = 11;
  108. private static final int UPDATE_SELECTED_PRINTER = 5;
  109. private static final int UPDATE_STT = 2;
  110. private static boolean isMessageScreenShowing = false;
  111. private Switch btnToggleAlert;
  112. private Switch btnTogglePreview;
  113. private Dialog customPro;
  114. private int escprSetPrinterSuccessed = -1;
  115. private boolean isGotError = false;
  116. private boolean isKeepSimpleAPConnection = false;
  117. private boolean isRemotePrinter = false;
  118. boolean isResearchScanner = false;
  119. private boolean isTryConnectSimpleAp = false;
  120. private View mAlertMesseageSeparater;
  121. private LinearLayout mAlertMesseageView;
  122. private Thread mBackGround;
  123. private LinearLayout mBuyInkGroup;
  124. private int mBuyInkGroupVisibility;
  125. private View mBuyInkSeparator;
  126. private LinearLayout mBuyInkView;
  127. private IEpsonServiceCallback mCallback = new IEpsonServiceCallback.Stub() {
  128. public void onFindPrinterResult(String str, String str2, String str3, String str4, String str5) throws RemoteException {
  129. }
  130. public void onGetInkState() throws RemoteException {
  131. }
  132. public void onGetStatusState() throws RemoteException {
  133. }
  134. public void onNotifyContinueable(int i) throws RemoteException {
  135. }
  136. public void onNotifyEndJob(int i) throws RemoteException {
  137. }
  138. public void onNotifyError(int i, int i2, boolean z) throws RemoteException {
  139. }
  140. public void onNotifyProgress(int i, int i2) throws RemoteException {
  141. }
  142. };
  143. private LinearLayout mCleanCheckView;
  144. private Context mContext = null;
  145. private Display mDisplay;
  146. private Thread mDoMaintainThread;
  147. private LinearLayout mEpsonConnectView;
  148. private ServiceConnection mEpsonConnection = new ServiceConnection() {
  149. public void onServiceDisconnected(ComponentName componentName) {
  150. try {
  151. MaintainActivity.this.mEpsonService.unregisterCallback(MaintainActivity.this.mCallback);
  152. } catch (RemoteException e) {
  153. e.printStackTrace();
  154. }
  155. IEpsonService unused = MaintainActivity.this.mEpsonService = null;
  156. }
  157. public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
  158. IEpsonService unused = MaintainActivity.this.mEpsonService = IEpsonService.Stub.asInterface(iBinder);
  159. if (MaintainActivity.this.mEpsonService != null) {
  160. try {
  161. MaintainActivity.this.mEpsonService.registerCallback(MaintainActivity.this.mCallback);
  162. } catch (RemoteException e) {
  163. e.printStackTrace();
  164. }
  165. }
  166. }
  167. };
  168. private IEpsonService mEpsonService = null;
  169. private TextView mFWUpdateText;
  170. private LinearLayout mFWUpdateView;
  171. boolean mHavePrinter = false;
  172. private TextView mHeadCleanText;
  173. private LinearLayout mHeadCleanView;
  174. private LinearLayout mInkDsView;
  175. private LinearLayout mInkView;
  176. private volatile boolean mIsCancelProbe = false;
  177. private Boolean mIsNozzleCheckEnable = true;
  178. private volatile boolean mIsStillUpdate = true;
  179. boolean mIsStop = false;
  180. private LinearLayout mLLSerialNo;
  181. private View mLoadConPro;
  182. private Thread mLoadConfigThread;
  183. private TextView mMaintenanceBoxText;
  184. private LinearLayout mMaintenanceBoxView;
  185. private TextView mNozzleCheckText;
  186. private LinearLayout mNozzleCheckView;
  187. private View mOnlineRegistrationSeparator;
  188. private LinearLayout mOnlineRegistrationView;
  189. private View mPrintHistorySeparator;
  190. private LinearLayout mPrintHistoryView;
  191. private LinearLayout mPrintPreviewView;
  192. private MaintainPrinter2 mPrinter = MaintainPrinter2.getInstance();
  193. private View mPrinterSettingSeparator;
  194. private LinearLayout mPrinterSettingView;
  195. private int[] mPrinterStatus;
  196. boolean mStartSearch = false;
  197. private TextView mTextMaintenance;
  198. private TextView mTvPrinterName;
  199. private TextView mTvPrinterStatus;
  200. private TextView mTvPrinterStatusDetail;
  201. private TextView mTvSerialNo;
  202. private Handler mUiHandler = new Handler(new Handler.Callback() {
  203. public boolean handleMessage(Message message) {
  204. switch (message.what) {
  205. case 0:
  206. MaintainActivity.this.showProDia();
  207. break;
  208. case 1:
  209. EPLog.m313i("Maintain", "********Maintain finish********");
  210. MaintainActivity.this.interrupMaintainThread();
  211. MaintainActivity.this.cancelProDia();
  212. break;
  213. case 2:
  214. MaintainActivity.this.updateStatus(message.getData().getInt("GET_STT_RESULT"));
  215. break;
  216. case 3:
  217. MaintainActivity.this.updateInkInfo(message.getData().getInt("GET_INK_RESULT"));
  218. break;
  219. case 4:
  220. MaintainActivity.this.interrupMaintainThread();
  221. break;
  222. case 5:
  223. MaintainActivity.this.updateSelectedPrinter();
  224. break;
  225. case 6:
  226. MaintainActivity.this.showLoadProgressBar();
  227. MaintainActivity.this.setButtonClickable(false);
  228. MaintainActivity.this.setEpsonConnectButton(1);
  229. break;
  230. case 7:
  231. MaintainActivity.this.handlerError(message.getData().getInt(MaintainActivity.PROBE_RESULT), true);
  232. break;
  233. case 8:
  234. MaintainActivity.this.mTvPrinterName.setText(MaintainActivity.this.printerName);
  235. switch (MaintainActivity.this.printerLocation) {
  236. case 2:
  237. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setVisibility(0);
  238. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.C2136drawable.print_remote);
  239. break;
  240. case 3:
  241. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setVisibility(0);
  242. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.C2136drawable.print_ip);
  243. break;
  244. default:
  245. if (!MaintainActivity.this.printerName.equals("")) {
  246. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setVisibility(0);
  247. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.C2136drawable.print_local);
  248. break;
  249. } else {
  250. ((ImageView) MaintainActivity.this.findViewById(R.id.imageViewPrinterLocation)).setVisibility(8);
  251. break;
  252. }
  253. }
  254. case 9:
  255. MaintainActivity.this.mUiHandler.sendEmptyMessage(11);
  256. MaintainActivity.this.hideLoadProgressBar();
  257. MaintainActivity.this.stopLoadConfigThread();
  258. break;
  259. case 10:
  260. MaintainActivity.this.setupErrorMessage(10);
  261. MaintainActivity.this.interrupMaintainThread();
  262. break;
  263. case 11:
  264. MaintainActivity.this.updateButton();
  265. break;
  266. case 14:
  267. MaintainActivity.this.hideLoadProgressBar();
  268. break;
  269. case 15:
  270. MaintainActivity.this.updateBatteryInfoEx(message.getData().getInt("GET_BATTERY_RESULT"), (BatteryInfoEx) message.getData().getParcelable("GET_BATTERY_INFO"));
  271. break;
  272. case 16:
  273. MaintainActivity.this.updateMaintenanceBoxInfo((int[]) message.obj);
  274. break;
  275. }
  276. return false;
  277. }
  278. });
  279. private View mVSerialSeparator;
  280. private boolean mWaiteInkDsDialog;
  281. private MaintainBuyInkOnlineRegTask modelBuyInkOnlineRegTask;
  282. private String printerId = "";
  283. private String printerIp = "";
  284. private int printerLocation = 1;
  285. private String printerName = "";
  286. private int serverLoginStatus = -2;
  287. private static int calcInkWidth(int i, float f) {
  288. if (i <= 0) {
  289. i = 1;
  290. } else if (i > 100) {
  291. i = 100;
  292. }
  293. int i2 = (int) ((f / 100.0f) * ((float) i));
  294. if (i2 > 0) {
  295. return i2;
  296. }
  297. return 1;
  298. }
  299. private boolean isMaintenanceBoxStatusDisplayX(int i) {
  300. switch (i) {
  301. case -2:
  302. case -1:
  303. return true;
  304. default:
  305. return false;
  306. }
  307. }
  308. protected void onCreate(Bundle bundle) {
  309. EpLog.m78i(TAG, "onCreate IN");
  310. super.onCreate(bundle);
  311. setContentView((int) R.layout.maintain);
  312. this.mContext = this;
  313. this.mBuyInkGroupVisibility = 0;
  314. setActionBar((int) R.string.str_maintenance, true);
  315. if (this.mEpsonService == null) {
  316. bindService(new Intent(this, EpsonService.class), this.mEpsonConnection, 1);
  317. }
  318. this.mDisplay = getWindowManager().getDefaultDisplay();
  319. findViewById(R.id.printer).setOnClickListener(this);
  320. this.mTvPrinterName = (TextView) findViewById(R.id.printer_name);
  321. this.mVSerialSeparator = findViewById(R.id.serial_separator);
  322. this.mLLSerialNo = (LinearLayout) findViewById(R.id.serial);
  323. this.mTvSerialNo = (TextView) findViewById(R.id.serial_no);
  324. this.mTvPrinterStatus = (TextView) findViewById(R.id.printer_status);
  325. this.mTvPrinterStatusDetail = (TextView) findViewById(R.id.printer_status_detail);
  326. this.mTextMaintenance = (TextView) findViewById(R.id.text_maintenance);
  327. this.mInkView = (LinearLayout) findViewById(R.id.ink_view_ln);
  328. this.mMaintenanceBoxText = (TextView) findViewById(R.id.maintenance_box_text);
  329. this.mMaintenanceBoxView = (LinearLayout) findViewById(R.id.maintenance_box_info_layout);
  330. this.mCleanCheckView = (LinearLayout) findViewById(R.id.clean_check);
  331. this.mHeadCleanView = (LinearLayout) findViewById(R.id.head_clean_view);
  332. this.mHeadCleanView.setOnClickListener(this);
  333. this.mHeadCleanText = (TextView) findViewById(R.id.head_clean_text);
  334. this.mNozzleCheckView = (LinearLayout) findViewById(R.id.nozzle_check_view);
  335. this.mNozzleCheckView.setOnClickListener(this);
  336. this.mNozzleCheckText = (TextView) findViewById(R.id.nozzle_check_text);
  337. this.mFWUpdateView = (LinearLayout) findViewById(R.id.fwupdate_view);
  338. this.mFWUpdateView.setOnClickListener(this);
  339. this.mFWUpdateText = (TextView) findViewById(R.id.fwupdate_text);
  340. this.btnTogglePreview = (Switch) findViewById(R.id.togglePreview);
  341. this.btnTogglePreview.setOnClickListener(this);
  342. this.btnToggleAlert = (Switch) findViewById(R.id.toggleAlert);
  343. this.btnToggleAlert.setOnClickListener(this);
  344. this.mPrinterSettingView = (LinearLayout) findViewById(R.id.printer_setting);
  345. this.mPrinterSettingView.setOnClickListener(this);
  346. this.mEpsonConnectView = (LinearLayout) findViewById(R.id.epsonconnect_option);
  347. this.mEpsonConnectView.setOnClickListener(this);
  348. this.mPrintHistoryView = (LinearLayout) findViewById(R.id.print_history);
  349. this.mPrintHistoryView.setOnClickListener(this);
  350. this.mOnlineRegistrationView = (LinearLayout) findViewById(R.id.online_registration);
  351. this.mOnlineRegistrationView.setOnClickListener(this);
  352. this.mBuyInkGroup = (LinearLayout) findViewById(R.id.mentenance_buy_ink_frame);
  353. this.mBuyInkView = (LinearLayout) findViewById(R.id.mentenance_buy_ink);
  354. this.mBuyInkView.setOnClickListener(this);
  355. this.mBuyInkSeparator = findViewById(R.id.buy_ink_separator);
  356. this.mInkDsView = (LinearLayout) findViewById(R.id.maintenance_inkds);
  357. this.mInkDsView.setOnClickListener(this);
  358. this.mPrintPreviewView = (LinearLayout) findViewById(R.id.print_preview);
  359. this.mAlertMesseageView = (LinearLayout) findViewById(R.id.alert_messeage);
  360. this.mPrinterSettingSeparator = findViewById(R.id.printer_setting_separator);
  361. this.mPrintHistorySeparator = findViewById(R.id.print_history_separator);
  362. this.mOnlineRegistrationSeparator = findViewById(R.id.online_registration_separator);
  363. this.mAlertMesseageSeparater = findViewById(R.id.comm_messeage_separator);
  364. this.mPrinterSettingView.setEnabled(false);
  365. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  366. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(8);
  367. this.mVSerialSeparator.setVisibility(8);
  368. this.mLLSerialNo.setVisibility(8);
  369. EpLog.m78i(TAG, "onCreate :: doInitDriver");
  370. this.mPrinter.doInitDriver(this, 2);
  371. this.isResearchScanner = Utils.getPrefBoolean(getApplicationContext(), Constants.SCAN_REFS_USED_SCANNER_PATH, Constants.SCAN_REFS_SETTINGS_RESEACH);
  372. if (MyPrinter.getCurPrinter(this).getName() == null) {
  373. startSelectPrinterActivity();
  374. }
  375. this.mWaiteInkDsDialog = false;
  376. this.modelBuyInkOnlineRegTask = (MaintainBuyInkOnlineRegTask) ViewModelProviders.m2of((FragmentActivity) this).get(MaintainBuyInkOnlineRegTask.class);
  377. this.modelBuyInkOnlineRegTask.getUriEvent().observe(this, new Observer() {
  378. public final void onChanged(Object obj) {
  379. MaintainActivity.lambda$onCreate$0(MaintainActivity.this, (EventWrapper) obj);
  380. }
  381. });
  382. }
  383. public static /* synthetic */ void lambda$onCreate$0(MaintainActivity maintainActivity, EventWrapper eventWrapper) {
  384. if (!eventWrapper.hasBeenHandled()) {
  385. maintainActivity.dismissDialog(DIALOG_PROGRESS);
  386. maintainActivity.startActivity(new Intent("android.intent.action.VIEW", (Uri) eventWrapper.getEventContent()));
  387. }
  388. }
  389. private void startLoadConThread() {
  390. this.mIsCancelProbe = false;
  391. this.mLoadConfigThread = new Thread(new Runnable() {
  392. /* JADX WARNING: Code restructure failed: missing block: B:83:0x01e6, code lost:
  393. return;
  394. */
  395. /* Code decompiled incorrectly, please refer to instructions dump. */
  396. public synchronized void run() {
  397. /*
  398. r8 = this;
  399. monitor-enter(r8)
  400. java.lang.String r0 = "MAINTAIN"
  401. java.lang.String r1 = "new load Config thread"
  402. epson.print.Util.EPLog.m313i(r0, r1) // Catch:{ all -> 0x01f0 }
  403. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  404. android.os.Handler r0 = r0.mUiHandler // Catch:{ all -> 0x01f0 }
  405. r1 = 6
  406. r0.sendEmptyMessage(r1) // Catch:{ all -> 0x01f0 }
  407. r0 = 500(0x1f4, double:2.47E-321)
  408. java.lang.Thread.sleep(r0) // Catch:{ InterruptedException -> 0x01e7 }
  409. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  410. r0.loadConfig() // Catch:{ all -> 0x01f0 }
  411. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  412. android.os.Handler r0 = r0.mUiHandler // Catch:{ all -> 0x01f0 }
  413. r1 = 8
  414. r0.sendEmptyMessage(r1) // Catch:{ all -> 0x01f0 }
  415. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  416. boolean r0 = r0.mIsCancelProbe // Catch:{ all -> 0x01f0 }
  417. if (r0 == 0) goto L_0x0034
  418. r8.hideLoadProgress() // Catch:{ all -> 0x01f0 }
  419. monitor-exit(r8)
  420. return
  421. L_0x0034:
  422. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  423. epson.maintain.activity.MaintainActivity r2 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  424. boolean r2 = epson.print.MyPrinter.isRemotePrinter(r2) // Catch:{ all -> 0x01f0 }
  425. boolean unused = r0.isRemotePrinter = r2 // Catch:{ all -> 0x01f0 }
  426. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  427. boolean r0 = r0.isRemotePrinter // Catch:{ all -> 0x01f0 }
  428. r2 = -1
  429. r3 = 0
  430. r4 = 1
  431. if (r0 != r4) goto L_0x00ae
  432. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  433. r1 = -2
  434. int unused = r0.serverLoginStatus = r1 // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  435. r0 = 0
  436. L_0x0051:
  437. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  438. epson.print.service.IEpsonService r5 = r5.mEpsonService // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  439. if (r5 != 0) goto L_0x006b
  440. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  441. boolean r5 = r5.mIsCancelProbe // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  442. if (r5 != 0) goto L_0x006b
  443. r5 = 100
  444. java.lang.Thread.sleep(r5) // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  445. int r0 = r0 + r4
  446. r5 = 10
  447. if (r0 < r5) goto L_0x0051
  448. L_0x006b:
  449. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  450. epson.print.service.IEpsonService r0 = r0.mEpsonService // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  451. if (r0 == 0) goto L_0x009e
  452. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  453. epson.print.service.IEpsonService r0 = r0.mEpsonService // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  454. int r0 = r0.ensureLogin(r4) // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  455. if (r0 != 0) goto L_0x0085
  456. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  457. int unused = r0.serverLoginStatus = r3 // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  458. goto L_0x009e
  459. L_0x0085:
  460. r3 = -1100(0xfffffffffffffbb4, float:NaN)
  461. if (r0 != r3) goto L_0x008f
  462. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  463. int unused = r0.serverLoginStatus = r2 // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  464. goto L_0x009e
  465. L_0x008f:
  466. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  467. int unused = r0.serverLoginStatus = r1 // Catch:{ InterruptedException -> 0x009a, RemoteException -> 0x0095 }
  468. goto L_0x009e
  469. L_0x0095:
  470. r0 = move-exception
  471. r0.printStackTrace() // Catch:{ all -> 0x01f0 }
  472. goto L_0x009e
  473. L_0x009a:
  474. r0 = move-exception
  475. r0.printStackTrace() // Catch:{ all -> 0x01f0 }
  476. L_0x009e:
  477. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  478. android.os.Handler r0 = r0.mUiHandler // Catch:{ all -> 0x01f0 }
  479. r1 = 11
  480. r0.sendEmptyMessage(r1) // Catch:{ all -> 0x01f0 }
  481. r8.hideLoadProgress() // Catch:{ all -> 0x01f0 }
  482. monitor-exit(r8)
  483. return
  484. L_0x00ae:
  485. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  486. boolean r0 = r0.mIsCancelProbe // Catch:{ all -> 0x01f0 }
  487. if (r0 == 0) goto L_0x00bb
  488. r8.hideLoadProgress() // Catch:{ all -> 0x01f0 }
  489. monitor-exit(r8)
  490. return
  491. L_0x00bb:
  492. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  493. java.lang.String r0 = r0.printerId // Catch:{ all -> 0x01f0 }
  494. java.lang.String r5 = ""
  495. boolean r0 = r0.equals(r5) // Catch:{ all -> 0x01f0 }
  496. if (r0 != 0) goto L_0x01cf
  497. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  498. java.lang.String r0 = r0.printerName // Catch:{ all -> 0x01f0 }
  499. java.lang.String r5 = ""
  500. boolean r0 = r0.equals(r5) // Catch:{ all -> 0x01f0 }
  501. if (r0 != 0) goto L_0x01cf
  502. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  503. int r0 = r0.printerLocation // Catch:{ all -> 0x01f0 }
  504. if (r0 != r4) goto L_0x0108
  505. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  506. java.lang.String r5 = "printer"
  507. boolean r0 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.isNeedConnect(r0, r5) // Catch:{ all -> 0x01f0 }
  508. if (r0 != 0) goto L_0x00ef
  509. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  510. boolean unused = r0.isTryConnectSimpleAp = r3 // Catch:{ all -> 0x01f0 }
  511. goto L_0x0108
  512. L_0x00ef:
  513. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  514. boolean r0 = r0.isTryConnectSimpleAp // Catch:{ all -> 0x01f0 }
  515. if (r0 != 0) goto L_0x0108
  516. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  517. boolean unused = r0.isTryConnectSimpleAp = r4 // Catch:{ all -> 0x01f0 }
  518. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  519. java.lang.String r5 = "printer"
  520. boolean r0 = com.epson.mobilephone.common.wifidirect.WiFiDirectManager.reconnect(r0, r5, r2) // Catch:{ all -> 0x01f0 }
  521. if (r0 == 0) goto L_0x0108
  522. monitor-exit(r8)
  523. return
  524. L_0x0108:
  525. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  526. android.os.Handler r0 = r0.mUiHandler // Catch:{ all -> 0x01f0 }
  527. r0.sendEmptyMessage(r1) // Catch:{ all -> 0x01f0 }
  528. java.lang.String r0 = "startLoadConThread"
  529. java.lang.String r1 = "mPrinter.doProbePrinter"
  530. epson.print.Util.EPLog.m313i(r0, r1) // Catch:{ all -> 0x01f0 }
  531. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  532. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r0 = r0.mPrinter // Catch:{ all -> 0x01f0 }
  533. epson.maintain.activity.MaintainActivity r1 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  534. java.lang.String r1 = r1.printerId // Catch:{ all -> 0x01f0 }
  535. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  536. java.lang.String r5 = r5.printerIp // Catch:{ all -> 0x01f0 }
  537. epson.maintain.activity.MaintainActivity r6 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  538. int r6 = r6.printerLocation // Catch:{ all -> 0x01f0 }
  539. r7 = 60
  540. int r0 = r0.doProbePrinter(r7, r1, r5, r6) // Catch:{ all -> 0x01f0 }
  541. epson.maintain.activity.MaintainActivity r1 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  542. int unused = r1.escprSetPrinterSuccessed = r2 // Catch:{ all -> 0x01f0 }
  543. L_0x013b:
  544. epson.maintain.activity.MaintainActivity r1 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  545. boolean r1 = r1.mIsCancelProbe // Catch:{ InterruptedException -> 0x018e }
  546. if (r1 != 0) goto L_0x0192
  547. if (r0 != 0) goto L_0x0146
  548. goto L_0x0192
  549. L_0x0146:
  550. android.os.Message r1 = new android.os.Message // Catch:{ InterruptedException -> 0x018e }
  551. r1.<init>() // Catch:{ InterruptedException -> 0x018e }
  552. r2 = 7
  553. r1.what = r2 // Catch:{ InterruptedException -> 0x018e }
  554. android.os.Bundle r2 = new android.os.Bundle // Catch:{ InterruptedException -> 0x018e }
  555. r2.<init>() // Catch:{ InterruptedException -> 0x018e }
  556. java.lang.String r5 = "PROBE_ERROR"
  557. r2.putInt(r5, r0) // Catch:{ InterruptedException -> 0x018e }
  558. r1.setData(r2) // Catch:{ InterruptedException -> 0x018e }
  559. epson.maintain.activity.MaintainActivity r2 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  560. android.os.Handler r2 = r2.mUiHandler // Catch:{ InterruptedException -> 0x018e }
  561. r2.sendMessage(r1) // Catch:{ InterruptedException -> 0x018e }
  562. r1 = 4000(0xfa0, double:1.9763E-320)
  563. java.lang.Thread.sleep(r1) // Catch:{ InterruptedException -> 0x018e }
  564. epson.maintain.activity.MaintainActivity r1 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  565. boolean r1 = r1.mIsCancelProbe // Catch:{ InterruptedException -> 0x018e }
  566. if (r1 != 0) goto L_0x013b
  567. epson.maintain.activity.MaintainActivity r1 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  568. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r1 = r1.mPrinter // Catch:{ InterruptedException -> 0x018e }
  569. epson.maintain.activity.MaintainActivity r2 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  570. java.lang.String r2 = r2.printerId // Catch:{ InterruptedException -> 0x018e }
  571. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  572. java.lang.String r5 = r5.printerIp // Catch:{ InterruptedException -> 0x018e }
  573. epson.maintain.activity.MaintainActivity r6 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x018e }
  574. int r6 = r6.printerLocation // Catch:{ InterruptedException -> 0x018e }
  575. int r0 = r1.doProbePrinter(r7, r2, r5, r6) // Catch:{ InterruptedException -> 0x018e }
  576. goto L_0x013b
  577. L_0x018e:
  578. r1 = move-exception
  579. r1.printStackTrace() // Catch:{ all -> 0x01f0 }
  580. L_0x0192:
  581. java.lang.String r1 = "MAINTAIN"
  582. java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch:{ all -> 0x01f0 }
  583. r2.<init>() // Catch:{ all -> 0x01f0 }
  584. java.lang.String r5 = "Probe Printer result: "
  585. r2.append(r5) // Catch:{ all -> 0x01f0 }
  586. r2.append(r0) // Catch:{ all -> 0x01f0 }
  587. java.lang.String r2 = r2.toString() // Catch:{ all -> 0x01f0 }
  588. epson.print.Util.EPLog.m313i(r1, r2) // Catch:{ all -> 0x01f0 }
  589. epson.maintain.activity.MaintainActivity r1 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  590. boolean r1 = r1.mIsCancelProbe // Catch:{ all -> 0x01f0 }
  591. if (r1 != 0) goto L_0x01e5
  592. if (r0 != 0) goto L_0x01e5
  593. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  594. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r0 = r0.mPrinter // Catch:{ all -> 0x01f0 }
  595. r0.setMSearchPos(r3) // Catch:{ all -> 0x01f0 }
  596. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  597. int unused = r0.escprSetPrinterSuccessed = r3 // Catch:{ all -> 0x01f0 }
  598. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  599. r0.mHavePrinter = r4 // Catch:{ all -> 0x01f0 }
  600. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  601. android.os.Handler r0 = r0.mUiHandler // Catch:{ all -> 0x01f0 }
  602. r1 = 5
  603. r0.sendEmptyMessage(r1) // Catch:{ all -> 0x01f0 }
  604. goto L_0x01e5
  605. L_0x01cf:
  606. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  607. r0.mHavePrinter = r3 // Catch:{ all -> 0x01f0 }
  608. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this // Catch:{ all -> 0x01f0 }
  609. android.os.Handler r0 = r0.mUiHandler // Catch:{ all -> 0x01f0 }
  610. r1 = 9
  611. r0.sendEmptyMessage(r1) // Catch:{ all -> 0x01f0 }
  612. java.lang.String r0 = "MAINTAIN"
  613. java.lang.String r1 = "not select printer"
  614. epson.print.Util.EPLog.m313i(r0, r1) // Catch:{ all -> 0x01f0 }
  615. L_0x01e5:
  616. monitor-exit(r8)
  617. return
  618. L_0x01e7:
  619. r0 = move-exception
  620. r0.printStackTrace() // Catch:{ all -> 0x01f0 }
  621. r8.hideLoadProgress() // Catch:{ all -> 0x01f0 }
  622. monitor-exit(r8)
  623. return
  624. L_0x01f0:
  625. r0 = move-exception
  626. monitor-exit(r8)
  627. throw r0
  628. */
  629. throw new UnsupportedOperationException("Method not decompiled: epson.maintain.activity.MaintainActivity.C20151.run():void");
  630. }
  631. private void hideLoadProgress() {
  632. MaintainActivity.this.mUiHandler.sendEmptyMessage(14);
  633. }
  634. }, "load-config");
  635. this.mLoadConfigThread.start();
  636. }
  637. private void updateButton() {
  638. switch (this.printerLocation) {
  639. case 0:
  640. this.mTvPrinterName.setText(getString(R.string.str_lbl_title_scan));
  641. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(8);
  642. this.mTvPrinterStatus.setText(R.string.EPS_PRNERR_NOT_SELECTED_TITTLE);
  643. this.mTvPrinterStatusDetail.setText(R.string.EPS_PRNERR_NOT_SELECTED);
  644. LinearLayout linearLayout = this.mInkView;
  645. if (linearLayout != null) {
  646. linearLayout.removeAllViews();
  647. }
  648. this.mTextMaintenance.setVisibility(0);
  649. this.mCleanCheckView.setVisibility(0);
  650. this.mPrinterSettingView.setVisibility(0);
  651. this.mHeadCleanView.setEnabled(false);
  652. this.mNozzleCheckView.setEnabled(false);
  653. this.mFWUpdateView.setEnabled(false);
  654. this.mPrinterSettingView.setEnabled(false);
  655. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  656. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(8);
  657. localSetBuyInkGroupVisibility(8);
  658. this.mOnlineRegistrationSeparator.setVisibility(8);
  659. this.mOnlineRegistrationView.setVisibility(8);
  660. this.mPrinterSettingSeparator.setVisibility(8);
  661. this.mPrintPreviewView.setVisibility(8);
  662. this.mAlertMesseageSeparater.setVisibility(8);
  663. this.mAlertMesseageView.setVisibility(8);
  664. this.mPrintHistorySeparator.setVisibility(8);
  665. this.mPrintHistoryView.setVisibility(8);
  666. this.mMaintenanceBoxText.setVisibility(8);
  667. this.mMaintenanceBoxView.setVisibility(8);
  668. return;
  669. case 1:
  670. if (this.mPrinter.doGetLang() != 1) {
  671. this.mTextMaintenance.setVisibility(8);
  672. this.mCleanCheckView.setVisibility(8);
  673. this.mOnlineRegistrationSeparator.setVisibility(8);
  674. this.mOnlineRegistrationView.setVisibility(8);
  675. } else {
  676. this.mTextMaintenance.setVisibility(0);
  677. this.mCleanCheckView.setVisibility(0);
  678. this.mOnlineRegistrationSeparator.setVisibility(0);
  679. this.mOnlineRegistrationView.setVisibility(0);
  680. this.mOnlineRegistrationView.setEnabled(true);
  681. }
  682. updateBuyInkGroupForLocalOrIPPrinter();
  683. this.mPrinterSettingView.setVisibility(0);
  684. this.mPrinterSettingSeparator.setVisibility(8);
  685. this.mPrintPreviewView.setVisibility(8);
  686. this.mAlertMesseageSeparater.setVisibility(8);
  687. this.mAlertMesseageView.setVisibility(8);
  688. this.mPrintHistorySeparator.setVisibility(8);
  689. this.mPrintHistoryView.setVisibility(8);
  690. if (this.escprSetPrinterSuccessed == 0) {
  691. this.mHeadCleanView.setEnabled(true);
  692. this.mNozzleCheckView.setEnabled(true);
  693. this.mFWUpdateView.setEnabled(true);
  694. this.mPrinterSettingView.setEnabled(true);
  695. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.black));
  696. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(0);
  697. setEpsonConnectButton(0);
  698. } else {
  699. this.mHeadCleanView.setEnabled(false);
  700. this.mNozzleCheckView.setEnabled(false);
  701. this.mFWUpdateView.setEnabled(false);
  702. this.mPrinterSettingView.setEnabled(false);
  703. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  704. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(8);
  705. setEpsonConnectButton(1);
  706. }
  707. if (MyPrinter.PRINTER_USB.equals(this.printerIp)) {
  708. this.mFWUpdateView.setVisibility(8);
  709. this.mPrinterSettingSeparator.setVisibility(8);
  710. this.mPrinterSettingView.setVisibility(8);
  711. return;
  712. }
  713. return;
  714. case 2:
  715. localSetBuyInkGroupVisibility(0);
  716. this.mBuyInkView.setVisibility(0);
  717. this.mPrinterSettingSeparator.setVisibility(0);
  718. this.mPrinterSettingView.setVisibility(0);
  719. this.mPrintPreviewView.setVisibility(0);
  720. this.mAlertMesseageSeparater.setVisibility(0);
  721. this.mAlertMesseageView.setVisibility(0);
  722. this.mPrintHistorySeparator.setVisibility(0);
  723. this.mPrintHistoryView.setVisibility(0);
  724. setEpsonConnectButton(2);
  725. LinearLayout linearLayout2 = this.mInkView;
  726. if (linearLayout2 != null) {
  727. linearLayout2.removeAllViews();
  728. }
  729. TextView textView = new TextView(this.mContext);
  730. textView.setTextColor(getResources().getColor(R.color.black));
  731. textView.setTextSize(16.0f);
  732. textView.setText(getString(R.string.epsonconnect_str_status_inkinfo_error));
  733. this.mInkView.addView(textView);
  734. SharedPreferences sharedPreferences = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0);
  735. boolean z = sharedPreferences.getBoolean(Constants.ENABLE_SHOW_PREVIEW, true);
  736. boolean z2 = sharedPreferences.getBoolean(Constants.ENABLE_SHOW_WARNING, true);
  737. if (z) {
  738. this.btnTogglePreview.setChecked(true);
  739. } else {
  740. this.btnTogglePreview.setChecked(false);
  741. }
  742. if (z2) {
  743. this.btnToggleAlert.setChecked(true);
  744. } else {
  745. this.btnToggleAlert.setChecked(false);
  746. }
  747. BatteryInfoAdapter.BatteryInfoManager.clearBatteryList(this);
  748. this.mTextMaintenance.setVisibility(8);
  749. this.mCleanCheckView.setVisibility(8);
  750. this.mOnlineRegistrationSeparator.setVisibility(8);
  751. this.mOnlineRegistrationView.setVisibility(8);
  752. this.mMaintenanceBoxText.setVisibility(8);
  753. this.mMaintenanceBoxView.setVisibility(8);
  754. int i = this.serverLoginStatus;
  755. if (i == 0) {
  756. this.mTvPrinterStatus.setText(getString(R.string.EPS_PRNST_IDLE_TITLE));
  757. this.mTvPrinterStatusDetail.setText(getString(R.string.EPS_PRNST_IDLE_MSG));
  758. this.mPrintHistoryView.setEnabled(true);
  759. ((TextView) findViewById(R.id.text_print_history)).setTextColor(this.mContext.getResources().getColor(R.color.black));
  760. ((ImageView) findViewById(R.id.print_history_arrow)).setVisibility(0);
  761. this.mPrinterSettingView.setEnabled(true);
  762. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.black));
  763. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(0);
  764. return;
  765. } else if (i == -1) {
  766. this.mTvPrinterStatus.setText(getString(R.string.EC_ERR_COMM_ERROR_TITLE));
  767. this.mTvPrinterStatusDetail.setText(getString(R.string.EC_ERR_COMM_ERROR));
  768. this.mPrintHistoryView.setEnabled(false);
  769. ((TextView) findViewById(R.id.text_print_history)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  770. ((ImageView) findViewById(R.id.print_history_arrow)).setVisibility(8);
  771. this.mPrinterSettingView.setEnabled(false);
  772. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  773. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(8);
  774. return;
  775. } else {
  776. this.mTvPrinterStatus.setText(R.string.epsonconnect_str_status_login_error_title);
  777. this.mTvPrinterStatusDetail.setText(getString(R.string.epsonconnect_str_status_login_error));
  778. this.mPrintHistoryView.setEnabled(false);
  779. ((TextView) findViewById(R.id.text_print_history)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  780. ((ImageView) findViewById(R.id.print_history_arrow)).setVisibility(8);
  781. this.mPrinterSettingView.setEnabled(false);
  782. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  783. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(8);
  784. return;
  785. }
  786. case 3:
  787. if (this.mPrinter.doGetLang() != 1) {
  788. this.mTextMaintenance.setVisibility(8);
  789. this.mCleanCheckView.setVisibility(8);
  790. } else {
  791. this.mTextMaintenance.setVisibility(0);
  792. this.mCleanCheckView.setVisibility(0);
  793. }
  794. updateBuyInkGroupForLocalOrIPPrinter();
  795. this.mPrinterSettingView.setVisibility(0);
  796. this.mPrinterSettingSeparator.setVisibility(8);
  797. this.mPrintPreviewView.setVisibility(8);
  798. this.mAlertMesseageSeparater.setVisibility(8);
  799. this.mAlertMesseageView.setVisibility(8);
  800. this.mPrintHistorySeparator.setVisibility(8);
  801. this.mPrintHistoryView.setVisibility(8);
  802. this.mOnlineRegistrationSeparator.setVisibility(8);
  803. this.mOnlineRegistrationView.setVisibility(8);
  804. if (this.escprSetPrinterSuccessed == 0) {
  805. this.mHeadCleanView.setEnabled(true);
  806. this.mNozzleCheckView.setEnabled(true);
  807. this.mPrinterSettingView.setEnabled(true);
  808. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.black));
  809. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(0);
  810. setEpsonConnectButton(0);
  811. return;
  812. }
  813. this.mHeadCleanView.setEnabled(false);
  814. this.mNozzleCheckView.setEnabled(false);
  815. this.mPrinterSettingView.setEnabled(false);
  816. ((TextView) findViewById(R.id.text_printer_setting)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  817. ((ImageView) findViewById(R.id.printer_setting_arrow)).setVisibility(8);
  818. setEpsonConnectButton(1);
  819. return;
  820. default:
  821. return;
  822. }
  823. }
  824. private void localSetBuyInkGroupVisibility(int i) {
  825. this.mBuyInkGroup.setVisibility(i);
  826. this.mBuyInkGroupVisibility = i;
  827. }
  828. private void updateBuyInkGroupForLocalOrIPPrinter() {
  829. int i;
  830. int i2;
  831. int i3;
  832. int i4 = 0;
  833. InkRplnInfoClient.InkRsInfo info = new InkRplnRepository(false).getInfo(this);
  834. if (info != null) {
  835. i = info.getButtonType();
  836. } else {
  837. i = 0;
  838. }
  839. int i5 = 8;
  840. switch (i) {
  841. case 1:
  842. i3 = 0;
  843. i2 = 8;
  844. break;
  845. case 2:
  846. i3 = 0;
  847. i5 = 0;
  848. i2 = 0;
  849. break;
  850. case 3:
  851. i3 = 8;
  852. i4 = 8;
  853. i2 = 8;
  854. break;
  855. default:
  856. i3 = 8;
  857. i5 = 0;
  858. i2 = 8;
  859. break;
  860. }
  861. localSetBuyInkGroupVisibility(i4);
  862. this.mBuyInkView.setVisibility(i5);
  863. this.mInkDsView.setVisibility(i3);
  864. this.mBuyInkSeparator.setVisibility(i2);
  865. }
  866. private void setupErrorMessage(int i) {
  867. Utils.makeMessageBox(this, getString(R.string.EPS_PRNERR_DISABEL_CLEANING_TITLE), getString(R.string.EPS_PRNERR_DISABEL_CLEANING_MSG), getString(R.string.str_cancel)).show();
  868. }
  869. public void onClick(View view) {
  870. int id = view.getId();
  871. int i = R.string.str_nozzle_check;
  872. switch (id) {
  873. case R.id.epsonconnect_option /*2131231020*/:
  874. Intent intent = new Intent(this, ActivityECConfiguration.class);
  875. intent.putExtra(ActivityECConfiguration.INTENT_EC_BLE_CONTENT, false);
  876. startActivity(intent);
  877. return;
  878. case R.id.fwupdate_view /*2131231071*/:
  879. Analytics.sendAction(getApplicationContext(), Analytics.ACTION_ID_MAINTENANCE_FIRMWARE_UPDATE);
  880. Intent intent2 = new Intent(this, FirmwareUpdateActivity.class);
  881. intent2.putExtra(Constants.PRINTER_IP, this.printerIp);
  882. intent2.putExtra("PRINTER_MODEL_NAME", this.printerName);
  883. this.isKeepSimpleAPConnection = true;
  884. startActivity(intent2);
  885. return;
  886. case R.id.head_clean_view /*2131231097*/:
  887. Analytics.sendAction(getApplicationContext(), Analytics.ACTION_ID_MAINTENANCE_HEAD_CLEANING);
  888. AlertDialog.Builder icon = new AlertDialog.Builder(this).setIcon(R.C2136drawable.ic_action_warning);
  889. if (view.getId() != R.id.nozzle_check_view) {
  890. i = R.string.str_head_clean;
  891. }
  892. icon.setTitle(i).setPositiveButton(R.string.str_yes, new DialogInterface.OnClickListener() {
  893. public void onClick(DialogInterface dialogInterface, int i) {
  894. MaintainActivity.this.performMaintain(2);
  895. }
  896. }).setNegativeButton(R.string.str_no, new DialogInterface.OnClickListener() {
  897. public void onClick(DialogInterface dialogInterface, int i) {
  898. }
  899. }).show();
  900. return;
  901. case R.id.maintenance_inkds /*2131231241*/:
  902. Analytics.sendAction(this, Analytics.ACTION_ID_MAINTENANCE_READY_INK);
  903. startBrowsReadyInkUrl();
  904. return;
  905. case R.id.mentenance_buy_ink /*2131231247*/:
  906. Analytics.sendAction(this, Analytics.ACTION_ID_MAINTENANCE_BUY_INK);
  907. showDialog(DIALOG_PROGRESS);
  908. BuyInkTask(1, this.printerIp);
  909. return;
  910. case R.id.nozzle_check_view /*2131231280*/:
  911. Analytics.sendAction(getApplicationContext(), Analytics.ACTION_ID_MAINTENANCE_NOZZLE_CHECK);
  912. AlertDialog.Builder icon2 = new AlertDialog.Builder(this).setIcon(R.C2136drawable.ic_action_warning);
  913. if (view.getId() != R.id.nozzle_check_view) {
  914. i = R.string.str_head_clean;
  915. }
  916. icon2.setTitle(i).setPositiveButton(R.string.str_yes, new DialogInterface.OnClickListener() {
  917. public void onClick(DialogInterface dialogInterface, int i) {
  918. new NozzleCheckTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[0]);
  919. }
  920. }).setNegativeButton(R.string.str_no, new DialogInterface.OnClickListener() {
  921. public void onClick(DialogInterface dialogInterface, int i) {
  922. }
  923. }).show();
  924. return;
  925. case R.id.online_registration /*2131231289*/:
  926. showDialog(DIALOG_PROGRESS);
  927. OnlineRegTask(this.printerIp);
  928. return;
  929. case R.id.print_history /*2131231348*/:
  930. startActivity(new Intent(this, EccPrintLog.class));
  931. return;
  932. case R.id.printer /*2131231358*/:
  933. EPLog.m305d(TAG, "onClick() R.id.printer");
  934. new AsyncTask<Void, Void, Void>() {
  935. WorkingDialog dialog = new WorkingDialog(MaintainActivity.this);
  936. protected void onPreExecute() {
  937. super.onPreExecute();
  938. MaintainActivity.this.hideLoadProgressBar();
  939. this.dialog.show();
  940. }
  941. protected Void doInBackground(Void... voidArr) {
  942. MaintainActivity.this.stopLoadConfigThread();
  943. MaintainActivity.this.endBackGroundThread();
  944. MaintainActivity maintainActivity = MaintainActivity.this;
  945. WiFiDirectManager.disconnect(maintainActivity, WiFiDirectManager.DEVICE_TYPE_PRINTER, maintainActivity.printerIp);
  946. return null;
  947. }
  948. protected void onPostExecute(Void voidR) {
  949. MaintainActivity.this.startSelectPrinterActivity();
  950. this.dialog.dismiss();
  951. }
  952. }.execute(new Void[0]);
  953. return;
  954. case R.id.printer_setting /*2131231369*/:
  955. switch (this.printerLocation) {
  956. case 1:
  957. case 3:
  958. if (!WiFiDirectManager.isSimpleAP(this) || this.isKeepSimpleAPConnection) {
  959. this.printerIp = this.mPrinter.doGetIp();
  960. startActivity(new Intent("android.intent.action.VIEW", Uri.parse(IPAddressUtils.buildURL(Analytics.EXTENSION_STRING_WEB, this.printerIp, CommonDefine.SLASH))));
  961. return;
  962. }
  963. new AlertDialog.Builder(this.mContext).setCancelable(false).setMessage(R.string.str_webconfig_warn_message).setPositiveButton(R.string.str_ok, new DialogInterface.OnClickListener() {
  964. public void onClick(DialogInterface dialogInterface, int i) {
  965. boolean unused = MaintainActivity.this.isKeepSimpleAPConnection = true;
  966. MaintainActivity maintainActivity = MaintainActivity.this;
  967. String unused2 = maintainActivity.printerIp = maintainActivity.mPrinter.doGetIp();
  968. MaintainActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(CommonDefine.HTTP_PREFIX + MaintainActivity.this.printerIp + CommonDefine.SLASH)));
  969. }
  970. }).create().show();
  971. return;
  972. case 2:
  973. startActivity(new Intent("android.intent.action.VIEW", Uri.parse("https://www.epsonconnect.com/user/")));
  974. return;
  975. default:
  976. return;
  977. }
  978. case R.id.toggleAlert /*2131231560*/:
  979. if (this.btnToggleAlert.isChecked()) {
  980. SharedPreferences.Editor edit = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).edit();
  981. edit.putBoolean(Constants.ENABLE_SHOW_WARNING, true);
  982. edit.commit();
  983. return;
  984. }
  985. SharedPreferences.Editor edit2 = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).edit();
  986. edit2.putBoolean(Constants.ENABLE_SHOW_WARNING, false);
  987. edit2.commit();
  988. return;
  989. case R.id.togglePreview /*2131231563*/:
  990. if (!this.btnTogglePreview.isChecked()) {
  991. SharedPreferences.Editor edit3 = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).edit();
  992. edit3.putBoolean(Constants.ENABLE_SHOW_PREVIEW, false);
  993. edit3.commit();
  994. return;
  995. } else if (!isMessageScreenShowing) {
  996. showMessageDialog();
  997. return;
  998. } else {
  999. SharedPreferences.Editor edit4 = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).edit();
  1000. edit4.putBoolean(Constants.ENABLE_SHOW_PREVIEW, true);
  1001. edit4.commit();
  1002. return;
  1003. }
  1004. default:
  1005. return;
  1006. }
  1007. }
  1008. private void startSelectPrinterActivity() {
  1009. this.mWaiteInkDsDialog = true;
  1010. Intent intent = new Intent(this, MaintainPrinterSearchActivity.class);
  1011. intent.putExtra(Constants.PRINTER_ID, this.printerId);
  1012. intent.setAction("android.intent.action.VIEW");
  1013. startActivityForResult(intent, 101);
  1014. }
  1015. private void startBrowsReadyInkUrl() {
  1016. startActivity(new Intent(this, JumpUrlProgressActivity.class));
  1017. }
  1018. private void showNozzleCheckGuidanceDialog() {
  1019. if (!checkGaga()) {
  1020. new NozzleGuidanceDialog().show(getSupportFragmentManager(), DIALOG_TAG_NOZZLE_GUIDANCE);
  1021. }
  1022. }
  1023. private boolean checkGaga() {
  1024. String printerDeviceId = MyPrinter.getPrinterDeviceId(this, false);
  1025. if (printerDeviceId == null) {
  1026. return false;
  1027. }
  1028. return Arrays.asList(GAGA_DEVICE_ID_ARRAY).contains(printerDeviceId);
  1029. }
  1030. private void showMessageDialog() {
  1031. isMessageScreenShowing = true;
  1032. AlertDialog.Builder builder = new AlertDialog.Builder(this);
  1033. builder.setMessage(getString(R.string.epsonconnect_str_preview_warning) + "\n\n" + getString(R.string.epsonconnect_str_preview_warning2));
  1034. C20299 r1 = new DialogInterface.OnClickListener() {
  1035. public void onClick(DialogInterface dialogInterface, int i) {
  1036. SharedPreferences.Editor edit = MaintainActivity.this.getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).edit();
  1037. edit.putBoolean(Constants.ENABLE_SHOW_PREVIEW, true);
  1038. edit.commit();
  1039. }
  1040. };
  1041. C201610 r2 = new DialogInterface.OnClickListener() {
  1042. public void onClick(DialogInterface dialogInterface, int i) {
  1043. MaintainActivity.this.btnTogglePreview.setChecked(false);
  1044. }
  1045. };
  1046. builder.setPositiveButton(R.string.str_yes, r1);
  1047. builder.setNegativeButton(R.string.str_no, r2);
  1048. builder.setCancelable(false);
  1049. builder.show();
  1050. isMessageScreenShowing = false;
  1051. }
  1052. private void showProDia() {
  1053. if (this.customPro == null) {
  1054. this.customPro = new CustomProDialog(this, R.style.AppTheme_Translucent, R.layout.maintain_executing_dialog);
  1055. }
  1056. this.customPro.show();
  1057. }
  1058. private void cancelProDia() {
  1059. Dialog dialog = this.customPro;
  1060. if (dialog != null && dialog.isShowing()) {
  1061. this.customPro.cancel();
  1062. this.customPro = null;
  1063. }
  1064. }
  1065. private void showLoadProgressBar() {
  1066. if (this.mLoadConPro == null) {
  1067. this.mLoadConPro = findViewById(R.id.progress_status);
  1068. }
  1069. this.mLoadConPro.setVisibility(0);
  1070. }
  1071. private void hideLoadProgressBar() {
  1072. View view = this.mLoadConPro;
  1073. if (view != null) {
  1074. view.setVisibility(8);
  1075. }
  1076. }
  1077. private void stopLoadConfigThread() {
  1078. this.mIsCancelProbe = true;
  1079. Thread thread = this.mLoadConfigThread;
  1080. if (thread != null && thread.isAlive()) {
  1081. this.mPrinter.doCancelFindPrinter();
  1082. if (this.mEpsonService != null) {
  1083. new AsyncTaskExecutor<Void, Void, Void>() {
  1084. protected Void doInBackground(Void... voidArr) {
  1085. try {
  1086. MaintainActivity.this.mEpsonService.EpsonConnectCancel();
  1087. return null;
  1088. } catch (RemoteException e) {
  1089. e.printStackTrace();
  1090. return null;
  1091. }
  1092. }
  1093. }.executeOnExecutor(new Void[0]);
  1094. }
  1095. this.mLoadConfigThread.interrupt();
  1096. this.mLoadConfigThread = null;
  1097. }
  1098. }
  1099. private void startBackgroundThread() {
  1100. this.mIsStillUpdate = true;
  1101. this.mBackGround = new Thread(new Runnable() {
  1102. public void run() {
  1103. int doGetStatus = MaintainActivity.this.mPrinter.doGetStatus();
  1104. Message message = new Message();
  1105. message.what = 2;
  1106. Bundle bundle = new Bundle();
  1107. bundle.putInt("GET_STT_RESULT", doGetStatus);
  1108. message.setData(bundle);
  1109. MaintainActivity.this.mUiHandler.sendMessage(message);
  1110. int doGetInkInfo = MaintainActivity.this.mPrinter.doGetInkInfo();
  1111. Message message2 = new Message();
  1112. message2.what = 3;
  1113. Bundle bundle2 = new Bundle();
  1114. bundle2.putInt("GET_INK_RESULT", doGetInkInfo);
  1115. message2.setData(bundle2);
  1116. MaintainActivity.this.mUiHandler.sendMessage(message2);
  1117. BatteryInfoEx batteryInfoEx = new BatteryInfoEx();
  1118. int batteryInfo = MaintainActivity.this.mPrinter.getBatteryInfo(batteryInfoEx);
  1119. boolean z = batteryInfo == 0 && batteryInfoEx.powerSourceType != -1;
  1120. Message message3 = new Message();
  1121. message3.what = 15;
  1122. Bundle bundle3 = new Bundle();
  1123. bundle3.putInt("GET_BATTERY_RESULT", batteryInfo);
  1124. bundle3.putParcelable("GET_BATTERY_INFO", batteryInfoEx);
  1125. message3.setData(bundle3);
  1126. MaintainActivity.this.mUiHandler.sendMessage(message3);
  1127. int[] maintenanceBoxInformation = MaintainActivity.this.mPrinter.getMaintenanceBoxInformation();
  1128. MaintainActivity maintainActivity = MaintainActivity.this;
  1129. maintainActivity.sendMaintenanceBoxInfoMessage(maintainActivity.mUiHandler, maintenanceBoxInformation);
  1130. while (MaintainActivity.this.mIsStillUpdate) {
  1131. try {
  1132. EPLog.m313i(MaintainActivity.TAG, "thread update stt running");
  1133. int doGetStatus2 = MaintainActivity.this.mPrinter.doGetStatus();
  1134. Message message4 = new Message();
  1135. message4.what = 2;
  1136. bundle3.putInt("GET_STT_RESULT", doGetStatus2);
  1137. Bundle bundle4 = new Bundle();
  1138. message4.setData(bundle4);
  1139. MaintainActivity.this.mUiHandler.sendMessage(message4);
  1140. if (z) {
  1141. int batteryInfo2 = MaintainActivity.this.mPrinter.getBatteryInfo(batteryInfoEx);
  1142. Message message5 = new Message();
  1143. message5.what = 15;
  1144. bundle3 = new Bundle();
  1145. bundle3.putInt("GET_BATTERY_RESULT", batteryInfo2);
  1146. bundle3.putParcelable("GET_BATTERY_INFO", batteryInfoEx);
  1147. message5.setData(bundle3);
  1148. MaintainActivity.this.mUiHandler.sendMessage(message5);
  1149. } else {
  1150. bundle3 = bundle4;
  1151. }
  1152. MaintainActivity.this.sendMaintenanceBoxInfoMessage(MaintainActivity.this.mUiHandler, MaintainActivity.this.mPrinter.getMaintenanceBoxInformation());
  1153. Thread.sleep(4000);
  1154. } catch (InterruptedException e) {
  1155. EPLog.m318w("startBackgroundThread", "InterruptedException");
  1156. e.printStackTrace();
  1157. return;
  1158. }
  1159. }
  1160. }
  1161. }, "status-update");
  1162. this.mBackGround.setPriority(5);
  1163. this.mBackGround.start();
  1164. }
  1165. private void sendMaintenanceBoxInfoMessage(Handler handler, int[] iArr) {
  1166. this.mUiHandler.removeMessages(16);
  1167. handler.sendMessage(handler.obtainMessage(16, 0, 0, iArr));
  1168. }
  1169. private void endBackGroundThread() {
  1170. this.mIsStillUpdate = false;
  1171. Thread thread = this.mBackGround;
  1172. if (thread != null && thread.isAlive()) {
  1173. this.mBackGround.interrupt();
  1174. try {
  1175. this.mBackGround.join();
  1176. } catch (InterruptedException e) {
  1177. e.printStackTrace();
  1178. }
  1179. this.mBackGround = null;
  1180. }
  1181. }
  1182. public void onConfigurationChanged(Configuration configuration) {
  1183. super.onConfigurationChanged(configuration);
  1184. }
  1185. protected void onActivityResult(int i, int i2, Intent intent) {
  1186. IEpsonService iEpsonService;
  1187. super.onActivityResult(i, i2, intent);
  1188. switch (i) {
  1189. case 100:
  1190. onInkReplenishDialogEnd();
  1191. return;
  1192. case 101:
  1193. MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
  1194. if (curPrinter.getName() == null) {
  1195. finish();
  1196. return;
  1197. } else if (i2 == 1) {
  1198. if (MyPrinter.isRemotePrinter(getApplicationContext()) && (iEpsonService = this.mEpsonService) != null) {
  1199. try {
  1200. iEpsonService.refreshRemotePrinterLogin();
  1201. } catch (RemoteException unused) {
  1202. }
  1203. }
  1204. if (!isSimpleApOrP2p(curPrinter)) {
  1205. startInkDsDialog();
  1206. return;
  1207. } else {
  1208. onInkReplenishDialogEnd();
  1209. return;
  1210. }
  1211. } else {
  1212. onInkReplenishDialogEnd();
  1213. return;
  1214. }
  1215. default:
  1216. return;
  1217. }
  1218. }
  1219. private boolean isSimpleApOrP2p(MyPrinter myPrinter) {
  1220. return WiFiDirectManager.getCurConnectInfo(this, MacAddrUtils.getMacAddressFromPrinterId(myPrinter.getPrinterId())) != null;
  1221. }
  1222. private void onInkReplenishDialogEnd() {
  1223. this.mWaiteInkDsDialog = false;
  1224. }
  1225. private void startInkDsDialog() {
  1226. startActivityForResult(InkRplnProgressDialog.getStartIntent(this), 100);
  1227. }
  1228. private void updateSelectedPrinter() {
  1229. hideLoadProgressBar();
  1230. stopLoadConfigThread();
  1231. this.mIsNozzleCheckEnable = true;
  1232. this.escprSetPrinterSuccessed = this.mPrinter.doSetPrinter();
  1233. int i = this.escprSetPrinterSuccessed;
  1234. int i2 = 0;
  1235. if (i == 0) {
  1236. startBackgroundThread();
  1237. this.mIsStillUpdate = true;
  1238. setButtonClickable(true);
  1239. } else {
  1240. this.mIsStillUpdate = false;
  1241. handlerError(i, false);
  1242. }
  1243. if (this.mPrinter.doGetLang() != 1) {
  1244. this.mHeadCleanView.setVisibility(8);
  1245. this.mNozzleCheckView.setVisibility(8);
  1246. this.mFWUpdateView.setVisibility(8);
  1247. } else {
  1248. this.mHeadCleanView.setVisibility(0);
  1249. this.mNozzleCheckView.setVisibility(0);
  1250. LinearLayout linearLayout = this.mFWUpdateView;
  1251. if (this.printerLocation != 1) {
  1252. i2 = 8;
  1253. }
  1254. linearLayout.setVisibility(i2);
  1255. }
  1256. this.printerIp = this.mPrinter.doGetIp();
  1257. }
  1258. private synchronized void updateStatus(int i) {
  1259. this.mUiHandler.sendEmptyMessage(11);
  1260. if (i == 0) {
  1261. if (isPrinterReady() != 1) {
  1262. setButtonClickable(false);
  1263. } else {
  1264. setButtonClickable(true);
  1265. int doGetInkInfo = this.mPrinter.doGetInkInfo();
  1266. Message message = new Message();
  1267. message.what = 3;
  1268. Bundle bundle = new Bundle();
  1269. bundle.putInt("GET_INK_RESULT", doGetInkInfo);
  1270. message.setData(bundle);
  1271. this.mUiHandler.sendMessage(message);
  1272. }
  1273. if (this.mPrinterStatus[0] == 4) {
  1274. if (this.mPrinterStatus[1] == 102) {
  1275. this.escprSetPrinterSuccessed = -1;
  1276. } else {
  1277. this.escprSetPrinterSuccessed = 0;
  1278. }
  1279. if (this.isRemotePrinter && this.mPrinterStatus[1] == 102) {
  1280. this.mUiHandler.sendEmptyMessage(11);
  1281. } else {
  1282. setErrorStatus(this.mPrinterStatus[0], this.mPrinterStatus[1]);
  1283. if (this.mPrinterStatus[1] == 102) {
  1284. this.mInkView.removeAllViews();
  1285. }
  1286. if (this.mPrinterStatus[1] == 6 || this.mPrinterStatus[1] == 103 || this.mPrinterStatus[1] == 104) {
  1287. int doGetInkInfo2 = this.mPrinter.doGetInkInfo();
  1288. Message message2 = new Message();
  1289. message2.what = 3;
  1290. Bundle bundle2 = new Bundle();
  1291. bundle2.putInt("GET_INK_RESULT", doGetInkInfo2);
  1292. message2.setData(bundle2);
  1293. this.mUiHandler.sendMessage(message2);
  1294. }
  1295. }
  1296. } else {
  1297. this.escprSetPrinterSuccessed = 0;
  1298. Integer[] stringId = MediaInfo.StatusTable.getStringId(this.mPrinterStatus[0]);
  1299. if (stringId != null) {
  1300. this.mTvPrinterStatus.setText(getString(stringId[0].intValue()));
  1301. this.mTvPrinterStatusDetail.setText(getString(stringId[1].intValue()));
  1302. } else {
  1303. TextView textView = this.mTvPrinterStatus;
  1304. textView.setText("Stt Code: " + this.mPrinterStatus[0]);
  1305. TextView textView2 = this.mTvPrinterStatusDetail;
  1306. textView2.setText("Err Code: " + this.mPrinterStatus[1]);
  1307. }
  1308. }
  1309. } else {
  1310. handlerError(i, false);
  1311. }
  1312. }
  1313. public void updateInkInfo(int i) {
  1314. createInkView(this.mPrinter.getMPrinterInfor(), i);
  1315. }
  1316. private void updateBatteryInfoEx(int i, BatteryInfoEx batteryInfoEx) {
  1317. int i2 = batteryInfoEx.number;
  1318. int i3 = batteryInfoEx.powerSourceType;
  1319. if (i != 0 || i2 <= 0 || i3 == -1) {
  1320. BatteryInfoAdapter.BatteryInfoManager.clearBatteryList(this);
  1321. return;
  1322. }
  1323. int[] iArr = batteryInfoEx.batteryState;
  1324. int[] iArr2 = batteryInfoEx.batteryRemain;
  1325. BatteryInfoAdapter.BatteryInfoManager.showPowerText(this);
  1326. BatteryInfoAdapter.BatteryInfoManager.showBatteryList(this, i2, i3, iArr, iArr2);
  1327. }
  1328. private void updateMaintenanceBoxInfo(int[] iArr) {
  1329. int i = this.mBuyInkGroupVisibility;
  1330. if (iArr == null || iArr.length <= 0) {
  1331. this.mMaintenanceBoxText.setVisibility(8);
  1332. this.mMaintenanceBoxView.setVisibility(8);
  1333. if (8 != this.mInkView.getVisibility()) {
  1334. int i2 = this.mBuyInkGroupVisibility;
  1335. return;
  1336. }
  1337. return;
  1338. }
  1339. this.mMaintenanceBoxText.setVisibility(0);
  1340. this.mMaintenanceBoxView.setVisibility(0);
  1341. this.mBuyInkGroup.setVisibility(i);
  1342. LayoutInflater from = LayoutInflater.from(this);
  1343. Point point = new Point();
  1344. this.mDisplay.getSize(point);
  1345. int i3 = (point.x - 30) / 2;
  1346. this.mMaintenanceBoxView.removeAllViews();
  1347. int length = iArr.length / 2;
  1348. for (int i4 = 0; i4 < length; i4++) {
  1349. int i5 = i4 * 2;
  1350. int i6 = iArr[i5];
  1351. int i7 = iArr[i5 + 1];
  1352. View inflate = from.inflate(R.layout.ink_item, this.mMaintenanceBoxView, false);
  1353. ((TextView) inflate.findViewById(R.id.ink_name)).setVisibility(8);
  1354. ((RelativeLayout) inflate.findViewById(R.id.ink_holder)).getLayoutParams().width = i3;
  1355. ViewGroup viewGroup = (ViewGroup) inflate.findViewById(R.id.ink_level);
  1356. if (i7 <= 0 || isMaintenanceBoxStatusDisplayX(i6)) {
  1357. viewGroup.getLayoutParams().width = 0;
  1358. inflate.findViewById(R.id.ink_error).setVisibility(0);
  1359. viewGroup.setVisibility(4);
  1360. } else {
  1361. viewGroup.getLayoutParams().width = (int) ((((float) (i3 - 4)) / 100.0f) * ((float) i7));
  1362. viewGroup.setBackgroundResource(R.color.maintenance_box_info);
  1363. viewGroup.setVisibility(0);
  1364. }
  1365. this.mMaintenanceBoxView.addView(inflate);
  1366. }
  1367. }
  1368. private void handlerError(int i, boolean z) {
  1369. hideLoadProgressBar();
  1370. if (i == -1351 || i == -1100) {
  1371. i = -1300;
  1372. }
  1373. if (this.isRemotePrinter && i == -1300) {
  1374. setButtonClickable(false);
  1375. this.mUiHandler.sendEmptyMessage(11);
  1376. return;
  1377. }
  1378. setErrorStatus(4, i);
  1379. setButtonClickable(false);
  1380. this.mUiHandler.sendEmptyMessage(11);
  1381. if (!z) {
  1382. return;
  1383. }
  1384. if (i == -1300 || i == -500001) {
  1385. this.mInkView.removeAllViews();
  1386. }
  1387. }
  1388. private void setErrorStatus(int i, int i2) {
  1389. Integer[] stringId = MediaInfo.ErrorTable.getStringId(i2);
  1390. if (stringId != null) {
  1391. String[] replaceMessage = Utils.replaceMessage(stringId, i2, getApplicationContext());
  1392. this.mTvPrinterStatus.setText(replaceMessage[1]);
  1393. EPLog.m313i(TAG, "Stt title: " + replaceMessage[1]);
  1394. String str = replaceMessage[0];
  1395. this.mTvPrinterStatusDetail.setText(str);
  1396. EPLog.m313i(TAG, "Stt detail: " + str);
  1397. return;
  1398. }
  1399. TextView textView = this.mTvPrinterStatus;
  1400. textView.setText("Stt Code: " + i);
  1401. TextView textView2 = this.mTvPrinterStatusDetail;
  1402. textView2.setText("Err Code: " + i2);
  1403. }
  1404. private int isPrinterReady() {
  1405. this.mPrinterStatus = this.mPrinter.getMPrinterInfor().getMStatus();
  1406. int[] iArr = this.mPrinterStatus;
  1407. if (iArr[0] == 2 || iArr[0] == 1 || iArr[0] == 3) {
  1408. return 0;
  1409. }
  1410. if (iArr[0] == 4) {
  1411. return -1;
  1412. }
  1413. return 1;
  1414. }
  1415. private void interrupMaintainThread() {
  1416. Thread thread = this.mDoMaintainThread;
  1417. if (thread != null && thread.isAlive()) {
  1418. this.mDoMaintainThread.interrupt();
  1419. this.mDoMaintainThread = null;
  1420. }
  1421. }
  1422. protected void onDestroy() {
  1423. super.onDestroy();
  1424. EPLog.m313i(TAG, "onDestroy");
  1425. IEpsonService iEpsonService = this.mEpsonService;
  1426. if (iEpsonService != null) {
  1427. try {
  1428. iEpsonService.unregisterCallback(this.mCallback);
  1429. unbindService(this.mEpsonConnection);
  1430. } catch (RemoteException e) {
  1431. e.printStackTrace();
  1432. }
  1433. }
  1434. }
  1435. protected void onResume() {
  1436. EPLog.m307e("MaintainActivity", "onResume()");
  1437. super.onResume();
  1438. this.isKeepSimpleAPConnection = false;
  1439. if (!this.mWaiteInkDsDialog) {
  1440. startLoadConThread();
  1441. }
  1442. }
  1443. protected void onPause() {
  1444. EPLog.m305d("MaintainActivity", "onPause");
  1445. this.mIsCancelProbe = true;
  1446. hideLoadProgressBar();
  1447. this.mPrinter.doCancelFindPrinter();
  1448. stopLoadConfigThread();
  1449. interrupMaintainThread();
  1450. endBackGroundThread();
  1451. this.mUiHandler.removeMessages(16);
  1452. if (!this.isKeepSimpleAPConnection) {
  1453. WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, this.printerIp);
  1454. }
  1455. super.onPause();
  1456. }
  1457. protected void onStop() {
  1458. super.onStop();
  1459. }
  1460. private void performMaintain(final int i) {
  1461. if (isPrinterReady() == 1) {
  1462. this.mUiHandler.sendEmptyMessage(0);
  1463. this.mDoMaintainThread = new Thread(new Runnable() {
  1464. /* JADX WARNING: Removed duplicated region for block: B:35:0x0092 A[EDGE_INSN: B:35:0x0092->B:29:0x0092 ?: BREAK , SYNTHETIC] */
  1465. /* JADX WARNING: Removed duplicated region for block: B:37:0x002a A[SYNTHETIC] */
  1466. /* Code decompiled incorrectly, please refer to instructions dump. */
  1467. public void run() {
  1468. /*
  1469. r9 = this;
  1470. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this
  1471. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r0 = r0.mPrinter
  1472. int r1 = r3
  1473. int r0 = r0.doDoMainteCmd(r1)
  1474. r1 = 108(0x6c, float:1.51E-43)
  1475. r2 = 10
  1476. r3 = 1
  1477. r4 = 0
  1478. if (r0 != r1) goto L_0x0028
  1479. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this
  1480. boolean unused = r5.isGotError = r3
  1481. r5 = 11
  1482. epson.maintain.activity.MaintainActivity r6 = epson.maintain.activity.MaintainActivity.this
  1483. android.os.Handler r6 = r6.mUiHandler
  1484. r6.sendEmptyMessage(r2)
  1485. r5 = 0
  1486. r6 = 11
  1487. goto L_0x002a
  1488. L_0x0028:
  1489. r5 = 1
  1490. r6 = 0
  1491. L_0x002a:
  1492. if (r5 != 0) goto L_0x002e
  1493. if (r6 > r2) goto L_0x0092
  1494. L_0x002e:
  1495. r7 = 1000(0x3e8, double:4.94E-321)
  1496. java.lang.Thread.sleep(r7) // Catch:{ InterruptedException -> 0x009c }
  1497. int r6 = r6 + 1
  1498. if (r0 != r1) goto L_0x004a
  1499. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x0046 }
  1500. boolean unused = r5.isGotError = r3 // Catch:{ InterruptedException -> 0x0046 }
  1501. epson.maintain.activity.MaintainActivity r5 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x0046 }
  1502. android.os.Handler r5 = r5.mUiHandler // Catch:{ InterruptedException -> 0x0046 }
  1503. r5.sendEmptyMessage(r2) // Catch:{ InterruptedException -> 0x0046 }
  1504. goto L_0x0092
  1505. L_0x0046:
  1506. r5 = move-exception
  1507. r7 = r5
  1508. r5 = 0
  1509. goto L_0x009d
  1510. L_0x004a:
  1511. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1512. com.epson.mobilephone.common.maintain2.MaintainPrinter2 r7 = r7.mPrinter // Catch:{ InterruptedException -> 0x009c }
  1513. r7.doGetStatus() // Catch:{ InterruptedException -> 0x009c }
  1514. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1515. int[] r7 = r7.mPrinterStatus // Catch:{ InterruptedException -> 0x009c }
  1516. r7 = r7[r4] // Catch:{ InterruptedException -> 0x009c }
  1517. r8 = 4
  1518. if (r7 != r8) goto L_0x006d
  1519. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1520. boolean unused = r7.isGotError = r3 // Catch:{ InterruptedException -> 0x009c }
  1521. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1522. android.os.Handler r7 = r7.mUiHandler // Catch:{ InterruptedException -> 0x009c }
  1523. r7.sendEmptyMessage(r8) // Catch:{ InterruptedException -> 0x009c }
  1524. goto L_0x0072
  1525. L_0x006d:
  1526. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1527. boolean unused = r7.isGotError = r4 // Catch:{ InterruptedException -> 0x009c }
  1528. L_0x0072:
  1529. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1530. int[] r7 = r7.mPrinterStatus // Catch:{ InterruptedException -> 0x009c }
  1531. r7 = r7[r4] // Catch:{ InterruptedException -> 0x009c }
  1532. if (r7 == 0) goto L_0x0089
  1533. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1534. int[] r7 = r7.mPrinterStatus // Catch:{ InterruptedException -> 0x009c }
  1535. r5 = r7[r4] // Catch:{ InterruptedException -> 0x009c }
  1536. if (r5 != r8) goto L_0x0087
  1537. goto L_0x0089
  1538. L_0x0087:
  1539. r5 = 1
  1540. goto L_0x008a
  1541. L_0x0089:
  1542. r5 = 0
  1543. L_0x008a:
  1544. epson.maintain.activity.MaintainActivity r7 = epson.maintain.activity.MaintainActivity.this // Catch:{ InterruptedException -> 0x009c }
  1545. boolean r7 = r7.isGotError // Catch:{ InterruptedException -> 0x009c }
  1546. if (r7 == 0) goto L_0x002a
  1547. L_0x0092:
  1548. epson.maintain.activity.MaintainActivity r0 = epson.maintain.activity.MaintainActivity.this
  1549. android.os.Handler r0 = r0.mUiHandler
  1550. r0.sendEmptyMessage(r3)
  1551. return
  1552. L_0x009c:
  1553. r7 = move-exception
  1554. L_0x009d:
  1555. r7.printStackTrace()
  1556. goto L_0x002a
  1557. */
  1558. throw new UnsupportedOperationException("Method not decompiled: epson.maintain.activity.MaintainActivity.C201913.run():void");
  1559. }
  1560. });
  1561. this.mDoMaintainThread.start();
  1562. }
  1563. }
  1564. private void loadConfig() {
  1565. MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
  1566. this.printerName = curPrinter.getUserDefName(this);
  1567. if (this.printerName == null) {
  1568. this.printerName = "";
  1569. }
  1570. this.printerId = curPrinter.getPrinterId();
  1571. if (this.printerId == null) {
  1572. this.printerId = "";
  1573. }
  1574. this.printerIp = curPrinter.getIp();
  1575. if (this.printerIp == null) {
  1576. this.printerIp = "";
  1577. }
  1578. this.printerLocation = curPrinter.getLocation();
  1579. }
  1580. public void createInkView(MaintainPrinterInfo2 maintainPrinterInfo2, int i) {
  1581. MaintainPrinterInfo2 maintainPrinterInfo22 = maintainPrinterInfo2;
  1582. LayoutInflater from = LayoutInflater.from(this);
  1583. Point point = new Point();
  1584. this.mDisplay.getSize(point);
  1585. int i2 = (point.x - 30) / 2;
  1586. LinearLayout linearLayout = this.mInkView;
  1587. if (linearLayout != null) {
  1588. linearLayout.removeAllViews();
  1589. }
  1590. int inkNum = maintainPrinterInfo2.getInkNum();
  1591. if (inkNum > 0) {
  1592. findViewById(R.id.ink_text).setVisibility(0);
  1593. this.mInkView.setVisibility(0);
  1594. this.mBuyInkGroup.setVisibility(this.mBuyInkGroupVisibility);
  1595. for (int i3 = 0; i3 < inkNum; i3++) {
  1596. int inkRemainingAmount = maintainPrinterInfo22.getInkRemainingAmount(i3);
  1597. int inkName = maintainPrinterInfo22.getInkName(i3);
  1598. Integer[] colorName = MediaInfo.ColorTable.getColorName(inkName);
  1599. if (colorName == null) {
  1600. EpLog.m77i("colorNo = " + inkName);
  1601. colorName = MediaInfo.ColorTable.getColorName(Constants.ColorName.EPS_COLOR_WHITE.ordinal());
  1602. if (colorName != null) {
  1603. colorName[1] = 0;
  1604. } else {
  1605. return;
  1606. }
  1607. } else {
  1608. logColorInfo(inkName, colorName);
  1609. }
  1610. View inflate = from.inflate(R.layout.ink_item, (ViewGroup) null);
  1611. TextView textView = (TextView) inflate.findViewById(R.id.ink_name);
  1612. if (colorName[1].intValue() != 0) {
  1613. textView.setText(colorName[1].intValue());
  1614. } else {
  1615. textView.setText("");
  1616. }
  1617. ((RelativeLayout) inflate.findViewById(R.id.ink_holder)).getLayoutParams().width = i2;
  1618. ViewGroup viewGroup = (ViewGroup) inflate.findViewById(R.id.ink_level);
  1619. float f = (float) (i2 - 4);
  1620. if (maintainPrinterInfo22.getInkStatus(i3) == -4 || i != 0) {
  1621. viewGroup.getLayoutParams().width = 0;
  1622. viewGroup.setVisibility(4);
  1623. if (maintainPrinterInfo22.getInkStatus(i3) != -4) {
  1624. inflate.findViewById(R.id.ink_error).setVisibility(0);
  1625. }
  1626. } else {
  1627. viewGroup.getLayoutParams().width = calcInkWidth(inkRemainingAmount, f);
  1628. if (!(maintainPrinterInfo22.getInkStatus(i3) == 0 || maintainPrinterInfo22.getInkStatus(i3) == 1 || maintainPrinterInfo22.getInkStatus(i3) == 2)) {
  1629. viewGroup.getLayoutParams().width = 0;
  1630. }
  1631. if (checkIfWhite(colorName[0].intValue())) {
  1632. View findViewById = inflate.findViewById(R.id.white_ink_level);
  1633. findViewById.setBackgroundResource(colorName[0].intValue());
  1634. findViewById.setVisibility(0);
  1635. } else {
  1636. viewGroup.setBackgroundResource(colorName[0].intValue());
  1637. }
  1638. viewGroup.setVisibility(0);
  1639. if (inkRemainingAmount <= 0) {
  1640. inflate.findViewById(R.id.ink_error).setVisibility(0);
  1641. }
  1642. }
  1643. this.mInkView.addView(inflate);
  1644. }
  1645. return;
  1646. }
  1647. findViewById(R.id.ink_text).setVisibility(8);
  1648. this.mInkView.setVisibility(8);
  1649. }
  1650. private boolean checkIfWhite(@ColorRes int i) {
  1651. try {
  1652. return (getResources().getColor(i) & ViewCompat.MEASURED_SIZE_MASK) == 16777215;
  1653. } catch (Resources.NotFoundException unused) {
  1654. return false;
  1655. }
  1656. }
  1657. private void logColorInfo(int i, @NonNull Integer[] numArr) {
  1658. String str;
  1659. String str2;
  1660. String str3;
  1661. int intValue = numArr[1].intValue();
  1662. int intValue2 = numArr[0].intValue();
  1663. int intValue3 = numArr[2].intValue();
  1664. StringBuilder sb = new StringBuilder();
  1665. sb.append("colorNo = ");
  1666. sb.append(i);
  1667. sb.append(":");
  1668. if (intValue == 0) {
  1669. str = "--";
  1670. } else {
  1671. str = getString(numArr[1].intValue());
  1672. }
  1673. sb.append(str);
  1674. sb.append(":");
  1675. if (intValue2 == 0) {
  1676. str2 = "--";
  1677. } else {
  1678. str2 = String.format("#%06X", new Object[]{Integer.valueOf(16777215 & ContextCompat.getColor(this, numArr[0].intValue()))});
  1679. }
  1680. sb.append(str2);
  1681. sb.append(":");
  1682. if (intValue3 == 0) {
  1683. str3 = "--";
  1684. } else {
  1685. str3 = getString(numArr[2].intValue());
  1686. }
  1687. sb.append(str3);
  1688. EpLog.m77i(sb.toString());
  1689. }
  1690. private class CustomProDialog extends Dialog {
  1691. private int mLayoutId;
  1692. CustomProDialog(Context context, int i, int i2) {
  1693. super(context, i);
  1694. this.mLayoutId = i2;
  1695. setCancelable(false);
  1696. }
  1697. protected void onCreate(Bundle bundle) {
  1698. super.onCreate(bundle);
  1699. requestWindowFeature(1);
  1700. View inflate = getLayoutInflater().inflate(this.mLayoutId, (ViewGroup) null);
  1701. if (this.mLayoutId == R.layout.maintain_executing_dialog) {
  1702. ((Button) inflate.findViewById(R.id.close_btn)).setOnClickListener(new View.OnClickListener() {
  1703. public void onClick(View view) {
  1704. CustomProDialog.this.cancel();
  1705. MaintainActivity.this.interrupMaintainThread();
  1706. }
  1707. });
  1708. }
  1709. setContentView(inflate);
  1710. }
  1711. }
  1712. private void setButtonClickable(boolean z) {
  1713. this.mNozzleCheckView.setClickable(z);
  1714. this.mHeadCleanView.setClickable(z);
  1715. this.mFWUpdateView.setClickable(z);
  1716. if (z) {
  1717. if (!this.mIsNozzleCheckEnable.booleanValue()) {
  1718. this.mNozzleCheckText.setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  1719. } else {
  1720. this.mNozzleCheckText.setTextColor(this.mContext.getResources().getColor(R.color.black));
  1721. }
  1722. this.mHeadCleanText.setTextColor(this.mContext.getResources().getColor(R.color.black));
  1723. this.mFWUpdateText.setTextColor(this.mContext.getResources().getColor(R.color.black));
  1724. return;
  1725. }
  1726. this.mNozzleCheckText.setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  1727. this.mHeadCleanText.setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  1728. this.mFWUpdateText.setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  1729. }
  1730. private void setEpsonConnectButton(int i) {
  1731. switch (i) {
  1732. case 0:
  1733. this.mEpsonConnectView.setClickable(true);
  1734. this.mEpsonConnectView.setEnabled(true);
  1735. ((TextView) findViewById(R.id.text_epson_connect)).setTextColor(this.mContext.getResources().getColor(R.color.black));
  1736. ((ImageView) findViewById(R.id.epsonconnect_arrow)).setVisibility(0);
  1737. findViewById(R.id.epsonconnect_separator).setVisibility(0);
  1738. this.mEpsonConnectView.setVisibility(0);
  1739. return;
  1740. case 1:
  1741. this.mEpsonConnectView.setClickable(false);
  1742. this.mEpsonConnectView.setEnabled(false);
  1743. ((TextView) findViewById(R.id.text_epson_connect)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  1744. ((ImageView) findViewById(R.id.epsonconnect_arrow)).setVisibility(8);
  1745. findViewById(R.id.epsonconnect_separator).setVisibility(0);
  1746. this.mEpsonConnectView.setVisibility(0);
  1747. return;
  1748. case 2:
  1749. this.mEpsonConnectView.setClickable(false);
  1750. this.mEpsonConnectView.setEnabled(false);
  1751. ((TextView) findViewById(R.id.text_epson_connect)).setTextColor(this.mContext.getResources().getColor(R.color.light_gray));
  1752. ((ImageView) findViewById(R.id.epsonconnect_arrow)).setVisibility(8);
  1753. findViewById(R.id.epsonconnect_separator).setVisibility(8);
  1754. this.mEpsonConnectView.setVisibility(8);
  1755. return;
  1756. default:
  1757. return;
  1758. }
  1759. }
  1760. /* access modifiers changed from: package-private */
  1761. public void startBrowseNozzleCheckGuidance() {
  1762. showDialog(DIALOG_PROGRESS);
  1763. BuyInkTask(2, this.printerIp);
  1764. }
  1765. private void BuyInkTask(int i, String str) {
  1766. if (this.modelBuyInkOnlineRegTask.getReady()) {
  1767. this.modelBuyInkOnlineRegTask.loadData(i, str);
  1768. }
  1769. }
  1770. private void OnlineRegTask(String str) {
  1771. if (this.modelBuyInkOnlineRegTask.getReady()) {
  1772. this.modelBuyInkOnlineRegTask.loadData(str);
  1773. }
  1774. }
  1775. public static boolean disableSimpleApAndWait(Context context, String str) {
  1776. if (!WiFiDirectManager.disconnect(context, WiFiDirectManager.DEVICE_TYPE_PRINTER, str)) {
  1777. return false;
  1778. }
  1779. int i = 0;
  1780. while (i < 10) {
  1781. try {
  1782. if (Utils.isOnline(context)) {
  1783. return true;
  1784. }
  1785. EPLog.m305d(TAG, "Wait Connection 3G");
  1786. i++;
  1787. Thread.sleep(1000);
  1788. } catch (InterruptedException e) {
  1789. e.printStackTrace();
  1790. return false;
  1791. }
  1792. }
  1793. return false;
  1794. }
  1795. private void showDialog(String str) {
  1796. DialogProgress newInstance = DialogProgress.newInstance(str, 0, getString(R.string.str_wait));
  1797. newInstance.setCancelable(false);
  1798. newInstance.show(getSupportFragmentManager(), str);
  1799. }
  1800. private void dismissDialog(String str) {
  1801. DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
  1802. if (dialogFragment != null) {
  1803. dialogFragment.dismiss();
  1804. }
  1805. }
  1806. private class NozzleCheckTask extends AsyncTask<Void, Void, Integer> {
  1807. private NozzleCheckTask() {
  1808. }
  1809. protected void onPreExecute() {
  1810. MaintainActivity.this.showProDia();
  1811. }
  1812. protected Integer doInBackground(Void... voidArr) {
  1813. return Integer.valueOf(MaintainActivity.this.mPrinter.doDoMainteCmd(3));
  1814. }
  1815. protected void onPostExecute(Integer num) {
  1816. MaintainActivity.this.cancelProDia();
  1817. if (num.intValue() == 108) {
  1818. MaintainActivity.this.setupErrorMessage(10);
  1819. } else {
  1820. MaintainActivity.this.showNozzleCheckGuidanceDialog();
  1821. }
  1822. }
  1823. }
  1824. }