翰林优商.apk(点击下载) / AuthWebVeiwActivity.java


package com.mobile.auth.gatewayauth.activity;

import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.mbridge.msdk.playercommon.exoplayer2.text.ttml.TtmlNode;
import com.mobile.auth.gatewayauth.AuthUIConfig;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.gatewayauth.b;
import com.mobile.auth.gatewayauth.utils.i;
import com.mobile.auth.m.a;
import com.nirvana.tools.core.AppUtils;

public class AuthWebVeiwActivity extends Activity {
    private WebView a;
    private String b;
    private String c;
    private ProgressBar d;
    private TextView e;
    private RelativeLayout f;
    private AuthUIConfig g;
    private ImageButton h;

    static /* synthetic */ ProgressBar a(AuthWebVeiwActivity authWebVeiwActivity) {
        try {
            return authWebVeiwActivity.d;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    static /* synthetic */ String b(AuthWebVeiwActivity authWebVeiwActivity) {
        try {
            return authWebVeiwActivity.c;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    static /* synthetic */ TextView c(AuthWebVeiwActivity authWebVeiwActivity) {
        try {
            return authWebVeiwActivity.e;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
            return null;
        }
    }

    /* access modifiers changed from: protected */
    public void onCreate(Bundle bundle) {
        AuthUIConfig g2;
        AuthUIConfig authUIConfig;
        TextView textView;
        int navTextSize;
        try {
            this.b = getIntent().getStringExtra("url");
            this.c = getIntent().getStringExtra("name");
            int intExtra = getIntent().getIntExtra("ui_manager_id", 0);
            setRequestedOrientation(getIntent().getIntExtra("orientation", 1));
            super.onCreate(bundle);
            b a2 = b.a(intExtra);
            if (a2 == null) {
                a.a(getApplicationContext()).e("UIManager is null!|ID:", String.valueOf(intExtra));
                g2 = b.a;
            } else {
                g2 = a2.g();
            }
            this.g = g2;
            setContentView(AppUtils.getResID(this, "authsdk_dialog_layout", TtmlNode.TAG_LAYOUT));
            int webViewStatusBarColor = this.g.getWebViewStatusBarColor();
            if (AuthUIConfig.DEFAULT_WEB_STATUS_BAR_COLOR == webViewStatusBarColor) {
                webViewStatusBarColor = this.g.getWebNavColor();
            }
            b.a(this.g, webViewStatusBarColor, this);
            this.e = (TextView) findViewById(AppUtils.getResID(this, "authsdk_title_tv", "id"));
            this.f = (RelativeLayout) findViewById(AppUtils.getResID(this, "authsdk_title_rl", "id"));
            this.h = (ImageButton) findViewById(AppUtils.getResID(this, "authsdk_back_btn", "id"));
            this.f.setBackgroundColor(this.g.getWebNavColor());
            this.e.setTextColor(this.g.getWebNavTextColor());
            if (this.g.getWebNavTextSize() != -1) {
                authUIConfig = this.g;
                textView = this.e;
                navTextSize = authUIConfig.getWebNavTextSize();
            } else {
                authUIConfig = this.g;
                textView = this.e;
                navTextSize = authUIConfig.getNavTextSize();
            }
            authUIConfig.setTextSize(textView, navTextSize);
            this.h.setBackgroundColor(0);
            this.h.setScaleType(this.g.getNavReturnScaleType());
            this.h.setPadding(0, 0, 0, 0);
            Drawable webNavReturnImgDrawable = this.g.getWebNavReturnImgDrawable();
            if (webNavReturnImgDrawable == null) {
                webNavReturnImgDrawable = i.c(this, this.g.getWebNavReturnImgPath());
            }
            if (webNavReturnImgDrawable == null) {
                webNavReturnImgDrawable = this.g.getNavReturnImgDrawable();
            }
            if (webNavReturnImgDrawable == null) {
                webNavReturnImgDrawable = i.a(this, this.g.getNavReturnImgPath(), "authsdk_return_bg");
            }
            this.h.setImageDrawable(webNavReturnImgDrawable);
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.h.getLayoutParams();
            layoutParams.width = AppUtils.dp2px(this, (float) this.g.getNavReturnImgWidth());
            layoutParams.height = AppUtils.dp2px(this, (float) this.g.getNavReturnImgHeight());
            this.h.setOnClickListener(new View.OnClickListener() {
                /* class com.mobile.auth.gatewayauth.activity.AuthWebVeiwActivity.AnonymousClass1 */

                public void onClick(View view) {
                    try {
                        AuthWebVeiwActivity.this.finish();
                    } catch (Throwable th) {
                        ExceptionProcessor.processException(th);
                    }
                }
            });
            this.d = (ProgressBar) findViewById(AppUtils.getResID(this, "authsdk_progressBar", "id"));
            WebView webView = (WebView) findViewById(AppUtils.getResID(this, "authsdk_webview", "id"));
            this.a = webView;
            webView.setWebChromeClient(new WebChromeClient() {
                /* class com.mobile.auth.gatewayauth.activity.AuthWebVeiwActivity.AnonymousClass2 */

                public void onProgressChanged(WebView webView, int i) {
                    if (i == 100) {
                        try {
                            AuthWebVeiwActivity.a(AuthWebVeiwActivity.this).setVisibility(8);
                            String title = webView.getTitle();
                            if (!TextUtils.isEmpty(AuthWebVeiwActivity.b(AuthWebVeiwActivity.this))) {
                                AuthWebVeiwActivity.c(AuthWebVeiwActivity.this).setText(AuthWebVeiwActivity.b(AuthWebVeiwActivity.this));
                            } else if (!TextUtils.isEmpty(title)) {
                                AuthWebVeiwActivity.c(AuthWebVeiwActivity.this).setText(title);
                            } else {
                                AuthWebVeiwActivity.c(AuthWebVeiwActivity.this).setText("服务协议");
                            }
                        } catch (Throwable th) {
                            ExceptionProcessor.processException(th);
                        }
                    } else {
                        AuthWebVeiwActivity.a(AuthWebVeiwActivity.this).setVisibility(0);
                        AuthWebVeiwActivity.a(AuthWebVeiwActivity.this).setProgress(i);
                    }
                }
            });
            this.a.setWebViewClient(new WebViewClient() {
                /* class com.mobile.auth.gatewayauth.activity.AuthWebVeiwActivity.AnonymousClass3 */

                @Override // android.webkit.WebViewClient
                public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                    return false;
                }
            });
            this.a.setVerticalScrollBarEnabled(false);
            this.a.setHorizontalScrollBarEnabled(false);
            WebSettings settings = this.a.getSettings();
            settings.setUseWideViewPort(true);
            settings.setLoadWithOverviewMode(true);
            settings.setDomStorageEnabled(true);
            settings.setSavePassword(false);
            settings.setAllowFileAccess(false);
            settings.setJavaScriptEnabled(this.g.isWebSupportedJavascript());
            this.a.loadUrl(this.b);
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }

    /* access modifiers changed from: protected */
    public void onDestroy() {
        try {
            WebView webView = this.a;
            if (webView != null) {
                webView.removeAllViews();
                this.a.destroy();
                this.a = null;
            }
            super.onDestroy();
            this.g = null;
        } catch (Throwable th) {
            ExceptionProcessor.processException(th);
        }
    }
}