123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- package epson.maintain.activity;
- import android.os.AsyncTask;
- import android.os.Bundle;
- import android.webkit.WebView;
- import android.webkit.WebViewClient;
- import androidx.fragment.app.DialogFragment;
- import androidx.fragment.app.FragmentActivity;
- import androidx.lifecycle.Observer;
- import androidx.lifecycle.ViewModelProviders;
- 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.i(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.i(LOG_TAG, "RemotePrintHistoryTask creating.");
- LogUrl logUrl = new LogUrl();
- logUrl.setContextDependValue(this);
- mRemotePrintHistoryTask = new RemotePrintHistoryTask(this);
- mRemotePrintHistoryTask.execute(new LogUrl[]{logUrl});
- } else {
- EPLog.i(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);
- }
- private void showDialog(java.lang.String r12) {
- 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.i(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.i(EccPrintLog.LOG_TAG, "onPostExecute() begin");
- WeakReference<EccPrintLog> weakReference = mEccPrintLog;
- if (weakReference != null && (eccPrintLog = (EccPrintLog) weakReference.get()) != null) {
- eccPrintLog.setUrl(mLogUrl, mErrorCode);
- EPLog.i(EccPrintLog.LOG_TAG, "onPostExecute() end");
- }
- }
- }
- }
|