CopyActivity.java 30 KB

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