CopyActivity.java 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  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.m313i(CopyActivity.this.TAG, "HandlerCallback");
  58. switch (message.what) {
  59. case 0:
  60. EPLog.m313i(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.m313i(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.m313i(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.m313i(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. /* access modifiers changed from: package-private */
  302. public void startActivityAndKeepSimpleAp(Intent intent) {
  303. this.isKeepSimpleAPConnection = true;
  304. startActivity(intent);
  305. }
  306. /* access modifiers changed from: package-private */
  307. public void allClear() {
  308. this.doClear = true;
  309. this.loading.show();
  310. ArrayList<ECopyOptionItem> copyOptionItems = this.copyComponent.getCopyOptionItems();
  311. int i = this.clearindex;
  312. this.clearindex = i + 1;
  313. ECopyOptionItem eCopyOptionItem = copyOptionItems.get(i);
  314. switch (eCopyOptionItem.getKey()) {
  315. case ColorEffectsType:
  316. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_Color);
  317. break;
  318. case ScanContentType:
  319. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ScanContentType_Mixed);
  320. break;
  321. case PrintMediaType:
  322. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_Stationery);
  323. break;
  324. case PrintMediaSize:
  325. if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.US.getLanguage()) && eCopyOptionItem.getSelectableChoices().contains(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter)) {
  326. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter);
  327. break;
  328. } else {
  329. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_A4);
  330. break;
  331. }
  332. break;
  333. case PrintMediaSource:
  334. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSource_Bottom);
  335. break;
  336. case PrintQuality:
  337. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintQuality_Normal);
  338. break;
  339. case XScale:
  340. eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XScale_Autofit);
  341. break;
  342. case XDensity:
  343. case CopyMagnification:
  344. case Copies:
  345. eCopyOptionItem.selectValue(eCopyOptionItem.getDefaultValue());
  346. break;
  347. }
  348. this.copyComponent.setCopyOptionItem(eCopyOptionItem);
  349. }
  350. /* access modifiers changed from: package-private */
  351. public void fetchCopyOptionContext() {
  352. this.copyComponent.createCopyOptionContext(this.copyType, new ECopyComponent.ICopyOptionContextListener() {
  353. public void onCopyOptionContextCreated(ECopyComponent.ECopyType eCopyType, ECopyOptionContext eCopyOptionContext, ECopyComponent.ICopyOptionContextListener.ContextCreationError contextCreationError) {
  354. CopyActivity copyActivity = CopyActivity.this;
  355. copyActivity.optionContext = eCopyOptionContext;
  356. if (contextCreationError == null) {
  357. copyActivity.copyComponent.bindCopyOptionContext(CopyActivity.this.optionContext, CopyActivity.this.optionListener);
  358. ArrayList<ECopyOptionItem> copyOptionItems = CopyActivity.this.copyComponent.getCopyOptionItems();
  359. if (ActivityBase.printerId.equalsIgnoreCase(CopyActivity.this.presettings.loadPrePrinter())) {
  360. CopyActivity.this.presettings.setCopyOptions(copyOptionItems);
  361. } else {
  362. CopyActivity.this.buildCopyOptions(copyOptionItems);
  363. }
  364. } else {
  365. ActivityBase.errorDialog unused = copyActivity.errordialog = new ActivityBase.errorDialog(copyActivity);
  366. String[] reasonText = CopyActivity.this.errordialog.getReasonText(contextCreationError);
  367. CopyActivity.this.errordialog.showErrorDialog(reasonText[0], reasonText[1], ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
  368. public void onClose(ActivityBase.ClickButton clickButton) {
  369. CopyActivity.this.finish();
  370. }
  371. });
  372. }
  373. }
  374. });
  375. }
  376. /* access modifiers changed from: package-private */
  377. public void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
  378. Iterator<ECopyOptionItem> it = arrayList.iterator();
  379. while (it.hasNext()) {
  380. ECopyOptionItem next = it.next();
  381. ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
  382. switch (key) {
  383. case ColorEffectsType:
  384. String str = this.TAG;
  385. EPLog.m313i(str, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  386. updateSetting(R.id.copy_color_info, next);
  387. break;
  388. case ScanContentType:
  389. String str2 = this.TAG;
  390. EPLog.m313i(str2, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  391. updateSetting(R.id.copy_document_type_info, next);
  392. break;
  393. case PrintMediaType:
  394. String str3 = this.TAG;
  395. EPLog.m313i(str3, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  396. updateSetting(R.id.copy_paper_type_info, next);
  397. break;
  398. case PrintMediaSize:
  399. String str4 = this.TAG;
  400. EPLog.m313i(str4, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  401. updateSetting(R.id.copy_paper_size_info, next);
  402. break;
  403. case PrintMediaSource:
  404. String str5 = this.TAG;
  405. EPLog.m313i(str5, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  406. updateSetting(R.id.copy_paper_source_info, next);
  407. break;
  408. case PrintQuality:
  409. String str6 = this.TAG;
  410. EPLog.m313i(str6, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  411. updateSetting(R.id.copy_quality_info, next);
  412. break;
  413. case XScale:
  414. String str7 = this.TAG;
  415. EPLog.m313i(str7, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
  416. updateSetting(R.id.copy_scale_info, next);
  417. break;
  418. case XDensity:
  419. this.optionValueMap.put(key, new XDensityValue(next));
  420. break;
  421. case CopyMagnification:
  422. this.optionValueMap.put(key, new ActivityBase.CopyMagnificationValue(next));
  423. break;
  424. case Copies:
  425. this.optionValueMap.put(key, new CopiesValue(next));
  426. break;
  427. }
  428. this.loading.dismiss();
  429. }
  430. }
  431. /* access modifiers changed from: package-private */
  432. public void updateSetting(int i, ECopyOptionItem eCopyOptionItem) {
  433. TextView textView = (TextView) this.mLayout.findViewById(i);
  434. if (eCopyOptionItem.getSelectedChoice() == ECopyOptionItem.ECopyOptionItemChoice.XScale_Custom) {
  435. textView.setText(getString(R.string.XScale_CustomSetting) + String.valueOf(((ActivityBase.NumberOptionValue) this.optionValueMap.get(ECopyOptionItem.ECopyOptionItemKey.CopyMagnification)).value) + " %");
  436. return;
  437. }
  438. textView.setText(string(eCopyOptionItem.getSelectedChoice().name()));
  439. }
  440. class CopiesValue extends ActivityBase.NumberOptionValue {
  441. public CopiesValue(ECopyOptionItem eCopyOptionItem) {
  442. super();
  443. bindOption(R.id.SettingEditCopies, eCopyOptionItem);
  444. bindCountUp(R.id.SettingButonCopiesCountUp);
  445. bindCountDown(R.id.SettingButonCopiesCountDown);
  446. setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
  447. }
  448. }
  449. class XDensityValue extends ActivityBase.NumberOptionValue {
  450. ImageView image;
  451. TypedArray images = CopyActivity.this.getResources().obtainTypedArray(R.array.density_images);
  452. public XDensityValue(ECopyOptionItem eCopyOptionItem) {
  453. super();
  454. bindOption(R.id.density_image, eCopyOptionItem);
  455. bindCountUp(R.id.SettingButonXDensityCountUp);
  456. bindCountDown(R.id.SettingButonXDensityCountDown);
  457. setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
  458. }
  459. /* access modifiers changed from: package-private */
  460. public void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
  461. this.optionItem = eCopyOptionItem;
  462. this.value = eCopyOptionItem.getSelectedValue();
  463. this.image = (ImageView) CopyActivity.this.findViewById(i);
  464. this.image.setImageDrawable(this.images.getDrawable(this.value + 4));
  465. this.image.setEnabled(eCopyOptionItem.isEnabled());
  466. }
  467. /* access modifiers changed from: package-private */
  468. public void bindCountUp(int i) {
  469. this.countUp = (Button) CopyActivity.this.findViewById(i);
  470. this.countUp.setOnClickListener(new CounterImage(1));
  471. if (this.value == this.optionItem.getMaximumValue()) {
  472. this.countUp.setEnabled(false);
  473. } else {
  474. this.countUp.setEnabled(true);
  475. }
  476. }
  477. /* access modifiers changed from: package-private */
  478. public void bindCountDown(int i) {
  479. this.countDown = (Button) CopyActivity.this.findViewById(i);
  480. this.countDown.setOnClickListener(new CounterImage(-1));
  481. if (this.value == this.optionItem.getMinimumValue()) {
  482. this.countDown.setEnabled(false);
  483. } else {
  484. this.countDown.setEnabled(true);
  485. }
  486. }
  487. class CounterImage extends ActivityBase.NumberOptionValue.Counter implements View.OnClickListener {
  488. public CounterImage(int i) {
  489. super(i);
  490. }
  491. /* access modifiers changed from: package-private */
  492. public void updateImage(int i) {
  493. XDensityValue.this.value += i;
  494. XDensityValue.this.optionItem.selectValue(XDensityValue.this.value);
  495. if (XDensityValue.this.changedListener != null) {
  496. XDensityValue.this.changedListener.onOptionItemChanged(XDensityValue.this.optionItem);
  497. }
  498. }
  499. public void onClick(View view) {
  500. updateImage(this.amount);
  501. }
  502. }
  503. }
  504. private void getPrinterInfo() {
  505. MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
  506. printerId = curPrinter.getPrinterId();
  507. printerIp = curPrinter.getIp();
  508. this.printerLocation = curPrinter.getLocation();
  509. }
  510. private class ProbePrinter extends AsyncTask<Void, Void, Boolean> {
  511. private volatile boolean mRepeatCopyAvailable;
  512. /* access modifiers changed from: protected */
  513. public void onPreExecute() {
  514. }
  515. private ProbePrinter() {
  516. }
  517. /* access modifiers changed from: protected */
  518. public Boolean doInBackground(Void... voidArr) {
  519. EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter doInBackground");
  520. this.mRepeatCopyAvailable = false;
  521. if ((CopyActivity.this.printerLocation != 1 && CopyActivity.this.printerLocation != 3) || ActivityBase.printerId == null) {
  522. return false;
  523. }
  524. CopyActivity.this.mPrinter.doInitDriver(CopyActivity.this, 2);
  525. if (CopyActivity.this.mPrinter.doProbePrinter(60, ActivityBase.printerId, ActivityBase.printerIp, CopyActivity.this.printerLocation) != 0) {
  526. return false;
  527. }
  528. int doSetPrinter = CopyActivity.this.mPrinter.doSetPrinter();
  529. String access$200 = CopyActivity.this.TAG;
  530. EPLog.m313i(access$200, "Set Printer result: " + doSetPrinter);
  531. if (doSetPrinter != 0) {
  532. return false;
  533. }
  534. CopyActivity copyActivity = CopyActivity.this;
  535. String unused = copyActivity.ipAdress = copyActivity.mPrinter.doGetIp();
  536. String access$2002 = CopyActivity.this.TAG;
  537. EPLog.m313i(access$2002, "IPAdress : " + CopyActivity.this.ipAdress);
  538. CopyActivity copyActivity2 = CopyActivity.this;
  539. copyActivity2.bProbedPrinter = true;
  540. copyActivity2.systemSettings = new ECopyComponent.ICopySystemSettings() {
  541. public int getThickPaper() {
  542. return 0;
  543. }
  544. public String getPrinterIPAddress() {
  545. String access$200 = CopyActivity.this.TAG;
  546. EPLog.m313i(access$200, "getPrinterIPAddress : " + CopyActivity.this.ipAdress);
  547. return CopyActivity.this.ipAdress;
  548. }
  549. };
  550. ECopyComponent sharedComponent = ECopyComponent.sharedComponent();
  551. sharedComponent.setSystemSettings(CopyActivity.this.systemSettings);
  552. sharedComponent.setProperty(ECopyComponent.Property.RequestConnectionTimeout, CopyActivity.CONNECTION_TIMEOUT);
  553. this.mRepeatCopyAvailable = CopyActivity.this.checkRepeatCopyFunction();
  554. return true;
  555. }
  556. /* access modifiers changed from: protected */
  557. public void onCancelled() {
  558. EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onCancelled");
  559. super.onCancelled();
  560. CopyActivity.this.mPrinter.doCancelFindPrinter();
  561. }
  562. /* access modifiers changed from: protected */
  563. public void onPostExecute(Boolean bool) {
  564. EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onPostExecute");
  565. CopyActivity.this.changeRepeatCopyButtonState(this.mRepeatCopyAvailable);
  566. if (bool.booleanValue()) {
  567. CopyActivity.this.mHandler.sendEmptyMessage(2);
  568. } else {
  569. CopyActivity.this.mHandler.sendEmptyMessage(1);
  570. }
  571. }
  572. }
  573. /* access modifiers changed from: private */
  574. public boolean checkRepeatCopyFunction() {
  575. ERemoteDevice eRemoteDevice = new ERemoteDevice();
  576. eRemoteDevice.setHostIP(this.ipAdress);
  577. eRemoteDevice.setRequestConnectionTimeout(CONNECTION_TIMEOUT);
  578. ERemoteDevice.ERemoteDeviceFunctionsResult executeGetFunctionsCommand = eRemoteDevice.executeGetFunctionsCommand(Utils.getRemoteOperationUUID(getApplicationContext()));
  579. return executeGetFunctionsCommand.success() && executeGetFunctionsCommand.functions().contains(ERemoteOperation.ERemoteParam.repeat_copy);
  580. }
  581. /* access modifiers changed from: private */
  582. public void changeRepeatCopyButtonState(boolean z) {
  583. int i;
  584. boolean z2 = false;
  585. if (z) {
  586. i = 0;
  587. z2 = true;
  588. } else {
  589. i = 8;
  590. }
  591. this.mCopyTypeGroup.setVisibility(i);
  592. this.mRepeatCopyButton.setEnabled(z2);
  593. }
  594. /* access modifiers changed from: protected */
  595. public void deleteLongTapMessage() {
  596. MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
  597. findViewById(R.id.SettingButonCopiesCountUp).dispatchTouchEvent(obtain);
  598. findViewById(R.id.SettingButonCopiesCountDown).dispatchTouchEvent(obtain);
  599. findViewById(R.id.SettingButonXDensityCountUp).dispatchTouchEvent(obtain);
  600. findViewById(R.id.SettingButonXDensityCountDown).dispatchTouchEvent(obtain);
  601. }
  602. public void onConfigurationChanged(Configuration configuration) {
  603. super.onConfigurationChanged(configuration);
  604. deleteLongTapMessage();
  605. }
  606. }