思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c

以下内容为反编译后的 MyWebView.java 源代码,内容仅作参考


package com.sitech.oncon.widget.webview;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.sitech.core.util.Log;
import com.sitech.core.util.MyChromeClient;
import com.sitech.core.util.MyChromeClientExt;
import com.sitech.core.util.js.DownloadBlobFileJSInterface;
import com.sitech.oncon.R;
import com.sitech.oncon.activity.BaseActivity;
import com.sitech.oncon.activity.FragmentBaseActivity;
import com.sitech.oncon.app.sip.util.NetworkChangeReceiver;
import com.sitech.oncon.application.MyApplication;
import com.sitech.oncon.widget.CustomWebTitleView;
import com.sitech.oncon.widget.TitleView;
import com.sitech.oncon.widget.WebViewUI;
import com.tencent.smtt.export.external.interfaces.WebResourceRequest;
import com.tencent.smtt.export.external.interfaces.WebResourceResponse;
import com.tencent.smtt.sdk.ValueCallback;
import com.tencent.smtt.sdk.WebBackForwardList;
import com.tencent.smtt.sdk.WebHistoryItem;
import com.tencent.smtt.sdk.WebView;
import defpackage.bk0;
import defpackage.dw0;
import java.io.File;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import org.json.JSONException;
import org.json.JSONObject;
public class MyWebView extends LinearLayout implements NetworkChangeReceiver.a {
    public static final int w = 1001;
    public static final int x = 1002;
    public static int y;
    public static final Object z = new Object();
    public WebViewUI a;
    public ProgressBar b;
    public View c;
    public RelativeLayout d;
    public TextView e;
    public RelativeLayout f;
    public MyChromeClient g;
    public CustomWebTitleView h;
    public TitleView i;
    public View j;
    public SwipeRefreshLayout k;
    public np1 l;
    public boolean m;
    public ln1 n;
    public boolean o;
    public mb1 p;
    public ob1 q;
    public dw0 r;
    public boolean s;
    public boolean t;
    public Bitmap u;
    @SuppressLint({"HandlerLeak"})
    public Handler v;

    public class a implements Runnable {
        public final String a;

        public a(String str) {
            this.a = str;
        }

        @Override
        public void run() {
            Bitmap b = MyWebView.this.b(this.a);
            if (b != null) {
                Context context = MyWebView.this.getContext();
                dl0.a(context, b, "WebImage_" + ik0.f() + qk0.a);
                return;
            }
            MyWebView.b(MyWebView.this.getContext(), "保存失败");
        }
    }

    public class b extends Handler {
        public b() {
        }

        @Override
        public void handleMessage(Message message) {
            try {
                if (message.what != 3016) {
                    return;
                }
                if (MyWebView.this.n.e()) {
                    MyWebView.this.d.setVisibility(0);
                    if (message.arg1 != 0 && MyWebView.this.e != null) {
                        TextView textView = MyWebView.this.e;
                        textView.setText(MyWebView.this.getResources().getString(R.string.webview_network_error) + "\n" + message.arg1);
                    }
                    MyWebView.this.j();
                } else if (bk0.j0) {
                    if (MyWebView.this.f != null) {
                        MyWebView.this.f.setVisibility(0);
                    }
                    MyWebView.this.j();
                }
            } catch (Throwable th) {
                Log.a(bk0.V5, th.getMessage(), th);
            }
        }
    }

    public class c implements View.OnScrollChangeListener {
        public c() {
        }

        @Override
        public void onScrollChange(View view, int i, int i2, int i3, int i4) {
            SwipeRefreshLayout swipeRefreshLayout;
            if (i2 == 0) {
                MyWebView myWebView = MyWebView.this;
                if (!myWebView.o || (swipeRefreshLayout = myWebView.k) == null) {
                    return;
                }
                swipeRefreshLayout.setEnabled(true);
                return;
            }
            SwipeRefreshLayout swipeRefreshLayout2 = MyWebView.this.k;
            if (swipeRefreshLayout2 != null) {
                swipeRefreshLayout2.setEnabled(false);
            }
        }
    }

    public class d implements SwipeRefreshLayout.OnRefreshListener {
        public d() {
        }

        @Override
        public void onRefresh() {
            MyWebView.this.a.reload();
        }
    }

    public class e implements SwipeRefreshLayout.OnChildScrollUpCallback {
        public e() {
        }

        @Override
        public boolean canChildScrollUp(@NonNull SwipeRefreshLayout swipeRefreshLayout, @Nullable View view) {
            return MyWebView.this.a.getScrollY() > 0;
        }
    }

    public class f implements DialogInterface.OnClickListener {
        public f() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
            MyWebView.this.a(true);
        }
    }

    public class g implements DialogInterface.OnClickListener {
        public g() {
        }

        @Override
        public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
        }
    }

    public class h implements dw0.b {
        public h() {
        }

        @Override
        public void a(String str) {
            JSONObject jSONObject = new JSONObject();
            try {
                jSONObject.put("content", str);
            } catch (JSONException e) {
                Log.a((Throwable) e);
            }
            if (MyWebView.this.getContext() instanceof BaseActivity) {
                ((BaseActivity) MyWebView.this.getContext()).toastToMessage(jSONObject.toString());
            } else if (MyWebView.this.getContext() instanceof FragmentBaseActivity) {
                ((FragmentBaseActivity) MyWebView.this.getContext()).toastToMessage(jSONObject.toString());
            }
            WebViewUI webViewUI = MyWebView.this.a;
            webViewUI.loadUrl("javascript:getBarcodeByScanner(" + jSONObject.toString() + ");");
        }
    }

    public class i implements Runnable {
        public final BaseActivity a;
        public final String b;

        public i(BaseActivity baseActivity, String str) {
            this.a = baseActivity;
            this.b = str;
        }

        @Override
        public void run() {
            this.a.toastToMessage(this.b);
        }
    }

    public class j implements View.OnClickListener {
        public j() {
        }

        @Override
        public void onClick(View view) {
            MyWebView.this.getContext().startActivity(new Intent("android.settings.WIFI_SETTINGS"));
        }
    }

    public class k implements View.OnClickListener {
        public k() {
        }

        @Override
        public void onClick(View view) {
            MyWebView.this.a.reload();
            if (MyWebView.this.f != null) {
                MyWebView.this.f.setVisibility(8);
            }
            MyWebView.this.d.setVisibility(8);
            MyWebView.this.s();
        }
    }

    public class l implements MyChromeClient.d {
        public l() {
        }

        @Override
        public void a(boolean z) {
            if (z) {
                WindowManager.LayoutParams attributes = ((Activity) MyWebView.this.getContext()).getWindow().getAttributes();
                attributes.flags |= 1024;
                attributes.flags |= 128;
                ((Activity) MyWebView.this.getContext()).getWindow().setAttributes(attributes);
                if (Build.VERSION.SDK_INT >= 14) {
                    ((Activity) MyWebView.this.getContext()).getWindow().getDecorView().setSystemUiVisibility(1);
                    return;
                }
                return;
            }
            WindowManager.LayoutParams attributes2 = ((Activity) MyWebView.this.getContext()).getWindow().getAttributes();
            attributes2.flags &= -1025;
            attributes2.flags &= -129;
            ((Activity) MyWebView.this.getContext()).getWindow().setAttributes(attributes2);
            if (Build.VERSION.SDK_INT >= 14) {
                ((Activity) MyWebView.this.getContext()).getWindow().getDecorView().setSystemUiVisibility(0);
            }
        }
    }

    public class n implements WebViewUI.j {
        public n() {
        }

        @Override
        public void a(WebView webView, String str, Bitmap bitmap) {
        }
    }

    public class o implements WebViewUI.h {
        public o() {
        }

        @Override
        public void a(WebView webView, String str) {
            if (webView.canGoBack()) {
                CustomWebTitleView customWebTitleView = MyWebView.this.h;
                if (customWebTitleView != null) {
                    customWebTitleView.setLeftViewOfLeftLL(R.drawable.ic_back);
                    MyWebView.this.h.setLeftViewTVOfLeftLLImg(R.drawable.ic_web_home);
                    return;
                }
                return;
            }
            CustomWebTitleView customWebTitleView2 = MyWebView.this.h;
            if (customWebTitleView2 != null) {
                customWebTitleView2.setLeftViewImgOfLeftLLVisible(false);
                MyWebView.this.h.setLeftViewTVOfLeftLLVisible(false);
            }
        }
    }

    public class p implements WebViewUI.i {
        public p() {
        }

        @Override
        public void a() {
            MyWebView.this.p();
        }
    }

    public class q implements DownloadBlobFileJSInterface.DownloadBlobSuccessListener {
        public q() {
        }

        @Override
        public void downloadBlobSuccess(String str) {
            try {
                new s(str).start();
            } catch (Throwable th) {
                Log.a(th);
            }
        }
    }

    public class r implements View.OnLongClickListener {

        public class a implements DialogInterface.OnClickListener {
            public final WebView.HitTestResult a;

            public a(WebView.HitTestResult hitTestResult) {
                this.a = hitTestResult;
            }

            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
                String extra = this.a.getExtra();
                if (i == 0 && !TextUtils.isEmpty(extra)) {
                    if (extra.startsWith("blob:")) {
                        MyWebView.this.a.loadUrl(DownloadBlobFileJSInterface.getBase64StringFromBlobUrl(extra, "image/png"));
                        return;
                    }
                    new s(extra).start();
                }
            }
        }

        public r() {
        }

        @Override
        public boolean onLongClick(View view) {
            WebView.HitTestResult hitTestResult = MyWebView.this.a.getHitTestResult();
            if (hitTestResult.getType() == 5 || hitTestResult.getType() == 8) {
                new AlertDialog.Builder(MyApplication.h().b.b()).setItems(new String[]{"保存图片到本地"}, new a(hitTestResult)).show();
                return true;
            }
            return false;
        }
    }

    public class s extends Thread {
        public String a;

        public s(String str) {
            this.a = str;
        }

        @Override
        @RequiresApi(api = 24)
        public void run() {
            MyWebView.this.a(this.a);
        }
    }

    public MyWebView(Context context) {
        super(context);
        this.m = false;
        this.o = false;
        this.s = bk0.w3;
        this.t = bk0.k0;
        this.u = null;
        this.v = new b();
        u();
    }

    private dw0 getBarcodeScanner() {
        if (this.r == null) {
            synchronized (z) {
                if (this.r == null) {
                    this.r = new dw0(new h());
                }
            }
        }
        return this.r;
    }

    private np1 getExitAppDialog() {
        if (this.l == null) {
            synchronized (z) {
                if (this.l == null) {
                    this.l = new np1(getContext());
                    if (bk0.a()) {
                        this.l.a(0);
                        this.l.b(R.string.dialog_message);
                    } else {
                        this.l.a(8);
                        this.l.b(R.string.confirm_to_quit);
                    }
                    this.l.b(R.string.confirm, new f());
                    this.l.a(R.string.cancel, new g());
                }
            }
        }
        return this.l;
    }

    private void u() {
        try {
            new WebView(getContext());
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        k();
        this.b = (ProgressBar) this.j.findViewById(R.id.pbar);
        this.c = this.j.findViewById(R.id.loading_image);
        this.n = new ln1(getContext());
        NetworkChangeReceiver.e.add(this);
        this.d = (RelativeLayout) this.j.findViewById(R.id.network_Empty_Layout);
        this.e = (TextView) this.j.findViewById(R.id.flag_Network_Empty_1);
        this.f = (RelativeLayout) this.j.findViewById(R.id.network_Error_Layout);
        View findViewById = this.j.findViewById(R.id.open_Network_Setting);
        View findViewById2 = this.j.findViewById(R.id.refresh_Weex_Page);
        if (findViewById != null) {
            findViewById.setOnClickListener(new j());
        }
        if (findViewById2 != null) {
            findViewById2.setOnClickListener(new k());
        }
        this.k = (SwipeRefreshLayout) this.j.findViewById(R.id.wv_pull_refresh_scrollview);
        this.a = (WebViewUI) this.j.findViewById(R.id.webviewui);
        WebViewUI webViewUI = this.a;
        webViewUI.B0 = this.t;
        webViewUI.setMyWebView(this);
        v();
        this.g = new MyChromeClient(getContext(), this.a, this.b, this.c);
        this.g.showWebLoading = this.s;
        View findViewById3 = findViewById(R.id.nonVideoLayout);
        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.widget_mywebview_loading_video, (ViewGroup) null);
        this.g.setNonVideoView(findViewById3);
        this.g.setVideoView((ViewGroup) findViewById(R.id.videoLayout));
        this.g.setLoadingView(inflate);
        this.g.setOnToggledFullscreen(new l());
        this.a.setWebChromeClient(this.g);
        this.a.setWebChromeClientExtension(new MyChromeClientExt(getContext()));
        this.a.f0 = new m();
        this.a.h0 = new n();
        this.a.g0 = new o();
        this.a.i0 = new p();
        if (bk0.B2) {
            this.a.m0.setDownloadBlobSuccessListener(new q());
            this.a.setOnLongClickListener(new r());
        }
    }

    private void v() {
        if (Build.VERSION.SDK_INT >= 23) {
            this.a.setOnScrollChangeListener(new c());
        }
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setOnRefreshListener(new d());
            this.k.setOnChildScrollUpCallback(new e());
        }
    }

    public Bitmap b(String str) {
        if (str.contains("http")) {
            d(str);
        } else {
            c(str);
        }
        return this.u;
    }

    public void c(String str) {
        byte[] a2 = vj0.a(str.split(",")[1]);
        this.u = BitmapFactory.decodeByteArray(a2, 0, a2.length);
    }

    public void d(String str) {
        try {
            HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(str).openConnection();
            httpURLConnection.setDoInput(true);
            httpURLConnection.connect();
            InputStream inputStream = httpURLConnection.getInputStream();
            this.u = BitmapFactory.decodeStream(inputStream);
            inputStream.close();
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void e() {
        try {
            if (bk0.A1) {
                if (bk0.D3 == bk0.f.FINISH_WITH_NOTHING) {
                    a(true);
                } else if (bk0.D3 == bk0.f.FINISH_WITH_DIALOG) {
                    if (this.a.canGoBack()) {
                        a(true);
                    } else if (!getExitAppDialog().isShowing()) {
                        getExitAppDialog().show();
                    }
                } else if (bk0.D3 == bk0.f.FINISH_WITH_TOAST) {
                    if (this.a.canGoBack()) {
                        a(true);
                    } else {
                        int i2 = ((SystemClock.currentThreadTimeMillis() - 0) > 3000L ? 1 : ((SystemClock.currentThreadTimeMillis() - 0) == 3000L ? 0 : -1));
                        if (i2 > 0) {
                            Toast.makeText((Activity) getContext(), R.string.click_again_quit, 1).show();
                        } else if (i2 <= 0) {
                            a(true);
                        }
                    }
                }
            } else {
                a(false);
            }
            this.d.setVisibility(8);
            if (this.f != null) {
                this.f.setVisibility(8);
            }
            s();
        } catch (Throwable th) {
            Log.a(th);
        }
    }

    public void f() {
        if (this.p.c.size() > 2) {
            return;
        }
        if (this.p.c.size() == 2) {
            this.p.c.get(0).a();
        } else {
            this.p.c.size();
        }
    }

    public boolean g() {
        return !TextUtils.isEmpty(this.a.getJsapi().getHelpUrl());
    }

    public String getCurrUrl() {
        return this.a.o0;
    }

    public boolean h() {
        return !TextUtils.isEmpty(this.a.getJsapi().getHomePage());
    }

    public boolean i() {
        return this.p != null;
    }

    public void j() {
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setVisibility(8);
        }
    }

    public void k() {
        this.j = LayoutInflater.from(getContext()).inflate(R.layout.widget_mywebview, this);
    }

    public void l() {
        WebViewUI webViewUI = this.a;
        ve1.a(webViewUI, webViewUI.getJsapi().getHelpUrl());
    }

    public void m() {
        WebViewUI webViewUI = this.a;
        ve1.a(webViewUI, webViewUI.getJsapi().getHomePage());
    }

    public void n() {
        if (!bk0.m1) {
            try {
                getContext().deleteDatabase("webview.db");
                getContext().deleteDatabase("webviewCache.db");
            } catch (Throwable th) {
                th.printStackTrace();
            }
            try {
                this.a.clearCache(true);
            } catch (Throwable th2) {
                th2.printStackTrace();
            }
        }
        try {
            removeAllViews();
            this.a.clearHistory();
            this.a.loadUrl("about:blank");
        } catch (Throwable th3) {
            th3.printStackTrace();
        }
        if (bk0.X1) {
            Log.d("----");
            rm0.a(MyApplication.h());
            bk0.yb = "";
            rm0.b(MyApplication.h());
        }
        NetworkChangeReceiver.e.remove(this);
    }

    @RequiresApi(api = 11)
    public void o() {
        this.a.onPause();
    }

    @Override
    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (keyEvent.getAction() != 0) {
            return super.onKeyDown(i2, keyEvent);
        }
        if (i2 != 3 && i2 != 4 && i2 != 82) {
            switch (i2) {
                case 24:
                case 25:
                case 26:
                    break;
                default:
                    getBarcodeScanner().a(keyEvent);
                    return true;
            }
        }
        return super.onKeyDown(i2, keyEvent);
    }

    @Override
    public void onNetChange(int i2) {
        if (this.n.e()) {
            this.d.setVisibility(8);
            RelativeLayout relativeLayout = this.f;
            if (relativeLayout != null) {
                relativeLayout.setVisibility(8);
            }
            s();
            WebViewUI webViewUI = this.a;
            if (webViewUI.s0) {
                webViewUI.reload();
                return;
            }
            return;
        }
        this.v.sendEmptyMessage(i51.w);
    }

    public void p() {
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setRefreshing(false);
        }
    }

    @RequiresApi(api = 11)
    public void q() {
        this.a.onResume();
    }

    public void r() {
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setRefreshing(true);
        }
    }

    public void s() {
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setVisibility(0);
        }
    }

    public void setActivity(Activity activity) {
    }

    public void setAppid(String str) {
        this.a.getJsapi().mAppId = str;
    }

    public void setTitleV(TitleView titleView) {
        this.i = titleView;
        this.g.titleV = titleView;
        this.a.getJsapi().setmTitleView(titleView);
    }

    public void setWebRightMenuData(mb1 mb1Var) {
        this.p = mb1Var;
    }

    public void setmCustomWebTitleV(CustomWebTitleView customWebTitleView) {
        this.h = customWebTitleView;
        this.g.mCustomWebTitleView = customWebTitleView;
        this.a.getJsapi().setmCustomWebTitleView(customWebTitleView);
        WebViewUI webViewUI = this.a;
        webViewUI.u0 = this.m;
        webViewUI.getJsapi().rightAlwaysShown = this.m;
    }

    public void t() {
        if (Build.VERSION.SDK_INT < 19) {
            this.a.loadUrl("javascript:yxAndroidBackBtnClick()");
        } else {
            this.a.evaluateJavascript("javascript:yxAndroidBackBtnClick()", null);
        }
    }

    public class m implements WebViewUI.k {
        public m() {
        }

        @Override
        public void a(WebView webView, int i, String str, String str2) {
            webView.stopLoading();
            MyWebView.this.v.obtainMessage(i51.w, i, 0, str).sendToTarget();
            MyWebView.this.p();
        }

        @Override
        public void a(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
            webView.stopLoading();
            MyWebView.this.v.obtainMessage(i51.w, webResourceResponse.getStatusCode(), 0, webResourceResponse.getReasonPhrase()).sendToTarget();
            MyWebView.this.p();
        }
    }

    @RequiresApi(api = 24)
    public void a(String str) {
        try {
            new Thread(new a(str)).start();
        } catch (Exception e2) {
            b(getContext(), "保存失败");
            e2.printStackTrace();
        }
    }

    public void c() {
        this.o = false;
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setEnabled(false);
        }
    }

    @TargetApi(21)
    private void b(int i2, int i3, Intent intent) {
        Uri[] uriArr;
        Uri[] uriArr2;
        if (i2 != 1001 || this.g.mUploadMessageAboveL == null) {
            return;
        }
        if (i3 != -1) {
            uriArr = null;
        } else if (intent == null) {
            uriArr = new Uri[]{kk0.a(getContext(), new File(this.g.mCameraFilePath))};
        } else {
            String dataString = intent.getDataString();
            ClipData clipData = intent.getClipData();
            if (clipData != null) {
                uriArr2 = new Uri[clipData.getItemCount()];
                for (int i4 = 0; i4 < clipData.getItemCount(); i4++) {
                    uriArr2[i4] = clipData.getItemAt(i4).getUri();
                }
            } else {
                uriArr2 = null;
            }
            uriArr = dataString != null ? new Uri[]{Uri.parse(dataString)} : uriArr2;
        }
        this.g.mUploadMessageAboveL.onReceiveValue(uriArr);
        this.g.mUploadMessageAboveL = null;
    }

    public void a(int i2, int i3, Intent intent) {
        if (i2 == 1001) {
            if (Build.VERSION.SDK_INT < 21) {
                if (this.g.mUploadMessage == null) {
                    return;
                }
                Uri data = (intent == null || i3 != -1) ? null : intent.getData();
                if (data == null && intent == null && i3 == -1) {
                    File file = new File(this.g.mCameraFilePath);
                    if (file.exists()) {
                        data = kk0.a(getContext(), file);
                        getContext().sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", data));
                    }
                }
                this.g.mUploadMessage.onReceiveValue(data);
                this.g.mUploadMessage = null;
                return;
            }
            b(i2, i3, intent);
        } else if (i2 == 1002) {
            MyChromeClient myChromeClient = this.g;
            if (myChromeClient.mUploadMessage == null && myChromeClient.mUploadMessageAboveL == null) {
                return;
            }
            Uri data2 = (intent == null || i3 != -1) ? null : intent.getData();
            if (Build.VERSION.SDK_INT < 21) {
                ValueCallback<Uri> valueCallback = this.g.mUploadMessage;
                if (valueCallback != null) {
                    if (i3 == -1) {
                        valueCallback.onReceiveValue(data2);
                        this.g.mUploadMessage = null;
                        return;
                    }
                    valueCallback.onReceiveValue(Uri.EMPTY);
                    this.g.mUploadMessage = null;
                    return;
                }
                return;
            }
            ValueCallback<Uri[]> valueCallback2 = this.g.mUploadMessageAboveL;
            if (valueCallback2 != null) {
                if (i3 == -1) {
                    valueCallback2.onReceiveValue(new Uri[]{data2});
                    this.g.mUploadMessageAboveL = null;
                    return;
                }
                valueCallback2.onReceiveValue(new Uri[0]);
                this.g.mUploadMessageAboveL = null;
            }
        }
    }

    public MyWebView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.m = false;
        this.o = false;
        this.s = bk0.w3;
        this.t = bk0.k0;
        this.u = null;
        this.v = new b();
        u();
    }

    public void d() {
        this.o = true;
        SwipeRefreshLayout swipeRefreshLayout = this.k;
        if (swipeRefreshLayout != null) {
            swipeRefreshLayout.setEnabled(true);
        }
    }

    public void b() {
        this.a.k();
    }

    @TargetApi(11)
    public MyWebView(Context context, AttributeSet attributeSet, int i2) {
        super(context, attributeSet, i2);
        this.m = false;
        this.o = false;
        this.s = bk0.w3;
        this.t = bk0.k0;
        this.u = null;
        this.v = new b();
        u();
    }

    public void b(View view) {
        if (this.q == null) {
            this.q = new ob1(getContext());
        }
        this.q.a(this.p);
        this.q.a(view);
    }

    public static void b(Context context, String str) {
        if (context instanceof BaseActivity) {
            BaseActivity baseActivity = (BaseActivity) context;
            baseActivity.runOnUiThread(new i(baseActivity, str));
        }
    }

    @TargetApi(21)
    public MyWebView(Context context, AttributeSet attributeSet, int i2, int i3) {
        super(context, attributeSet, i2, i3);
        this.m = false;
        this.o = false;
        this.s = bk0.w3;
        this.t = bk0.k0;
        this.u = null;
        this.v = new b();
        u();
    }

    public boolean a() {
        return this.a.canGoBack();
    }

    public void a(boolean z2) {
        int i2;
        try {
            if (!this.a.canGoBack()) {
                if (z2) {
                    ((Activity) getContext()).finish();
                }
            } else if (bk0.Fc) {
                this.a.goBack();
            } else {
                WebBackForwardList copyBackForwardList = this.a.copyBackForwardList();
                int currentIndex = copyBackForwardList.getCurrentIndex();
                Log.d("cidx:" + currentIndex);
                if (currentIndex >= 2) {
                    i2 = currentIndex - 1;
                    if (copyBackForwardList.getCurrentItem().getUrl().equals(copyBackForwardList.getItemAtIndex(i2).getUrl())) {
                        System.out.println("wbfl.getCurrentItem().getUrl()" + copyBackForwardList.getCurrentItem().getUrl());
                        System.out.println("wbfl.getItemAtIndex(cidx - 1).getUrl())" + copyBackForwardList.getItemAtIndex(i2).getUrl());
                        int a2 = ve1.a(currentIndex, copyBackForwardList);
                        if (a2 == currentIndex) {
                            if (z2) {
                                ((Activity) getContext()).finish();
                            }
                            i2 = 0;
                        } else {
                            int i3 = -(a2 + 1);
                            Log.d("nidx:" + i3);
                            this.a.goBackOrForward(i3);
                            i2 = currentIndex - a2;
                        }
                    } else {
                        this.a.goBack();
                    }
                } else {
                    this.a.goBack();
                    i2 = currentIndex - 1;
                }
                if (i2 >= 0) {
                    WebHistoryItem itemAtIndex = copyBackForwardList.getItemAtIndex(i2);
                    if (this.h != null) {
                        this.h.g.setVisibility(0);
                        this.h.g.setText(km0.r(itemAtIndex.getTitle()));
                    }
                    if (this.i != null) {
                        this.i.setTitle(km0.r(itemAtIndex.getTitle()));
                    }
                }
            }
        } catch (Throwable th) {
            try {
                Log.a("MyWebView", th.getMessage(), th);
            } catch (Throwable th2) {
                th2.printStackTrace();
            }
            if (z2) {
                ((Activity) getContext()).finish();
            }
        }
    }

    public void a(View view) {
        if (this.p.c.size() > 2) {
            b(view);
        } else if (this.p.c.size() == 2) {
            this.p.c.get(1).a();
        } else if (this.p.c.size() == 1) {
            this.p.c.get(0).a();
        }
    }
}