1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264 |
- package com.epson.cameracopy.ui;
- import android.content.ComponentName;
- import android.content.Context;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.content.ServiceConnection;
- import android.content.SharedPreferences;
- import android.content.res.Configuration;
- import android.os.AsyncTask;
- import android.os.Bundle;
- import android.os.Handler;
- import android.os.IBinder;
- import android.os.RemoteException;
- import android.os.SystemClock;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.MotionEvent;
- import android.view.View;
- import android.widget.Button;
- import android.widget.ImageView;
- import android.widget.LinearLayout;
- import android.widget.TextView;
- import com.epson.mobilephone.common.escpr.EscprError;
- import com.epson.mobilephone.common.escpr.MediaInfo;
- import com.epson.mobilephone.common.wifidirect.WiFiDirectManager;
- import epson.common.Constants;
- import epson.common.ExternalFileUtils;
- import epson.common.Utils;
- import epson.print.ActivityIACommon;
- import epson.print.EPPrinterManager;
- import epson.print.MyPrinter;
- import epson.print.R;
- import epson.print.Util.EPLog;
- import epson.print.inkrpln.InkRplnRepository;
- import epson.print.screen.PageRangeSetting;
- import epson.print.screen.PrintProgress;
- import epson.print.screen.PrintSetting;
- import epson.print.screen.PrinterInfoDetail;
- import epson.print.screen.SearchPrinterScr;
- import epson.print.service.EpsonService;
- import epson.print.service.IEpsonService;
- import epson.print.service.IEpsonServiceCallback;
- import epson.print.widgets.CustomTitleAlertDialogBuilder;
- import epson.print.widgets.LongTapRepeatAdapter;
- import java.io.File;
- import java.util.ArrayList;
- /* renamed from: com.epson.cameracopy.ui.CameraPrintSettingActivity */
- public class CameraPrintSettingActivity extends ActivityIACommon implements View.OnClickListener {
- private static final String EXTRA_PRINTER = "myprinter";
- private static final String EXTRA_SIMPLEAP = "simpleap";
- private static final int REQUEST_CODE_INFO = 1;
- private static final int REQUEST_CODE_INK_REPLENISH_PROGRESS = 4;
- private static final int REQUEST_CODE_PAGE_RANGE = 2;
- private static final int REQUEST_CODE_PRINTER = 0;
- public static final String TAG = "CameraPrintSetting";
- private final int COLOR_VALUE_MAX = 50;
- private final int COLOR_VALUE_MIN = -50;
- private final int COPIES_MAX = 30;
- private final int COPIES_MIN = 1;
- private final int EPS_ERR_COMM_ERROR = -1100;
- private final int EPS_ERR_NONE = 0;
- private final int EPS_ERR_OPR_FAIL = -1000;
- private final int EPS_ERR_PRINTER_NOT_SET = EscprError.EPS_ERR_PRINTER_NOT_SET;
- private final int GET_ADVANCED = 64;
- private final int GET_COLOR = 6;
- private final int GET_DUPLEX = 32;
- private final int GET_LAYOUT = 3;
- private final int GET_PAPER_SIZE = 1;
- private final int GET_PAPER_SOURCE = 5;
- private final int GET_PAPER_TYPE = 2;
- private final int GET_QUALITY = 4;
- private final int GET_SUPPORTED_MEDIA = 0;
- private final int PROBE_PRINTER = 17;
- private final int SEARCH_BY_ID = 7;
- private final int SEARCH_ERROR = 16;
- private final int SETTING_DONE = 3;
- private final int SHOW_ERROR_DIALOG = 18;
- private String autoConnectSsid = null;
- private TextView brightness;
- private Button brightnessMinus;
- private Button brightnessPlus;
- private int brightnessValue;
- private int color;
- private TextView colorInfo;
- private int[] color_info = null;
- private TextView contrast;
- private Button contrastMinus;
- private Button contrastPlus;
- private int contrastValue;
- private TextView copies;
- private Button copiesMinus;
- private Button copiesPlus;
- private int copiesValue;
- private boolean disablePrintArea = false;
- private int duplex;
- private TextView duplexInfo;
- private int[] duplex_info = null;
- private boolean enableShowPreview = false;
- private int endValue;
- private int feedDirection;
- private TextView feedDirectionInfo;
- private int[] info = null;
- private boolean isDocumentSetting = true;
- boolean isInfoAvai = false;
- Boolean isNotLoading = true;
- private boolean isRetryAfterConnectSimpleAp = false;
- private boolean isTryConnectSimpleAp = false;
- private int lang = 1;
- private int layout;
- private TextView layoutInfo;
- private int[] layout_info = null;
- private final IEpsonServiceCallback mCallback = new IEpsonServiceCallback.Stub() {
- public void onGetInkState() throws RemoteException {
- }
- public void onGetStatusState() throws RemoteException {
- }
- public void onNotifyEndJob(int i) throws RemoteException {
- }
- public void onNotifyProgress(int i, int i2) throws RemoteException {
- }
- public void onFindPrinterResult(String str, String str2, String str3, String str4, String str5) throws RemoteException {
- String unused = CameraPrintSettingActivity.this.printerIp = str2;
- }
- public void onNotifyContinueable(int i) throws RemoteException {
- EPLog.i("IEpsonServiceCallback", "onNotifyContinueable code = " + i);
- if (i == 0) {
- CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
- cameraPrintSettingActivity.isInfoAvai = true;
- int unused = cameraPrintSettingActivity.lang = cameraPrintSettingActivity.getPrinterLang();
- CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
- cameraPrintSettingActivity2.undoFlag = false;
- cameraPrintSettingActivity2.mHandler.sendEmptyMessage(0);
- }
- }
- public void onNotifyError(int i, int i2, boolean z) throws RemoteException {
- EPLog.i("IEpsonServiceCallback", "onNotifyError errorCode = " + i2);
- CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
- cameraPrintSettingActivity.isInfoAvai = true;
- int unused = cameraPrintSettingActivity.lang = cameraPrintSettingActivity.getPrinterLang();
- CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
- cameraPrintSettingActivity2.undoFlag = false;
- cameraPrintSettingActivity2.mHandler.sendEmptyMessage(0);
- }
- };
- private final boolean mCameraCopy = true;
- private Context mContext = null;
- private final ServiceConnection mEpsonConnection = new ServiceConnection() {
- public void onServiceDisconnected(ComponentName componentName) {
- EPLog.m316v("SettingScr", "onServiceDisconnected");
- try {
- CameraPrintSettingActivity.mEpsonService.unregisterCallback(CameraPrintSettingActivity.mCallback);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- IEpsonService unused = CameraPrintSettingActivity.mEpsonService = null;
- }
- public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
- IEpsonService unused = CameraPrintSettingActivity.mEpsonService = IEpsonService.Stub.asInterface(iBinder);
- EPLog.m316v("SettingScr", "onServiceConnected");
- if (CameraPrintSettingActivity.mEpsonService != null) {
- try {
- CameraPrintSettingActivity.mEpsonService.registerCallback(CameraPrintSettingActivity.mCallback);
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
- };
- private IEpsonService mEpsonService = null;
- Handler mHandler = new Handler(new Handler.Callback() {
- public boolean handleMessage(android.os.Message r15) {
- throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.ui.CameraPrintSettingActivity.C08553.handleMessage(android.os.Message):boolean");
- }
- private int[] removeCddvdMedia(int[] iArr) {
- if (iArr == null) {
- return null;
- }
- ArrayList arrayList = new ArrayList();
- for (int valueOf : iArr) {
- arrayList.add(Integer.valueOf(valueOf));
- }
- for (Integer remove : new Integer[]{91, 92, 93}) {
- do {
- } while (arrayList.remove(remove));
- }
- int[] iArr2 = new int[arrayList.size()];
- for (int i = 0; i < arrayList.size(); i++) {
- iArr2[i] = ((Integer) arrayList.get(i)).intValue();
- }
- return iArr2;
- }
- });
- private MediaInfo.AbstractInfo mLookupTable;
- private MediaInfo.AbstractInfo mPaperSizeType;
- private boolean mPrinterSelectDone;
- private int mRemoteSrcType;
- private boolean mWaiteInkReplenProgress;
- private int paperSize;
- private TextView paperSizeInfo;
- private int paperSource;
- private TextView paperSourceInfo;
- private int paperType;
- private TextView paperTypeInfo;
- private int[] paper_size_info = null;
- private int[] paper_source_info = null;
- private int[] paper_type_info = null;
- private boolean printAll;
- private TextView printDateInfo;
- private int printdate;
- private MyPrinter printer = null;
- private String printerDeviceId;
- private String printerEmailAddress;
- private String printerId;
- private String printerIp;
- private int printerLocation;
- private TextView printerName;
- private String printerSerialNo;
- private View progressGetOption;
- private int quality;
- private TextView qualityInfo;
- private int[] quality_info = null;
- private TextView saturation;
- private Button saturationMinus;
- private Button saturationPlus;
- private int saturationValue;
- private int sheets = 1;
- private int sizeIndex = 0;
- private int startValue;
- private int typeIndex = 0;
- boolean undoFlag = true;
- static /* synthetic */ int access$1108(CameraPrintSettingActivity cameraPrintSettingActivity) {
- int i = cameraPrintSettingActivity.sizeIndex;
- cameraPrintSettingActivity.sizeIndex = i + 1;
- return i;
- }
- static /* synthetic */ int access$1608(CameraPrintSettingActivity cameraPrintSettingActivity) {
- int i = cameraPrintSettingActivity.typeIndex;
- cameraPrintSettingActivity.typeIndex = i + 1;
- return i;
- }
- protected void onCreate(Bundle bundle) {
- super.onCreate(bundle);
- setContentView(R.layout.setting_layout);
- setActionBar(R.string.str_btn_printer_settings, true);
- bindEpsonService();
- mContext = this;
- mRemoteSrcType = 2;
- isDocumentSetting = getIntent().getBooleanExtra(PrintProgress.PARAM_DOCUMENT_MODE, false);
- if (this.isDocumentSetting) {
- sheets = getIntent().getIntExtra("SHEETS", 1);
- disablePrintArea = getIntent().getBooleanExtra("PRINTAREA", false);
- mRemoteSrcType = 1;
- }
- sheets = 1;
- mRemoteSrcType = 2;
- printerName = (TextView) findViewById(R.id.printer_name);
- paperSizeInfo = (TextView) findViewById(R.id.paper_size_info);
- paperTypeInfo = (TextView) findViewById(R.id.paper_type_info);
- layoutInfo = (TextView) findViewById(R.id.layout_info);
- qualityInfo = (TextView) findViewById(R.id.quality_info);
- paperSourceInfo = (TextView) findViewById(R.id.paper_source_info);
- copies = (TextView) findViewById(R.id.copies);
- copiesMinus = (Button) findViewById(R.id.copies_minus_button);
- copiesPlus = (Button) findViewById(R.id.copies_plus_button);
- LongTapRepeatAdapter.bless(this.copiesMinus);
- LongTapRepeatAdapter.bless(this.copiesPlus);
- colorInfo = (TextView) findViewById(R.id.color_info);
- duplexInfo = (TextView) findViewById(R.id.duplex_info);
- feedDirectionInfo = (TextView) findViewById(R.id.feed_direction_info);
- printDateInfo = (TextView) findViewById(R.id.printdate_info);
- brightness = (TextView) findViewById(R.id.brightness);
- brightnessMinus = (Button) findViewById(R.id.brightness_minus_button);
- brightnessPlus = (Button) findViewById(R.id.brightness_plus_button);
- contrast = (TextView) findViewById(R.id.contrast);
- contrastMinus = (Button) findViewById(R.id.contrast_minus_button);
- contrastPlus = (Button) findViewById(R.id.contrast_plus_button);
- saturation = (TextView) findViewById(R.id.saturation);
- saturationMinus = (Button) findViewById(R.id.saturation_minus_button);
- saturationPlus = (Button) findViewById(R.id.saturation_plus_button);
- progressGetOption = findViewById(R.id.progressGetOption);
- enableShowPreview = getSharedPreferences(Constants.PREFS_EPSON_CONNECT, 0).getBoolean(Constants.ENABLE_SHOW_PREVIEW, true);
- loadConfig();
- setClickListener();
- updatePrinterIcon();
- if (this.printerId != null) {
- undoFlag = false;
- if (loadSupportedMediaFile()) {
- mHandler.sendEmptyMessage(1);
- } else {
- mHandler.sendEmptyMessage(17);
- }
- } else {
- mHandler.sendEmptyMessage(1);
- }
- }
- private void updatePrinterIcon() {
- if (this.printerName.getText().equals(getString(R.string.str_lbl_title_scan))) {
- ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(View.GONE);
- return;
- }
- ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(View.VISIBLE);
- switch (this.printerLocation) {
- case 1:
- ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.drawable.print_local);
- return;
- case 2:
- ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.drawable.print_remote);
- return;
- case 3:
- ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setImageResource(R.drawable.print_ip);
- return;
- default:
- return;
- }
- }
- private void setClickListener() {
- copiesMinus.setOnClickListener(this);
- copiesPlus.setOnClickListener(this);
- brightnessMinus.setOnClickListener(this);
- brightnessPlus.setOnClickListener(this);
- contrastMinus.setOnClickListener(this);
- contrastPlus.setOnClickListener(this);
- saturationMinus.setOnClickListener(this);
- saturationPlus.setOnClickListener(this);
- if (this.isDocumentSetting) {
- findViewById(R.id.page_range_setting).setOnClickListener(this);
- }
- findViewById(R.id.printer).setOnClickListener(this);
- findViewById(R.id.paper_size).setOnClickListener(this);
- findViewById(R.id.paper_type).setOnClickListener(this);
- findViewById(R.id.layout).setOnClickListener(this);
- findViewById(R.id.quality).setOnClickListener(this);
- findViewById(R.id.paper_source).setOnClickListener(this);
- findViewById(R.id.color).setOnClickListener(this);
- findViewById(R.id.duplex).setOnClickListener(this);
- findViewById(R.id.feed_direction).setOnClickListener(this);
- findViewById(R.id.printdate).setOnClickListener(this);
- }
- private void loadConfig() {
- MyPrinter curPrinter = MyPrinter.getCurPrinter(this);
- if (curPrinter == null || curPrinter.getName() == null) {
- printerName.setText(getString(R.string.str_lbl_title_scan));
- } else {
- printerName.setText(curPrinter.getUserDefName(this));
- }
- printerDeviceId = curPrinter.getName();
- printerId = curPrinter.getPrinterId();
- printerIp = curPrinter.getIp();
- printerSerialNo = curPrinter.getSerialNo();
- printerEmailAddress = curPrinter.getEmailAddress();
- printerLocation = curPrinter.getLocation();
- boolean z = true;
- if (this.printerLocation == 0) {
- printerLocation = 1;
- }
- autoConnectSsid = WiFiDirectManager.getConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER);
- PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
- printSetting.loadSettings();
- mLookupTable = new MediaInfo.PaperSize();
- paperSize = printSetting.paperSizeValue;
- paperSizeInfo.setText(getString(mLookupTable.getStringId(this.paperSize)));
- mLookupTable.destructor();
- mLookupTable = new MediaInfo.PaperType();
- paperType = printSetting.paperTypeValue;
- paperTypeInfo.setText(getString(mLookupTable.getStringId(this.paperType)));
- mLookupTable.destructor();
- mPaperSizeType = printSetting.loadPaperSizeTypePear();
- mPaperSizeType.putID(this.paperSize, paperType);
- mLookupTable = new MediaInfo.Layout();
- layout = printSetting.layoutValue;
- layoutInfo.setText(getString(mLookupTable.getStringId(this.layout)));
- mLookupTable.destructor();
- mLookupTable = new MediaInfo.Quality();
- quality = printSetting.qualityValue;
- qualityInfo.setText(getString(mLookupTable.getStringId(this.quality)));
- mLookupTable.destructor();
- mLookupTable = new MediaInfo.PaperSource();
- paperSource = printSetting.paperSourceValue;
- paperSourceInfo.setText(getString(mLookupTable.getStringId(this.paperSource)));
- mLookupTable.destructor();
- mLookupTable = new MediaInfo.Color();
- color = printSetting.colorValue;
- colorInfo.setText(getString(mLookupTable.getStringId(this.color)));
- mLookupTable.destructor();
- copiesValue = printSetting.copiesValue;
- copies.setText(String.valueOf(this.copiesValue));
- copiesMinus.setEnabled(this.copiesValue != 1);
- Button button = copiesPlus;
- if (this.copiesValue == 30) {
- z = false;
- }
- button.setEnabled(z);
- brightnessValue = printSetting.brightnessValue;
- contrastValue = printSetting.contrastValue;
- saturationValue = printSetting.saturationValue;
- mLookupTable = new MediaInfo.Duplex();
- duplex = printSetting.duplexValue;
- duplexInfo.setText(getString(mLookupTable.getStringId(this.duplex)));
- mLookupTable.destructor();
- mLookupTable = new MediaInfo.FeedDirection();
- feedDirection = printSetting.feedDirectionValue;
- feedDirectionInfo.setText(getString(mLookupTable.getStringId(this.feedDirection)));
- mLookupTable.destructor();
- lang = curPrinter.getLang();
- if (this.isDocumentSetting) {
- printAll = printSetting.printAll;
- startValue = printSetting.startValue;
- endValue = printSetting.endValue;
- ((TextView) findViewById(R.id.page_range_value)).setText(this.startValue + ".." + endValue);
- return;
- }
- mLookupTable = new MediaInfo.PrintDate();
- printdate = printSetting.printdate;
- printDateInfo.setText(getString(mLookupTable.getStringId(this.printdate)));
- mLookupTable.destructor();
- }
- private boolean loadSupportedMediaFile() {
- ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
- File savedSupportedMedia = instance.getSavedSupportedMedia();
- File supportedMedia = instance.getSupportedMedia();
- File preSupportedMedia = instance.getPreSupportedMedia();
- EPLog.i(TAG, "call loadSupportedMedia");
- try {
- if (!savedSupportedMedia.exists()) {
- EPLog.w("loadSupportedMedia", savedSupportedMedia.getName() + " not exist");
- return false;
- }
- Utils.copyFile(savedSupportedMedia, supportedMedia);
- Utils.copyFile(savedSupportedMedia, preSupportedMedia);
- File savedAreaInfo = instance.getSavedAreaInfo();
- File areaInfo = instance.getAreaInfo();
- File preAreaInfo = instance.getPreAreaInfo();
- try {
- if (!savedAreaInfo.exists()) {
- return true;
- }
- Utils.copyFile(savedAreaInfo, areaInfo);
- Utils.copyFile(savedAreaInfo, preAreaInfo);
- return true;
- } catch (Exception e) {
- EPLog.w("loadSupportedMedia", "failure " + e.getMessage());
- return false;
- }
- } catch (Exception e2) {
- EPLog.w("loadSupportedMedia", "failure " + e2.getMessage());
- return false;
- }
- }
- private boolean updateSupportedMediaFile(boolean z) {
- ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
- EPLog.i(TAG, "call updateSupportedMedia");
- File supportedMedia = instance.getSupportedMedia();
- File preSupportedMedia = instance.getPreSupportedMedia();
- if (z) {
- File file = preSupportedMedia;
- preSupportedMedia = supportedMedia;
- supportedMedia = file;
- }
- try {
- Utils.copyFile(supportedMedia, preSupportedMedia);
- File areaInfo = instance.getAreaInfo();
- File preAreaInfo = instance.getPreAreaInfo();
- if (!z) {
- File file2 = areaInfo;
- areaInfo = preAreaInfo;
- preAreaInfo = file2;
- }
- try {
- if (!preAreaInfo.exists()) {
- return true;
- }
- Utils.copyFile(preAreaInfo, areaInfo);
- return true;
- } catch (Exception e) {
- if (preAreaInfo != null && preAreaInfo.exists()) {
- preAreaInfo.delete();
- }
- if (areaInfo != null && areaInfo.exists()) {
- areaInfo.delete();
- }
- EPLog.w("updateSupportedMediaFile", "failure " + e.getMessage());
- return false;
- }
- } catch (Exception e2) {
- if (supportedMedia != null && supportedMedia.exists()) {
- supportedMedia.delete();
- }
- if (preSupportedMedia != null && preSupportedMedia.exists()) {
- preSupportedMedia.delete();
- }
- EPLog.w("updateSupportedMediaFile", "failure " + e2.getMessage());
- return false;
- }
- }
- private boolean saveSupportedMediaFile() {
- ExternalFileUtils instance = ExternalFileUtils.getInstance(this);
- EPLog.i(TAG, "call saveSupportedMedia");
- File supportedMedia = instance.getSupportedMedia();
- File savedSupportedMedia = instance.getSavedSupportedMedia();
- try {
- if (!supportedMedia.exists()) {
- EPLog.w("updateSupportedMediaFile", supportedMedia.getName() + " not exist");
- return false;
- }
- Utils.copyFile(supportedMedia, savedSupportedMedia);
- File areaInfo = instance.getAreaInfo();
- File savedAreaInfo = instance.getSavedAreaInfo();
- int i = printerLocation;
- if (i == 1 || i == 3) {
- try {
- if (!areaInfo.exists()) {
- EPLog.w("updateSupportedMediaFile", areaInfo.getName() + " not exist");
- return false;
- }
- Utils.copyFile(areaInfo, savedAreaInfo);
- } catch (Exception e) {
- EPLog.w("saveSupportedMediaFile", "failure " + e.getMessage());
- return false;
- }
- } else {
- EPLog.i(TAG, "delete AreaInfo");
- instance.removeAreaInfo();
- }
- return true;
- } catch (Exception e2) {
- EPLog.w("saveSupportedMediaFile", "failure " + e2.getMessage());
- return false;
- }
- }
- private void saveChanged() {
- SharedPreferences.Editor edit = getSharedPreferences("PrintSetting", 0).edit();
- edit.putInt(Constants.PREFS_INFO_PRINT_SAVE, 1);
- edit.commit();
- MyPrinter myPrinter = new MyPrinter(this.printerDeviceId, printerIp, printerId, printerSerialNo, printerEmailAddress, printerLocation);
- myPrinter.setLang(this.lang);
- myPrinter.setCurPrinter(this);
- PrintSetting printSetting = new PrintSetting(this, PrintSetting.Kind.cameracopy);
- printSetting.paperSizeValue = paperSize;
- printSetting.paperTypeValue = paperType;
- printSetting.layoutValue = layout;
- printSetting.qualityValue = quality;
- printSetting.paperSourceValue = paperSource;
- printSetting.colorValue = color;
- printSetting.duplexValue = duplex;
- printSetting.feedDirectionValue = feedDirection;
- printSetting.copiesValue = copiesValue;
- printSetting.brightnessValue = brightnessValue;
- printSetting.contrastValue = contrastValue;
- printSetting.saturationValue = saturationValue;
- if (this.isDocumentSetting) {
- printSetting.printAll = printAll;
- printSetting.startValue = startValue;
- printSetting.endValue = endValue;
- } else {
- printSetting.printdate = printdate;
- }
- printSetting.saveSettings();
- printSetting.savePaperSizeTypePear((MediaInfo.PaperSizeType) mPaperSizeType);
- saveSupportedMediaFile();
- String str = autoConnectSsid;
- if (str == null || str.length() <= 0) {
- WiFiDirectManager.resetConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER);
- } else {
- WiFiDirectManager.setConnectInfo(this, autoConnectSsid, WiFiDirectManager.DEVICE_TYPE_PRINTER, myPrinter.getName());
- }
- EPPrinterManager ePPrinterManager = new EPPrinterManager(mContext);
- ePPrinterManager.commitIPPrinterInfo();
- ePPrinterManager.commitRemotePrinterInfo();
- if (mPrinterSelectDone) {
- new InkRplnRepository(false).savePermanently(this);
- }
- }
- protected void onDestroy() {
- super.onDestroy();
- unbindEpsonService();
- EPLog.i("SettingScr", "onDestroy");
- mPaperSizeType.destructor();
- }
- private void bindEpsonService() {
- EPLog.m316v("SettingScr", "bindEpsonService");
- if (mEpsonService == null) {
- bindService(new Intent(this, EpsonService.class), mEpsonConnection, 1);
- }
- }
- private void unbindEpsonService() {
- EPLog.m316v("SettingScr", "unbindEpsonService");
- IEpsonService iEpsonService = mEpsonService;
- if (iEpsonService != null) {
- try {
- iEpsonService.unregisterCallback(mCallback);
- unbindService(mEpsonConnection);
- mEpsonService = null;
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- }
- public void onClick(View view) {
- if (this.progressGetOption.getVisibility() == 8) {
- IEpsonService iEpsonService = mEpsonService;
- if (iEpsonService != null) {
- try {
- iEpsonService.cancelSearchPrinter();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- switch (view.getId()) {
- case R.id.brightness_minus_button /*2131230848*/:
- brightnessValue--;
- if (this.brightnessValue <= -50) {
- brightnessValue = -50;
- brightnessMinus.setEnabled(false);
- } else {
- brightnessMinus.setEnabled(true);
- }
- brightnessPlus.setEnabled(true);
- brightness.setText(String.valueOf(this.brightnessValue));
- return;
- case R.id.brightness_plus_button /*2131230850*/:
- brightnessValue++;
- if (this.brightnessValue >= 50) {
- brightnessValue = 50;
- brightnessPlus.setEnabled(false);
- } else {
- brightnessPlus.setEnabled(true);
- }
- brightnessMinus.setEnabled(true);
- brightness.setText(String.valueOf(this.brightnessValue));
- return;
- case R.id.color /*2131230930*/:
- launchDetailScreen(this.color, R.id.color);
- return;
- case R.id.contrast_minus_button /*2131230942*/:
- contrastValue--;
- if (this.contrastValue <= -50) {
- contrastValue = -50;
- contrastMinus.setEnabled(false);
- } else {
- contrastMinus.setEnabled(true);
- }
- contrastPlus.setEnabled(true);
- contrast.setText(String.valueOf(this.contrastValue));
- return;
- case R.id.contrast_plus_button /*2131230943*/:
- contrastValue++;
- if (this.contrastValue >= 50) {
- contrastValue = 50;
- contrastPlus.setEnabled(false);
- } else {
- contrastPlus.setEnabled(true);
- }
- contrastMinus.setEnabled(true);
- contrast.setText(String.valueOf(this.contrastValue));
- return;
- case R.id.copies_minus_button /*2131230945*/:
- copiesValue--;
- if (this.copiesValue <= 1) {
- copiesValue = 1;
- copiesMinus.setEnabled(false);
- } else {
- copiesMinus.setEnabled(true);
- }
- copiesPlus.setEnabled(true);
- copies.setText(String.valueOf(this.copiesValue));
- return;
- case R.id.copies_plus_button /*2131230946*/:
- copiesValue++;
- if (this.copiesValue >= 30) {
- copiesValue = 30;
- copiesPlus.setEnabled(false);
- } else {
- copiesPlus.setEnabled(true);
- }
- copiesMinus.setEnabled(true);
- copies.setText(String.valueOf(this.copiesValue));
- return;
- case R.id.duplex /*2131231005*/:
- launchDetailScreen(this.duplex, R.id.duplex);
- return;
- case R.id.feed_direction /*2131231037*/:
- launchDetailScreen(this.feedDirection, R.id.feed_direction);
- return;
- case R.id.layout /*2131231158*/:
- launchDetailScreen(this.layout, R.id.layout);
- return;
- case R.id.page_range_setting /*2131231300*/:
- Intent intent = new Intent(this, PageRangeSetting.class);
- intent.putExtra("SHEETS", sheets);
- intent.putExtra("printAll", printAll);
- intent.putExtra("startValue", startValue);
- intent.putExtra("endValue", endValue);
- startActivityForResult(intent, 2);
- return;
- case R.id.paper_size /*2131231306*/:
- launchDetailScreen(this.paperSize, R.id.paper_size);
- return;
- case R.id.paper_source /*2131231311*/:
- int i = paperSource;
- int[] iArr = paper_source_info;
- if (iArr != null && iArr.length <= 1) {
- i = 128;
- }
- launchDetailScreen(i, R.id.paper_source);
- return;
- case R.id.paper_type /*2131231314*/:
- launchDetailScreen(this.paperType, R.id.paper_type);
- return;
- case R.id.printdate /*2131231355*/:
- launchDetailScreen(this.printdate, R.id.printdate);
- return;
- case R.id.printer /*2131231358*/:
- unbindEpsonService();
- new AsyncTask<Void, Void, Void>() {
- protected void onPreExecute() {
- CameraPrintSettingActivity.this.findViewById(R.id.printer).setClickable(false);
- }
- protected Void doInBackground(Void... voidArr) {
- CameraPrintSettingActivity cameraPrintSettingActivity = CameraPrintSettingActivity.this;
- WiFiDirectManager.disconnect(cameraPrintSettingActivity, WiFiDirectManager.DEVICE_TYPE_PRINTER, cameraPrintSettingActivity.printerIp);
- CameraPrintSettingActivity cameraPrintSettingActivity2 = CameraPrintSettingActivity.this;
- WiFiDirectManager.disconnectSimpleAP(cameraPrintSettingActivity2, cameraPrintSettingActivity2.autoConnectSsid, CameraPrintSettingActivity.this.printerIp);
- return null;
- }
- protected void onPostExecute(Void voidR) {
- Intent intent = new Intent(CameraPrintSettingActivity.this, SearchPrinterScr.class);
- Bundle bundle = new Bundle();
- bundle.putString(Constants.PRINTER_ID, CameraPrintSettingActivity.this.printerId);
- bundle.putString(Constants.PRINTER_IP, CameraPrintSettingActivity.this.printerIp);
- bundle.putString(Constants.PRINTER_EMAIL_ADDRESS, CameraPrintSettingActivity.this.printerEmailAddress);
- bundle.putInt(Constants.PRINTER_LOCATION, CameraPrintSettingActivity.this.printerLocation);
- bundle.putString(CameraPrintSettingActivity.EXTRA_SIMPLEAP, CameraPrintSettingActivity.this.autoConnectSsid);
- intent.putExtras(bundle);
- CameraPrintSettingActivity.this.startActivityForResult(intent, 0);
- CameraPrintSettingActivity.this.findViewById(R.id.printer).setClickable(true);
- }
- }.execute(new Void[0]);
- return;
- case R.id.quality /*2131231392*/:
- launchDetailScreen(this.quality, R.id.quality);
- return;
- case R.id.saturation_minus_button /*2131231425*/:
- saturationValue--;
- if (this.saturationValue <= -50) {
- saturationValue = -50;
- saturationMinus.setEnabled(false);
- } else {
- saturationMinus.setEnabled(true);
- }
- saturationPlus.setEnabled(true);
- saturation.setText(String.valueOf(this.saturationValue));
- return;
- case R.id.saturation_plus_button /*2131231426*/:
- saturationValue++;
- if (this.saturationValue >= 50) {
- saturationValue = 50;
- saturationPlus.setEnabled(false);
- } else {
- saturationPlus.setEnabled(true);
- }
- saturationMinus.setEnabled(true);
- saturation.setText(String.valueOf(this.saturationValue));
- return;
- default:
- return;
- }
- }
- }
- private void launchDetailScreen(int i, int i2) {
- Intent intent = new Intent(this, PrinterInfoDetail.class);
- Bundle bundle = new Bundle();
- bundle.putInt("ID", i2);
- bundle.putInt("sizeIndex", sizeIndex);
- bundle.putInt("typeIndex", typeIndex);
- bundle.putInt("curValue", i);
- bundle.putBoolean("isDocumentSetting", isDocumentSetting);
- switch (i2) {
- case R.id.color /*2131230930*/:
- bundle.putIntArray(Constants.COLOR_INFO, color_info);
- break;
- case R.id.duplex /*2131231005*/:
- bundle.putIntArray(Constants.DUPLEX_INFO, duplex_info);
- break;
- case R.id.layout /*2131231158*/:
- bundle.putIntArray(Constants.LAYOUT_INFO, layout_info);
- break;
- case R.id.paper_size /*2131231306*/:
- bundle.putIntArray(Constants.PAPER_SIZE_INFO, paper_size_info);
- break;
- case R.id.paper_source /*2131231311*/:
- int[] iArr = paper_source_info;
- bundle.putIntArray(Constants.PAPER_SOURCE_INFO, (iArr == null || iArr.length > 1) ? paper_source_info : new int[]{128});
- break;
- case R.id.paper_type /*2131231314*/:
- bundle.putIntArray(Constants.PAPER_TYPE_INFO, paper_type_info);
- break;
- case R.id.quality /*2131231392*/:
- bundle.putIntArray(Constants.PRINT_QUALITY_INFO, quality_info);
- break;
- }
- intent.putExtras(bundle);
- startActivityForResult(intent, 1);
- }
- protected void onActivityResult(int i, int i2, Intent intent) {
- super.onActivityResult(i, i2, intent);
- String callingPackage = getCallingPackage();
- EPLog.i(callingPackage, "requestCode = " + i + " resultCode = " + i2);
- if (i != 0) {
- if (i != 4) {
- if (i != 2) {
- if (i == 1 && i2 == -1) {
- int i3 = intent.getExtras().getInt("curValue");
- switch (intent.getExtras().getInt("ID")) {
- case R.id.color /*2131230930*/:
- mLookupTable = new MediaInfo.Color();
- colorInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- color = i3;
- break;
- case R.id.duplex /*2131231005*/:
- mLookupTable = new MediaInfo.Duplex();
- duplexInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- duplex = i3;
- break;
- case R.id.feed_direction /*2131231037*/:
- mLookupTable = new MediaInfo.FeedDirection();
- feedDirectionInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- feedDirection = i3;
- break;
- case R.id.layout /*2131231158*/:
- mLookupTable = new MediaInfo.Layout();
- layoutInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- layout = i3;
- undoFlag = false;
- mHandler.sendEmptyMessage(32);
- break;
- case R.id.paper_size /*2131231306*/:
- sizeIndex = intent.getExtras().getInt("INDEX");
- mLookupTable = new MediaInfo.PaperSize();
- paperSizeInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- paperSize = i3;
- paperType = mPaperSizeType.getID(this.paperSize);
- undoFlag = false;
- mHandler.sendEmptyMessage(2);
- break;
- case R.id.paper_source /*2131231311*/:
- mLookupTable = new MediaInfo.PaperSource();
- paperSourceInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- int[] iArr = paper_source_info;
- if (iArr != null && iArr.length > 1) {
- paperSource = i3;
- }
- undoFlag = false;
- mHandler.sendEmptyMessage(32);
- break;
- case R.id.paper_type /*2131231314*/:
- typeIndex = intent.getExtras().getInt("INDEX");
- mLookupTable = new MediaInfo.PaperType();
- paperTypeInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- paperType = i3;
- mPaperSizeType.putID(this.paperSize, paperType);
- undoFlag = false;
- mHandler.sendEmptyMessage(3);
- break;
- case R.id.printdate /*2131231355*/:
- mLookupTable = new MediaInfo.PrintDate();
- printDateInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- printdate = i3;
- break;
- case R.id.quality /*2131231392*/:
- mLookupTable = new MediaInfo.Quality();
- qualityInfo.setText(getString(mLookupTable.getStringId(i3)));
- mLookupTable.destructor();
- quality = i3;
- break;
- }
- }
- } else if (i2 == -1) {
- printAll = intent.getExtras().getBoolean("printAll");
- startValue = intent.getExtras().getInt("startValue");
- endValue = intent.getExtras().getInt("endValue");
- mHandler.sendEmptyMessage(64);
- }
- } else {
- endInkReplAndGoProbePrinter();
- }
- } else {
- onPrinterSelectEnd(i2, intent);
- }
- updatePrinterIcon();
- }
- /* JADX WARNING: Can't fix incorrect switch cases order */
- /* JADX WARNING: Code restructure failed: missing block: B:25:0x00ea, code lost:
- if (r7.loadIpPrinterInfo(r6.printerId) == null) goto L_0x00f7;
- */
- /* JADX WARNING: Code restructure failed: missing block: B:27:0x00f3, code lost:
- if (r7.loadRemotePrinterInfo(r6.printerEmailAddress) == null) goto L_0x00f7;
- */
- /* Code decompiled incorrectly, please refer to instructions dump. */
- private void onPrinterSelectEnd(int r7, android.content.Intent r8) {
- /*
- r6 = this;
- r0 = 0
- r1 = 1
- r2 = -1
- if (r7 != r2) goto L_0x00d6
- android.os.Bundle r7 = r8.getExtras()
- java.lang.String r2 = "myprinter"
- android.os.Parcelable r7 = r7.getParcelable(r2)
- epson.print.MyPrinter r7 = (epson.print.MyPrinter) r7
- r6.printer = r7
- android.widget.TextView r7 = r6.printerName
- epson.print.MyPrinter r2 = r6.printer
- java.lang.String r2 = r2.getName()
- r7.setText(r2)
- epson.print.MyPrinter r7 = r6.printer
- java.lang.String r7 = r7.getName()
- r6.printerDeviceId = r7
- epson.print.MyPrinter r7 = r6.printer
- java.lang.String r7 = r7.getPrinterId()
- r6.printerId = r7
- epson.print.MyPrinter r7 = r6.printer
- java.lang.String r7 = r7.getIp()
- r6.printerIp = r7
- epson.print.MyPrinter r7 = r6.printer
- java.lang.String r7 = r7.getSerialNo()
- r6.printerSerialNo = r7
- epson.print.MyPrinter r7 = r6.printer
- java.lang.String r7 = r7.getEmailAddress()
- r6.printerEmailAddress = r7
- epson.print.MyPrinter r7 = r6.printer
- int r7 = r7.getLocation()
- r6.printerLocation = r7
- epson.print.EPPrinterManager r7 = new epson.print.EPPrinterManager
- r7.<init>(r6)
- int r2 = r6.printerLocation
- switch(r2) {
- case 2: goto L_0x0075;
- case 3: goto L_0x0059;
- default: goto L_0x0058;
- }
- L_0x0058:
- goto L_0x0090
- L_0x0059:
- java.lang.String r2 = r6.printerId
- epson.print.EPPrinterInfo r7 = r7.loadIpPrinterInfo(r2)
- if (r7 == 0) goto L_0x0090
- java.lang.String r2 = r7.userDefName
- if (r2 == 0) goto L_0x0090
- java.lang.String r2 = r7.userDefName
- int r2 = r2.length()
- if (r2 <= 0) goto L_0x0090
- android.widget.TextView r2 = r6.printerName
- java.lang.String r7 = r7.userDefName
- r2.setText(r7)
- goto L_0x0090
- L_0x0075:
- java.lang.String r2 = r6.printerEmailAddress
- epson.print.EPPrinterInfo r7 = r7.loadRemotePrinterInfo(r2)
- if (r7 == 0) goto L_0x0090
- java.lang.String r2 = r7.userDefName
- if (r2 == 0) goto L_0x0090
- java.lang.String r2 = r7.userDefName
- int r2 = r2.length()
- if (r2 <= 0) goto L_0x0090
- android.widget.TextView r2 = r6.printerName
- java.lang.String r7 = r7.userDefName
- r2.setText(r7)
- L_0x0090:
- android.os.Bundle r7 = r8.getExtras()
- java.lang.String r8 = "simpleap"
- java.lang.String r7 = r7.getString(r8)
- r6.autoConnectSsid = r7
- android.content.Context r7 = r6.getApplicationContext()
- java.lang.String r8 = "PrintSetting"
- java.lang.String r2 = "RE_SEARCH"
- epson.common.Utils.savePref((android.content.Context) r7, (java.lang.String) r8, (java.lang.String) r2, (boolean) r1)
- r6.undoFlag = r0
- r6.mPrinterSelectDone = r1
- r6.mWaiteInkReplenProgress = r1
- android.content.Context r7 = r6.getApplicationContext()
- java.lang.String r8 = r6.printerId
- boolean r7 = epson.print.inkrpln.InkReplnHelper.isSimpleApOrP2p(r7, r8)
- if (r7 != 0) goto L_0x00d2
- epson.print.inkrpln.PrintSettingDependencyBuilder r7 = new epson.print.inkrpln.PrintSettingDependencyBuilder
- java.lang.String r1 = r6.printerId
- java.lang.String r2 = r6.printerIp
- java.lang.String r3 = r6.printerSerialNo
- int r4 = r6.printerLocation
- java.lang.String r5 = r6.printerDeviceId
- r0 = r7
- r0.<init>(r1, r2, r3, r4, r5)
- android.content.Intent r7 = epson.print.inkrpln.InkRplnProgressDialog.getStartIntent2(r6, r7)
- r8 = 4
- r6.startActivityForResult(r7, r8)
- goto L_0x00fc
- L_0x00d2:
- r6.endInkReplAndGoProbePrinter()
- goto L_0x00fc
- L_0x00d6:
- r6.bindEpsonService()
- epson.print.EPPrinterManager r7 = new epson.print.EPPrinterManager
- r7.<init>(r6)
- int r8 = r6.printerLocation
- switch(r8) {
- case 2: goto L_0x00ed;
- case 3: goto L_0x00e4;
- default: goto L_0x00e3;
- }
- L_0x00e3:
- goto L_0x00f6
- L_0x00e4:
- java.lang.String r8 = r6.printerId
- epson.print.EPPrinterInfo r7 = r7.loadIpPrinterInfo(r8)
- if (r7 != 0) goto L_0x00f6
- goto L_0x00f7
- L_0x00ed:
- java.lang.String r8 = r6.printerEmailAddress
- epson.print.EPPrinterInfo r7 = r7.loadRemotePrinterInfo(r8)
- if (r7 != 0) goto L_0x00f6
- goto L_0x00f7
- L_0x00f6:
- r1 = 0
- L_0x00f7:
- if (r1 == 0) goto L_0x00fc
- r6.resetSettings()
- L_0x00fc:
- return
- */
- throw new UnsupportedOperationException("Method not decompiled: com.epson.cameracopy.ui.CameraPrintSettingActivity.onPrinterSelectEnd(int, android.content.Intent):void");
- }
- private void endInkReplAndGoProbePrinter() {
- mWaiteInkReplenProgress = false;
- bindEpsonService();
- mHandler.sendEmptyMessageDelayed(17, 100);
- }
- private void updateSettingView() {
- boolean z = isDocumentSetting;
- setVisibilityPageRange(false);
- int[] iArr = color_info;
- if (iArr == null) {
- ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(View.GONE);
- } else if (iArr.length <= 1) {
- ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(View.GONE);
- } else {
- ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(View.VISIBLE);
- }
- int[] iArr2 = duplex_info;
- findViewById(R.id.duplex_view).setVisibility(View.GONE);
- ((LinearLayout) findViewById(R.id.duplex)).setVisibility(View.GONE);
- switch (this.lang) {
- case 2:
- case 3:
- findViewById(R.id.feed_direction_view).setVisibility(View.VISIBLE);
- findViewById(R.id.feed_direction).setVisibility(View.VISIBLE);
- break;
- default:
- findViewById(R.id.feed_direction_view).setVisibility(View.GONE);
- findViewById(R.id.feed_direction).setVisibility(View.GONE);
- break;
- }
- if (!this.isDocumentSetting) {
- int i = printerLocation;
- }
- findViewById(R.id.printdate).setVisibility(View.GONE);
- }
- private int getPrinterLang() {
- int i;
- IEpsonService iEpsonService;
- if (!(this.printerLocation == 2 || (iEpsonService = mEpsonService) == null)) {
- try {
- i = iEpsonService.getLang();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- EPLog.d(TAG, "getPrinterLang called : ret = " + i);
- return i;
- }
- i = 1;
- EPLog.d(TAG, "getPrinterLang called : ret = " + i);
- return i;
- }
- private void setVisibilityPageRange(boolean z) {
- int i = 0;
- findViewById(R.id.page_range_setting).setVisibility(z ? 0 : 8);
- View findViewById = findViewById(R.id.page_range_separator);
- if (!z) {
- i = 8;
- }
- findViewById.setVisibility(i);
- }
- private void setClickablePageRange(boolean z) {
- findViewById(R.id.page_range_setting).setClickable(z);
- int i = 0;
- findViewById(R.id.page_range_next_screen_imv).setVisibility(z ? 0 : 8);
- View findViewById = findViewById(R.id.page_range_value);
- if (!z) {
- i = 8;
- }
- findViewById.setVisibility(i);
- }
- private void resetSettings() {
- printerDeviceId = null;
- printerId = null;
- printerEmailAddress = null;
- printerIp = null;
- printerLocation = 0;
- info = null;
- paper_source_info = null;
- color_info = null;
- paper_size_info = null;
- paper_type_info = null;
- layout_info = null;
- quality_info = null;
- duplex_info = null;
- autoConnectSsid = "";
- printerName.setText(getString(R.string.str_lbl_title_scan));
- ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(View.GONE);
- updateSettingView();
- setScreenState(true);
- }
- public void onBackPressed() {
- super.onBackPressed();
- IEpsonService iEpsonService = mEpsonService;
- if (iEpsonService != null) {
- try {
- iEpsonService.cancelSearchPrinter();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
- loadSupportedMediaFile();
- EPPrinterManager ePPrinterManager = new EPPrinterManager(mContext);
- ePPrinterManager.rollbackRemotePrinterInfo();
- ePPrinterManager.rollbackIPPrinterInfo();
- new InkRplnRepository(false).deleteTemporaryData(this);
- }
- private void setScreenState(Boolean bool) {
- if (bool.booleanValue()) {
- progressGetOption.setVisibility(View.GONE);
- } else {
- progressGetOption.setVisibility(View.VISIBLE);
- }
- findViewById(R.id.printer).setClickable(bool.booleanValue());
- findViewById(R.id.paper_size).setClickable(bool.booleanValue());
- findViewById(R.id.paper_type).setClickable(bool.booleanValue());
- findViewById(R.id.layout).setClickable(bool.booleanValue());
- findViewById(R.id.quality).setClickable(bool.booleanValue());
- findViewById(R.id.paper_source).setClickable(bool.booleanValue());
- findViewById(R.id.color).setClickable(bool.booleanValue());
- findViewById(R.id.duplex).setClickable(bool.booleanValue());
- findViewById(R.id.feed_direction).setClickable(bool.booleanValue());
- findViewById(R.id.printdate).setClickable(bool.booleanValue());
- }
- public void showErrorDialog(String str, String str2) {
- new CustomTitleAlertDialogBuilder(this).setCancelable(false).setTitle(str).setMessage(str2).setNegativeButton(getString(R.string.ok_button), new DialogInterface.OnClickListener() {
- public void onClick(DialogInterface dialogInterface, int i) {
- CameraPrintSettingActivity.this.setScreenState(true);
- dialogInterface.cancel();
- }
- }).create().show();
- updateSupportedMediaFile(true);
- }
- protected void onResume() {
- super.onResume();
- EPLog.m307e("SettingScr", "onResume()");
- if (this.printerId != null && printerLocation == 1 && isRetryAfterConnectSimpleAp) {
- undoFlag = false;
- if (loadSupportedMediaFile()) {
- mHandler.sendEmptyMessage(1);
- } else {
- mHandler.sendEmptyMessage(17);
- }
- }
- }
- protected void onPause() {
- EPLog.d("SettingScr", "onPause");
- super.onPause();
- if (isFinishing()) {
- deleteLongTapMessage();
- }
- WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, printerIp);
- WiFiDirectManager.disconnectSimpleAP(this, autoConnectSsid, printerIp);
- }
- public boolean onCreateOptionsMenu(Menu menu) {
- getMenuInflater().inflate(R.menu.menu_done, menu);
- return super.onCreateOptionsMenu(menu);
- }
- public boolean onOptionsItemSelected(MenuItem menuItem) {
- if (menuItem.getItemId() != R.id.menuSettingsDone) {
- return super.onOptionsItemSelected(menuItem);
- }
- saveChanged();
- setResult(3, getIntent());
- finish();
- return true;
- }
- protected void deleteLongTapMessage() {
- MotionEvent obtain = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis() + 10, 1, 0.0f, 0.0f, 0);
- copiesMinus.dispatchTouchEvent(obtain);
- copiesPlus.dispatchTouchEvent(obtain);
- }
- public void onConfigurationChanged(Configuration configuration) {
- super.onConfigurationChanged(configuration);
- deleteLongTapMessage();
- }
- }
|