123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649 |
- package epson.print.rpcopy;
- import android.content.Intent;
- import android.content.res.Configuration;
- import android.content.res.TypedArray;
- import android.os.AsyncTask;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.Message;
- import android.os.SystemClock;
- import android.view.MotionEvent;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.Button;
- import android.widget.CompoundButton;
- import android.widget.ImageView;
- import android.widget.RadioButton;
- import android.widget.RadioGroup;
- import android.widget.TextView;
- import com.epson.mobilephone.common.maintain2.MaintainPrinter2;
- import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
- import epson.print.R;
- import epson.print.MyPrinter;
- import epson.print.Util.EPLog;
- import epson.print.rpcopy.ActivityBase;
- import epson.print.rpcopy.Component.ecopycomponent.ECopyComponent;
- import epson.print.rpcopy.Component.ecopycomponent.ECopyOptionContext;
- import epson.print.rpcopy.Component.ecopycomponent.ECopyOptionItem;
- import epson.print.widgets.LongTapRepeatAdapter;
- import java.util.ArrayList;
- import java.util.Iterator;
- import java.util.Locale;
- public class CopyActivity extends ActivityBase implements View.OnClickListener {
- private static final int EPS_COMM_BID = 2;
- public static final int RESULT_BACK_TO_HOME = -1;
- public static final int RESULT_CHANGE_TO_NORMAL_COPY = 0;
- private final int COMM_ERROR = 1;
- private final int PROBE_PRINTER = 0;
- /* access modifiers changed from: private */
- public String TAG = "CopyActivty";
- private final int UPDATE_SETTING = 2;
- boolean bProbedPrinter = false;
- /* access modifiers changed from: private */
- public int clearindex = 0;
- CopyProcess copyProcess;
- /* access modifiers changed from: private */
- public boolean doClear = false;
- /* access modifiers changed from: private */
- public ActivityBase.errorDialog errordialog;
- /* access modifiers changed from: private */
- public String ipAdress;
- Handler mHandler = new Handler(new Handler.Callback() {
- public boolean handleMessage(Message message) {
- EPLog.m313i(CopyActivity.this.TAG, "HandlerCallback");
- switch (message.what) {
- case 0:
- EPLog.m313i(CopyActivity.this.TAG, "PROBE_PRINTER");
- CopyActivity copyActivity = CopyActivity.this;
- ProbePrinter unused = copyActivity.task = new ProbePrinter();
- CopyActivity.this.task.execute(new Void[0]);
- return true;
- case 1:
- EPLog.m313i(CopyActivity.this.TAG, "COMM_ERROR");
- CopyActivity copyActivity2 = CopyActivity.this;
- ActivityBase.errorDialog unused2 = copyActivity2.errordialog = new ActivityBase.errorDialog(copyActivity2);
- 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() {
- public void onClose(ActivityBase.ClickButton clickButton) {
- CopyActivity.this.returnToHome();
- }
- });
- return true;
- case 2:
- EPLog.m313i(CopyActivity.this.TAG, "UPDATE_SETTING");
- if (CopyActivity.this.mECopyOptionContext == null) {
- CopyActivity.this.fetchCopyOptionContext();
- return true;
- }
- CopyActivity copyActivity3 = CopyActivity.this;
- copyActivity3.mECopyOptionContext = copyActivity3.copyComponent.getBindedCopyOptionContext();
- CopyActivity.this.copyComponent.bindCopyOptionContext(CopyActivity.this.mECopyOptionContext, CopyActivity.this.optionListener);
- CopyActivity copyActivity4 = CopyActivity.this;
- copyActivity4.buildCopyOptions(copyActivity4.copyComponent.getCopyOptionItems());
- return true;
- default:
- return true;
- }
- }
- });
- private ViewGroup mLayout;
- private RadioButton mNormalCopyButton;
- /* access modifiers changed from: private */
- public MaintainPrinter2 mPrinter;
- ECopyComponent.ICopyOptionListener optionListener;
- ActivityBase.OptionItemChangedListener optionValueChangedListener;
- /* access modifiers changed from: private */
- public ActivityBase.settingPreference presettings = new ActivityBase.settingPreference();
- /* access modifiers changed from: private */
- public int printerLocation;
- ECopyComponent.ICopySystemSettings systemSettings;
- /* access modifiers changed from: private */
- public ProbePrinter task;
- public void onCreate(Bundle bundle) {
- super.onCreate(bundle);
- setContentView((int) R.layout.copy);
- this.copyComponent.getRemoteOperationUUID(this);
- this.mECopyOptionContext = null;
- this.mLayout = (ViewGroup) findViewById(R.id.copy);
- setupUi();
- setClickListener();
- setActionBar((int) R.string.FunctionName_iPrint_Copy, true);
- if (this.mPrinter == null) {
- this.mPrinter = MaintainPrinter2.getInstance();
- }
- this.optionValueChangedListener = new ActivityBase.OptionItemChangedListener() {
- public void onOptionItemChanged(ECopyOptionItem eCopyOptionItem) {
- CopyActivity.this.copyComponent.setCopyOptionItem(eCopyOptionItem);
- }
- };
- this.optionListener = new ECopyComponent.ICopyOptionListener() {
- public void onCopyOptionChanged(ECopyOptionItem eCopyOptionItem, ArrayList<ECopyOptionItem> arrayList, ECopyComponent.ICopyOptionListener.CopyOptionChangedError copyOptionChangedError) {
- if (copyOptionChangedError != null) {
- CopyActivity.this.loading.dismiss();
- CopyActivity copyActivity = CopyActivity.this;
- ActivityBase.errorDialog errordialog = new ActivityBase.errorDialog(copyActivity);
- String[] reasonText = errordialog.getReasonText(copyOptionChangedError);
- errordialog.showErrorDialog(reasonText[0], reasonText[1]);
- return;
- }
- ArrayList arrayList2 = new ArrayList();
- if (CopyActivity.this.doClear) {
- if (CopyActivity.this.clearindex != CopyActivity.this.copyComponent.getCopyOptionItems().size()) {
- CopyActivity.this.allClear();
- return;
- }
- boolean unused = CopyActivity.this.doClear = false;
- int unused2 = CopyActivity.this.clearindex = 0;
- arrayList2.addAll(CopyActivity.this.copyComponent.getCopyOptionItems());
- }
- arrayList2.add(eCopyOptionItem);
- if (arrayList != null) {
- arrayList2.addAll(arrayList);
- }
- CopyActivity.this.buildCopyOptions(arrayList2);
- }
- };
- }
- public void onResume() {
- EPLog.m316v(this.TAG, "onResume()");
- super.onResume();
- this.isKeepSimpleAPConnection = false;
- getPrinterInfo();
- CopyProcess copyProcess2 = this.copyProcess;
- if (copyProcess2 == null || !copyProcess2.isProccessing()) {
- if (!WiFiDirectManager.isNeedConnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER)) {
- this.isTryConnectSimpleAp = false;
- } else if (!this.isTryConnectSimpleAp) {
- this.isTryConnectSimpleAp = true;
- if (WiFiDirectManager.reconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, -1)) {
- this.isKeepSimpleAPConnection = true;
- this.bProbedPrinter = false;
- return;
- }
- }
- this.loading.show();
- if (!this.bProbedPrinter) {
- this.mHandler.sendEmptyMessage(0);
- } else {
- this.mHandler.sendEmptyMessage(2);
- }
- } else {
- this.copyProcess.setDisconnectWifi(false);
- }
- }
- public void onPause() {
- EPLog.m316v(this.TAG, "onPause()");
- super.onPause();
- int i = this.printerLocation;
- if (i == 1 || i == 3) {
- ProbePrinter probePrinter = this.task;
- if (probePrinter != null) {
- probePrinter.cancel(true);
- }
- CopyProcess copyProcess2 = this.copyProcess;
- if (copyProcess2 != null && copyProcess2.isProccessing()) {
- this.copyProcess.setDisconnectWifi(true);
- } else if (!this.isKeepSimpleAPConnection) {
- WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, ActivityBase.printerIp);
- }
- }
- if (isFinishing()) {
- deleteLongTapMessage();
- }
- }
- /* access modifiers changed from: protected */
- public void onDestroy() {
- super.onDestroy();
- }
- public void onBackPressed() {
- returnToHome();
- }
- private void setupUi() {
- findViewById(R.id.scale).setVisibility(8);
- findViewById(R.id.document_type_separator).setVisibility(8);
- findViewById(R.id.document_type).setVisibility(8);
- findViewById(R.id.repeat_copy_layout).setVisibility(0);
- findViewById(R.id.remove_background_separator).setVisibility(0);
- findViewById(R.id.remove_background_layout).setVisibility(0);
- ((RadioGroup) findViewById(R.id.copy_type_group)).setVisibility(0);
- this.mNormalCopyButton = (RadioButton) findViewById(R.id.normal_copy_tab);
- this.mNormalCopyButton.setChecked(false);
- this.mNormalCopyButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- public void onCheckedChanged(CompoundButton compoundButton, boolean z) {
- if (z) {
- CopyActivity.this.switchToNormalCopy();
- }
- }
- });
- ((RadioButton) findViewById(R.id.repeat_copy_tab)).setChecked(true);
- }
- /* access modifiers changed from: private */
- public void setupUiPostCommunication() {
- findViewById(R.id.print_cut_line_layout).setVisibility(0);
- findViewById(R.id.print_cut_line_style_separator).setVisibility(0);
- findViewById(R.id.print_cut_line_style_layout).setVisibility(0);
- findViewById(R.id.print_cut_line_weight_separator).setVisibility(0);
- findViewById(R.id.print_cut_line_weight_layout).setVisibility(0);
- }
- /* access modifiers changed from: private */
- public void switchToNormalCopy() {
- setResult(0);
- finish();
- }
- /* access modifiers changed from: private */
- public void returnToHome() {
- setResult(-1);
- finish();
- }
- private void setClickListener() {
- findViewById(R.id.color).setOnClickListener(this);
- findViewById(R.id.scale).setOnClickListener(this);
- findViewById(R.id.paper_size).setOnClickListener(this);
- findViewById(R.id.paper_type).setOnClickListener(this);
- findViewById(R.id.paper_source).setOnClickListener(this);
- findViewById(R.id.document_type).setOnClickListener(this);
- findViewById(R.id.quality).setOnClickListener(this);
- findViewById(R.id.copy_setting_clear_all).setOnClickListener(this);
- findViewById(R.id.copy_button).setOnClickListener(this);
- findViewById(R.id.repeat_copy_layout).setOnClickListener(this);
- findViewById(R.id.remove_background_layout).setOnClickListener(this);
- LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountUp));
- LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonCopiesCountDown));
- LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountUp));
- LongTapRepeatAdapter.bless(findViewById(R.id.SettingButonXDensityCountDown));
- }
- /* access modifiers changed from: private */
- public void setClickListenerPostCommunication() {
- findViewById(R.id.print_cut_line_layout).setOnClickListener(this);
- findViewById(R.id.print_cut_line_style_layout).setOnClickListener(this);
- findViewById(R.id.print_cut_line_weight_layout).setOnClickListener(this);
- }
- public void onClick(View view) {
- Intent intent = new Intent();
- switch (view.getId()) {
- case R.id.color /*2131230930*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.ColorEffectsType.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.copy_button /*2131230948*/:
- String str = this.TAG;
- EPLog.m313i(str, "NOW_PRINTER:" + printerId);
- this.presettings.saveCopyOptions(this.copyComponent.getCopyOptionItems());
- this.copyProcess = new CopyProcess(this);
- this.copyProcess.startCopy(getApplicationContext());
- return;
- case R.id.copy_setting_clear_all /*2131230967*/:
- allClear();
- return;
- case R.id.paper_size /*2131231306*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSize.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.paper_source /*2131231311*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaSource.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.paper_type /*2131231314*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintMediaType.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.print_cut_line_layout /*2131231337*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XCutLine.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.print_cut_line_style_layout /*2131231339*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XCutLineStyle.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.print_cut_line_weight_layout /*2131231344*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.XCutLineWeight.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.quality /*2131231392*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.PrintQuality.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.remove_background_layout /*2131231396*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.RemoveBackground.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- case R.id.repeat_copy_layout /*2131231400*/:
- intent.setClass(getBaseContext(), CopySettingActivity.class);
- intent.putExtra("Key", ECopyOptionItem.ECopyOptionItemKey.RepeatLayout.name());
- startActivityAndKeepSimpleAp(intent);
- return;
- default:
- return;
- }
- }
- private void startActivityAndKeepSimpleAp(Intent intent) {
- this.isKeepSimpleAPConnection = true;
- startActivity(intent);
- }
- private void allClear() {
- this.doClear = true;
- this.loading.show();
- ArrayList<ECopyOptionItem> copyOptionItems = this.copyComponent.getCopyOptionItems();
- int i = this.clearindex;
- this.clearindex = i + 1;
- ECopyOptionItem eCopyOptionItem = copyOptionItems.get(i);
- switch (eCopyOptionItem.getKey()) {
- case ColorEffectsType:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.ColorEffectsType_Color);
- break;
- case PrintMediaType:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaType_Stationery);
- break;
- case PrintMediaSize:
- if (Locale.getDefault().getLanguage().equalsIgnoreCase(Locale.US.getLanguage()) && eCopyOptionItem.getSelectableChoices().contains(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter)) {
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_Letter);
- break;
- } else {
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSize_A4);
- break;
- }
- case PrintMediaSource:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintMediaSource_Bottom);
- break;
- case PrintQuality:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.PrintQuality_Normal);
- break;
- case XDensity:
- case Copies:
- eCopyOptionItem.selectValue(eCopyOptionItem.getDefaultValue());
- break;
- case RepeatLayout:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.RepeatLayout_twoRepeat);
- break;
- case RemoveBackground:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XRemoveBackground_Off);
- break;
- case XCutLine:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XCutLine_Off);
- break;
- case XCutLineStyle:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XCutLineStyle_Dash);
- break;
- case XCutLineWeight:
- eCopyOptionItem.selectChoice(ECopyOptionItem.ECopyOptionItemChoice.XCutLineWidth_Dash);
- break;
- }
- this.copyComponent.setCopyOptionItem(eCopyOptionItem);
- }
- private void fetchCopyOptionContext() {
- ECopyComponent.createCopyOptionContext(this.copyComponent, this.copyType, new ECopyComponent.ICopyOptionContextListener() {
- public void onCopyOptionContextCreated(ECopyComponent.ECopyType eCopyType, ECopyOptionContext eCopyOptionContext, ECopyComponent.ICopyOptionContextListener.ContextCreationError contextCreationError) {
- CopyActivity copyActivity = CopyActivity.this;
- copyActivity.mECopyOptionContext = eCopyOptionContext;
- if (contextCreationError == null) {
- copyActivity.copyComponent.bindCopyOptionContext(CopyActivity.this.mECopyOptionContext, CopyActivity.this.optionListener);
- ArrayList<ECopyOptionItem> copyOptionItems = CopyActivity.this.copyComponent.getCopyOptionItems();
- ECopyOptionContext bindedCopyOptionContext = CopyActivity.this.copyComponent.getBindedCopyOptionContext();
- if (bindedCopyOptionContext != null && bindedCopyOptionContext.hasCopyOptionItemOf(ECopyOptionItem.ECopyOptionItemKey.XCutLine)) {
- CopyActivity.this.setupUiPostCommunication();
- CopyActivity.this.setClickListenerPostCommunication();
- }
- if (ActivityBase.printerId.equalsIgnoreCase(CopyActivity.this.presettings.loadPrePrinter())) {
- CopyActivity.this.presettings.setCopyOptions(copyOptionItems);
- } else {
- CopyActivity.this.buildCopyOptions(copyOptionItems);
- }
- } else {
- ActivityBase.errorDialog unused = copyActivity.errordialog = new ActivityBase.errorDialog(copyActivity);
- String[] reasonText = CopyActivity.this.errordialog.getReasonText(contextCreationError);
- CopyActivity.this.errordialog.showErrorDialog(reasonText[0], reasonText[1], ActivityBase.DialogButtons.Ok, new ActivityBase.IClose() {
- public void onClose(ActivityBase.ClickButton clickButton) {
- CopyActivity.this.returnToHome();
- }
- });
- }
- }
- });
- }
- private void buildCopyOptions(ArrayList<ECopyOptionItem> arrayList) {
- Iterator<ECopyOptionItem> it = arrayList.iterator();
- while (it.hasNext()) {
- ECopyOptionItem next = it.next();
- ECopyOptionItem.ECopyOptionItemKey key = next.getKey();
- switch (key) {
- case ColorEffectsType:
- String str = this.TAG;
- EPLog.m313i(str, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
- updateSetting(R.id.copy_color_info, next);
- break;
- case PrintMediaType:
- String str2 = this.TAG;
- EPLog.m313i(str2, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
- updateSetting(R.id.copy_paper_type_info, next);
- break;
- case PrintMediaSize:
- String str3 = this.TAG;
- EPLog.m313i(str3, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
- updateSetting(R.id.copy_paper_size_info, next);
- break;
- case PrintMediaSource:
- String str4 = this.TAG;
- EPLog.m313i(str4, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
- updateSetting(R.id.copy_paper_source_info, next);
- break;
- case PrintQuality:
- String str5 = this.TAG;
- EPLog.m313i(str5, "show " + key.name() + ":" + next.getSelectedChoice() + " setting");
- updateSetting(R.id.copy_quality_info, next);
- break;
- case XDensity:
- this.optionValueMap.put(key, new XDensityValue(next));
- break;
- case Copies:
- this.optionValueMap.put(key, new CopiesValue(next));
- break;
- case RepeatLayout:
- updateSetting(R.id.repeat_copy_layout_value, next);
- break;
- case RemoveBackground:
- updateSetting(R.id.remove_background_value, next);
- break;
- case XCutLine:
- updateSetting(R.id.print_cut_line_value, next);
- break;
- case XCutLineStyle:
- updateSetting(R.id.print_cut_line_style_value, next);
- break;
- case XCutLineWeight:
- updateSetting(R.id.print_cut_line_weight_value, next);
- break;
- }
- this.loading.dismiss();
- }
- }
- private void updateSetting(int i, ECopyOptionItem eCopyOptionItem) {
- TextView textView = (TextView) this.mLayout.findViewById(i);
- if (eCopyOptionItem.getSelectedChoice() == null) {
- EPLog.m318w("CopyActivity", "updateSetting() choice == null");
- } else {
- textView.setText(getDisplayString(eCopyOptionItem.getSelectedChoice().name()));
- }
- }
- class CopiesValue extends ActivityBase.NumberOptionValue {
- public CopiesValue(ECopyOptionItem eCopyOptionItem) {
- super();
- bindOption(R.id.SettingEditCopies, eCopyOptionItem);
- bindCountUp(R.id.SettingButonCopiesCountUp);
- bindCountDown(R.id.SettingButonCopiesCountDown);
- setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
- }
- }
- class XDensityValue extends ActivityBase.NumberOptionValue {
- ImageView image;
- TypedArray images = CopyActivity.this.getResources().obtainTypedArray(R.array.density_images);
- public XDensityValue(ECopyOptionItem eCopyOptionItem) {
- super();
- bindOption(R.id.density_image, eCopyOptionItem);
- bindCountUp(R.id.SettingButonXDensityCountUp);
- bindCountDown(R.id.SettingButonXDensityCountDown);
- setOptionValueChangedListener(CopyActivity.this.optionValueChangedListener);
- }
- private void bindOption(int i, ECopyOptionItem eCopyOptionItem) {
- this.optionItem = eCopyOptionItem;
- this.value = eCopyOptionItem.getSelectedValue();
- this.image = (ImageView) CopyActivity.this.findViewById(i);
- this.image.setImageDrawable(this.images.getDrawable(this.value + 4));
- this.image.setEnabled(eCopyOptionItem.isEnabled());
- }
- private void bindCountUp(int i) {
- this.countUp = (Button) CopyActivity.this.findViewById(i);
- this.countUp.setOnClickListener(new CounterImage(1));
- if (this.value == this.optionItem.getMaximumValue()) {
- this.countUp.setEnabled(false);
- } else {
- this.countUp.setEnabled(true);
- }
- }
- private void bindCountDown(int i) {
- this.countDown = (Button) CopyActivity.this.findViewById(i);
- this.countDown.setOnClickListener(new CounterImage(-1));
- if (this.value == this.optionItem.getMinimumValue()) {
- this.countDown.setEnabled(false);
- } else {
- this.countDown.setEnabled(true);
- }
- }
- class CounterImage extends ActivityBase.NumberOptionValue.Counter implements View.OnClickListener {
- public CounterImage(int i) {
- super(i);
- }
- private void updateImage(int i) {
- XDensityValue.this.value += i;
- XDensityValue.this.optionItem.selectValue(XDensityValue.this.value);
- if (XDensityValue.this.changedListener != null) {
- XDensityValue.this.changedListener.onOptionItemChanged(XDensityValue.this.optionItem);
- }
- }
- public void onClick(View view) {
- updateImage(this.amount);
- }
- }
- }
- private void getPrinterInfo() {
- MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
- printerId = curPrinter.getPrinterId();
- printerIp = curPrinter.getIp();
- this.printerLocation = curPrinter.getLocation();
- }
- private class ProbePrinter extends AsyncTask<Void, Void, Boolean> {
- /* access modifiers changed from: protected */
- public void onPreExecute() {
- }
- private ProbePrinter() {
- }
- /* access modifiers changed from: protected */
- public Boolean doInBackground(Void... voidArr) {
- EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter doInBackground");
- if ((CopyActivity.this.printerLocation != 1 && CopyActivity.this.printerLocation != 3) || ActivityBase.printerId == null) {
- return false;
- }
- CopyActivity.this.mPrinter.doInitDriver(CopyActivity.this, 2);
- if (CopyActivity.this.mPrinter.doProbePrinter(60, ActivityBase.printerId, ActivityBase.printerIp, CopyActivity.this.printerLocation) != 0) {
- return false;
- }
- int doSetPrinter = CopyActivity.this.mPrinter.doSetPrinter();
- String access$200 = CopyActivity.this.TAG;
- EPLog.m313i(access$200, "Set Printer result: " + doSetPrinter);
- if (doSetPrinter != 0) {
- return false;
- }
- CopyActivity copyActivity = CopyActivity.this;
- String unused = copyActivity.ipAdress = copyActivity.mPrinter.doGetIp();
- String access$2002 = CopyActivity.this.TAG;
- EPLog.m313i(access$2002, "IPAdress : " + CopyActivity.this.ipAdress);
- CopyActivity copyActivity2 = CopyActivity.this;
- copyActivity2.bProbedPrinter = true;
- copyActivity2.systemSettings = new ECopyComponent.ICopySystemSettings() {
- public int getThickPaper() {
- return 0;
- }
- public String getPrinterIPAddress() {
- String access$200 = CopyActivity.this.TAG;
- EPLog.m313i(access$200, "getPrinterIPAddress : " + CopyActivity.this.ipAdress);
- return CopyActivity.this.ipAdress;
- }
- };
- ECopyComponent sharedComponent = ECopyComponent.sharedComponent();
- sharedComponent.setSystemSettings(CopyActivity.this.systemSettings);
- sharedComponent.setProperty(ECopyComponent.Property.RequestConnectionTimeout, 30000);
- return true;
- }
- /* access modifiers changed from: protected */
- public void onCancelled() {
- EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onCancelled");
- super.onCancelled();
- CopyActivity.this.mPrinter.doCancelFindPrinter();
- }
- /* access modifiers changed from: protected */
- public void onPostExecute(Boolean bool) {
- EPLog.m313i(CopyActivity.this.TAG, "ProbePrinter onPostExecute");
- if (bool.booleanValue()) {
- CopyActivity.this.mHandler.sendEmptyMessage(2);
- } else {
- CopyActivity.this.mHandler.sendEmptyMessage(1);
- }
- }
- }
- /* access modifiers changed from: protected */
- public void deleteLongTapMessage() {
- MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
- findViewById(R.id.SettingButonCopiesCountUp).dispatchTouchEvent(obtain);
- findViewById(R.id.SettingButonCopiesCountDown).dispatchTouchEvent(obtain);
- findViewById(R.id.SettingButonXDensityCountUp).dispatchTouchEvent(obtain);
- findViewById(R.id.SettingButonXDensityCountDown).dispatchTouchEvent(obtain);
- }
- public void onConfigurationChanged(Configuration configuration) {
- super.onConfigurationChanged(configuration);
- deleteLongTapMessage();
- }
- }
|