package epson.print.screen; 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 java.io.File; 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.service.EpsonService; import epson.print.service.IEpsonService; import epson.print.service.IEpsonServiceCallback; import epson.print.widgets.CustomTitleAlertDialogBuilder; import epson.print.widgets.LayoutEx; import epson.print.widgets.LongTapRepeatAdapter; public class SettingScr 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 = "PrintSetting"; 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 TextView apfStateText; 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 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 = printerIp = str2; } public void onNotifyContinueable(int i) throws RemoteException { if (!mFinishRequested) { EPLog.i("IEpsonServiceCallback", "onNotifyContinueable code = " + i); if (i == 0) { SettingScr settingScr = SettingScr.this; settingScr.isInfoAvai = true; int unused = settingScr.lang = settingScr.getPrinterLang(); SettingScr settingScr2 = SettingScr.this; settingScr2.undoFlag = false; settingScr2.mHandler.sendEmptyMessage(0); } } } public void onNotifyError(int i, int i2, boolean z) throws RemoteException { if (!mFinishRequested) { EPLog.i("IEpsonServiceCallback", "onNotifyError errorCode = " + i2); SettingScr settingScr = SettingScr.this; settingScr.isInfoAvai = true; int unused = settingScr.lang = settingScr.getPrinterLang(); SettingScr settingScr2 = SettingScr.this; settingScr2.undoFlag = false; settingScr2.mHandler.sendEmptyMessage(0); } } }; private Context mContext = null; private ServiceConnection mEpsonConnection = new ServiceConnection() { public void onServiceDisconnected(ComponentName componentName) { EPLog.v("SettingScr", "onServiceDisconnected"); try { mEpsonService.unregisterCallback (mCallback); } catch (RemoteException e) { e.printStackTrace(); } IEpsonService unused = mEpsonService = null; } public void onServiceConnected(ComponentName componentName, IBinder iBinder) { IEpsonService unused = mEpsonService = IEpsonService.Stub.asInterface(iBinder); EPLog.v("SettingScr", "onServiceConnected"); if (mEpsonService != null) { try { mEpsonService.registerCallback (mCallback); } catch (RemoteException e) { e.printStackTrace(); } } } }; private IEpsonService mEpsonService = null; private volatile boolean mFinishRequested; Handler mHandler = new Handler(new Handler.Callback() { public boolean handleMessage(android.os.Message r15) { throw new UnsupportedOperationException("Method not decompiled: epson.print.screen.SettingScr.C23643.handleMessage(android.os.Message):boolean"); } }); private MediaInfo.AbstractInfo mLookupTable; private MediaInfo.AbstractInfo mPaperSizeType; private boolean mPrinterSelectDone; private int mSharpnessValue; private TextView mSharpnessValueText; 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 int photoApfValueForLocalPrinter; 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$1208(SettingScr settingScr) { int i = settingScr.sizeIndex; settingScr.sizeIndex = i + 1; return i; } static /* synthetic */ int access$1708(SettingScr settingScr) { int i = settingScr.typeIndex; settingScr.typeIndex = i + 1; return i; } protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView((int) R.layout.setting_layout); setActionBar((int) R.string.str_btn_printer_settings, true); bindEpsonService(); mContext = this; isDocumentSetting = getIntent().getBooleanExtra(PrintProgress.PARAM_DOCUMENT_MODE, false); if (isDocumentSetting) { sheets = getIntent().getIntExtra("SHEETS", 1); disablePrintArea = getIntent().getBooleanExtra("PRINTAREA", false); } 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(copiesMinus); LongTapRepeatAdapter.bless(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); apfStateText = (TextView) findViewById(R.id.apf_setting_text); mSharpnessValueText = (TextView) findViewById(R.id.sharpness_setting_text); 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 (printerId != null) { undoFlag = false; if (loadSupportedMediaFile()) { mHandler.sendEmptyMessage(1); } else { mHandler.sendEmptyMessage(17); } } else { mHandler.sendEmptyMessage(1); } } private void updatePrinterIcon() { if (printerName.getText().equals(getString(R.string.str_lbl_title_scan))) { ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(8); return; } ((ImageView) findViewById(R.id.imageViewPrinterLocation)).setVisibility(0); switch (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 (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); findViewById(R.id.apf_setting_layout).setOnClickListener(this); findViewById(R.id.sharpness_setting_layout).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 (printerLocation == 0) { printerLocation = 1; } autoConnectSsid = WiFiDirectManager.getConnectInfo(this, WiFiDirectManager.DEVICE_TYPE_PRINTER); PrintSetting printSetting = new PrintSetting(this, isDocumentSetting ? PrintSetting.Kind.document : PrintSetting.Kind.photo); printSetting.loadSettings(); mLookupTable = new MediaInfo.PaperSize(); paperSize = printSetting.paperSizeValue; paperSizeInfo.setText(getString(mLookupTable.getStringId(paperSize))); mLookupTable.destructor(); mLookupTable = new MediaInfo.PaperType(); paperType = printSetting.paperTypeValue; paperTypeInfo.setText(getString(mLookupTable.getStringId(paperType))); mLookupTable.destructor(); mPaperSizeType = printSetting.loadPaperSizeTypePear(); mPaperSizeType.putID(paperSize, paperType); mLookupTable = new LayoutEx(); int i = printSetting.layoutMultiPageValue; if (i != 0) { layout = i; } else { layout = printSetting.layoutValue; } layoutInfo.setText(getString(mLookupTable.getStringId(layout))); mLookupTable.destructor(); mLookupTable = new MediaInfo.Quality(); quality = printSetting.qualityValue; qualityInfo.setText(getString(mLookupTable.getStringId(quality))); mLookupTable.destructor(); mLookupTable = new MediaInfo.PaperSource(); paperSource = printSetting.paperSourceValue; paperSourceInfo.setText(getString(mLookupTable.getStringId(paperSource))); mLookupTable.destructor(); mLookupTable = new MediaInfo.Color(); color = printSetting.colorValue; colorInfo.setText(getString(mLookupTable.getStringId(color))); mLookupTable.destructor(); copiesValue = printSetting.copiesValue; copies.setText(String.valueOf(copiesValue)); copiesMinus.setEnabled(copiesValue != 1); Button button = copiesPlus; if (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(duplex))); mLookupTable.destructor(); mLookupTable = new MediaInfo.FeedDirection(); feedDirection = printSetting.feedDirectionValue; feedDirectionInfo.setText(getString(mLookupTable.getStringId(feedDirection))); mLookupTable.destructor(); lang = curPrinter.getLang(); if (isDocumentSetting) { printAll = printSetting.printAll; startValue = printSetting.startValue; endValue = printSetting.endValue; ((TextView) findViewById(R.id.page_range_value)).setText(startValue + ".." + endValue); return; } mLookupTable = new MediaInfo.PrintDate(); printdate = printSetting.printdate; printDateInfo.setText(getString(mLookupTable.getStringId(printdate))); mLookupTable.destructor(); photoApfValueForLocalPrinter = printSetting.photoApfValueForLocalPrinter; displayApfState(photoApfValueForLocalPrinter); mSharpnessValue = printSetting.sharpnessForPhoto; displaySharpnessState(mSharpnessValue); } private void displayApfState(int i) { MediaInfo.ApfState apfState = new MediaInfo.ApfState(); apfStateText.setText(apfState.getStringId(i)); apfState.destructor(); } private void displaySharpnessState(int i) { MediaInfo.SharpnessState sharpnessState = new MediaInfo.SharpnessState(); mSharpnessValueText.setText(sharpnessState.getStringId(i)); sharpnessState.destructor(); } private boolean loadSupportedMediaFile() { ExternalFileUtils instance = ExternalFileUtils.getInstance(this); File savedSupportedMedia = instance.getSavedSupportedMedia(); File supportedMedia = instance.getSupportedMedia(); File preSupportedMedia = instance.getPreSupportedMedia(); EPLog.i("PrintSetting", "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("PrintSetting", "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("PrintSetting", "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("PrintSetting", "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(printerDeviceId, printerIp, printerId, printerSerialNo, printerEmailAddress, printerLocation); myPrinter.setLang(lang); myPrinter.setCurPrinter(this); PrintSetting printSetting = new PrintSetting(this, isDocumentSetting ? PrintSetting.Kind.document : PrintSetting.Kind.photo); printSetting.paperSizeValue = paperSize; printSetting.paperTypeValue = paperType; int i = layout; if ((-65536 & i) != 0) { printSetting.layoutValue = 2; printSetting.layoutMultiPageValue = i; } else { printSetting.layoutValue = i; printSetting.layoutMultiPageValue = 0; } 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 (isDocumentSetting) { printSetting.printAll = printAll; printSetting.startValue = startValue; printSetting.endValue = endValue; } else { printSetting.printdate = printdate; printSetting.photoApfValueForLocalPrinter = photoApfValueForLocalPrinter; printSetting.sharpnessForPhoto = mSharpnessValue; } 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(); refreshRemoteServiceRemotePrinter(); if (mPrinterSelectDone) { new InkRplnRepository(false).savePermanently(this); } } private void refreshRemoteServiceRemotePrinter() { IEpsonService iEpsonService = mEpsonService; if (iEpsonService != null) { try { iEpsonService.refreshRemotePrinterLogin(); } catch (RemoteException unused) { } } } protected void onDestroy() { super.onDestroy(); unbindEpsonService(); EPLog.i("SettingScr", "onDestroy"); mPaperSizeType.destructor(); } private void bindEpsonService() { EPLog.v("SettingScr", "bindEpsonService"); if (mEpsonService == null) { bindService(new Intent(this, EpsonService.class), mEpsonConnection, 1); } } private void unbindEpsonService() { EPLog.v("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 (progressGetOption.getVisibility() == 8) { IEpsonService iEpsonService = mEpsonService; if (iEpsonService != null) { try { iEpsonService.cancelSearchPrinter(); } catch (RemoteException e) { e.printStackTrace(); } } switch (view.getId()) { case R.id.apf_setting_layout /*2131230819*/: launchDetailScreen(photoApfValueForLocalPrinter, R.id.apf_setting_layout); return; case R.id.brightness_minus_button /*2131230848*/: brightnessValue--; if (brightnessValue <= -50) { brightnessValue = -50; brightnessMinus.setEnabled(false); } else { brightnessMinus.setEnabled(true); } brightnessPlus.setEnabled(true); brightness.setText(String.valueOf(brightnessValue)); return; case R.id.brightness_plus_button /*2131230850*/: brightnessValue++; if (brightnessValue >= 50) { brightnessValue = 50; brightnessPlus.setEnabled(false); } else { brightnessPlus.setEnabled(true); } brightnessMinus.setEnabled(true); brightness.setText(String.valueOf(brightnessValue)); return; case R.id.color /*2131230930*/: launchDetailScreen(color, R.id.color); return; case R.id.contrast_minus_button /*2131230942*/: contrastValue--; if (contrastValue <= -50) { contrastValue = -50; contrastMinus.setEnabled(false); } else { contrastMinus.setEnabled(true); } contrastPlus.setEnabled(true); contrast.setText(String.valueOf(contrastValue)); return; case R.id.contrast_plus_button /*2131230943*/: contrastValue++; if (contrastValue >= 50) { contrastValue = 50; contrastPlus.setEnabled(false); } else { contrastPlus.setEnabled(true); } contrastMinus.setEnabled(true); contrast.setText(String.valueOf(contrastValue)); return; case R.id.copies_minus_button /*2131230945*/: copiesValue--; if (copiesValue <= 1) { copiesValue = 1; copiesMinus.setEnabled(false); } else { copiesMinus.setEnabled(true); } copiesPlus.setEnabled(true); copies.setText(String.valueOf(copiesValue)); return; case R.id.copies_plus_button /*2131230946*/: copiesValue++; if (copiesValue >= 30) { copiesValue = 30; copiesPlus.setEnabled(false); } else { copiesPlus.setEnabled(true); } copiesMinus.setEnabled(true); copies.setText(String.valueOf(copiesValue)); return; case R.id.duplex /*2131231005*/: launchDetailScreen(duplex, R.id.duplex); return; case R.id.feed_direction /*2131231037*/: launchDetailScreen(feedDirection, R.id.feed_direction); return; case R.id.layout /*2131231158*/: launchDetailScreen(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(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(paperType, R.id.paper_type); return; case R.id.printdate /*2131231355*/: launchDetailScreen(printdate, R.id.printdate); return; case R.id.printer /*2131231358*/: unbindEpsonService(); new AsyncTask() { protected void onPreExecute() { findViewById(R.id.printer).setClickable(false); } protected Void doInBackground(Void... voidArr) { SettingScr settingScr = SettingScr.this; WiFiDirectManager.disconnect(settingScr, WiFiDirectManager.DEVICE_TYPE_PRINTER, settingScr.printerIp); SettingScr settingScr2 = SettingScr.this; WiFiDirectManager.disconnectSimpleAP(settingScr2, settingScr2.autoConnectSsid, printerIp); return null; } protected void onPostExecute(Void voidR) { Intent intent = new Intent(SettingScr.this, SearchPrinterScr.class); Bundle bundle = new Bundle(); bundle.putString(Constants.PRINTER_ID, printerId); bundle.putString(Constants.PRINTER_IP, printerIp); bundle.putString(Constants.PRINTER_EMAIL_ADDRESS, printerEmailAddress); bundle.putInt(Constants.PRINTER_LOCATION, printerLocation); bundle.putString(SettingScr.EXTRA_SIMPLEAP, autoConnectSsid); intent.putExtras(bundle); startActivityForResult(intent, 0); findViewById(R.id.printer).setClickable(true); } }.execute(new Void[0]); return; case R.id.quality /*2131231392*/: launchDetailScreen(quality, R.id.quality); return; case R.id.saturation_minus_button /*2131231425*/: saturationValue--; if (saturationValue <= -50) { saturationValue = -50; saturationMinus.setEnabled(false); } else { saturationMinus.setEnabled(true); } saturationPlus.setEnabled(true); saturation.setText(String.valueOf(saturationValue)); return; case R.id.saturation_plus_button /*2131231426*/: saturationValue++; if (saturationValue >= 50) { saturationValue = 50; saturationPlus.setEnabled(false); } else { saturationPlus.setEnabled(true); } saturationMinus.setEnabled(true); saturation.setText(String.valueOf(saturationValue)); return; case R.id.sharpness_setting_layout /*2131231482*/: launchDetailScreen(mSharpnessValue, R.id.sharpness_setting_layout); 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) { int i3 = 1; if (i == 1 && i2 == -1) { int i4 = intent.getExtras().getInt("curValue"); switch (intent.getExtras().getInt("ID")) { case R.id.apf_setting_layout /*2131230819*/: if (i4 != 1) { i3 = 0; } photoApfValueForLocalPrinter = i3; displayApfState(photoApfValueForLocalPrinter); break; case R.id.color /*2131230930*/: mLookupTable = new MediaInfo.Color(); colorInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); color = i4; break; case R.id.duplex /*2131231005*/: mLookupTable = new MediaInfo.Duplex(); duplexInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); duplex = i4; break; case R.id.feed_direction /*2131231037*/: mLookupTable = new MediaInfo.FeedDirection(); feedDirectionInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); feedDirection = i4; break; case R.id.layout /*2131231158*/: mLookupTable = new LayoutEx(); layoutInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); layout = i4; 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(i4))); mLookupTable.destructor(); paperSize = i4; paperType = mPaperSizeType.getID(paperSize); undoFlag = false; mHandler.sendEmptyMessage(2); break; case R.id.paper_source /*2131231311*/: mLookupTable = new MediaInfo.PaperSource(); paperSourceInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); int[] iArr = paper_source_info; if (iArr != null && iArr.length > 1) { paperSource = i4; } 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(i4))); mLookupTable.destructor(); paperType = i4; mPaperSizeType.putID(paperSize, paperType); undoFlag = false; mHandler.sendEmptyMessage(3); break; case R.id.printdate /*2131231355*/: mLookupTable = new MediaInfo.PrintDate(); printDateInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); printdate = i4; break; case R.id.quality /*2131231392*/: mLookupTable = new MediaInfo.Quality(); qualityInfo.setText(getString(mLookupTable.getStringId(i4))); mLookupTable.destructor(); quality = i4; break; case R.id.sharpness_setting_layout /*2131231482*/: if (i4 != 1) { i3 = 0; } mSharpnessValue = i3; displaySharpnessState(mSharpnessValue); 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.(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.(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.(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: epson.print.screen.SettingScr.onPrinterSelectEnd(int, android.content.Intent):void"); } private void endInkReplAndGoProbePrinter() { mWaiteInkReplenProgress = false; bindEpsonService(); mHandler.sendEmptyMessageDelayed(17, 100); } private void updateSettingView() { int i = 8; if (isDocumentSetting) { if (printerLocation != 2) { setVisibilityPageRange(true); setClickablePageRange(true); } else if (!enableShowPreview) { setVisibilityPageRange(false); } else if (disablePrintArea) { setVisibilityPageRange(true); setClickablePageRange(false); } else { setVisibilityPageRange(true); setClickablePageRange(true); } if (sheets == 1) { ((ImageView) findViewById(R.id.page_range_next_screen_imv)).setVisibility(8); } else { ((ImageView) findViewById(R.id.page_range_next_screen_imv)).setVisibility(0); } } else { setVisibilityPageRange(false); } int[] iArr = color_info; if (iArr == null) { ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(8); } else if (iArr.length <= 1) { ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(8); } else { ((ImageView) findViewById(R.id.color_next_screen_imv)).setVisibility(0); } int[] iArr2 = duplex_info; if (iArr2 == null) { findViewById(R.id.duplex_view).setVisibility(8); ((LinearLayout) findViewById(R.id.duplex)).setVisibility(8); } else if (iArr2.length <= 1) { findViewById(R.id.duplex_view).setVisibility(8); ((LinearLayout) findViewById(R.id.duplex)).setVisibility(8); } else { findViewById(R.id.duplex_view).setVisibility(0); ((LinearLayout) findViewById(R.id.duplex)).setVisibility(0); } switch (lang) { case 2: case 3: findViewById(R.id.feed_direction_view).setVisibility(0); findViewById(R.id.feed_direction).setVisibility(0); break; default: findViewById(R.id.feed_direction_view).setVisibility(8); findViewById(R.id.feed_direction).setVisibility(8); break; } if (isDocumentSetting || printerLocation == 2) { findViewById(R.id.printdate).setVisibility(8); } else { findViewById(R.id.printdate).setVisibility(0); } if (printerLocation != 2 && !this.isDocumentSetting) { i = 0; } findViewById(R.id.viewGroupPhotoEffect).setVisibility(i); findViewById(R.id.apf_setting_layout).setVisibility(i); findViewById(R.id.sharpness_setting_layout).setVisibility(i); } private int getPrinterLang() { int i; IEpsonService iEpsonService; if (!(printerLocation == 2 || (iEpsonService = mEpsonService) == null)) { try { i = iEpsonService.getLang(); } catch (RemoteException e) { e.printStackTrace(); } EPLog.d("PrintSetting", "getPrinterLang called : ret = " + i); return i; } i = 1; EPLog.d("PrintSetting", "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(8); updateSettingView(); setScreenState(true); } public void onBackPressed() { super.onBackPressed(); mFinishRequested = true; 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(8); } else { progressGetOption.setVisibility(0); } 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.f343ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialogInterface, int i) { setScreenState(true); dialogInterface.cancel(); } }).create().show(); updateSupportedMediaFile(true); } protected void onResume() { super.onResume(); EPLog.e("SettingScr", "onResume()"); if (printerId != null && printerLocation == 1 && isRetryAfterConnectSimpleAp && !this.mWaiteInkReplenProgress) { undoFlag = false; if (loadSupportedMediaFile()) { mHandler.sendEmptyMessage(1); } else { mHandler.sendEmptyMessage(17); } } } protected void onPause() { EPLog.d("SettingScr", "onPause"); super.onPause(); if (isFinishing()) { mFinishRequested = true; deleteLongTapMessage(); } WiFiDirectManager.disconnect(this, WiFiDirectManager.DEVICE_TYPE_PRINTER, printerIp); WiFiDirectManager.disconnectSimpleAP(this, autoConnectSsid, printerIp); } public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.C2138menu.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(); } }