导航菜单

页面标题

页面副标题

Fancy Optimizer v4.6.3 - WebBrowserActivity.java 源代码

正在查看: Fancy Optimizer v4.6.3 应用的 WebBrowserActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.fancyclean.boost.securebrowser.ui.activity;

import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Patterns;
import android.util.Property;
import android.view.ContextMenu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.webkit.DownloadListener;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.PopupMenu;
import androidx.core.app.JobIntentService;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import c.m;
import com.adtiny.core.d;
import com.airbnb.lottie.LottieAnimationView;
import com.applovin.exoplayer2.ui.n;
import com.fancyclean.boost.securebrowser.service.ClearWebBrowserHistoriesService;
import com.fancyclean.boost.securebrowser.ui.activity.WebBrowserActivity;
import com.fancyclean.boost.securebrowser.ui.presenter.WebBrowserPresenter;
import com.fancyclean.boost.securebrowser.ui.view.BrowserBottomBar;
import com.fancyclean.boost.securebrowser.ui.view.BrowserLocationBar;
import com.fancyclean.boost.securebrowser.ui.view.ExitInhaleAnimView;
import com.thinkyeah.common.ui.dialog.c;
import com.thinkyeah.common.ui.view.ThWebView;
import com.thinkyeah.common.ui.view.ThinkRecyclerView;
import eg.x0;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List;
import nb.l;
import ob.c;
import ok.a;

@gl.d(WebBrowserPresenter.class)
public class WebBrowserActivity extends l<pb.c> implements pb.d, PopupMenu.OnMenuItemClickListener {
    public static final vj.h N = new vj.h("WebBrowserActivity");
    public static final String[] O = {"android.permission.WRITE_EXTERNAL_STORAGE"};
    public ValueCallback<Uri[]> C;
    public long D;
    public String E;
    public Handler H;
    public ok.a I;
    public kl.h J;
    public View l;
    public WebView m;
    public LinearLayout n;
    public TextView o;
    public RelativeLayout p;
    public BrowserLocationBar q;
    public BrowserBottomBar r;
    public ob.c s;
    public PopupMenu t;
    public RelativeLayout u;
    public ExitInhaleAnimView v;
    public kb.b w;

    public g f215x;

    public d.d f216y;

    public String f217z;
    public String A = null;
    public boolean B = false;
    public final HashMap F = new HashMap();
    public boolean G = false;
    public final a K = new a();
    public final b L = new b();
    public final c M = new c();

    public class a implements c.a {
        public a() {
        }
    }

    public class b implements BrowserLocationBar.a {
        public b() {
        }

        public final void a(int i) {
            WebBrowserActivity webBrowserActivity = WebBrowserActivity.this;
            if (i == 0) {
                vj.h hVar = WebBrowserActivity.N;
                webBrowserActivity.m.loadUrl("about:blank");
                tk.b.a().b("click_browser_home", (HashMap) null);
            } else if (i == 1) {
                webBrowserActivity.m.reload();
                webBrowserActivity.f3();
            } else {
                if (i != 2) {
                    return;
                }
                webBrowserActivity.m.stopLoading();
            }
        }
    }

    public class c implements BrowserBottomBar.a {
        public c() {
        }

        public final void a(int i) {
            FragmentActivity fragmentActivity = WebBrowserActivity.this;
            if (i == 1) {
                vj.h hVar = WebBrowserActivity.N;
                if (fragmentActivity.B) {
                    fragmentActivity.b3();
                }
                fragmentActivity.m.goBack();
                return;
            }
            if (i == 2) {
                if (fragmentActivity.B) {
                    fragmentActivity.b3();
                }
                fragmentActivity.m.goForward();
                return;
            }
            mb.a aVar = null;
            if (i != 3) {
                if (i == 4) {
                    if (fragmentActivity.B) {
                        fragmentActivity.Y2();
                        return;
                    } else {
                        new e().j0(fragmentActivity, "ExitWebBrowserConfirmDialogFragment");
                        return;
                    }
                }
                if (i != 5) {
                    return;
                }
                if (fragmentActivity.m != null && !fragmentActivity.isDestroyed()) {
                    aVar = fragmentActivity.Z2(fragmentActivity.m.getUrl());
                }
                if (aVar == null) {
                    ((pb.c) fragmentActivity.W2()).i(fragmentActivity.m.getTitle(), fragmentActivity.m.getUrl(), fragmentActivity.m.getFavicon());
                    fragmentActivity.C0();
                    return;
                }
                long j = aVar.c;
                d dVar = new d();
                Bundle bundle = new Bundle();
                bundle.putLong("bookmark_id", j);
                dVar.setArguments(bundle);
                dVar.j0(fragmentActivity, "DeleteCurrentBookmarkConfirmDialogFragment");
                return;
            }
            if (x0.k(fragmentActivity)) {
                SharedPreferences sharedPreferences = fragmentActivity.getSharedPreferences("secure_browser", 0);
                SharedPreferences.Editor edit = sharedPreferences == null ? null : sharedPreferences.edit();
                if (edit != null) {
                    edit.putBoolean("is_dark_mode_enabled", false);
                    edit.apply();
                }
                fragmentActivity.m.loadUrl(fragmentActivity.f217z);
                Toast.makeText((Context) fragmentActivity, 2131887972, 0).show();
                tk.b.a().b("disable_browser_dark_mode", (HashMap) null);
            } else {
                SharedPreferences sharedPreferences2 = fragmentActivity.getSharedPreferences("secure_browser", 0);
                SharedPreferences.Editor edit2 = sharedPreferences2 == null ? null : sharedPreferences2.edit();
                if (edit2 != null) {
                    edit2.putBoolean("is_dark_mode_enabled", true);
                    edit2.apply();
                }
                fragmentActivity.m.post(new n(this, 18));
                Toast.makeText((Context) fragmentActivity, 2131887973, 0).show();
                tk.b.a().b("enable_browser_dark_mode", (HashMap) null);
            }
            fragmentActivity.getWindow().setStatusBarColor(kb.h.b(fragmentActivity));
            fragmentActivity.g3();
            fragmentActivity.f3();
            fragmentActivity.s.notifyDataSetChanged();
            fragmentActivity.r.c();
            fragmentActivity.r.b();
            fragmentActivity.q.b();
        }
    }

    public static class d extends com.thinkyeah.common.ui.dialog.c<WebBrowserActivity> {
        public static final int c = 0;

        @NonNull
        public final Dialog onCreateDialog(Bundle bundle) {
            final long j = getArguments().getLong("bookmark_id");
            c.a aVar = new c.a(getActivity());
            aVar.c(2131886485);
            aVar.e(2131886483, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    int i10 = WebBrowserActivity.d.c;
                    WebBrowserActivity activity = WebBrowserActivity.d.this.getActivity();
                    if (activity != null) {
                        vj.h hVar = WebBrowserActivity.N;
                        ((pb.c) activity.W2()).B(j);
                    }
                }
            });
            aVar.d(2131886274, (DialogInterface.OnClickListener) null);
            return aVar.a();
        }
    }

    public static class e extends com.thinkyeah.common.ui.dialog.c<WebBrowserActivity> {
        public static final int c = 0;

        @NonNull
        public final Dialog onCreateDialog(Bundle bundle) {
            c.a aVar = new c.a(getActivity());
            aVar.g(2131886455);
            aVar.c(2131886792);
            aVar.e(2131886790, new com.facebook.login.g(this, 8));
            aVar.d(2131886274, (DialogInterface.OnClickListener) null);
            return aVar.a();
        }
    }

    public static class f extends FrameLayout {
        public f(WebBrowserActivity webBrowserActivity) {
            super(webBrowserActivity);
            setBackgroundColor(ContextCompat.getColor(webBrowserActivity, 2131099724));
        }

        @Override
        @SuppressLint({"ClickableViewAccessibility"})
        public final boolean onTouchEvent(@NonNull MotionEvent motionEvent) {
            return true;
        }
    }

    public static class h {
        public final String a;
        public final long b;

        public h(String str, long j) {
            this.a = str;
            this.b = j;
        }

        @NonNull
        public final String toString() {
            return this.a;
        }
    }

    public static class i extends com.thinkyeah.common.ui.dialog.c<WebBrowserActivity> {
        public static final int c = 0;

        public static i t0(String str, String str2, String str3) {
            i iVar = new i();
            Bundle bundle = new Bundle();
            bundle.putString("URL", str);
            bundle.putString("REFERRER_URL", str2);
            bundle.putString("MIME_TYPE", str3);
            iVar.setArguments(bundle);
            return iVar;
        }

        @NonNull
        public final Dialog onCreateDialog(Bundle bundle) {
            final String string = getArguments().getString("URL");
            final String string2 = getArguments().getString("MIME_TYPE");
            c.a aVar = new c.a(getActivity());
            aVar.g(2131887429);
            aVar.c(2131887574);
            aVar.e(2131887429, new DialogInterface.OnClickListener() {
                @Override
                public final void onClick(DialogInterface dialogInterface, int i) {
                    int i10 = WebBrowserActivity.i.c;
                    final il.b bVar = (WebBrowserActivity) WebBrowserActivity.i.this.getActivity();
                    if (bVar == null) {
                        return;
                    }
                    ok.a aVar2 = bVar.I;
                    String[] strArr = WebBrowserActivity.O;
                    boolean a = aVar2.a(strArr);
                    final String str = string;
                    final String str2 = string2;
                    if (!a) {
                        bVar.I.d(strArr, new a.b() {
                            public final void g(boolean z10) {
                                vj.h hVar = WebBrowserActivity.N;
                                il.e eVar = WebBrowserActivity.this;
                                if (!z10) {
                                    eVar.getClass();
                                } else {
                                    Toast.makeText(eVar.getApplicationContext(), 2131886749, 0).show();
                                    ((pb.c) eVar.W2()).A(str, str2);
                                }
                            }
                        });
                    } else {
                        Toast.makeText(bVar.getApplicationContext(), 2131886749, 0).show();
                        ((pb.c) bVar.W2()).A(str, str2);
                    }
                }
            });
            aVar.d(2131886274, (DialogInterface.OnClickListener) null);
            return aVar.a();
        }
    }

    public static class j extends com.thinkyeah.common.ui.dialog.c<WebBrowserActivity> {
        public static final int c = 0;

        @NonNull
        public final Dialog onCreateDialog(@Nullable Bundle bundle) {
            c.a aVar = new c.a(getContext());
            aVar.g(2131886512);
            aVar.c(2131886495);
            aVar.e(2131886464, new t4.g(this, 10));
            aVar.d(2131886274, new t4.c(this, 6));
            return aVar.a();
        }
    }

    public static void X2(WebBrowserActivity webBrowserActivity) {
        ?? r02 = webBrowserActivity.m;
        StringBuilder sb2 = new StringBuilder("javascript:(function() {var parent = document.getElementsByTagName('head').item(0);var style = document.createElement('style');style.type = 'text/css';style.innerHTML = window.atob('");
        ?? openRawResource = webBrowserActivity.getResources().openRawResource(2131820556);
        byte[] bArr = new byte[0];
        try {
            try {
                bArr = new byte[openRawResource.available()];
                openRawResource.read(bArr);
            } catch (IOException e10) {
                N.d((String) null, e10);
            }
            j4.b.s(openRawResource);
            sb2.append(Base64.encodeToString(bArr, 2));
            sb2.append("');parent.appendChild(style)})();");
            openRawResource = sb2.toString();
            r02.loadUrl(openRawResource);
        } catch (Throwable th) {
            j4.b.s(openRawResource);
            throw th;
        }
    }

    public static boolean c3(String str) {
        if (str == null) {
            return false;
        }
        if (!str.contains("://")) {
            str = "http://".concat(str);
        }
        return Patterns.WEB_URL.matcher(str).matches();
    }

    @Override
    public final void C0() {
        String url = this.m.getUrl();
        BrowserBottomBar browserBottomBar = this.r;
        boolean z10 = Z2(url) != null;
        browserBottomBar.getClass();
        BrowserBottomBar.l.c("==> showAddedBookmark, added: " + z10);
        if (browserBottomBar.j) {
            browserBottomBar.i.setColorFilter(browserBottomBar.a(false));
        } else if (z10) {
            browserBottomBar.i.clearColorFilter();
            browserBottomBar.i.setImageResource(2131231335);
        } else {
            browserBottomBar.i.setImageResource(2131231339);
            browserBottomBar.i.setColorFilter(browserBottomBar.a(true));
        }
    }

    public final void Y2() {
        if (this.G) {
            return;
        }
        this.G = true;
        this.m.clearHistory();
        Intent intent = new Intent((Context) this, (Class<?>) ClearWebBrowserHistoriesService.class);
        intent.putExtra("clear_all", true);
        vj.h hVar = ClearWebBrowserHistoriesService.c;
        JobIntentService.enqueueWork(this, ClearWebBrowserHistoriesService.class, 1009, intent);
        View rootView = getWindow().getDecorView().getRootView();
        rootView.setDrawingCacheEnabled(true);
        Bitmap createBitmap = Bitmap.createBitmap(rootView.getDrawingCache());
        rootView.setDrawingCacheEnabled(false);
        TextView textView = (TextView) findViewById(2131363582);
        TextView textView2 = (TextView) findViewById(2131363552);
        ImageView imageView = (ImageView) findViewById(2131362524);
        LottieAnimationView findViewById = findViewById(2131362622);
        findViewById.g.e.addListener(new nb.g(this));
        this.v.setExitInhaleAnimListener(new m(this, findViewById, textView2, textView, 3));
        this.v.setBitmap(createBitmap);
        imageView.setVisibility(0);
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(imageView, (Property<ImageView, Float>) View.TRANSLATION_Y, imageView.getHeight(), imageView.getHeight() / 2.0f);
        ofFloat.setDuration(200L);
        ofFloat.setInterpolator(new LinearInterpolator());
        ofFloat.addListener(new nb.h(this, imageView));
        ofFloat.start();
    }

    public final mb.a Z2(String str) {
        h hVar;
        if (str == null) {
            return null;
        }
        mb.a c10 = this.w.b.c(str);
        HashMap hashMap = this.F;
        if (c10 == null && hashMap.containsKey(str) && (hVar = (h) hashMap.get(str)) != null) {
            c10 = this.w.b.c(hVar.a);
        }
        StringBuilder n = android.support.v4.media.c.n("GetBookmarkInfo of url: ", str, ", isNull: ");
        n.append(c10 == null);
        String sb2 = n.toString();
        vj.h hVar2 = N;
        hVar2.c(sb2);
        hVar2.c("Redirect Url Map: " + hashMap);
        return c10;
    }

    public final void a3(Intent intent) {
        String stringExtra;
        if (intent == null) {
            this.m.loadUrl("about:blank");
            return;
        }
        Uri data = intent.getData();
        if (data != null) {
            stringExtra = data.toString();
        } else {
            stringExtra = intent.getStringExtra("url");
            if (TextUtils.isEmpty(stringExtra)) {
                this.m.loadUrl("about:blank");
                return;
            }
        }
        if (stringExtra != null) {
            stringExtra = stringExtra.trim();
        }
        if (!TextUtils.isEmpty(stringExtra)) {
            this.f217z = stringExtra;
        }
        this.m.loadUrl("about:blank");
        d3();
        this.D = System.currentTimeMillis();
    }

    public final void applyOverrideConfiguration(Configuration configuration) {
        if (Build.VERSION.SDK_INT <= 25) {
            return;
        }
        super/*wj.c*/.applyOverrideConfiguration(configuration);
    }

    public final void b3() {
        this.B = false;
        this.q.setVisibility(0);
        this.q.setInHomePageMode(false);
        this.r.setInHomePageMode(false);
        this.l.setVisibility(8);
        this.m.setVisibility(0);
        BrowserLocationBar browserLocationBar = this.q;
        browserLocationBar.getClass();
        BrowserLocationBar.p.c("==> showFavIcon");
        if (browserLocationBar.o) {
            return;
        }
        browserLocationBar.f.setImageResource(2131231596);
    }

    public final void d3() {
        b3();
        String str = this.f217z;
        if (!c3(str)) {
            try {
                String str2 = !y7.a.a(this).equalsIgnoreCase("CN") ? "http://www.google.com/search?q=" : "http://www.baidu.com/s?wd=";
                StringBuilder sb2 = new StringBuilder();
                sb2.append(str2);
                sb2.append(str != null ? URLEncoder.encode(str, "UTF-8") : "");
                str = sb2.toString();
            } catch (UnsupportedEncodingException unused) {
                str = null;
            }
        } else if (!str.contains("://")) {
            str = "https://".concat(str);
        }
        if (str != null) {
            if (str.equals(this.m.getUrl())) {
                this.m.reload();
            } else {
                this.q.setTitle(str);
                this.m.loadUrl(str);
            }
        }
    }

    public final void e3() {
        this.r.setBackwardButtonEnabled(this.m.canGoBack());
        this.r.setForwardButtonEnabled(this.m.canGoForward());
    }

    public final void f3() {
        BrowserBottomBar browserBottomBar = this.r;
        browserBottomBar.h.setColorFilter(browserBottomBar.a(true));
        e3();
        C0();
    }

    public final void g3() {
        Resources resources;
        int i10;
        this.l.setBackgroundColor(kb.h.b(this));
        RelativeLayout relativeLayout = this.p;
        SharedPreferences sharedPreferences = getSharedPreferences("secure_browser", 0);
        relativeLayout.setBackgroundResource(sharedPreferences == null ? false : sharedPreferences.getBoolean("is_dark_mode_enabled", false) ? 2131231045 : 2131231046);
        TextView textView = this.o;
        SharedPreferences sharedPreferences2 = getSharedPreferences("secure_browser", 0);
        if (sharedPreferences2 != null ? sharedPreferences2.getBoolean("is_dark_mode_enabled", false) : false) {
            resources = getResources();
            i10 = 2131099743;
        } else {
            resources = getResources();
            i10 = 2131099747;
        }
        textView.setTextColor(resources.getColor(i10));
    }

    public final void h3() {
        this.B = true;
        this.q.setVisibility(8);
        this.q.setInHomePageMode(true);
        this.r.setInHomePageMode(true);
        this.l.setVisibility(0);
        this.m.setVisibility(8);
        ((pb.c) W2()).X0();
    }

    @Override
    public final void m0(List<mb.c> list) {
        ob.c cVar = this.s;
        cVar.j = list;
        cVar.notifyDataSetChanged();
        SharedPreferences sharedPreferences = getSharedPreferences("secure_browser", 0);
        if ((sharedPreferences != null ? sharedPreferences.getBoolean("has_shown_bookmark_tip", false) : false) && this.f216y == null) {
            this.H.post(new nb.a(this, 1));
        }
    }

    public final void onActivityResult(int i10, int i11, Intent intent) {
        Uri data;
        ValueCallback<Uri[]> valueCallback;
        if (i10 == 3) {
            if (i11 != -1 || (data = intent.getData()) == null || (valueCallback = this.C) == null) {
                return;
            }
            valueCallback.onReceiveValue(new Uri[]{data});
            this.C = null;
            return;
        }
        if (i10 != 4 && i10 != 5) {
            super/*androidx.fragment.app.FragmentActivity*/.onActivityResult(i10, i11, intent);
            return;
        }
        if (i11 != -1) {
            h3();
            return;
        }
        String stringExtra = intent.getStringExtra("url");
        if (TextUtils.isEmpty(stringExtra)) {
            h3();
        } else {
            this.f217z = stringExtra.trim();
            d3();
        }
    }

    public final void onBackPressed() {
        kl.h hVar = this.J;
        if (hVar != null) {
            hVar.b(this);
            this.J = null;
            return;
        }
        g gVar = this.f215x;
        if (gVar != null) {
            if (gVar.f != null) {
                gVar.onHideCustomView();
                return;
            }
        }
        if (this.m.canGoBack()) {
            N.c("can go back");
            if (this.B) {
                b3();
            }
            this.m.goBack();
            return;
        }
        if (this.B) {
            Y2();
        } else {
            this.m.loadUrl("about:blank");
        }
    }

    @Override
    public final void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (isFinishing()) {
            return;
        }
        getWindow().addFlags(8192);
        setContentView(2131558535);
        this.H = new Handler(Looper.getMainLooper());
        this.w = kb.b.c(this);
        View findViewById = findViewById(2131363792);
        this.l = findViewById;
        this.o = (TextView) findViewById.findViewById(2131363694);
        this.n = (LinearLayout) this.l.findViewById(2131362595);
        this.p = (RelativeLayout) findViewById(2131362991);
        ThinkRecyclerView findViewById2 = findViewById(2131363016);
        int i10 = 0;
        findViewById2.setNestedScrollingEnabled(false);
        findViewById2.setHasFixedSize(false);
        g3();
        ob.c cVar = new ob.c(this);
        this.s = cVar;
        cVar.k = this.K;
        findViewById2.setLayoutManager(new GridLayoutManager(this, getResources().getInteger(2131427349)));
        findViewById2.setAdapter(this.s);
        this.p.setOnClickListener(new t4.d(this, 25));
        ImageView imageView = (ImageView) findViewById(2131362476);
        imageView.setOnClickListener(new ib.b(this, 1));
        PopupMenu popupMenu = new PopupMenu(this, imageView);
        this.t = popupMenu;
        popupMenu.inflate(2131623936);
        this.t.setOnMenuItemClickListener(this);
        this.v = (ExitInhaleAnimView) findViewById(2131363859);
        this.m = (WebView) findViewById(2131363879);
        BrowserLocationBar browserLocationBar = (BrowserLocationBar) findViewById(2131362619);
        this.q = browserLocationBar;
        browserLocationBar.setBrowserLocationBarListener(this.L);
        BrowserBottomBar browserBottomBar = (BrowserBottomBar) findViewById(2131361981);
        this.r = browserBottomBar;
        browserBottomBar.setBrowserBottomBarListener(this.M);
        this.r.setBackwardButtonEnabled(false);
        this.r.setForwardButtonEnabled(false);
        this.u = (RelativeLayout) findViewById(2131362967);
        registerForContextMenu(this.m);
        WebSettings settings = this.m.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setSavePassword(false);
        settings.setDomStorageEnabled(true);
        settings.setSupportZoom(true);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setLoadsImagesAutomatically(true);
        settings.setAllowFileAccess(true);
        settings.setDisplayZoomControls(false);
        settings.setBuiltInZoomControls(true);
        settings.setCacheMode(-1);
        settings.setDatabaseEnabled(true);
        settings.setDomStorageEnabled(true);
        settings.setDatabasePath(getDir("databases", 0).getPath());
        settings.setGeolocationDatabasePath(getDir("geolocation", 0).getPath());
        this.m.setScrollBarStyle(33554432);
        this.m.setDownloadListener(new DownloadListener() {
            @Override
            public final void onDownloadStart(String str, String str2, String str3, String str4, long j10) {
                vj.h hVar = WebBrowserActivity.N;
                WebBrowserActivity webBrowserActivity = WebBrowserActivity.this;
                webBrowserActivity.getClass();
                WebBrowserActivity.N.c("onDownloadStart. Url: " + str + ", mimeType: " + str4 + ", contentLength: " + j10);
                WebBrowserActivity.i.t0(str, webBrowserActivity.m.getUrl(), str4).j0(webBrowserActivity, "SaveImageDialogFragment");
            }
        });
        ?? gVar = new g(this);
        this.f215x = gVar;
        this.m.setWebChromeClient(gVar);
        this.m.setWebViewClient(new nb.e(this));
        vj.e eVar = x0.g;
        eVar.l(this, "has_entered_secure_browser", true);
        if (!eVar.g(this, "has_shown_bookmark_tip", false)) {
            this.H.postDelayed(new nb.a(this, i10), 200L);
        } else if (!eVar.g(this, "has_suggest_create_shortcut", false)) {
            j jVar = new j();
            jVar.setCancelable(false);
            jVar.j0(this, "SuggestCreateBrowserDialogFragment");
            eVar.l(this, "has_suggest_create_shortcut", true);
        }
        a3(getIntent());
        ok.a aVar = new ok.a(this, 2131887944);
        this.I = aVar;
        aVar.c();
    }

    public final void onCreateContextMenu(ContextMenu contextMenu, View view, ContextMenu.ContextMenuInfo contextMenuInfo) {
        super/*android.app.Activity*/.onCreateContextMenu(contextMenu, view, contextMenuInfo);
        WebView.HitTestResult hitTestResult = this.m.getHitTestResult();
        if (hitTestResult.getType() == 5 || hitTestResult.getType() == 8) {
            N.c("Image hit:" + hitTestResult.getExtra());
            if (hitTestResult.getExtra() == null || !c3(hitTestResult.getExtra())) {
                return;
            }
            i.t0(hitTestResult.getExtra(), this.m.getUrl(), "image/*").j0(this, "SaveDialogFragment");
        }
    }

    public final void onDestroy() {
        N.c("==> onDestroy");
        this.I.f();
        this.I = null;
        ExitInhaleAnimView exitInhaleAnimView = this.v;
        ValueAnimator valueAnimator = exitInhaleAnimView.d;
        if (valueAnimator != null) {
            valueAnimator.removeAllListeners();
            exitInhaleAnimView.d.cancel();
            exitInhaleAnimView.d = null;
        }
        this.m.clearCache(true);
        this.m.destroy();
        this.m = null;
        PopupMenu popupMenu = this.t;
        if (popupMenu != null) {
            popupMenu.dismiss();
            this.t = null;
        }
        this.H.removeCallbacksAndMessages(null);
        d.d dVar = this.f216y;
        if (dVar != null) {
            dVar.destroy();
        }
        super/*il.b*/.onDestroy();
    }

    public final boolean onMenuItemClick(MenuItem menuItem) {
        if (menuItem.getItemId() != 2131361873) {
            return true;
        }
        kb.h.a(this);
        return true;
    }

    public final void onNewIntent(Intent intent) {
        super/*androidx.fragment.app.FragmentActivity*/.onNewIntent(intent);
        a3(intent);
    }

    public final void onPause() {
        this.m.onPause();
        super/*wk.a*/.onPause();
    }

    public final void onResume() {
        super/*wk.a*/.onResume();
        this.m.onResume();
    }

    public static class g extends ThWebView.a {
        public static final int i = 0;
        public boolean d;
        public f e;
        public FrameLayout f;
        public WebChromeClient.CustomViewCallback g;
        public int h;

        public g(FragmentActivity fragmentActivity) {
            super(fragmentActivity);
            this.d = false;
        }

        public final void b() {
            il.e eVar = (WebBrowserActivity) a();
            if (eVar == null) {
                return;
            }
            WebBrowserActivity.N.c("Hide navigation bar");
            eVar.getWindow().getDecorView().setSystemUiVisibility(eVar.getWindow().getDecorView().getSystemUiVisibility() | 2 | 4);
        }

        @SuppressLint({"ClickableViewAccessibility"})
        public final void c(View view, WebChromeClient.CustomViewCallback customViewCallback) {
            final ?? r02 = (WebBrowserActivity) a();
            if (r02 == 0) {
                return;
            }
            if (this.f != null) {
                customViewCallback.onCustomViewHidden();
                return;
            }
            this.h = r02.getRequestedOrientation();
            FrameLayout frameLayout = (FrameLayout) r02.getWindow().getDecorView();
            this.e = new f(r02);
            FrameLayout frameLayout2 = (FrameLayout) View.inflate(r02, 2131558533, null);
            ((LinearLayout) frameLayout2.findViewById(2131362578)).addView(view, new FrameLayout.LayoutParams(-1, -1));
            ((ImageButton) frameLayout2.findViewById(2131362323)).setOnClickListener(new t4.d(this, 26));
            this.e.addView(frameLayout2, new FrameLayout.LayoutParams(-1, -1));
            LinearLayout linearLayout = new LinearLayout(r02);
            linearLayout.setOnTouchListener(new View.OnTouchListener() {
                @Override
                public final boolean onTouch(View view2, MotionEvent motionEvent) {
                    WebBrowserActivity.g gVar = WebBrowserActivity.g.this;
                    il.e eVar = (WebBrowserActivity) gVar.a();
                    if (eVar != null && (eVar.getWindow().getDecorView().getSystemUiVisibility() & 2) == 0) {
                        gVar.b();
                    } else {
                        il.e eVar2 = (WebBrowserActivity) gVar.a();
                        if (eVar2 != null) {
                            WebBrowserActivity.N.c("Show navigation bar");
                            eVar2.getWindow().getDecorView().setSystemUiVisibility(eVar2.getWindow().getDecorView().getSystemUiVisibility() & (-3) & (-5));
                        }
                        new Handler().postDelayed(new d.e(15, gVar, r02), 3000L);
                    }
                    return false;
                }
            });
            this.e.addView(linearLayout, new FrameLayout.LayoutParams(-1, -1));
            ((TextView) frameLayout2.findViewById(2131363694)).setText(r02.m.getTitle());
            frameLayout.addView(this.e, new FrameLayout.LayoutParams(-1, -1));
            this.f = frameLayout2;
            this.g = customViewCallback;
            r02.setRequestedOrientation(0);
            r02.getWindow().addFlags(1024);
            r02.getWindow().addFlags(128);
            r02.getWindow().getDecorView().setSystemUiVisibility(5895);
        }

        public final void onHideCustomView() {
            super/*android.webkit.WebChromeClient*/.onHideCustomView();
            il.e eVar = (WebBrowserActivity) a();
            if (eVar == null) {
                return;
            }
            WebBrowserActivity.N.c("onHideCustomView");
            if (this.f == null) {
                return;
            }
            ((FrameLayout) eVar.getWindow().getDecorView()).removeView(this.e);
            this.e = null;
            this.f = null;
            this.g.onCustomViewHidden();
            eVar.setRequestedOrientation(this.h);
            eVar.getWindow().clearFlags(1024);
            eVar.getWindow().clearFlags(128);
            eVar.getWindow().getDecorView().setSystemUiVisibility(0);
            eVar.getWindow().getDecorView().setSystemUiVisibility(256);
        }

        public final void onProgressChanged(WebView webView, int i10) {
            WebBrowserActivity a = a();
            if (a == null) {
                return;
            }
            if (i10 <= 0 || i10 >= a.q.getProgress()) {
                a.q.setProgress(i10);
                if (a.q.getProgress() == 0) {
                    this.d = true;
                    new Handler().postDelayed(new nb.f(this, 1), 500L);
                } else {
                    this.d = false;
                }
                if (i10 < 100) {
                    BrowserLocationBar browserLocationBar = a.q;
                    if (browserLocationBar.o) {
                        return;
                    }
                    browserLocationBar.l.setVisibility(0);
                    return;
                }
                BrowserLocationBar browserLocationBar2 = a.q;
                if (browserLocationBar2.o) {
                    return;
                }
                Animation loadAnimation = AnimationUtils.loadAnimation(browserLocationBar2.getContext(), 2130771981);
                loadAnimation.setAnimationListener(new rb.a(browserLocationBar2));
                browserLocationBar2.l.startAnimation(loadAnimation);
                browserLocationBar2.l.setProgress(0);
            }
        }

        public final void onReceivedIcon(WebView webView, Bitmap bitmap) {
            WebBrowserActivity.N.c("==> onReceivedIcon");
            WebBrowserActivity a = a();
            if (a == null || bitmap == null) {
                return;
            }
            BrowserLocationBar browserLocationBar = a.q;
            browserLocationBar.getClass();
            BrowserLocationBar.p.c("==> showFavIcon");
            if (!browserLocationBar.o) {
                browserLocationBar.f.setImageBitmap(bitmap);
            }
            ((pb.c) a.W2()).l(webView.getUrl(), bitmap);
            ((pb.c) a.W2()).j1(webView.getUrl(), bitmap);
        }

        public final void onReceivedTitle(WebView webView, String str) {
            WebBrowserActivity.N.c("==> onReceivedTitle, title: " + str);
            WebBrowserActivity a = a();
            if (a == null || str == null) {
                return;
            }
            a.q.setTitle(str);
            a.e3();
        }

        public final void onShowCustomView(View view, int i10, WebChromeClient.CustomViewCallback customViewCallback) {
            WebBrowserActivity.N.c("onShowCustomView, orientation:" + i10);
            c(view, customViewCallback);
        }

        public final boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            WebBrowserActivity a = a();
            if (a == null) {
                return false;
            }
            a.C = valueCallback;
            try {
                Intent intent = new Intent("android.intent.action.GET_CONTENT");
                intent.setType("*/*");
                intent.putExtra("android.intent.extra.LOCAL_ONLY", true);
                intent.putExtra("android.intent.extra.ALLOW_MULTIPLE", true);
                if (!TextUtils.isEmpty(null)) {
                    intent.setPackage(null);
                }
                a.startActivityForResult(intent, 3);
                throw null;
            } catch (Exception unused) {
                return true;
            }
        }

        public final void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
            WebBrowserActivity.N.c("onShowCustomView");
            c(view, customViewCallback);
        }
    }

    @Override
    public final Context getContext() {
        return this;
    }
}