Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c

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


package com.mobvista.msdk.mvjscommon.authority.activity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.LinearLayout;
import com.mobvista.msdk.MobVistaConstans;
import com.mobvista.msdk.b.a;
import com.mobvista.msdk.b.b;
import com.mobvista.msdk.base.utils.h;
import com.mobvista.msdk.base.utils.o;
import com.mobvista.msdk.mvjscommon.windvane.WindVaneWebView;
import com.mobvista.msdk.mvjscommon.windvane.c;
import com.mobvista.msdk.mvjscommon.windvane.g;
import java.util.regex.Pattern;
public class MVAuthorityActivity extends Activity {
    public static final long TIMEOUT = 10000;
    private static String f = "MVAuthorityActivity";
    LinearLayout b;
    MVAuthorityCustomView c;
    LinearLayout.LayoutParams d;
    Handler e;
    private AlertDialog h;
    private WindVaneWebView g = null;
    String a = "";
    private Runnable i = new Runnable() {
        @Override
        public final void run() {
            MVAuthorityActivity.this.dismissLoadingDialog();
            MVAuthorityActivity.this.b.removeView(MVAuthorityActivity.this.g);
            MVAuthorityActivity.this.b.addView(MVAuthorityActivity.this.c, MVAuthorityActivity.this.d);
        }
    };

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        return i == 4;
    }

    @Override
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        h.a(f, "MVAuthorityActivity  onCreate");
        showLoadingDialog();
        try {
            b.a();
            a b = b.b(com.mobvista.msdk.base.controller.a.d().k());
            if (b == null) {
                b.a();
                b = b.b();
            }
            this.a = b.i();
            this.e = new Handler();
            if (!TextUtils.isEmpty(this.a) && isHttpUrl(this.a)) {
                String str = this.a;
                this.g = new WindVaneWebView(this);
                this.e.postDelayed(this.i, 10000L);
                this.g.setWebViewListener(new c() {
                    @Override
                    public final boolean a() {
                        return false;
                    }

                    @Override
                    public final void c() {
                    }

                    @Override
                    public final void d() {
                    }

                    @Override
                    public final void e() {
                    }

                    @Override
                    public final void a(WebView webView, int i, String str2, String str3) {
                        MVAuthorityActivity.this.dismissLoadingDialog();
                        MVAuthorityActivity.this.b.removeView(MVAuthorityActivity.this.g);
                        MVAuthorityActivity.this.b.addView(MVAuthorityActivity.this.c, MVAuthorityActivity.this.d);
                        com.mobvista.msdk.base.controller.authoritycontroller.a.a().b.onShowPopWindowStatusFaile(str2);
                    }

                    @Override
                    public final void b() {
                        MVAuthorityActivity.this.dismissLoadingDialog();
                        MVAuthorityActivity.this.b.removeView(MVAuthorityActivity.this.g);
                        MVAuthorityActivity.this.b.addView(MVAuthorityActivity.this.c, MVAuthorityActivity.this.d);
                        com.mobvista.msdk.base.controller.authoritycontroller.a.a().b.onShowPopWindowStatusFaile(MobVistaConstans.AUTHORITY_APP_LOAD_FAILED);
                    }

                    @Override
                    public final void a(WebView webView, String str2) {
                        h.a(MVAuthorityActivity.f, "onPageFinished");
                        MVAuthorityActivity.this.dismissLoadingDialog();
                        MVAuthorityActivity.this.webviewshow(MVAuthorityActivity.this.g);
                        MVAuthorityActivity.this.e.removeCallbacks(MVAuthorityActivity.this.i);
                        com.mobvista.msdk.base.controller.authoritycontroller.a.a().b.onShowPopWindowStatusSucessful();
                    }
                });
                this.g.loadUrl(str);
                this.g = this.g;
            }
            this.b = new LinearLayout(this);
            this.d = new LinearLayout.LayoutParams(-1, -1);
            this.c = new MVAuthorityCustomView(this);
            if (this.g == null) {
                this.b.addView(this.c, this.d);
            } else {
                this.b.addView(this.g, this.d);
            }
            setContentView(this.b);
        } catch (Throwable unused) {
            finish();
        }
    }

    public void webviewshow(WindVaneWebView windVaneWebView) {
        try {
            h.a(f, "webviewshow");
            g.a();
            g.a(windVaneWebView, "webviewshow", "");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static boolean isHttpUrl(String str) {
        boolean matches = Pattern.compile("(((https|http)?://)?([a-z0-9]+[.])|(www.))\\w+[.|\\/]([a-z0-9]{0,})?[[.]([a-z0-9]{0,})]+((/[\\S&&[^,;一-龥]]+)+)?([.][a-z0-9]{0,}+|/?)".trim()).matcher(str.trim()).matches();
        if (matches) {
            return true;
        }
        return matches;
    }

    public void showLoadingDialog() {
        try {
            if (this.h == null) {
                this.h = new AlertDialog.Builder(this).create();
            }
            this.h.getWindow().setBackgroundDrawable(new ColorDrawable());
            this.h.setCancelable(false);
            this.h.setOnKeyListener(new DialogInterface.OnKeyListener() {
                @Override
                public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                    return i == 84 || i == 4;
                }
            });
            this.h.show();
            View inflate = LayoutInflater.from(this).inflate(o.a(this, "loading_alert", "layout"), (ViewGroup) null);
            if (inflate != null) {
                this.h.setContentView(inflate);
                this.h.setCanceledOnTouchOutside(false);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void dismissLoadingDialog() {
        if (this.h == null || !this.h.isShowing()) {
            return;
        }
        this.h.dismiss();
    }
}