OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.kxqp.gs.ui.question;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import com.excean.bytedancebi.bean.BiEventBrowsePage;
import com.excean.bytedancebi.d.d;
import com.excean.bytedancebi.manager.BiManager;
import com.excelliance.kxqp.GameUtil;
import com.excelliance.kxqp.bitmap.ui.a.c;
import com.excelliance.kxqp.gs.base.GSBaseActivity;
import com.excelliance.kxqp.gs.base.e;
import com.excelliance.kxqp.gs.multi.down.DownloadProviderMonitorService;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.nyactivitys.f;
import com.excelliance.kxqp.gs.util.ao;
import com.excelliance.kxqp.gs.util.az;
import com.excelliance.kxqp.gs.util.bd;
import com.excelliance.kxqp.gs.util.bf;
import com.excelliance.kxqp.gs.util.by;
import com.excelliance.kxqp.gs.util.bz;
import com.excelliance.kxqp.gs.util.cn;
import com.excelliance.kxqp.gs.util.w;
import com.excelliance.kxqp.widget.video.NiceVideoPlayer;
import com.excelliance.kxqp.widget.video.j;
import com.tencent.open.SocialConstants;
import org.json.JSONException;
import org.json.JSONObject;

public class WebNativeVideoActivity extends GSBaseActivity {

    private View f10935a;

    private NiceVideoPlayer f10936b;
    private j c;
    private WebView d;
    private String e;
    private String f;
    private int g;
    private int h;
    private String i;
    private int j;
    private String k;
    private String l;

    @Override
    public boolean customAnimation() {
        return false;
    }

    @Override
    public boolean deepStatus() {
        return true;
    }

    @Override
    public e initPresenter() {
        return null;
    }

    @Override
    public void singleClick(View view) {
    }

    @Override
    protected void initId() {
        a();
        d();
        b();
    }

    private void a() {
        this.g = this.mContext.getResources().getDisplayMetrics().widthPixels;
        this.h = (int) (this.g * 0.5625f);
    }

    private void b() {
        this.f10936b = (NiceVideoPlayer) ao.a(this.mContext).a("videoPlayer", this.f10935a);
        ViewGroup.LayoutParams layoutParams = this.f10936b.getLayoutParams();
        layoutParams.height = this.h;
        layoutParams.width = this.g;
        this.f10936b.setLayoutParams(layoutParams);
        this.f10936b.setPlayerType(222);
        this.c = new j(this);
        this.f10936b.setController(this.c);
        this.f10936b.setVolume(0);
        c();
    }

    private void c() {
        final by a2 = by.a(this, "sp_total_info");
        this.e = a2.b("KEY_GUIDE_VIDEO_URL", (String) null);
        if (TextUtils.isEmpty(this.e)) {
            tp.f(new Runnable() {
                @Override
                public void run() {
                    String c = bd.c("https://api.ourplay.com.cn/getinfo/video", com.excelliance.kxqp.bitmap.a.a(WebNativeVideoActivity.this).toString());
                    if (TextUtils.isEmpty(c)) {
                        return;
                    }
                    try {
                        JSONObject jSONObject = new JSONObject(c);
                        WebNativeVideoActivity.this.e = jSONObject.optString("data");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }
                    if (TextUtils.isEmpty(WebNativeVideoActivity.this.e)) {
                        return;
                    }
                    tp.i(new Runnable() {
                        @Override
                        public void run() {
                            if (WebNativeVideoActivity.this.f10936b != null) {
                                a2.a("KEY_GUIDE_VIDEO_URL", WebNativeVideoActivity.this.e);
                                WebNativeVideoActivity.this.c.setVideoSource(WebNativeVideoActivity.this.e);
                                WebNativeVideoActivity.this.f10936b.a();
                            }
                        }
                    });
                }
            });
        } else {
            this.c.setVideoSource(this.e);
            this.f10936b.a();
        }
    }

    private void d() {
        this.d = (WebView) ao.a(this.mContext).a("webView", this.f10935a);
        FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.d.getLayoutParams();
        layoutParams.setMargins(0, this.h, 0, 0);
        this.d.setLayoutParams(layoutParams);
        Intent intent = getIntent();
        this.i = intent.getStringExtra("page_banner_id");
        this.j = intent.getIntExtra("page_support_download", 0);
        this.k = intent.getStringExtra("page_banner_download_pkg");
        this.f = e();
        if (TextUtils.isEmpty(this.f)) {
            finish();
        }
        WebSettings settings = this.d.getSettings();
        settings.setJavaScriptEnabled(true);
        if (Build.VERSION.SDK_INT > 17) {
            this.d.addJavascriptInterface(new c(this.mContext), "commonInterface");
        }
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setSupportZoom(false);
        settings.setBuiltInZoomControls(false);
        settings.setDisplayZoomControls(true);
        settings.setCacheMode(1);
        settings.setAllowFileAccess(false);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setLoadsImagesAutomatically(true);
        settings.setDefaultTextEncodingName("utf-8");
        settings.setDomStorageEnabled(true);
        if (Build.VERSION.SDK_INT >= 26) {
            settings.setSafeBrowsingEnabled(false);
        }
        if (Build.VERSION.SDK_INT > 17) {
            this.d.addJavascriptInterface(new a(), "AndroidJs");
            if (com.excelliance.kxqp.gs.ui.nyactivitys.e.b(this.mContext)) {
                this.d.addJavascriptInterface(new f(this.mContext), "newYearInterface");
            }
        }
        this.d.removeJavascriptInterface("searchBoxJavaBridge_");
        this.d.removeJavascriptInterface("accessibility");
        this.d.removeJavascriptInterface("accessibilityTraversal");
        this.d.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                az.e("WebNativeVideoActivity", "shouldOverrideUrlLoading url:" + str);
                if (!TextUtils.isEmpty(str) && (str.startsWith("weixin:") || str.startsWith("alipays:"))) {
                    try {
                        az.e("WebNativeVideoActivity", "shouldOverrideUrlLoading 1 url:" + str);
                        WebNativeVideoActivity.this.mContext.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                        return true;
                    } catch (Exception unused) {
                        az.e("WebNativeVideoActivity", "white can't parse url..." + str);
                        return true;
                    }
                }
                return super.shouldOverrideUrlLoading(webView, str);
            }

            @Override
            public void onPageStarted(WebView webView, String str, Bitmap bitmap) {
                super.onPageStarted(webView, str, bitmap);
            }

            @Override
            public void onPageFinished(WebView webView, String str) {
                webView.loadUrl("javascript:doAdjust()");
                super.onPageFinished(webView, str);
            }
        });
        this.d.setDownloadListener(new DownloadListener() {
            @Override
            public void onDownloadStart(final String str, final String str2, final String str3, final String str4, final long j) {
                az.d("WebNativeVideoActivity", "onDownloadStart  url:" + str + " userAgent:" + str2 + " contentDisposition:" + str3 + " mimetype:" + str4 + " contentLength:" + j);
                if (WebNativeVideoActivity.this.j == 1 && bf.e(WebNativeVideoActivity.this.mContext)) {
                    com.excelliance.kxqp.bitmap.ui.a.c cVar = new com.excelliance.kxqp.bitmap.ui.a.c(WebNativeVideoActivity.this.mContext, new Runnable() {
                        @Override
                        public void run() {
                            DownloadProviderMonitorService.a(WebNativeVideoActivity.this.mContext, str, str2, str3, str4, j, WebNativeVideoActivity.this.i, WebNativeVideoActivity.this.k);
                        }
                    });
                    cVar.a(new c.a() {
                        @Override
                        public void a() {
                            bz.a().b(WebNativeVideoActivity.this.mContext, 5, WebNativeVideoActivity.this.k, WebNativeVideoActivity.this.i);
                        }

                        @Override
                        public void b() {
                            bz.a().b(WebNativeVideoActivity.this.mContext, 6, WebNativeVideoActivity.this.k, WebNativeVideoActivity.this.i);
                        }
                    });
                    cVar.run();
                }
            }
        });
        this.d.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onReceivedTitle(WebView webView, String str) {
                super.onReceivedTitle(webView, str);
                WebNativeVideoActivity.this.l = str;
            }
        });
        this.d.loadUrl(this.f);
    }

    private String e() {
        return getIntent().getStringExtra(SocialConstants.PARAM_URL);
    }

    @Override
    public boolean onKeyDown(int i, KeyEvent keyEvent) {
        if (i == 4) {
            hideKeyboard(this);
            if (this.f10936b != null && this.f10936b.m()) {
                this.f10936b.q();
                return true;
            }
            if (this.d != null && this.d.canGoBack()) {
                this.d.goBack();
                return true;
            }
            finish();
            return true;
        }
        return super.onKeyDown(i, keyEvent);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (this.d != null) {
            this.d.getSettings().setJavaScriptEnabled(false);
            this.d.clearCache(true);
            this.d.setWebChromeClient(null);
            this.d.setWebViewClient(null);
            this.d.setVisibility(8);
            this.d.removeAllViews();
            this.d.destroy();
            this.d = null;
        }
        if (this.f10936b != null) {
            this.f10936b.u();
            this.f10936b = null;
        }
    }

    @Override
    public void disExposure() {
        Bundle bundleExtra;
        super.disExposure();
        Intent intent = getIntent();
        if (!intent.getBooleanExtra("upload_page_view_event", false) || (bundleExtra = intent.getBundleExtra("game_info")) == null) {
            return;
        }
        BiEventBrowsePage biEventBrowsePage = new BiEventBrowsePage();
        biEventBrowsePage.current_page = "文章";
        biEventBrowsePage.pageview_duration = d.a(this.mPageBrowseHandle.f1371b) + "";
        biEventBrowsePage.game_packagename = bundleExtra.getString("game_package_name");
        biEventBrowsePage.game_update_time = bundleExtra.getString("game_update_time");
        biEventBrowsePage.game_version = bundleExtra.getString("game_version");
        biEventBrowsePage.link_address = this.f;
        biEventBrowsePage.link_name = this.l;
        com.excelliance.kxqp.gs.g.c.a().a(biEventBrowsePage);
    }

    @Override
    protected View getLayout() {
        this.f10935a = w.b(this.mContext, "activity_question_video");
        return this.f10935a;
    }

    public class a {
        a() {
        }

        @JavascriptInterface
        public void adjustLayoutParams(final float f) {
            tp.i(new Runnable() {
                @Override
                public void run() {
                    if (WebNativeVideoActivity.this.d != null) {
                        ViewGroup.LayoutParams layoutParams = WebNativeVideoActivity.this.d.getLayoutParams();
                        layoutParams.width = WebNativeVideoActivity.this.g;
                        layoutParams.height = (int) (WebNativeVideoActivity.this.g * f);
                        WebNativeVideoActivity.this.d.setLayoutParams(layoutParams);
                    }
                }
            });
        }

        @JavascriptInterface
        public String getUserInfo() {
            JSONObject i = cn.i(WebNativeVideoActivity.this.mContext);
            if (i != null) {
                try {
                    i.put(BiManager.UQID, GameUtil.getIntance().F(WebNativeVideoActivity.this.mContext));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
            return i.toString();
        }
    }

    @Override
    public void onStart() {
        super.onStart();
    }

    @Override
    public void onStop() {
        super.onStop();
        if (this.f10936b == null || !this.f10936b.i()) {
            return;
        }
        this.f10936b.c();
    }
}