CameraPrintSettingActivity.java 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264
  1. package com.epson.cameracopy.ui;
  2. import android.content.ComponentName;
  3. import android.content.Context;
  4. import android.content.DialogInterface;
  5. import android.content.Intent;
  6. import android.content.ServiceConnection;
  7. import android.content.SharedPreferences;
  8. import android.content.res.Configuration;
  9. import android.os.AsyncTask;
  10. import android.os.Bundle;
  11. import android.os.Handler;
  12. import android.os.IBinder;
  13. import android.os.RemoteException;
  14. import android.os.SystemClock;
  15. import android.view.Menu;
  16. import android.view.MenuItem;
  17. import android.view.MotionEvent;
  18. import android.view.View;
  19. import android.widget.Button;
  20. import android.widget.ImageView;
  21. import android.widget.LinearLayout;
  22. import android.widget.TextView;
  23. import com.epson.mobilephone.common.escpr.EscprError;
  24. import com.epson.mobilephone.common.escpr.MediaInfo;
  25. import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
  26. import epson.common.Constants;
  27. import epson.common.ExternalFileUtils;
  28. import epson.common.Utils;
  29. import epson.print.ActivityIACommon;
  30. import epson.print.EPPrinterManager;
  31. import epson.print.MyPrinter;
  32. import epson.print.R;
  33. import epson.print.Util.EPLog;
  34. import epson.print.inkrpln.InkRplnRepository;
  35. import epson.print.screen.PageRangeSetting;
  36. import epson.print.screen.PrintProgress;
  37. import epson.print.screen.PrintSetting;
  38. import epson.print.screen.PrinterInfoDetail;
  39. import epson.print.screen.SearchPrinterScr;
  40. import epson.print.service.EpsonService;
  41. import epson.print.service.IEpsonService;
  42. import epson.print.service.IEpsonServiceCallback;
  43. import epson.print.widgets.CustomTitleAlertDialogBuilder;
  44. import epson.print.widgets.LongTapRepeatAdapter;
  45. import java.io.File;
  46. import java.util.ArrayList;
  47. /* renamed from: com.epson.cameracopy.ui.CameraPrintSettingActivity */
  48. public class CameraPrintSettingActivity extends ActivityIACommon implements View.OnClickListener {
  49. private static final String EXTRA_PRINTER = "myprinter";
  50. private static final String EXTRA_SIMPLEAP = "simpleap";
  51. private static final int REQUEST_CODE_INFO = 1;
  52. private static final int REQUEST_CODE_INK_REPLENISH_PROGRESS = 4;
  53. private static final int REQUEST_CODE_PAGE_RANGE = 2;
  54. private static final int REQUEST_CODE_PRINTER = 0;
  55. public static final String TAG = "CameraPrintSetting";
  56. private final int COLOR_VALUE_MAX = 50;
  57. private final int COLOR_VALUE_MIN = -50;
  58. private final int COPIES_MAX = 30;
  59. private final int COPIES_MIN = 1;
  60. private final int EPS_ERR_COMM_ERROR = -1100;
  61. private final int EPS_ERR_NONE = 0;
  62. private final int EPS_ERR_OPR_FAIL = -1000;
  63. private final int EPS_ERR_PRINTER_NOT_SET = EscprError.EPS_ERR_PRINTER_NOT_SET;
  64. private final int GET_ADVANCED = 64;
  65. private final int GET_COLOR = 6;
  66. private final int GET_DUPLEX = 32;
  67. private final int GET_LAYOUT = 3;
  68. private final int GET_PAPER_SIZE = 1;
  69. private final int GET_PAPER_SOURCE = 5;
  70. private final int GET_PAPER_TYPE = 2;
  71. private final int GET_QUALITY = 4;
  72. private final int GET_SUPPORTED_MEDIA = 0;
  73. private final int PROBE_PRINTER = 17;
  74. private final int SEARCH_BY_ID = 7;
  75. private final int SEARCH_ERROR = 16;
  76. private final int SETTING_DONE = 3;
  77. private final int SHOW_ERROR_DIALOG = 18;
  78. private String autoConnectSsid = null;
  79. private TextView brightness;
  80. private Button brightnessMinus;
  81. private Button brightnessPlus;
  82. private int brightnessValue;
  83. private int color;
  84. private TextView colorInfo;
  85. private int[] color_info = null;
  86. private TextView contrast;
  87. private Button contrastMinus;
  88. private Button contrastPlus;
  89. private int contrastValue;
  90. private TextView copies;
  91. private Button copiesMinus;
  92. private Button copiesPlus;
  93. private int copiesValue;
  94. private boolean disablePrintArea = false;
  95. private int duplex;
  96. private TextView duplexInfo;
  97. private int[] duplex_info = null;
  98. private boolean enableShowPreview = false;
  99. private int endValue;
  100. private int feedDirection;
  101. private TextView feedDirectionInfo;
  102. private int[] info = null;
  103. private boolean isDocumentSetting = true;
  104. boolean isInfoAvai = false;
  105. Boolean isNotLoading = true;
  106. private boolean isRetryAfterConnectSimpleAp = false;
  107. private boolean isTryConnectSimpleAp = false;
  108. private int lang = 1;
  109. private int layout;
  110. private TextView layoutInfo;
  111. private int[] layout_info = null;
  112. private final IEpsonServiceCallback mCallback = new IEpsonServiceCallback.Stub() {
  113. public void onGetInkState() throws RemoteException {
  114. }
  115. public void onGetStatusState() throws RemoteException {
  116. }
  117. public void onNotifyEndJob(int i) throws RemoteException {
  118. }
  119. public void onNotifyProgress(int i, int i2) throws RemoteException {
  120. }
  121. public void onFindPrinterResult(String str, String str2, String str3, String str4, String str5) throws RemoteException {
  122. String unused = CameraPrintSettingActivity.this.printerIp = str2;
  123. }
  124. public void onNotifyContinueable(int i) throws RemoteException {
  125. EPLog.i("IEpsonServiceCallback", "onNotifyContinueable code = " + i);
  126. if (i == 0) {
  127. CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
  128. cameraPrintSettingActivity.isInfoAvai = true;
  129. int unused = cameraPrintSettingActivity.lang = cameraPrintSettingActivity.getPrinterLang();
  130. CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
  131. cameraPrintSettingActivity2.undoFlag = false;
  132. cameraPrintSettingActivity2.mHandler.sendEmptyMessage(0);
  133. }
  134. }
  135. public void onNotifyError(int i, int i2, boolean z) throws RemoteException {
  136. EPLog.i("IEpsonServiceCallback", "onNotifyError errorCode = " + i2);
  137. CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
  138. cameraPrintSettingActivity.isInfoAvai = true;
  139. int unused = cameraPrintSettingActivity.lang = cameraPrintSettingActivity.getPrinterLang();
  140. CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
  141. cameraPrintSettingActivity2.undoFlag = false;
  142. cameraPrintSettingActivity2.mHandler.sendEmptyMessage(0);
  143. }
  144. };
  145. private final boolean mCameraCopy = true;
  146. private Context mContext = null;
  147. private final ServiceConnection mEpsonConnection = new ServiceConnection() {
  148. public void onServiceDisconnected(ComponentName componentName) {
  149. EPLog.m316v("SettingScr", "onServiceDisconnected");
  150. try {
  151. CameraPrintSettingActivity.mEpsonService.unregisterCallback(CameraPrintSettingActivity.mCallback);
  152. } catch (RemoteException e) {
  153. e.printStackTrace();
  154. }
  155. IEpsonService unused = CameraPrintSettingActivity.mEpsonService = null;
  156. }
  157. public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
  158. IEpsonService unused = CameraPrintSettingActivity.mEpsonService = IEpsonService.Stub.asInterface(iBinder);
  159. EPLog.m316v("SettingScr", "onServiceConnected");
  160. if (CameraPrintSettingActivity.mEpsonService != null) {
  161. try {
  162. CameraPrintSettingActivity.mEpsonService.registerCallback(CameraPrintSettingActivity.mCallback);
  163. } catch (RemoteException e) {
  164. e.printStackTrace();
  165. }
  166. }
  167. }
  168. };
  169. private IEpsonService mEpsonService = null;
  170. Handler mHandler = new Handler(new Handler.Callback() {
  171. public boolean handleMessage(android.os.Message r15) {
  172. throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.ui.CameraPrintSettingActivity.C08553.handleMessage(android.os.Message):boolean");
  173. }
  174. private int[] removeCddvdMedia(int[] iArr) {
  175. if (iArr == null) {
  176. return null;
  177. }
  178. ArrayList arrayList = new ArrayList();
  179. for (int valueOf : iArr) {
  180. arrayList.add(Integer.valueOf(valueOf));
  181. }
  182. for (Integer remove : new Integer[]{91, 92, 93}) {
  183. do {
  184. } while (arrayList.remove(remove));
  185. }
  186. int[] iArr2 = new int[arrayList.size()];
  187. for (int i = 0; i < arrayList.size(); i++) {
  188. iArr2[i] = ((Integer) arrayList.get(i)).intValue();
  189. }
  190. return iArr2;
  191. }
  192. });
  193. private MediaInfo.AbstractInfo mLookupTable;
  194. private MediaInfo.AbstractInfo mPaperSizeType;
  195. private boolean mPrinterSelectDone;
  196. private int mRemoteSrcType;
  197. private boolean mWaiteInkReplenProgress;
  198. private int paperSize;
  199. private TextView paperSizeInfo;
  200. private int paperSource;
  201. private TextView paperSourceInfo;
  202. private int paperType;
  203. private TextView paperTypeInfo;
  204. private int[] paper_size_info = null;
  205. private int[] paper_source_info = null;
  206. private int[] paper_type_info = null;
  207. private boolean printAll;
  208. private TextView printDateInfo;
  209. private int printdate;
  210. private MyPrinter printer = null;
  211. private String printerDeviceId;
  212. private String printerEmailAddress;
  213. private String printerId;
  214. private String printerIp;
  215. private int printerLocation;
  216. private TextView printerName;
  217. private String printerSerialNo;
  218. private View progressGetOption;
  219. private int quality;
  220. private TextView qualityInfo;
  221. private int[] quality_info = null;
  222. private TextView saturation;
  223. private Button saturationMinus;
  224. private Button saturationPlus;
  225. private int saturationValue;
  226. private int sheets = 1;
  227. private int sizeIndex = 0;
  228. private int startValue;
  229. private int typeIndex = 0;
  230. boolean undoFlag = true;
  231. static /* synthetic */ int access$1108(CameraPrintSettingActivity cameraPrintSettingActivity) {
  232. int i = cameraPrintSettingActivity.sizeIndex;
  233. cameraPrintSettingActivity.sizeIndex = i + 1;
  234. return i;
  235. }
  236. static /* synthetic */ int access$1608(CameraPrintSettingActivity cameraPrintSettingActivity) {
  237. int i = cameraPrintSettingActivity.typeIndex;
  238. cameraPrintSettingActivity.typeIndex = i + 1;
  239. return i;
  240. }
  241. protected void onCreate(Bundle bundle) {
  242. super.onCreate(bundle);
  243. setContentView(R.layout.setting_layout);
  244. setActionBar(R.string.str_btn_printer_settings, true);
  245. bindEpsonService();
  246. mContext = this;
  247. mRemoteSrcType = 2;
  248. isDocumentSetting = getIntent().getBooleanExtra(PrintProgress.PARAM_DOCUMENT_MODE, false);
  249. if (this.isDocumentSetting) {
  250. sheets = getIntent().getIntExtra("SHEETS", 1);
  251. disablePrintArea = getIntent().getBooleanExtra("PRINTAREA", false);
  252. mRemoteSrcType = 1;
  253. }
  254. sheets = 1;
  255. mRemoteSrcType = 2;
  256. printerName = (TextView) findViewById(R.id.printer_name);
  257. paperSizeInfo = (TextView) findViewById(R.id.paper_size_info);
  258. paperTypeInfo = (TextView) findViewById(R.id.paper_type_info);
  259. layoutInfo = (TextView) findViewById(R.id.layout_info);
  260. qualityInfo = (TextView) findViewById(R.id.quality_info);
  261. paperSourceInfo = (TextView) findViewById(R.id.paper_source_info);
  262. copies = (TextView) findViewById(R.id.copies);
  263. copiesMinus = (Button) findViewById(R.id.copies_minus_button);
  264. copiesPlus = (Button) findViewById(R.id.copies_plus_button);
  265. LongTapRepeatAdapter.bless(this.copiesMinus);
  266. LongTapRepeatAdapter.bless(this.copiesPlus);
  267. colorInfo = (TextView) findViewById(R.id.color_info);
  268. duplexInfo = (TextView) findViewById(R.id.duplex_info);
  269. feedDirectionInfo = (TextView) findViewById(R.id.feed_direction_info);
  270. printDateInfo = (TextView) findViewById(R.id.printdate_info);
  271. brightness = (TextView) findViewById(R.id.brightness);
  272. brightnessMinus = (Button) findViewById(R.id.brightness_minus_button);
  273. brightnessPlus = (Button) findViewById(R.id.brightness_plus_button);
  274. contrast = (TextView) findViewById(R.id.contrast);
  275. contrastMinus = (Button) findViewById(R.id.contrast_minus_button);
  276. contrastPlus = (Button) findViewById(R.id.contrast_plus_button);
  277. saturation = (TextView) findViewById(R.id.saturation);
  278. saturationMinus = (Button) findViewById(R.id.saturation_minus_button);
  279. saturationPlus = (Button) findViewById(R.id.saturation_plus_button);
  280. progressGetOption = findViewById(R.id.progressGetOption);
  281. enableShowPreview = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).getBoolean(Constants.ENABLE_SHOW_PREVIEW, true);
  282. loadConfig();
  283. setClickListener();
  284. updatePrinterIcon();
  285. if (this.printerId != null) {
  286. undoFlag = false;
  287. if (loadSupportedMediaFile()) {
  288. mHandler.sendEmptyMessage(1);
  289. } else {
  290. mHandler.sendEmptyMessage(17);
  291. }
  292. } else {
  293. mHandler.sendEmptyMessage(1);
  294. }
  295. }
  296. private void updatePrinterIcon() {
  297. if (this.printerName.getText().equals(getString(R.string.str_lbl_title_scan))) {
  298. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(View.GONE);
  299. return;
  300. }
  301. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(View.VISIBLE);
  302. switch (this.printerLocation) {
  303. case 1:
  304. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.drawable.print_local);
  305. return;
  306. case 2:
  307. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.drawable.print_remote);
  308. return;
  309. case 3:
  310. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.drawable.print_ip);
  311. return;
  312. default:
  313. return;
  314. }
  315. }
  316. private void setClickListener() {
  317. copiesMinus.setOnClickListener(this);
  318. copiesPlus.setOnClickListener(this);
  319. brightnessMinus.setOnClickListener(this);
  320. brightnessPlus.setOnClickListener(this);
  321. contrastMinus.setOnClickListener(this);
  322. contrastPlus.setOnClickListener(this);
  323. saturationMinus.setOnClickListener(this);
  324. saturationPlus.setOnClickListener(this);
  325. if (this.isDocumentSetting) {
  326. findViewById(R.id.page_range_setting).setOnClickListener(this);
  327. }
  328. findViewById(R.id.printer).setOnClickListener(this);
  329. findViewById(R.id.paper_size).setOnClickListener(this);
  330. findViewById(R.id.paper_type).setOnClickListener(this);
  331. findViewById(R.id.layout).setOnClickListener(this);
  332. findViewById(R.id.quality).setOnClickListener(this);
  333. findViewById(R.id.paper_source).setOnClickListener(this);
  334. findViewById(R.id.color).setOnClickListener(this);
  335. findViewById(R.id.duplex).setOnClickListener(this);
  336. findViewById(R.id.feed_direction).setOnClickListener(this);
  337. findViewById(R.id.printdate).setOnClickListener(this);
  338. }
  339. private void loadConfig() {
  340. MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
  341. if (curPrinter == null || curPrinter.getName() == null) {
  342. printerName.setText(getString(R.string.str_lbl_title_scan));
  343. } else {
  344. printerName.setText(curPrinter.getUserDefName(this));
  345. }
  346. printerDeviceId = curPrinter.getName();
  347. printerId = curPrinter.getPrinterId();
  348. printerIp = curPrinter.getIp();
  349. printerSerialNo = curPrinter.getSerialNo();
  350. printerEmailAddress = curPrinter.getEmailAddress();
  351. printerLocation = curPrinter.getLocation();
  352. boolean z = true;
  353. if (this.printerLocation == 0) {
  354. printerLocation = 1;
  355. }
  356. autoConnectSsid = WiFiDirectManager.getConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER);
  357. PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
  358. printSetting.loadSettings();
  359. mLookupTable = new MediaInfo.PaperSize();
  360. paperSize = printSetting.paperSizeValue;
  361. paperSizeInfo.setText(getString(mLookupTable.getStringId(this.paperSize)));
  362. mLookupTable.destructor();
  363. mLookupTable = new MediaInfo.PaperType();
  364. paperType = printSetting.paperTypeValue;
  365. paperTypeInfo.setText(getString(mLookupTable.getStringId(this.paperType)));
  366. mLookupTable.destructor();
  367. mPaperSizeType = printSetting.loadPaperSizeTypePear();
  368. mPaperSizeType.putID(this.paperSize, paperType);
  369. mLookupTable = new MediaInfo.Layout();
  370. layout = printSetting.layoutValue;
  371. layoutInfo.setText(getString(mLookupTable.getStringId(this.layout)));
  372. mLookupTable.destructor();
  373. mLookupTable = new MediaInfo.Quality();
  374. quality = printSetting.qualityValue;
  375. qualityInfo.setText(getString(mLookupTable.getStringId(this.quality)));
  376. mLookupTable.destructor();
  377. mLookupTable = new MediaInfo.PaperSource();
  378. paperSource = printSetting.paperSourceValue;
  379. paperSourceInfo.setText(getString(mLookupTable.getStringId(this.paperSource)));
  380. mLookupTable.destructor();
  381. mLookupTable = new MediaInfo.Color();
  382. color = printSetting.colorValue;
  383. colorInfo.setText(getString(mLookupTable.getStringId(this.color)));
  384. mLookupTable.destructor();
  385. copiesValue = printSetting.copiesValue;
  386. copies.setText(String.valueOf(this.copiesValue));
  387. copiesMinus.setEnabled(this.copiesValue != 1);
  388. Button button = copiesPlus;
  389. if (this.copiesValue == 30) {
  390. z = false;
  391. }
  392. button.setEnabled(z);
  393. brightnessValue = printSetting.brightnessValue;
  394. contrastValue = printSetting.contrastValue;
  395. saturationValue = printSetting.saturationValue;
  396. mLookupTable = new MediaInfo.Duplex();
  397. duplex = printSetting.duplexValue;
  398. duplexInfo.setText(getString(mLookupTable.getStringId(this.duplex)));
  399. mLookupTable.destructor();
  400. mLookupTable = new MediaInfo.FeedDirection();
  401. feedDirection = printSetting.feedDirectionValue;
  402. feedDirectionInfo.setText(getString(mLookupTable.getStringId(this.feedDirection)));
  403. mLookupTable.destructor();
  404. lang = curPrinter.getLang();
  405. if (this.isDocumentSetting) {
  406. printAll = printSetting.printAll;
  407. startValue = printSetting.startValue;
  408. endValue = printSetting.endValue;
  409. ((TextView) findViewById(R.id.page_range_value)).setText(this.startValue + ".." + endValue);
  410. return;
  411. }
  412. mLookupTable = new MediaInfo.PrintDate();
  413. printdate = printSetting.printdate;
  414. printDateInfo.setText(getString(mLookupTable.getStringId(this.printdate)));
  415. mLookupTable.destructor();
  416. }
  417. private boolean loadSupportedMediaFile() {
  418. ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
  419. File savedSupportedMedia = instance.getSavedSupportedMedia();
  420. File supportedMedia = instance.getSupportedMedia();
  421. File preSupportedMedia = instance.getPreSupportedMedia();
  422. EPLog.i(TAG, "call loadSupportedMedia");
  423. try {
  424. if (!savedSupportedMedia.exists()) {
  425. EPLog.w("loadSupportedMedia", savedSupportedMedia.getName() + " not exist");
  426. return false;
  427. }
  428. Utils.copyFile(savedSupportedMedia, supportedMedia);
  429. Utils.copyFile(savedSupportedMedia, preSupportedMedia);
  430. File savedAreaInfo = instance.getSavedAreaInfo();
  431. File areaInfo = instance.getAreaInfo();
  432. File preAreaInfo = instance.getPreAreaInfo();
  433. try {
  434. if (!savedAreaInfo.exists()) {
  435. return true;
  436. }
  437. Utils.copyFile(savedAreaInfo, areaInfo);
  438. Utils.copyFile(savedAreaInfo, preAreaInfo);
  439. return true;
  440. } catch (Exception e) {
  441. EPLog.w("loadSupportedMedia", "failure " + e.getMessage());
  442. return false;
  443. }
  444. } catch (Exception e2) {
  445. EPLog.w("loadSupportedMedia", "failure " + e2.getMessage());
  446. return false;
  447. }
  448. }
  449. private boolean updateSupportedMediaFile(boolean z) {
  450. ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
  451. EPLog.i(TAG, "call updateSupportedMedia");
  452. File supportedMedia = instance.getSupportedMedia();
  453. File preSupportedMedia = instance.getPreSupportedMedia();
  454. if (z) {
  455. File file = preSupportedMedia;
  456. preSupportedMedia = supportedMedia;
  457. supportedMedia = file;
  458. }
  459. try {
  460. Utils.copyFile(supportedMedia, preSupportedMedia);
  461. File areaInfo = instance.getAreaInfo();
  462. File preAreaInfo = instance.getPreAreaInfo();
  463. if (!z) {
  464. File file2 = areaInfo;
  465. areaInfo = preAreaInfo;
  466. preAreaInfo = file2;
  467. }
  468. try {
  469. if (!preAreaInfo.exists()) {
  470. return true;
  471. }
  472. Utils.copyFile(preAreaInfo, areaInfo);
  473. return true;
  474. } catch (Exception e) {
  475. if (preAreaInfo != null && preAreaInfo.exists()) {
  476. preAreaInfo.delete();
  477. }
  478. if (areaInfo != null && areaInfo.exists()) {
  479. areaInfo.delete();
  480. }
  481. EPLog.w("updateSupportedMediaFile", "failure " + e.getMessage());
  482. return false;
  483. }
  484. } catch (Exception e2) {
  485. if (supportedMedia != null && supportedMedia.exists()) {
  486. supportedMedia.delete();
  487. }
  488. if (preSupportedMedia != null && preSupportedMedia.exists()) {
  489. preSupportedMedia.delete();
  490. }
  491. EPLog.w("updateSupportedMediaFile", "failure " + e2.getMessage());
  492. return false;
  493. }
  494. }
  495. private boolean saveSupportedMediaFile() {
  496. ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
  497. EPLog.i(TAG, "call saveSupportedMedia");
  498. File supportedMedia = instance.getSupportedMedia();
  499. File savedSupportedMedia = instance.getSavedSupportedMedia();
  500. try {
  501. if (!supportedMedia.exists()) {
  502. EPLog.w("updateSupportedMediaFile", supportedMedia.getName() + " not exist");
  503. return false;
  504. }
  505. Utils.copyFile(supportedMedia, savedSupportedMedia);
  506. File areaInfo = instance.getAreaInfo();
  507. File savedAreaInfo = instance.getSavedAreaInfo();
  508. int i = printerLocation;
  509. if (i == 1 || i == 3) {
  510. try {
  511. if (!areaInfo.exists()) {
  512. EPLog.w("updateSupportedMediaFile", areaInfo.getName() + " not exist");
  513. return false;
  514. }
  515. Utils.copyFile(areaInfo, savedAreaInfo);
  516. } catch (Exception e) {
  517. EPLog.w("saveSupportedMediaFile", "failure " + e.getMessage());
  518. return false;
  519. }
  520. } else {
  521. EPLog.i(TAG, "delete AreaInfo");
  522. instance.removeAreaInfo();
  523. }
  524. return true;
  525. } catch (Exception e2) {
  526. EPLog.w("saveSupportedMediaFile", "failure " + e2.getMessage());
  527. return false;
  528. }
  529. }
  530. private void saveChanged() {
  531. SharedPreferences.Editor edit = getSharedPreferences("PrintSetting", 0).edit();
  532. edit.putInt(Constants.PREFS_INFO_PRINT_SAVE, 1);
  533. edit.commit();
  534. MyPrinter myPrinter = new MyPrinter(this.printerDeviceId, printerIp, printerId, printerSerialNo, printerEmailAddress, printerLocation);
  535. myPrinter.setLang(this.lang);
  536. myPrinter.setCurPrinter(this);
  537. PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
  538. printSetting.paperSizeValue = paperSize;
  539. printSetting.paperTypeValue = paperType;
  540. printSetting.layoutValue = layout;
  541. printSetting.qualityValue = quality;
  542. printSetting.paperSourceValue = paperSource;
  543. printSetting.colorValue = color;
  544. printSetting.duplexValue = duplex;
  545. printSetting.feedDirectionValue = feedDirection;
  546. printSetting.copiesValue = copiesValue;
  547. printSetting.brightnessValue = brightnessValue;
  548. printSetting.contrastValue = contrastValue;
  549. printSetting.saturationValue = saturationValue;
  550. if (this.isDocumentSetting) {
  551. printSetting.printAll = printAll;
  552. printSetting.startValue = startValue;
  553. printSetting.endValue = endValue;
  554. } else {
  555. printSetting.printdate = printdate;
  556. }
  557. printSetting.saveSettings();
  558. printSetting.savePaperSizeTypePear((MediaInfo.PaperSizeType) mPaperSizeType);
  559. saveSupportedMediaFile();
  560. String str = autoConnectSsid;
  561. if (str == null || str.length() <= 0) {
  562. WiFiDirectManager.resetConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER);
  563. } else {
  564. WiFiDirectManager.setConnectInfo(this, autoConnectSsid, WiFiDirectManager.DEVICE_TYPE_PRINTER, myPrinter.getName());
  565. }
  566. EPPrinterManager ePPrinterManager = new EPPrinterManager(mContext);
  567. ePPrinterManager.commitIPPrinterInfo();
  568. ePPrinterManager.commitRemotePrinterInfo();
  569. if (mPrinterSelectDone) {
  570. new InkRplnRepository(false).savePermanently(this);
  571. }
  572. }
  573. protected void onDestroy() {
  574. super.onDestroy();
  575. unbindEpsonService();
  576. EPLog.i("SettingScr", "onDestroy");
  577. mPaperSizeType.destructor();
  578. }
  579. private void bindEpsonService() {
  580. EPLog.m316v("SettingScr", "bindEpsonService");
  581. if (mEpsonService == null) {
  582. bindService(new Intent(this, EpsonService.class), mEpsonConnection, 1);
  583. }
  584. }
  585. private void unbindEpsonService() {
  586. EPLog.m316v("SettingScr", "unbindEpsonService");
  587. IEpsonService iEpsonService = mEpsonService;
  588. if (iEpsonService != null) {
  589. try {
  590. iEpsonService.unregisterCallback(mCallback);
  591. unbindService(mEpsonConnection);
  592. mEpsonService = null;
  593. } catch (RemoteException e) {
  594. e.printStackTrace();
  595. }
  596. }
  597. }
  598. public void onClick(View view) {
  599. if (this.progressGetOption.getVisibility() == 8) {
  600. IEpsonService iEpsonService = mEpsonService;
  601. if (iEpsonService != null) {
  602. try {
  603. iEpsonService.cancelSearchPrinter();
  604. } catch (RemoteException e) {
  605. e.printStackTrace();
  606. }
  607. }
  608. switch (view.getId()) {
  609. case R.id.brightness_minus_button /*2131230848*/:
  610. brightnessValue--;
  611. if (this.brightnessValue <= -50) {
  612. brightnessValue = -50;
  613. brightnessMinus.setEnabled(false);
  614. } else {
  615. brightnessMinus.setEnabled(true);
  616. }
  617. brightnessPlus.setEnabled(true);
  618. brightness.setText(String.valueOf(this.brightnessValue));
  619. return;
  620. case R.id.brightness_plus_button /*2131230850*/:
  621. brightnessValue++;
  622. if (this.brightnessValue >= 50) {
  623. brightnessValue = 50;
  624. brightnessPlus.setEnabled(false);
  625. } else {
  626. brightnessPlus.setEnabled(true);
  627. }
  628. brightnessMinus.setEnabled(true);
  629. brightness.setText(String.valueOf(this.brightnessValue));
  630. return;
  631. case R.id.color /*2131230930*/:
  632. launchDetailScreen(this.color, R.id.color);
  633. return;
  634. case R.id.contrast_minus_button /*2131230942*/:
  635. contrastValue--;
  636. if (this.contrastValue <= -50) {
  637. contrastValue = -50;
  638. contrastMinus.setEnabled(false);
  639. } else {
  640. contrastMinus.setEnabled(true);
  641. }
  642. contrastPlus.setEnabled(true);
  643. contrast.setText(String.valueOf(this.contrastValue));
  644. return;
  645. case R.id.contrast_plus_button /*2131230943*/:
  646. contrastValue++;
  647. if (this.contrastValue >= 50) {
  648. contrastValue = 50;
  649. contrastPlus.setEnabled(false);
  650. } else {
  651. contrastPlus.setEnabled(true);
  652. }
  653. contrastMinus.setEnabled(true);
  654. contrast.setText(String.valueOf(this.contrastValue));
  655. return;
  656. case R.id.copies_minus_button /*2131230945*/:
  657. copiesValue--;
  658. if (this.copiesValue <= 1) {
  659. copiesValue = 1;
  660. copiesMinus.setEnabled(false);
  661. } else {
  662. copiesMinus.setEnabled(true);
  663. }
  664. copiesPlus.setEnabled(true);
  665. copies.setText(String.valueOf(this.copiesValue));
  666. return;
  667. case R.id.copies_plus_button /*2131230946*/:
  668. copiesValue++;
  669. if (this.copiesValue >= 30) {
  670. copiesValue = 30;
  671. copiesPlus.setEnabled(false);
  672. } else {
  673. copiesPlus.setEnabled(true);
  674. }
  675. copiesMinus.setEnabled(true);
  676. copies.setText(String.valueOf(this.copiesValue));
  677. return;
  678. case R.id.duplex /*2131231005*/:
  679. launchDetailScreen(this.duplex, R.id.duplex);
  680. return;
  681. case R.id.feed_direction /*2131231037*/:
  682. launchDetailScreen(this.feedDirection, R.id.feed_direction);
  683. return;
  684. case R.id.layout /*2131231158*/:
  685. launchDetailScreen(this.layout, R.id.layout);
  686. return;
  687. case R.id.page_range_setting /*2131231300*/:
  688. Intent intent = new Intent(this, PageRangeSetting.class);
  689. intent.putExtra("SHEETS", sheets);
  690. intent.putExtra("printAll", printAll);
  691. intent.putExtra("startValue", startValue);
  692. intent.putExtra("endValue", endValue);
  693. startActivityForResult(intent, 2);
  694. return;
  695. case R.id.paper_size /*2131231306*/:
  696. launchDetailScreen(this.paperSize, R.id.paper_size);
  697. return;
  698. case R.id.paper_source /*2131231311*/:
  699. int i = paperSource;
  700. int[] iArr = paper_source_info;
  701. if (iArr != null && iArr.length <= 1) {
  702. i = 128;
  703. }
  704. launchDetailScreen(i, R.id.paper_source);
  705. return;
  706. case R.id.paper_type /*2131231314*/:
  707. launchDetailScreen(this.paperType, R.id.paper_type);
  708. return;
  709. case R.id.printdate /*2131231355*/:
  710. launchDetailScreen(this.printdate, R.id.printdate);
  711. return;
  712. case R.id.printer /*2131231358*/:
  713. unbindEpsonService();
  714. new AsyncTask<Void, Void, Void>() {
  715. protected void onPreExecute() {
  716. CameraPrintSettingActivity.this.findViewById(R.id.printer).setClickable(false);
  717. }
  718. protected Void doInBackground(Void... voidArr) {
  719. CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
  720. WiFiDirectManager.disconnect(cameraPrintSettingActivity, WiFiDirectManager.DEVICE_TYPE_PRINTER, cameraPrintSettingActivity.printerIp);
  721. CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
  722. WiFiDirectManager.disconnectSimpleAP(cameraPrintSettingActivity2, cameraPrintSettingActivity2.autoConnectSsid, CameraPrintSettingActivity.this.printerIp);
  723. return null;
  724. }
  725. protected void onPostExecute(Void voidR) {
  726. Intent intent = new Intent(CameraPrintSettingActivity.this, SearchPrinterScr.class);
  727. Bundle bundle = new Bundle();
  728. bundle.putString(Constants.PRINTER_ID, CameraPrintSettingActivity.this.printerId);
  729. bundle.putString(Constants.PRINTER_IP, CameraPrintSettingActivity.this.printerIp);
  730. bundle.putString(Constants.PRINTER_EMAIL_ADDRESS, CameraPrintSettingActivity.this.printerEmailAddress);
  731. bundle.putInt(Constants.PRINTER_LOCATION, CameraPrintSettingActivity.this.printerLocation);
  732. bundle.putString(CameraPrintSettingActivity.EXTRA_SIMPLEAP, CameraPrintSettingActivity.this.autoConnectSsid);
  733. intent.putExtras(bundle);
  734. CameraPrintSettingActivity.this.startActivityForResult(intent, 0);
  735. CameraPrintSettingActivity.this.findViewById(R.id.printer).setClickable(true);
  736. }
  737. }.execute(new Void[0]);
  738. return;
  739. case R.id.quality /*2131231392*/:
  740. launchDetailScreen(this.quality, R.id.quality);
  741. return;
  742. case R.id.saturation_minus_button /*2131231425*/:
  743. saturationValue--;
  744. if (this.saturationValue <= -50) {
  745. saturationValue = -50;
  746. saturationMinus.setEnabled(false);
  747. } else {
  748. saturationMinus.setEnabled(true);
  749. }
  750. saturationPlus.setEnabled(true);
  751. saturation.setText(String.valueOf(this.saturationValue));
  752. return;
  753. case R.id.saturation_plus_button /*2131231426*/:
  754. saturationValue++;
  755. if (this.saturationValue >= 50) {
  756. saturationValue = 50;
  757. saturationPlus.setEnabled(false);
  758. } else {
  759. saturationPlus.setEnabled(true);
  760. }
  761. saturationMinus.setEnabled(true);
  762. saturation.setText(String.valueOf(this.saturationValue));
  763. return;
  764. default:
  765. return;
  766. }
  767. }
  768. }
  769. private void launchDetailScreen(int i, int i2) {
  770. Intent intent = new Intent(this, PrinterInfoDetail.class);
  771. Bundle bundle = new Bundle();
  772. bundle.putInt("ID", i2);
  773. bundle.putInt("sizeIndex", sizeIndex);
  774. bundle.putInt("typeIndex", typeIndex);
  775. bundle.putInt("curValue", i);
  776. bundle.putBoolean("isDocumentSetting", isDocumentSetting);
  777. switch (i2) {
  778. case R.id.color /*2131230930*/:
  779. bundle.putIntArray(Constants.COLOR_INFO, color_info);
  780. break;
  781. case R.id.duplex /*2131231005*/:
  782. bundle.putIntArray(Constants.DUPLEX_INFO, duplex_info);
  783. break;
  784. case R.id.layout /*2131231158*/:
  785. bundle.putIntArray(Constants.LAYOUT_INFO, layout_info);
  786. break;
  787. case R.id.paper_size /*2131231306*/:
  788. bundle.putIntArray(Constants.PAPER_SIZE_INFO, paper_size_info);
  789. break;
  790. case R.id.paper_source /*2131231311*/:
  791. int[] iArr = paper_source_info;
  792. bundle.putIntArray(Constants.PAPER_SOURCE_INFO, (iArr == null || iArr.length > 1) ? paper_source_info : new int[]{128});
  793. break;
  794. case R.id.paper_type /*2131231314*/:
  795. bundle.putIntArray(Constants.PAPER_TYPE_INFO, paper_type_info);
  796. break;
  797. case R.id.quality /*2131231392*/:
  798. bundle.putIntArray(Constants.PRINT_QUALITY_INFO, quality_info);
  799. break;
  800. }
  801. intent.putExtras(bundle);
  802. startActivityForResult(intent, 1);
  803. }
  804. protected void onActivityResult(int i, int i2, Intent intent) {
  805. super.onActivityResult(i, i2, intent);
  806. String callingPackage = getCallingPackage();
  807. EPLog.i(callingPackage, "requestCode = " + i + " resultCode = " + i2);
  808. if (i != 0) {
  809. if (i != 4) {
  810. if (i != 2) {
  811. if (i == 1 && i2 == -1) {
  812. int i3 = intent.getExtras().getInt("curValue");
  813. switch (intent.getExtras().getInt("ID")) {
  814. case R.id.color /*2131230930*/:
  815. mLookupTable = new MediaInfo.Color();
  816. colorInfo.setText(getString(mLookupTable.getStringId(i3)));
  817. mLookupTable.destructor();
  818. color = i3;
  819. break;
  820. case R.id.duplex /*2131231005*/:
  821. mLookupTable = new MediaInfo.Duplex();
  822. duplexInfo.setText(getString(mLookupTable.getStringId(i3)));
  823. mLookupTable.destructor();
  824. duplex = i3;
  825. break;
  826. case R.id.feed_direction /*2131231037*/:
  827. mLookupTable = new MediaInfo.FeedDirection();
  828. feedDirectionInfo.setText(getString(mLookupTable.getStringId(i3)));
  829. mLookupTable.destructor();
  830. feedDirection = i3;
  831. break;
  832. case R.id.layout /*2131231158*/:
  833. mLookupTable = new MediaInfo.Layout();
  834. layoutInfo.setText(getString(mLookupTable.getStringId(i3)));
  835. mLookupTable.destructor();
  836. layout = i3;
  837. undoFlag = false;
  838. mHandler.sendEmptyMessage(32);
  839. break;
  840. case R.id.paper_size /*2131231306*/:
  841. sizeIndex = intent.getExtras().getInt("INDEX");
  842. mLookupTable = new MediaInfo.PaperSize();
  843. paperSizeInfo.setText(getString(mLookupTable.getStringId(i3)));
  844. mLookupTable.destructor();
  845. paperSize = i3;
  846. paperType = mPaperSizeType.getID(this.paperSize);
  847. undoFlag = false;
  848. mHandler.sendEmptyMessage(2);
  849. break;
  850. case R.id.paper_source /*2131231311*/:
  851. mLookupTable = new MediaInfo.PaperSource();
  852. paperSourceInfo.setText(getString(mLookupTable.getStringId(i3)));
  853. mLookupTable.destructor();
  854. int[] iArr = paper_source_info;
  855. if (iArr != null && iArr.length > 1) {
  856. paperSource = i3;
  857. }
  858. undoFlag = false;
  859. mHandler.sendEmptyMessage(32);
  860. break;
  861. case R.id.paper_type /*2131231314*/:
  862. typeIndex = intent.getExtras().getInt("INDEX");
  863. mLookupTable = new MediaInfo.PaperType();
  864. paperTypeInfo.setText(getString(mLookupTable.getStringId(i3)));
  865. mLookupTable.destructor();
  866. paperType = i3;
  867. mPaperSizeType.putID(this.paperSize, paperType);
  868. undoFlag = false;
  869. mHandler.sendEmptyMessage(3);
  870. break;
  871. case R.id.printdate /*2131231355*/:
  872. mLookupTable = new MediaInfo.PrintDate();
  873. printDateInfo.setText(getString(mLookupTable.getStringId(i3)));
  874. mLookupTable.destructor();
  875. printdate = i3;
  876. break;
  877. case R.id.quality /*2131231392*/:
  878. mLookupTable = new MediaInfo.Quality();
  879. qualityInfo.setText(getString(mLookupTable.getStringId(i3)));
  880. mLookupTable.destructor();
  881. quality = i3;
  882. break;
  883. }
  884. }
  885. } else if (i2 == -1) {
  886. printAll = intent.getExtras().getBoolean("printAll");
  887. startValue = intent.getExtras().getInt("startValue");
  888. endValue = intent.getExtras().getInt("endValue");
  889. mHandler.sendEmptyMessage(64);
  890. }
  891. } else {
  892. endInkReplAndGoProbePrinter();
  893. }
  894. } else {
  895. onPrinterSelectEnd(i2, intent);
  896. }
  897. updatePrinterIcon();
  898. }
  899. /* JADX WARNING: Can't fix incorrect switch cases order */
  900. /* JADX WARNING: Code restructure failed: missing block: B:25:0x00ea, code lost:
  901. if (r7.loadIpPrinterInfo(r6.printerId) == null) goto L_0x00f7;
  902. */
  903. /* JADX WARNING: Code restructure failed: missing block: B:27:0x00f3, code lost:
  904. if (r7.loadRemotePrinterInfo(r6.printerEmailAddress) == null) goto L_0x00f7;
  905. */
  906. /* Code decompiled incorrectly, please refer to instructions dump. */
  907. private void onPrinterSelectEnd(int r7, android.content.Intent r8) {
  908. /*
  909. r6 = this;
  910. r0 = 0
  911. r1 = 1
  912. r2 = -1
  913. if (r7 != r2) goto L_0x00d6
  914. android.os.Bundle r7 = r8.getExtras()
  915. java.lang.String r2 = "myprinter"
  916. android.os.Parcelable r7 = r7.getParcelable(r2)
  917. epson.print.MyPrinter r7 = (epson.print.MyPrinter) r7
  918. r6.printer = r7
  919. android.widget.TextView r7 = r6.printerName
  920. epson.print.MyPrinter r2 = r6.printer
  921. java.lang.String r2 = r2.getName()
  922. r7.setText(r2)
  923. epson.print.MyPrinter r7 = r6.printer
  924. java.lang.String r7 = r7.getName()
  925. r6.printerDeviceId = r7
  926. epson.print.MyPrinter r7 = r6.printer
  927. java.lang.String r7 = r7.getPrinterId()
  928. r6.printerId = r7
  929. epson.print.MyPrinter r7 = r6.printer
  930. java.lang.String r7 = r7.getIp()
  931. r6.printerIp = r7
  932. epson.print.MyPrinter r7 = r6.printer
  933. java.lang.String r7 = r7.getSerialNo()
  934. r6.printerSerialNo = r7
  935. epson.print.MyPrinter r7 = r6.printer
  936. java.lang.String r7 = r7.getEmailAddress()
  937. r6.printerEmailAddress = r7
  938. epson.print.MyPrinter r7 = r6.printer
  939. int r7 = r7.getLocation()
  940. r6.printerLocation = r7
  941. epson.print.EPPrinterManager r7 = new epson.print.EPPrinterManager
  942. r7.<init>(r6)
  943. int r2 = r6.printerLocation
  944. switch(r2) {
  945. case 2: goto L_0x0075;
  946. case 3: goto L_0x0059;
  947. default: goto L_0x0058;
  948. }
  949. L_0x0058:
  950. goto L_0x0090
  951. L_0x0059:
  952. java.lang.String r2 = r6.printerId
  953. epson.print.EPPrinterInfo r7 = r7.loadIpPrinterInfo(r2)
  954. if (r7 == 0) goto L_0x0090
  955. java.lang.String r2 = r7.userDefName
  956. if (r2 == 0) goto L_0x0090
  957. java.lang.String r2 = r7.userDefName
  958. int r2 = r2.length()
  959. if (r2 <= 0) goto L_0x0090
  960. android.widget.TextView r2 = r6.printerName
  961. java.lang.String r7 = r7.userDefName
  962. r2.setText(r7)
  963. goto L_0x0090
  964. L_0x0075:
  965. java.lang.String r2 = r6.printerEmailAddress
  966. epson.print.EPPrinterInfo r7 = r7.loadRemotePrinterInfo(r2)
  967. if (r7 == 0) goto L_0x0090
  968. java.lang.String r2 = r7.userDefName
  969. if (r2 == 0) goto L_0x0090
  970. java.lang.String r2 = r7.userDefName
  971. int r2 = r2.length()
  972. if (r2 <= 0) goto L_0x0090
  973. android.widget.TextView r2 = r6.printerName
  974. java.lang.String r7 = r7.userDefName
  975. r2.setText(r7)
  976. L_0x0090:
  977. android.os.Bundle r7 = r8.getExtras()
  978. java.lang.String r8 = "simpleap"
  979. java.lang.String r7 = r7.getString(r8)
  980. r6.autoConnectSsid = r7
  981. android.content.Context r7 = r6.getApplicationContext()
  982. java.lang.String r8 = "PrintSetting"
  983. java.lang.String r2 = "RE_SEARCH"
  984. epson.common.Utils.savePref((android.content.Context) r7, (java.lang.String) r8, (java.lang.String) r2, (boolean) r1)
  985. r6.undoFlag = r0
  986. r6.mPrinterSelectDone = r1
  987. r6.mWaiteInkReplenProgress = r1
  988. android.content.Context r7 = r6.getApplicationContext()
  989. java.lang.String r8 = r6.printerId
  990. boolean r7 = epson.print.inkrpln.InkReplnHelper.isSimpleApOrP2p(r7, r8)
  991. if (r7 != 0) goto L_0x00d2
  992. epson.print.inkrpln.PrintSettingDependencyBuilder r7 = new epson.print.inkrpln.PrintSettingDependencyBuilder
  993. java.lang.String r1 = r6.printerId
  994. java.lang.String r2 = r6.printerIp
  995. java.lang.String r3 = r6.printerSerialNo
  996. int r4 = r6.printerLocation
  997. java.lang.String r5 = r6.printerDeviceId
  998. r0 = r7
  999. r0.<init>(r1, r2, r3, r4, r5)
  1000. android.content.Intent r7 = epson.print.inkrpln.InkRplnProgressDialog.getStartIntent2(r6, r7)
  1001. r8 = 4
  1002. r6.startActivityForResult(r7, r8)
  1003. goto L_0x00fc
  1004. L_0x00d2:
  1005. r6.endInkReplAndGoProbePrinter()
  1006. goto L_0x00fc
  1007. L_0x00d6:
  1008. r6.bindEpsonService()
  1009. epson.print.EPPrinterManager r7 = new epson.print.EPPrinterManager
  1010. r7.<init>(r6)
  1011. int r8 = r6.printerLocation
  1012. switch(r8) {
  1013. case 2: goto L_0x00ed;
  1014. case 3: goto L_0x00e4;
  1015. default: goto L_0x00e3;
  1016. }
  1017. L_0x00e3:
  1018. goto L_0x00f6
  1019. L_0x00e4:
  1020. java.lang.String r8 = r6.printerId
  1021. epson.print.EPPrinterInfo r7 = r7.loadIpPrinterInfo(r8)
  1022. if (r7 != 0) goto L_0x00f6
  1023. goto L_0x00f7
  1024. L_0x00ed:
  1025. java.lang.String r8 = r6.printerEmailAddress
  1026. epson.print.EPPrinterInfo r7 = r7.loadRemotePrinterInfo(r8)
  1027. if (r7 != 0) goto L_0x00f6
  1028. goto L_0x00f7
  1029. L_0x00f6:
  1030. r1 = 0
  1031. L_0x00f7:
  1032. if (r1 == 0) goto L_0x00fc
  1033. r6.resetSettings()
  1034. L_0x00fc:
  1035. return
  1036. */
  1037. throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.ui.CameraPrintSettingActivity.onPrinterSelectEnd(int, android.content.Intent):void");
  1038. }
  1039. private void endInkReplAndGoProbePrinter() {
  1040. mWaiteInkReplenProgress = false;
  1041. bindEpsonService();
  1042. mHandler.sendEmptyMessageDelayed(17, 100);
  1043. }
  1044. private void updateSettingView() {
  1045. boolean z = isDocumentSetting;
  1046. setVisibilityPageRange(false);
  1047. int[] iArr = color_info;
  1048. if (iArr == null) {
  1049. ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(View.GONE);
  1050. } else if (iArr.length <= 1) {
  1051. ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(View.GONE);
  1052. } else {
  1053. ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(View.VISIBLE);
  1054. }
  1055. int[] iArr2 = duplex_info;
  1056. findViewById(R.id.duplex_view).setVisibility(View.GONE);
  1057. ((LinearLayout) findViewById(R.id.duplex)).setVisibility(View.GONE);
  1058. switch (this.lang) {
  1059. case 2:
  1060. case 3:
  1061. findViewById(R.id.feed_direction_view).setVisibility(View.VISIBLE);
  1062. findViewById(R.id.feed_direction).setVisibility(View.VISIBLE);
  1063. break;
  1064. default:
  1065. findViewById(R.id.feed_direction_view).setVisibility(View.GONE);
  1066. findViewById(R.id.feed_direction).setVisibility(View.GONE);
  1067. break;
  1068. }
  1069. if (!this.isDocumentSetting) {
  1070. int i = printerLocation;
  1071. }
  1072. findViewById(R.id.printdate).setVisibility(View.GONE);
  1073. }
  1074. private int getPrinterLang() {
  1075. int i;
  1076. IEpsonService iEpsonService;
  1077. if (!(this.printerLocation == 2 || (iEpsonService = mEpsonService) == null)) {
  1078. try {
  1079. i = iEpsonService.getLang();
  1080. } catch (RemoteException e) {
  1081. e.printStackTrace();
  1082. }
  1083. EPLog.d(TAG, "getPrinterLang called : ret = " + i);
  1084. return i;
  1085. }
  1086. i = 1;
  1087. EPLog.d(TAG, "getPrinterLang called : ret = " + i);
  1088. return i;
  1089. }
  1090. private void setVisibilityPageRange(boolean z) {
  1091. int i = 0;
  1092. findViewById(R.id.page_range_setting).setVisibility(z ? 0 : 8);
  1093. View findViewById = findViewById(R.id.page_range_separator);
  1094. if (!z) {
  1095. i = 8;
  1096. }
  1097. findViewById.setVisibility(i);
  1098. }
  1099. private void setClickablePageRange(boolean z) {
  1100. findViewById(R.id.page_range_setting).setClickable(z);
  1101. int i = 0;
  1102. findViewById(R.id.page_range_next_screen_imv).setVisibility(z ? 0 : 8);
  1103. View findViewById = findViewById(R.id.page_range_value);
  1104. if (!z) {
  1105. i = 8;
  1106. }
  1107. findViewById.setVisibility(i);
  1108. }
  1109. private void resetSettings() {
  1110. printerDeviceId = null;
  1111. printerId = null;
  1112. printerEmailAddress = null;
  1113. printerIp = null;
  1114. printerLocation = 0;
  1115. info = null;
  1116. paper_source_info = null;
  1117. color_info = null;
  1118. paper_size_info = null;
  1119. paper_type_info = null;
  1120. layout_info = null;
  1121. quality_info = null;
  1122. duplex_info = null;
  1123. autoConnectSsid = "";
  1124. printerName.setText(getString(R.string.str_lbl_title_scan));
  1125. ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(View.GONE);
  1126. updateSettingView();
  1127. setScreenState(true);
  1128. }
  1129. public void onBackPressed() {
  1130. super.onBackPressed();
  1131. IEpsonService iEpsonService = mEpsonService;
  1132. if (iEpsonService != null) {
  1133. try {
  1134. iEpsonService.cancelSearchPrinter();
  1135. } catch (RemoteException e) {
  1136. e.printStackTrace();
  1137. }
  1138. }
  1139. loadSupportedMediaFile();
  1140. EPPrinterManager ePPrinterManager = new EPPrinterManager(mContext);
  1141. ePPrinterManager.rollbackRemotePrinterInfo();
  1142. ePPrinterManager.rollbackIPPrinterInfo();
  1143. new InkRplnRepository(false).deleteTemporaryData(this);
  1144. }
  1145. private void setScreenState(Boolean bool) {
  1146. if (bool.booleanValue()) {
  1147. progressGetOption.setVisibility(View.GONE);
  1148. } else {
  1149. progressGetOption.setVisibility(View.VISIBLE);
  1150. }
  1151. findViewById(R.id.printer).setClickable(bool.booleanValue());
  1152. findViewById(R.id.paper_size).setClickable(bool.booleanValue());
  1153. findViewById(R.id.paper_type).setClickable(bool.booleanValue());
  1154. findViewById(R.id.layout).setClickable(bool.booleanValue());
  1155. findViewById(R.id.quality).setClickable(bool.booleanValue());
  1156. findViewById(R.id.paper_source).setClickable(bool.booleanValue());
  1157. findViewById(R.id.color).setClickable(bool.booleanValue());
  1158. findViewById(R.id.duplex).setClickable(bool.booleanValue());
  1159. findViewById(R.id.feed_direction).setClickable(bool.booleanValue());
  1160. findViewById(R.id.printdate).setClickable(bool.booleanValue());
  1161. }
  1162. public void showErrorDialog(String str, String str2) {
  1163. new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(str).setMessage(str2).setNegativeButton(getString(R.string.ok_button), new DialogInterface.OnClickListener() {
  1164. public void onClick(DialogInterface dialogInterface, int i) {
  1165. CameraPrintSettingActivity.this.setScreenState(true);
  1166. dialogInterface.cancel();
  1167. }
  1168. }).create().show();
  1169. updateSupportedMediaFile(true);
  1170. }
  1171. protected void onResume() {
  1172. super.onResume();
  1173. EPLog.m307e("SettingScr", "onResume()");
  1174. if (this.printerId != null && printerLocation == 1 && isRetryAfterConnectSimpleAp) {
  1175. undoFlag = false;
  1176. if (loadSupportedMediaFile()) {
  1177. mHandler.sendEmptyMessage(1);
  1178. } else {
  1179. mHandler.sendEmptyMessage(17);
  1180. }
  1181. }
  1182. }
  1183. protected void onPause() {
  1184. EPLog.d("SettingScr", "onPause");
  1185. super.onPause();
  1186. if (isFinishing()) {
  1187. deleteLongTapMessage();
  1188. }
  1189. WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, printerIp);
  1190. WiFiDirectManager.disconnectSimpleAP(this, autoConnectSsid, printerIp);
  1191. }
  1192. public boolean onCreateOptionsMenu(Menu menu) {
  1193. getMenuInflater().inflate(R.menu.menu_done, menu);
  1194. return super.onCreateOptionsMenu(menu);
  1195. }
  1196. public boolean onOptionsItemSelected(MenuItem menuItem) {
  1197. if (menuItem.getItemId() != R.id.menuSettingsDone) {
  1198. return super.onOptionsItemSelected(menuItem);
  1199. }
  1200. saveChanged();
  1201. setResult(3, getIntent());
  1202. finish();
  1203. return true;
  1204. }
  1205. protected void deleteLongTapMessage() {
  1206. MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
  1207. copiesMinus.dispatchTouchEvent(obtain);
  1208. copiesPlus.dispatchTouchEvent(obtain);
  1209. }
  1210. public void onConfigurationChanged(Configuration configuration) {
  1211. super.onConfigurationChanged(configuration);
  1212. deleteLongTapMessage();
  1213. }
  1214. }