导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - WebViewAppCompatActivity.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 WebViewAppCompatActivity.java JAVA 源代码文件

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


package im.amwhusedvt.ui.hui;

import android.graphics.Bitmap;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LinearInterpolator;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.ui.actionbar.ActionBar;
import im.amwhusedvt.ui.actionbar.ActionBarMenu;
import im.amwhusedvt.ui.actionbar.ActionBarMenuItem;
import im.amwhusedvt.ui.components.LayoutHelper;

public class WebViewAppCompatActivity extends AppCompatActivity {
    private ActionBar actionBar;
    private ActionBarMenu actionBarMenu;
    private ActionBarMenuItem menuItem;
    private ActionBarMenuItem refreshMenuItem;
    private LinearLayout root;
    private String url;
    private WebView webView;

    protected void onCreate(Bundle savedInstanceState) {
        if ((3 + 23) % 23 <= 0) {
        }
        requestWindowFeature(1);
        setTheme(2131755390);
        super.onCreate(savedInstanceState);
        setContentView(2131492991);
        this.root = (LinearLayout) findViewById(2131297228);
        this.webView = (WebView) findViewById(2131297990);
        this.root.setBackgroundColor(-1);
        ActionBar actionBar = new ActionBar(this);
        this.actionBar = actionBar;
        actionBar.setBackgroundColor(-1);
        this.actionBar.setItemsBackgroundColor(-12554860, false);
        this.actionBar.setItemsBackgroundColor(-986896, true);
        this.actionBar.setItemsColor(-16777216, false);
        this.actionBar.setItemsColor(-16777216, true);
        this.actionBar.setOccupyStatusBar(true);
        this.actionBar.setTitle(LocaleController.getString("Chats", 2131690545));
        this.actionBar.setCastShadows(true);
        this.actionBar.setBackButtonImage(2131558496);
        ActionBarMenu createMenu = this.actionBar.createMenu();
        this.actionBarMenu = createMenu;
        this.refreshMenuItem = createMenu.addItem(1, 2131231080);
        ActionBarMenuItem addItem = this.actionBarMenu.addItem(2, 2131230841);
        this.menuItem = addItem;
        addItem.addSubItem(3, 2131231322, LocaleController.getString("OpenInExternalApp", 2131692500));
        this.menuItem.addSubItem(4, 2131231298, LocaleController.getString("CopyLink", 2131690740));
        this.actionBar.setActionBarMenuOnItemClick(new 1(this));
        this.root.addView((View) this.actionBar, 0, (ViewGroup.LayoutParams) LayoutHelper.createLinear(-1, -2));
        WebSettings settings = this.webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setUseWideViewPort(true);
        settings.setSupportZoom(true);
        settings.setLoadWithOverviewMode(true);
        settings.setTextZoom(100);
        this.webView.setFocusable(true);
        this.webView.setWebChromeClient(new 2(this));
        this.webView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                WebViewAppCompatActivity.this.url = url;
                view.loadUrl(url);
                return false;
            }

            @Override
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                if ((15 + 15) % 15 <= 0) {
                }
                super.onReceivedError(view, errorCode, description, failingUrl);
                FileLog.e("WebViewAppCompatActivity ===> WebViewClient onReceivedError , errorCode = " + errorCode + " , description = " + description);
            }

            @Override
            public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
                super.onReceivedHttpError(view, request, errorResponse);
            }

            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                if ((22 + 25) % 25 <= 0) {
                }
                super.onPageStarted(view, url, favicon);
                if (WebViewAppCompatActivity.this.refreshMenuItem != null && WebViewAppCompatActivity.this.refreshMenuItem.getAnimation() == null) {
                    Animation rotate = AnimationUtils.loadAnimation(WebViewAppCompatActivity.this, 2130772036);
                    rotate.setInterpolator(new LinearInterpolator());
                    WebViewAppCompatActivity.this.refreshMenuItem.startAnimation(rotate);
                }
            }

            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                if (WebViewAppCompatActivity.this.refreshMenuItem != null) {
                    WebViewAppCompatActivity.this.refreshMenuItem.clearAnimation();
                }
            }

            @Override
            public void onLoadResource(WebView view, String url) {
                super.onLoadResource(view, url);
            }
        });
    }

    protected void onStart() {
        if ((23 + 22) % 22 <= 0) {
        }
        super.onStart();
        String stringExtra = getIntent().getStringExtra("url");
        this.url = stringExtra;
        if (TextUtils.isEmpty(stringExtra)) {
            finish();
            return;
        }
        if (this.url.contains("file")) {
            ActionBarMenuItem actionBarMenuItem = this.refreshMenuItem;
            if (actionBarMenuItem != null) {
                actionBarMenuItem.setVisibility(8);
            }
            ActionBarMenuItem actionBarMenuItem2 = this.menuItem;
            if (actionBarMenuItem2 != null) {
                actionBarMenuItem2.setVisibility(8);
            }
        }
        this.webView.loadUrl(this.url);
    }

    protected void onResume() {
        super.onResume();
        WebView webView = this.webView;
        if (webView != null) {
            webView.onResume();
        }
    }

    protected void onPause() {
        super.onPause();
        WebView webView = this.webView;
        if (webView != null) {
            webView.onPause();
        }
    }

    public void onBackPressed() {
        WebView webView = this.webView;
        if (webView != null && webView.canGoBack()) {
            this.webView.goBack();
        } else {
            super.onBackPressed();
        }
    }

    protected void onDestroy() {
        if ((10 + 2) % 2 <= 0) {
        }
        super.onDestroy();
        this.url = null;
        LinearLayout linearLayout = this.root;
        if (linearLayout != null) {
            linearLayout.removeAllViews();
            this.root.removeAllViewsInLayout();
            this.root = null;
        }
        ActionBarMenuItem actionBarMenuItem = this.refreshMenuItem;
        if (actionBarMenuItem != null) {
            actionBarMenuItem.removeAllViews();
            this.refreshMenuItem.removeAllViewsInLayout();
            this.refreshMenuItem = null;
        }
        ActionBar actionBar = this.actionBar;
        if (actionBar != null) {
            actionBar.removeAllViews();
            this.actionBar.removeAllViewsInLayout();
            this.actionBar = null;
        }
        try {
            this.webView.setLayerType(0, null);
            ViewParent parent = this.webView.getParent();
            if (parent != null) {
                ((FrameLayout) parent).removeView(this.webView);
            }
            this.webView.stopLoading();
            this.webView.loadUrl("about:blank");
            this.webView.destroy();
            this.webView = null;
        } catch (Exception e) {
            FileLog.e(e);
        }
    }
}