123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- package epson.maintain.activity;
- import android.os.AsyncTask;
- import android.os.Bundle;
- import android.webkit.WebView;
- import android.webkit.WebViewClient;
- import androidx.fragment.app.FragmentActivity;
- import androidx.lifecycle.Observer;
- import epson.common.DialogProgress;
- import epson.common.DialogProgressViewModel;
- import epson.print.ActivityIACommon;
- import epson.print.R;
- import epson.print.Util.EPLog;
- import epson.print.ecclient.EccErrorInfo;
- import java.lang.ref.WeakReference;
- import java.util.Deque;
- import java.util.Locale;
- import org.opencv.core.Core;
- public class EccPrintLog extends ActivityIACommon implements DialogProgress.DialogButtonClick {
- private static final String DIALOG_ERROR = "dialog_error";
- private static final String DIALOG_PROGRESS = "dialog_progress";
- static final String LOG_TAG = "EccPrintLog";
- static RemotePrintHistoryTask mRemotePrintHistoryTask;
- private EccPrintLogViewModel mEccPrintLogViewModel;
- private DialogProgressViewModel mModelDialog;
- private WebView mWebView;
- public void onCancelDialog(String str) {
- }
- public void onNegativeClick(String str) {
- }
- public void onNeutralClick(String str) {
- }
- protected void onCreate(Bundle bundle) {
- EPLog.m313i(LOG_TAG, "onCreate() start");
- super.onCreate(bundle);
- setContentView(R.layout.epsonconnect_print_log);
- mModelDialog = (DialogProgressViewModel) ViewModelProviders.of((FragmentActivity) this).get(DialogProgressViewModel.class);
- mModelDialog.getDialogJob().observe(this, new Observer() {
- public final void onChanged(Object obj) {
- EccPrintLog.lambda$onCreate$0(EccPrintLog.this, (Deque) obj);
- }
- });
- mEccPrintLogViewModel = (EccPrintLogViewModel) ViewModelProviders.m2of((FragmentActivity) this).get(EccPrintLogViewModel.class);
- setActionBar(R.string.epsonconnect_str_print_history, true);
- mWebView = (WebView) findViewById(R.id.prtlog_webview);
- mWebView.setVerticalScrollbarOverlay(true);
- mWebView.getSettings().setJavaScriptEnabled(true);
- mWebView.setWebViewClient(new WebViewClient() {
- public void onReceivedError(WebView webView, int i, String str, String str2) {
- int i2;
- if (i != -15) {
- switch (i) {
- case Core.StsAutoTrace /*-8*/:
- case -7:
- case -6:
- break;
- default:
- i2 = -1200;
- break;
- }
- }
- i2 = -1100;
- EccPrintLog.this.show_message_and_finish(i2);
- }
- });
- startRemotePrintHistoryTask();
- }
- public static /* synthetic */ void lambda$onCreate$0(EccPrintLog eccPrintLog, Deque deque) {
- String[] checkQueue = eccPrintLog.mModelDialog.checkQueue();
- if (checkQueue != null) {
- String str = checkQueue[0];
- String str2 = checkQueue[1];
- if (str2.equals("do_show")) {
- eccPrintLog.showDialog(str);
- }
- if (str2.equals("do_dismiss")) {
- eccPrintLog.dismissDialog(str);
- }
- }
- }
- private synchronized void startRemotePrintHistoryTask() {
- if (mRemotePrintHistoryTask == null) {
- EPLog.m313i(LOG_TAG, "RemotePrintHistoryTask creating.");
- LogUrl logUrl = new LogUrl();
- logUrl.setContextDependValue(this);
- mRemotePrintHistoryTask = new RemotePrintHistoryTask(this);
- mRemotePrintHistoryTask.execute(new LogUrl[]{logUrl});
- } else {
- EPLog.m313i(LOG_TAG, "RemotePrintHistoryTask exists. not create");
- mRemotePrintHistoryTask.setActivity(this);
- }
- showProgressDialog();
- }
- private String[] getErrorTitleAndMessage(int i) {
- String str;
- String str2;
- String[] strArr = new String[2];
- getString(R.string.ECC_ERR_SVR_GENERAL_TITLE);
- if (i != -1100) {
- if (i != 10) {
- switch (i) {
- case EccErrorInfo.ECC_ERR_SVR_HTTP_NOT_FOUND /*-1209*/:
- case EccErrorInfo.ECC_ERR_SVR_BUSY /*-1208*/:
- str = getString(R.string.ECC_ERR_SVR_BUSY_TITLE);
- str2 = getString(R.string.ECC_ERR_SVR_BUSY);
- break;
- default:
- switch (i) {
- case -1203:
- str = getString(R.string.ECC_ERR_SVR_INVALID_ACCESSKEY_TITLE);
- str2 = getString(R.string.ECC_ERR_SVR_INVALID_ACCESSKEY);
- break;
- case -1202:
- str = getString(R.string.ECC_ERR_SVR_REMOTE_INVALID_TITLE);
- str2 = getString(R.string.ECC_ERR_SVR_REMOTE_INVALID);
- break;
- case -1201:
- str = getString(R.string.ECC_ERR_SVR_NOT_REGISTERED_TITLE);
- str2 = getString(R.string.ECC_ERR_SVR_NOT_REGISTERED);
- break;
- }
- }
- } else {
- getString(R.string.ECC_ERR_SVR_GENERAL_TITLE);
- }
- String string = getString(R.string.ECC_ERR_SVR_GENERAL_TITLE);
- str2 = getString(R.string.ECC_ERR_SVR_GENERAL2) + "0X" + Integer.toHexString(i).toUpperCase(Locale.US) + getString(R.string.ECC_ERR_SVR_GENERAL3);
- str = string;
- } else {
- str = getString(R.string.EC_ERR_COMM_ERROR_TITLE);
- str2 = getString(R.string.EC_ERR_COMM_ERROR);
- }
- strArr[0] = str;
- strArr[1] = str2;
- return strArr;
- }
- private void show_message_and_finish(int i) {
- mEccPrintLogViewModel.setTitleAndMessage(getErrorTitleAndMessage(i));
- mModelDialog.doShow(DIALOG_ERROR);
- }
- protected void onDestroy() {
- dissmissProgressDialog();
- super.onDestroy();
- }
- private void dissmissProgressDialog() {
- mModelDialog.doDismiss(DIALOG_PROGRESS);
- }
- private void showProgressDialog() {
- mModelDialog.doShow(DIALOG_PROGRESS);
- }
- /* JADX WARNING: Can't fix incorrect switch cases order */
- /* JADX WARNING: Removed duplicated region for block: B:12:0x002a */
- /* JADX WARNING: Removed duplicated region for block: B:15:0x0046 */
- /* JADX WARNING: Removed duplicated region for block: B:16:0x0052 A[FALL_THROUGH] */
- /* JADX WARNING: Removed duplicated region for block: B:18:0x0055 */
- /* JADX WARNING: Removed duplicated region for block: B:20:? A[RETURN, SYNTHETIC] */
- /* Code decompiled incorrectly, please refer to instructions dump. */
- private void showDialog(java.lang.String r12) {
- /*
- r11 = this;
- int r0 = r12.hashCode()
- r1 = -21731516(0xfffffffffeb46744, float:-1.1989861E38)
- r2 = 1
- r3 = 0
- if (r0 == r1) goto L_0x001b
- r1 = 722082897(0x2b0a1c51, float:4.9066746E-13)
- if (r0 == r1) goto L_0x0011
- goto L_0x0025
- L_0x0011:
- java.lang.String r0 = "dialog_error"
- boolean r0 = r12.equals(r0)
- if (r0 == 0) goto L_0x0025
- r0 = 1
- goto L_0x0026
- L_0x001b:
- java.lang.String r0 = "dialog_progress"
- boolean r0 = r12.equals(r0)
- if (r0 == 0) goto L_0x0025
- r0 = 0
- goto L_0x0026
- L_0x0025:
- r0 = -1
- L_0x0026:
- switch(r0) {
- case 0: goto L_0x0046;
- case 1: goto L_0x002a;
- default: goto L_0x0029;
- }
- L_0x0029:
- goto L_0x0052
- L_0x002a:
- epson.maintain.activity.EccPrintLogViewModel r0 = r11.mEccPrintLogViewModel
- java.lang.String[] r0 = r0.getTitleAndMessage()
- if (r0 == 0) goto L_0x0052
- r5 = 2
- r6 = r0[r2]
- r7 = r0[r3]
- r0 = 2131624958(0x7f0e03fe, float:1.887711E38)
- java.lang.String r8 = r11.getString(r0)
- r9 = 0
- r10 = 0
- r4 = r12
- epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r4, r5, r6, r7, r8, r9, r10)
- goto L_0x0053
- L_0x0046:
- r0 = 2131625243(0x7f0e051b, float:1.8877688E38)
- java.lang.String r0 = r11.getString(r0)
- epson.common.DialogProgress r0 = epson.common.DialogProgress.newInstance(r12, r3, r0)
- goto L_0x0053
- L_0x0052:
- r0 = 0
- L_0x0053:
- if (r0 == 0) goto L_0x005f
- r0.setCancelable(r3)
- android.support.v4.app.FragmentManager r1 = r11.getSupportFragmentManager()
- r0.show(r1, r12)
- L_0x005f:
- return
- */
- throw new UnsupportedOperationException("Method not decompiled: epson.maintain.activity.EccPrintLog.showDialog(java.lang.String):void");
- }
- private void dismissDialog(String str) {
- DialogFragment dialogFragment = (DialogFragment) getSupportFragmentManager().findFragmentByTag(str);
- if (dialogFragment != null) {
- dialogFragment.dismiss();
- }
- }
- public synchronized void setUrl(String str, int i) {
- mRemotePrintHistoryTask = null;
- EPLog.m313i(LOG_TAG, "setUrl");
- dissmissProgressDialog();
- if (str == null || i != 0) {
- show_message_and_finish(i);
- }
- if (mWebView != null) {
- mWebView.loadUrl(str);
- }
- }
- public void onPositiveClick(String str) {
- if (((str.hashCode() == 722082897 && str.equals(DIALOG_ERROR)) ? (char) 0 : 65535) == 0) {
- finish();
- }
- }
- static class RemotePrintHistoryTask extends AsyncTask<LogUrl, Void, Void> {
- WeakReference<EccPrintLog> mEccPrintLog;
- int mErrorCode;
- private String mLogUrl;
- public RemotePrintHistoryTask(EccPrintLog eccPrintLog) {
- mEccPrintLog = new WeakReference<>(eccPrintLog);
- }
- public void setActivity(EccPrintLog eccPrintLog) {
- mEccPrintLog = new WeakReference<>(eccPrintLog);
- }
- protected Void doInBackground(LogUrl... logUrlArr) {
- try {
- mLogUrl = logUrlArr[0].getUrl();
- mErrorCode = 0;
- return null;
- } catch (EccPrintLogException e) {
- mErrorCode = e.getErrorCode();
- return null;
- }
- }
- protected void onPostExecute(Void voidR) {
- EccPrintLog eccPrintLog;
- EPLog.m313i(EccPrintLog.LOG_TAG, "onPostExecute() begin");
- WeakReference<EccPrintLog> weakReference = mEccPrintLog;
- if (weakReference != null && (eccPrintLog = (EccPrintLog) weakReference.get()) != null) {
- eccPrintLog.setUrl(mLogUrl, mErrorCode);
- EPLog.m313i(EccPrintLog.LOG_TAG, "onPostExecute() end");
- }
- }
- }
- }
|