CopyActivity.java 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. package epson.print.rpcopy;
  2. import android.content.Intent;
  3. import android.content.res.Configuration;
  4. import android.content.res.TypedArray;
  5. import android.os.AsyncTask;
  6. import android.os.Bundle;
  7. import android.os.Handler;
  8. import android.os.Message;
  9. import android.os.SystemClock;
  10. import android.view.MotionEvent;
  11. import android.view.View;
  12. import android.view.ViewGroup;
  13. import android.widget.Button;
  14. import android.widget.CompoundButton;
  15. import android.widget.ImageView;
  16. import android.widget.RadioButton;
  17. import android.widget.RadioGroup;
  18. import android.widget.TextView;
  19. import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
  20. import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
  21. import epson.print.R;
  22. import epson.print.MyPrinter;
  23. import epson.print.Util.EPLog;
  24. import epson.print.rpcopy.ActivityBase;
  25. import epson.print.rpcopy.Component.ecopycomponent.ECopyComponent;
  26. import epson.print.rpcopy.Component.ecopycomponent.ECopyOptionContext;
  27. import epson.print.rpcopy.Component.ecopycomponent.ECopyOptionItem;
  28. import epson.print.widgets.LongTapRepeatAdapter;
  29. import java.util.ArrayList;
  30. import java.util.Iterator;
  31. import java.util.Locale;
  32. public class CopyActivity extends ActivityBase implements View.OnClickListener {
  33. private static final int EPS_COMM_BID = 2;
  34. public static final int RESULT_BACK_TO_HOME = -1;
  35. public static final int RESULT_CHANGE_TO_NORMAL_COPY = 0;
  36. private final int COMM_ERROR = 1;
  37. private final int PROBE_PRINTER = 0;
  38. /* access modifiers changed from: private */
  39. public String TAG = "CopyActivty";
  40. private final int UPDATE_SETTING = 2;
  41. boolean bProbedPrinter = false;
  42. /* access modifiers changed from: private */
  43. public int clearindex = 0;
  44. CopyProcess copyProcess;
  45. /* access modifiers changed from: private */
  46. public boolean doClear = false;
  47. /* access modifiers changed from: private */
  48. public ActivityBase.errorDialog errordialog;
  49. /* access modifiers changed from: private */
  50. public String ipAdress;
  51. Handler mHandler = new Handler(new Handler.Callback() {
  52. public boolean handleMessage(Message message) {
  53. EPLog.m313i(CopyActivity.this.TAG, "HandlerCallback");
  54. switch (message.what) {
  55. case 0:
  56. EPLog.m313i(CopyActivity.this.TAG, "PROBE_PRINTER");
  57. CopyActivity copyActivity = CopyActivity.this;
  58. ProbePrinter unused = copyActivity.task = new ProbePrinter();
  59. CopyActivity.this.task.execute(new Void[0]);
  60. return true;
  61. case 1:
  62. EPLog.m313i(CopyActivity.this.TAG, "COMM_ERROR");
  63. CopyActivity copyActivity2 = CopyActivity.this;
  64. ActivityBase.errorDialog unused2 = copyActivity2.errordialog = new ActivityBase.errorDialog(copyActivity2);
  65. CopyActivity.this.errordialog.showErrorDialog(CopyActivity.this.getString(R.string.EPS_PRNERR_COMM_TITLE), CopyActivity.this.getString(R.string.EPS_PRNERR_COMM5), ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
  66. public void onClose(ActivityBase.ClickButton clickButton) {
  67. CopyActivity.this.returnToHome();
  68. }
  69. });
  70. return true;
  71. case 2:
  72. EPLog.m313i(CopyActivity.this.TAG, "UPDATE_SETTING");
  73. if (CopyActivity.this.mECopyOptionContext == null) {
  74. CopyActivity.this.fetchCopyOptionContext();
  75. return true;
  76. }
  77. CopyActivity copyActivity3 = CopyActivity.this;
  78. copyActivity3.mECopyOptionContext = copyActivity3.copyComponent.getBindedCopyOptionContext();
  79. CopyActivity.this.copyComponent.bindCopyOptionContext(CopyActivity.this.mECopyOptionContext, CopyActivity.this.optionListener);
  80. CopyActivity copyActivity4 = CopyActivity.this;
  81. copyActivity4.buildCopyOptions(copyActivity4.copyComponent.getCopyOptionItems());
  82. return true;
  83. default:
  84. return true;
  85. }
  86. }
  87. });
  88. private ViewGroup mLayout;
  89. private RadioButton mNormalCopyButton;
  90. /* access modifiers changed from: private */
  91. public MaintainPrinter2 mPrinter;
  92. ECopyComponent.ICopyOptionListener optionListener;
  93. ActivityBase.OptionItemChangedListener optionValueChangedListener;
  94. /* access modifiers changed from: private */
  95. public ActivityBase.settingPreference presettings = new ActivityBase.settingPreference();
  96. /* access modifiers changed from: private */
  97. public int printerLocation;
  98. ECopyComponent.ICopySystemSettings systemSettings;
  99. /* access modifiers changed from: private */
  100. public ProbePrinter task;
  101. public void onCreate(Bundle bundle) {
  102. super.onCreate(bundle);
  103. setContentView((int) R.layout.copy);
  104. this.copyComponent.getRemoteOperationUUID(this);
  105. this.mECopyOptionContext = null;
  106. this.mLayout = (ViewGroup) findViewById(R.id.copy);
  107. setupUi();
  108. setClickListener();
  109. setActionBar((int) R.string.FunctionName_iPrint_Copy, true);
  110. if (this.mPrinter == null) {
  111. this.mPrinter = MaintainPrinter2.getInstance();
  112. }
  113. this.optionValueChangedListener = new ActivityBase.OptionItemChangedListener() {
  114. public void onOptionItemChanged(ECopyOptionItem eCopyOptionItem) {
  115. CopyActivity.this.copyComponent.setCopyOptionItem(eCopyOptionItem);
  116. }
  117. };
  118. this.optionListener = new ECopyComponent.ICopyOptionListener() {
  119. public void onCopyOptionChanged(ECopyOptionItem eCopyOptionItem, ArrayList<ECopyOptionItem> arrayList, ECopyComponent.ICopyOptionListener.CopyOptionChangedError copyOptionChangedError) {
  120. if (copyOptionChangedError != null) {
  121. CopyActivity.this.loading.dismiss();
  122. CopyActivity copyActivity = CopyActivity.this;
  123. ActivityBase.errorDialog errordialog = new ActivityBase.errorDialog(copyActivity);
  124. String[] reasonText = errordialog.getReasonText(copyOptionChangedError);
  125. errordialog.showErrorDialog(reasonText[0], reasonText[1]);
  126. return;
  127. }
  128. ArrayList arrayList2 = new ArrayList();
  129. if (CopyActivity.this.doClear) {
  130. if (CopyActivity.this.clearindex != CopyActivity.this.copyComponent.getCopyOptionItems().size()) {
  131. CopyActivity.this.allClear();
  132. return;
  133. }
  134. boolean unused = CopyActivity.this.doClear = false;
  135. int unused2 = CopyActivity.this.clearindex = 0;
  136. arrayList2.addAll(CopyActivity.this.copyComponent.getCopyOptionItems());
  137. }
  138. arrayList2.add(eCopyOptionItem);
  139. if (arrayList != null) {
  140. arrayList2.addAll(arrayList);
  141. }
  142. CopyActivity.this.buildCopyOptions(arrayList2);
  143. }
  144. };
  145. }
  146. public void onResume() {
  147. EPLog.m316v(this.TAG, "onResume()");
  148. super.onResume();
  149. this.isKeepSimpleAPConnection = false;
  150. getPrinterInfo();
  151. CopyProcess copyProcess2 = this.copyProcess;
  152. if (copyProcess2 == null || !copyProcess2.isProccessing()) {
  153. if (!WiFiDirectManager.isNeedConnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER)) {
  154. this.isTryConnectSimpleAp = false;
  155. } else if (!this.isTryConnectSimpleAp) {
  156. this.isTryConnectSimpleAp = true;
  157. if (WiFiDirectManager.reconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, -1)) {
  158. this.isKeepSimpleAPConnection = true;
  159. this.bProbedPrinter = false;
  160. return;
  161. }
  162. }
  163. this.loading.show();
  164. if (!this.bProbedPrinter) {
  165. this.mHandler.sendEmptyMessage(0);
  166. } else {
  167. this.mHandler.sendEmptyMessage(2);
  168. }
  169. } else {
  170. this.copyProcess.setDisconnectWifi(false);
  171. }
  172. }
  173. public void onPause() {
  174. EPLog.m316v(this.TAG, "onPause()");
  175. super.onPause();
  176. int i = this.printerLocation;
  177. if (i == 1 || i == 3) {
  178. ProbePrinter probePrinter = this.task;
  179. if (probePrinter != null) {
  180. probePrinter.cancel(true);
  181. }
  182. CopyProcess copyProcess2 = this.copyProcess;
  183. if (copyProcess2 != null && copyProcess2.isProccessing()) {
  184. this.copyProcess.setDisconnectWifi(true);
  185. } else if (!this.isKeepSimpleAPConnection) {
  186. WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
  187. }
  188. }
  189. if (isFinishing()) {
  190. deleteLongTapMessage();
  191. }
  192. }
  193. /* access modifiers changed from: protected */
  194. public void onDestroy() {
  195. super.onDestroy();
  196. }
  197. public void onBackPressed() {
  198. returnToHome();
  199. }
  200. private void setupUi() {
  201. findViewById(R.id.scale).setVisibility(8);
  202. findViewById(R.id.document_type_separator).setVisibility(8);
  203. findViewById(R.id.document_type).setVisibility(8);
  204. findViewById(R.id.repeat_copy_layout).setVisibility(0);
  205. findViewById(R.id.remove_background_separator).setVisibility(0);
  206. findViewById(R.id.remove_background_layout).setVisibility(0);
  207. ((RadioGroup) findViewById(R.id.copy_type_group)).setVisibility(0);
  208. this.mNormalCopyButton = (RadioButton) findViewById(R.id.normal_copy_tab);
  209. this.mNormalCopyButton.setChecked(false);
  210. this.mNormalCopyButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  211. public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
  212. if (z) {
  213. CopyActivity.this.switchToNormalCopy();
  214. }
  215. }
  216. });
  217. ((RadioButton) findViewById(R.id.repeat_copy_tab)).setChecked(true);
  218. }
  219. /* access modifiers changed from: private */
  220. public void setupUiPostCommunication() {
  221. findViewById(R.id.print_cut_line_layout).setVisibility(0);
  222. findViewById(R.id.print_cut_line_style_separator).setVisibility(0);
  223. findViewById(R.id.print_cut_line_style_layout).setVisibility(0);
  224. findViewById(R.id.print_cut_line_weight_separator).setVisibility(0);
  225. findViewById(R.id.print_cut_line_weight_layout).setVisibility(0);
  226. }
  227. /* access modifiers changed from: private */
  228. public void switchToNormalCopy() {
  229. setResult(0);
  230. finish();
  231. }
  232. /* access modifiers changed from: private */
  233. public void returnToHome() {
  234. setResult(-1);
  235. finish();
  236. }
  237. private void setClickListener() {
  238. findViewById(R.id.color).setOnClickListener(this);
  239. findViewById(R.id.scale).setOnClickListener(this);
  240. findViewById(R.id.paper_size).setOnClickListener(this);
  241. findViewById(R.id.paper_type).setOnClickListener(this);
  242. findViewById(R.id.paper_source).setOnClickListener(this);
  243. findViewById(R.id.document_type).setOnClickListener(this);
  244. findViewById(R.id.quality).setOnClickListener(this);
  245. findViewById(R.id.copy_setting_clear_all).setOnClickListener(this);
  246. findViewById(R.id.copy_button).setOnClickListener(this);
  247. findViewById(R.id.repeat_copy_layout).setOnClickListener(this);
  248. findViewById(R.id.remove_background_layout).setOnClickListener(this);
  249. LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountUp));
  250. LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountDown));
  251. LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountUp));
  252. LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountDown));
  253. }
  254. /* access modifiers changed from: private */
  255. public void setClickListenerPostCommunication() {
  256. findViewById(R.id.print_cut_line_layout).setOnClickListener(this);
  257. findViewById(R.id.print_cut_line_style_layout).setOnClickListener(this);
  258. findViewById(R.id.print_cut_line_weight_layout).setOnClickListener(this);
  259. }
  260. public void onClick(View view) {
  261. Intent intent = new Intent();
  262. switch (view.getId()) {
  263. case R.id.color /*2131230930*/:
  264. intent.setClass(getBaseContext(), CopySettingActivity.class);
  265. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.ColorEffectsType.name());
  266. startActivityAndKeepSimpleAp(intent);
  267. return;
  268. case R.id.copy_button /*2131230948*/:
  269. String str = this.TAG;
  270. EPLog.m313i(str, "NOW_PRINTER:" + printerId);
  271. this.presettings.saveCopyOptions(this.copyComponent.getCopyOptionItems());
  272. this.copyProcess = new CopyProcess(this);
  273. this.copyProcess.startCopy(getApplicationContext());
  274. return;
  275. case R.id.copy_setting_clear_all /*2131230967*/:
  276. allClear();
  277. return;
  278. case R.id.paper_size /*2131231306*/:
  279. intent.setClass(getBaseContext(), CopySettingActivity.class);
  280. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize.name());
  281. startActivityAndKeepSimpleAp(intent);
  282. return;
  283. case R.id.paper_source /*2131231311*/:
  284. intent.setClass(getBaseContext(), CopySettingActivity.class);
  285. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource.name());
  286. startActivityAndKeepSimpleAp(intent);
  287. return;
  288. case R.id.paper_type /*2131231314*/:
  289. intent.setClass(getBaseContext(), CopySettingActivity.class);
  290. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaType.name());
  291. startActivityAndKeepSimpleAp(intent);
  292. return;
  293. case R.id.print_cut_line_layout /*2131231337*/:
  294. intent.setClass(getBaseContext(), CopySettingActivity.class);
  295. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XCutLine.name());
  296. startActivityAndKeepSimpleAp(intent);
  297. return;
  298. case R.id.print_cut_line_style_layout /*2131231339*/:
  299. intent.setClass(getBaseContext(), CopySettingActivity.class);
  300. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XCutLineStyle.name());
  301. startActivityAndKeepSimpleAp(intent);
  302. return;
  303. case R.id.print_cut_line_weight_layout /*2131231344*/:
  304. intent.setClass(getBaseContext(), CopySettingActivity.class);
  305. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XCutLineWeight.name());
  306. startActivityAndKeepSimpleAp(intent);
  307. return;
  308. case R.id.quality /*2131231392*/:
  309. intent.setClass(getBaseContext(), CopySettingActivity.class);
  310. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintQuality.name());
  311. startActivityAndKeepSimpleAp(intent);
  312. return;
  313. case R.id.remove_background_layout /*2131231396*/:
  314. intent.setClass(getBaseContext(), CopySettingActivity.class);
  315. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.RemoveBackground.name());
  316. startActivityAndKeepSimpleAp(intent);
  317. return;
  318. case R.id.repeat_copy_layout /*2131231400*/:
  319. intent.setClass(getBaseContext(), CopySettingActivity.class);
  320. intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.RepeatLayout.name());
  321. startActivityAndKeepSimpleAp(intent);
  322. return;
  323. default:
  324. return;
  325. }
  326. }
  327. private void startActivityAndKeepSimpleAp(Intent intent) {
  328. this.isKeepSimpleAPConnection = true;
  329. startActivity(intent);
  330. }
  331. private void allClear() {
  332. this.doClear = true;
  333. this.loading.show();
  334. ArrayList<ECopyOptionItem> copyOptionItems = this.copyComponent.getCopyOptionItems();
  335. int i = this.clearindex;
  336. this.clearindex = i + 1;
  337. ECopyOptionItem eCopyOptionItem = copyOptionItems.get(i);
  338. switch (eCopyOptionItem.getKey()) {
  339. case ColorEffectsType:
  340. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_Color);
  341. break;
  342. case PrintMediaType:
  343. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_Stationery);
  344. break;
  345. case PrintMediaSize:
  346. if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.US.getLanguage()) && eCopyOptionItem.getSelectableChoices().contains(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter)) {
  347. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter);
  348. break;
  349. } else {
  350. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_A4);
  351. break;
  352. }
  353. case PrintMediaSource:
  354. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSource_Bottom);
  355. break;
  356. case PrintQuality:
  357. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintQuality_Normal);
  358. break;
  359. case XDensity:
  360. case Copies:
  361. eCopyOptionItem.selectValue(eCopyOptionItem.getDefaultValue());
  362. break;
  363. case RepeatLayout:
  364. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.RepeatLayout_twoRepeat);
  365. break;
  366. case RemoveBackground:
  367. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XRemoveBackground_Off);
  368. break;
  369. case XCutLine:
  370. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XCutLine_Off);
  371. break;
  372. case XCutLineStyle:
  373. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XCutLineStyle_Dash);
  374. break;
  375. case XCutLineWeight:
  376. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XCutLineWidth_Dash);
  377. break;
  378. }
  379. this.copyComponent.setCopyOptionItem(eCopyOptionItem);
  380. }
  381. private void fetchCopyOptionContext() {
  382. ECopyComponent.createCopyOptionContext(this.copyComponent, this.copyType, new ECopyComponent.ICopyOptionContextListener() {
  383. public void onCopyOptionContextCreated(ECopyComponent.ECopyType eCopyType, ECopyOptionContext eCopyOptionContext, ECopyComponent.ICopyOptionContextListener.ContextCreationError contextCreationError) {
  384. CopyActivity copyActivity = CopyActivity.this;
  385. copyActivity.mECopyOptionContext = eCopyOptionContext;
  386. if (contextCreationError == null) {
  387. copyActivity.copyComponent.bindCopyOptionContext(CopyActivity.this.mECopyOptionContext, CopyActivity.this.optionListener);
  388. ArrayList<ECopyOptionItem> copyOptionItems = CopyActivity.this.copyComponent.getCopyOptionItems();
  389. ECopyOptionContext bindedCopyOptionContext = CopyActivity.this.copyComponent.getBindedCopyOptionContext();
  390. if (bindedCopyOptionContext != null && bindedCopyOptionContext.hasCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XCutLine)) {
  391. CopyActivity.this.setupUiPostCommunication();
  392. CopyActivity.this.setClickListenerPostCommunication();
  393. }
  394. if (ActivityBase.printerId.equalsIgnoreCase(CopyActivity.this.presettings.loadPrePrinter())) {
  395. CopyActivity.this.presettings.setCopyOptions(copyOptionItems);
  396. } else {
  397. CopyActivity.this.buildCopyOptions(copyOptionItems);
  398. }
  399. } else {
  400. ActivityBase.errorDialog unused = copyActivity.errordialog = new ActivityBase.errorDialog(copyActivity);
  401. String[] reasonText = CopyActivity.this.errordialog.getReasonText(contextCreationError);
  402. CopyActivity.this.errordialog.showErrorDialog(reasonText[0], reasonText[1], ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
  403. public void onClose(ActivityBase.ClickButton clickButton) {
  404. CopyActivity.this.returnToHome();
  405. }
  406. });
  407. }
  408. }
  409. });
  410. }
  411. private void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
  412. Iterator<ECopyOptionItem> it = arrayList.iterator();
  413. while (it.hasNext()) {
  414. ECopyOptionItem next = it.next();
  415. ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
  416. switch (key) {
  417. case ColorEffectsType:
  418. String str = this.TAG;
  419. EPLog.m313i(str, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  420. updateSetting(R.id.copy_color_info, next);
  421. break;
  422. case PrintMediaType:
  423. String str2 = this.TAG;
  424. EPLog.m313i(str2, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  425. updateSetting(R.id.copy_paper_type_info, next);
  426. break;
  427. case PrintMediaSize:
  428. String str3 = this.TAG;
  429. EPLog.m313i(str3, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  430. updateSetting(R.id.copy_paper_size_info, next);
  431. break;
  432. case PrintMediaSource:
  433. String str4 = this.TAG;
  434. EPLog.m313i(str4, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  435. updateSetting(R.id.copy_paper_source_info, next);
  436. break;
  437. case PrintQuality:
  438. String str5 = this.TAG;
  439. EPLog.m313i(str5, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  440. updateSetting(R.id.copy_quality_info, next);
  441. break;
  442. case XDensity:
  443. this.optionValueMap.put(key, new XDensityValue(next));
  444. break;
  445. case Copies:
  446. this.optionValueMap.put(key, new CopiesValue(next));
  447. break;
  448. case RepeatLayout:
  449. updateSetting(R.id.repeat_copy_layout_value, next);
  450. break;
  451. case RemoveBackground:
  452. updateSetting(R.id.remove_background_value, next);
  453. break;
  454. case XCutLine:
  455. updateSetting(R.id.print_cut_line_value, next);
  456. break;
  457. case XCutLineStyle:
  458. updateSetting(R.id.print_cut_line_style_value, next);
  459. break;
  460. case XCutLineWeight:
  461. updateSetting(R.id.print_cut_line_weight_value, next);
  462. break;
  463. }
  464. this.loading.dismiss();
  465. }
  466. }
  467. private void updateSetting(int i, ECopyOptionItem eCopyOptionItem) {
  468. TextView textView = (TextView) this.mLayout.findViewById(i);
  469. if (eCopyOptionItem.getSelectedChoice() == null) {
  470. EPLog.m318w("CopyActivity", "updateSetting() choice == null");
  471. } else {
  472. textView.setText(getDisplayString(eCopyOptionItem.getSelectedChoice().name()));
  473. }
  474. }
  475. class CopiesValue extends ActivityBase.NumberOptionValue {
  476. public CopiesValue(ECopyOptionItem eCopyOptionItem) {
  477. super();
  478. bindOption(R.id.SettingEditCopies, eCopyOptionItem);
  479. bindCountUp(R.id.SettingButonCopiesCountUp);
  480. bindCountDown(R.id.SettingButonCopiesCountDown);
  481. setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
  482. }
  483. }
  484. class XDensityValue extends ActivityBase.NumberOptionValue {
  485. ImageView image;
  486. TypedArray images = CopyActivity.this.getResources().obtainTypedArray(R.array.density_images);
  487. public XDensityValue(ECopyOptionItem eCopyOptionItem) {
  488. super();
  489. bindOption(R.id.density_image, eCopyOptionItem);
  490. bindCountUp(R.id.SettingButonXDensityCountUp);
  491. bindCountDown(R.id.SettingButonXDensityCountDown);
  492. setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
  493. }
  494. private void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
  495. this.optionItem = eCopyOptionItem;
  496. this.value = eCopyOptionItem.getSelectedValue();
  497. this.image = (ImageView) CopyActivity.this.findViewById(i);
  498. this.image.setImageDrawable(this.images.getDrawable(this.value + 4));
  499. this.image.setEnabled(eCopyOptionItem.isEnabled());
  500. }
  501. private void bindCountUp(int i) {
  502. this.countUp = (Button) CopyActivity.this.findViewById(i);
  503. this.countUp.setOnClickListener(new CounterImage(1));
  504. if (this.value == this.optionItem.getMaximumValue()) {
  505. this.countUp.setEnabled(false);
  506. } else {
  507. this.countUp.setEnabled(true);
  508. }
  509. }
  510. private void bindCountDown(int i) {
  511. this.countDown = (Button) CopyActivity.this.findViewById(i);
  512. this.countDown.setOnClickListener(new CounterImage(-1));
  513. if (this.value == this.optionItem.getMinimumValue()) {
  514. this.countDown.setEnabled(false);
  515. } else {
  516. this.countDown.setEnabled(true);
  517. }
  518. }
  519. class CounterImage extends ActivityBase.NumberOptionValue.Counter implements View.OnClickListener {
  520. public CounterImage(int i) {
  521. super(i);
  522. }
  523. private void updateImage(int i) {
  524. XDensityValue.this.value += i;
  525. XDensityValue.this.optionItem.selectValue(XDensityValue.this.value);
  526. if (XDensityValue.this.changedListener != null) {
  527. XDensityValue.this.changedListener.onOptionItemChanged(XDensityValue.this.optionItem);
  528. }
  529. }
  530. public void onClick(View view) {
  531. updateImage(this.amount);
  532. }
  533. }
  534. }
  535. private void getPrinterInfo() {
  536. MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
  537. printerId = curPrinter.getPrinterId();
  538. printerIp = curPrinter.getIp();
  539. this.printerLocation = curPrinter.getLocation();
  540. }
  541. private class ProbePrinter extends AsyncTask<Void, Void, Boolean> {
  542. /* access modifiers changed from: protected */
  543. public void onPreExecute() {
  544. }
  545. private ProbePrinter() {
  546. }
  547. /* access modifiers changed from: protected */
  548. public Boolean doInBackground(Void... voidArr) {
  549. EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter doInBackground");
  550. if ((CopyActivity.this.printerLocation != 1 && CopyActivity.this.printerLocation != 3) || ActivityBase.printerId == null) {
  551. return false;
  552. }
  553. CopyActivity.this.mPrinter.doInitDriver(CopyActivity.this, 2);
  554. if (CopyActivity.this.mPrinter.doProbePrinter(60, ActivityBase.printerId, ActivityBase.printerIp, CopyActivity.this.printerLocation) != 0) {
  555. return false;
  556. }
  557. int doSetPrinter = CopyActivity.this.mPrinter.doSetPrinter();
  558. String access$200 = CopyActivity.this.TAG;
  559. EPLog.m313i(access$200, "Set Printer result: " + doSetPrinter);
  560. if (doSetPrinter != 0) {
  561. return false;
  562. }
  563. CopyActivity copyActivity = CopyActivity.this;
  564. String unused = copyActivity.ipAdress = copyActivity.mPrinter.doGetIp();
  565. String access$2002 = CopyActivity.this.TAG;
  566. EPLog.m313i(access$2002, "IPAdress : " + CopyActivity.this.ipAdress);
  567. CopyActivity copyActivity2 = CopyActivity.this;
  568. copyActivity2.bProbedPrinter = true;
  569. copyActivity2.systemSettings = new ECopyComponent.ICopySystemSettings() {
  570. public int getThickPaper() {
  571. return 0;
  572. }
  573. public String getPrinterIPAddress() {
  574. String access$200 = CopyActivity.this.TAG;
  575. EPLog.m313i(access$200, "getPrinterIPAddress : " + CopyActivity.this.ipAdress);
  576. return CopyActivity.this.ipAdress;
  577. }
  578. };
  579. ECopyComponent sharedComponent = ECopyComponent.sharedComponent();
  580. sharedComponent.setSystemSettings(CopyActivity.this.systemSettings);
  581. sharedComponent.setProperty(ECopyComponent.Property.RequestConnectionTimeout, 30000);
  582. return true;
  583. }
  584. /* access modifiers changed from: protected */
  585. public void onCancelled() {
  586. EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onCancelled");
  587. super.onCancelled();
  588. CopyActivity.this.mPrinter.doCancelFindPrinter();
  589. }
  590. /* access modifiers changed from: protected */
  591. public void onPostExecute(Boolean bool) {
  592. EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onPostExecute");
  593. if (bool.booleanValue()) {
  594. CopyActivity.this.mHandler.sendEmptyMessage(2);
  595. } else {
  596. CopyActivity.this.mHandler.sendEmptyMessage(1);
  597. }
  598. }
  599. }
  600. /* access modifiers changed from: protected */
  601. public void deleteLongTapMessage() {
  602. MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
  603. findViewById(R.id.SettingButonCopiesCountUp).dispatchTouchEvent(obtain);
  604. findViewById(R.id.SettingButonCopiesCountDown).dispatchTouchEvent(obtain);
  605. findViewById(R.id.SettingButonXDensityCountUp).dispatchTouchEvent(obtain);
  606. findViewById(R.id.SettingButonXDensityCountDown).dispatchTouchEvent(obtain);
  607. }
  608. public void onConfigurationChanged(Configuration configuration) {
  609. super.onConfigurationChanged(configuration);
  610. deleteLongTapMessage();
  611. }
  612. }