导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - HtmlX5DisplayActivity.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 HtmlX5DisplayActivity.java JAVA 源代码文件

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


package com.showself.ui;

import android.annotation.TargetApi;
import android.app.Dialog;
import android.content.ClipData;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.mifeng.ui.R;
import com.showself.domain.ShareData;
import com.showself.utils.Utils;
import com.showself.utils.l;
import com.showself.utils.o;
import com.showself.utils.r;
import com.showself.utils.r0;
import com.showself.utils.u0;
import com.showself.view.webview.SJX5WebView;
import com.tencent.smtt.export.external.interfaces.IX5WebChromeClient;
import com.tencent.smtt.sdk.DownloadListener;
import com.tencent.smtt.sdk.ValueCallback;
import com.tencent.smtt.sdk.WebChromeClient;
import com.tencent.smtt.sdk.WebView;
import com.tencent.tauth.AuthActivity;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.util.HashMap;
import org.apache.commons.httpclient.cookie.CookieSpec;
import org.apache.log4j.spi.LocationInfo;
import org.json.JSONObject;

public class HtmlX5DisplayActivity extends com.showself.ui.c implements View.OnClickListener {
    private String a;
    private String b;
    private String c;
    private TextView d;

    private SJX5WebView f2676e;

    private LinearLayout f2677f;

    private Button f2678g;

    private int f2679h;

    String f2680i;

    private boolean f2681j;

    private boolean f2682k;
    private boolean l;
    private TextView m;
    private boolean n;
    private ValueCallback<Uri[]> o;
    private com.r.a.a p;
    private com.showself.utils.c1.c q;
    private ImageView r;
    private ValueCallback<Uri> s;
    private WebChromeClient t = new g();

    class a implements View.OnLongClickListener {

        class C0075a implements l {
            final WebView.HitTestResult a;

            class RunnableC0076a implements Runnable {
                RunnableC0076a() {
                }

                @Override
                public void run() {
                    HtmlX5DisplayActivity htmlX5DisplayActivity = HtmlX5DisplayActivity.this;
                    htmlX5DisplayActivity.R(htmlX5DisplayActivity.f2680i);
                }
            }

            C0075a(WebView.HitTestResult hitTestResult) {
                this.a = hitTestResult;
            }

            @Override
            public void a(boolean z) {
                if (z) {
                    HtmlX5DisplayActivity.this.f2680i = this.a.getExtra();
                    new Thread(new RunnableC0076a()).start();
                }
            }
        }

        a() {
        }

        @Override
        public boolean onLongClick(View view) {
            WebView.HitTestResult hitTestResult = HtmlX5DisplayActivity.this.f2676e.getHitTestResult();
            if (hitTestResult.getType() != 5 && hitTestResult.getType() != 8) {
                return false;
            }
            androidx.fragment.app.b bVar = HtmlX5DisplayActivity.this;
            Utils.Q0(bVar, "提示", "保存图片到本地", bVar.getString(R.string.dialog_button_cancel), HtmlX5DisplayActivity.this.getResources().getColor(2131099757), HtmlX5DisplayActivity.this.getString(R.string.dialog_button_confirm), HtmlX5DisplayActivity.this.getResources().getColor(2131099758), new C0075a(hitTestResult), true);
            return true;
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            Toast.makeText((Context) HtmlX5DisplayActivity.this, (CharSequence) "保存失败", 0).show();
        }
    }

    class c implements Runnable {
        c() {
        }

        @Override
        public void run() {
            Toast.makeText((Context) HtmlX5DisplayActivity.this, (CharSequence) "保存失败", 0).show();
        }
    }

    class d implements Runnable {
        final File a;

        d(File file) {
            this.a = file;
        }

        @Override
        public void run() {
            HtmlX5DisplayActivity.this.sendBroadcast(new Intent("android.intent.action.MEDIA_SCANNER_SCAN_FILE", Uri.fromFile(this.a)));
            Toast.makeText((Context) HtmlX5DisplayActivity.this, (CharSequence) "保存成功", 0).show();
        }
    }

    class e implements com.r.a.b {
        e() {
        }

        @Override
        public void a() {
            HtmlX5DisplayActivity.this.I();
        }

        @Override
        public void b(String str) {
            new com.r.a.c(HtmlX5DisplayActivity.this).d(str);
        }
    }

    class f implements com.r.c.d {
        f() {
        }

        @Override
        public void onRequestFinish(com.r.c.c cVar, Object obj) {
            JSONObject jSONObject = (JSONObject) obj;
            if (jSONObject != null) {
                if (jSONObject.optInt("statuscode") == 0) {
                    HtmlX5DisplayActivity.this.z(jSONObject.optJSONObject("data").optInt("roomid"), jSONObject.optJSONObject("data").optString("param_quality"));
                } else {
                    Utils.Z0(HtmlX5DisplayActivity.this, jSONObject.optString("message"));
                }
            }
        }
    }

    class g extends WebChromeClient {
        private View a = null;
        private IX5WebChromeClient.CustomViewCallback b = null;

        g() {
        }

        @Override
        public void onHideCustomView() {
            if (this.a != null) {
                IX5WebChromeClient.CustomViewCallback customViewCallback = this.b;
                if (customViewCallback != null) {
                    customViewCallback.onCustomViewHidden();
                    this.b = null;
                }
                ViewGroup viewGroup = (ViewGroup) this.a.getParent();
                viewGroup.removeView(this.a);
                viewGroup.addView(HtmlX5DisplayActivity.this.f2676e);
                this.a = null;
            }
        }

        @Override
        public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback) {
            IX5WebChromeClient.CustomViewCallback customViewCallback2 = this.b;
            if (customViewCallback2 != null) {
                customViewCallback2.onCustomViewHidden();
                this.b = null;
                return;
            }
            ViewGroup viewGroup = (ViewGroup) HtmlX5DisplayActivity.this.f2676e.getParent();
            viewGroup.removeView(HtmlX5DisplayActivity.this.f2676e);
            viewGroup.addView(view);
            this.a = view;
            this.b = customViewCallback;
        }

        @Override
        public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> valueCallback, WebChromeClient.FileChooserParams fileChooserParams) {
            HtmlX5DisplayActivity.this.o = valueCallback;
            Intent intent = new Intent("android.intent.action.GET_CONTENT");
            intent.addCategory("android.intent.category.OPENABLE");
            intent.setType("image/*");
            HtmlX5DisplayActivity.this.startActivityForResult(Intent.createChooser(intent, "File Chooser"), 1);
            return true;
        }

        @Override
        public void openFileChooser(ValueCallback<Uri> valueCallback, String str, String str2) {
            HtmlX5DisplayActivity.this.s = valueCallback;
            Intent intent = new Intent("android.intent.action.GET_CONTENT");
            intent.addCategory("android.intent.category.OPENABLE");
            intent.setType("image/*");
            HtmlX5DisplayActivity.this.startActivityForResult(Intent.createChooser(intent, "File Chooser"), 1);
        }
    }

    public class h extends com.showself.view.webview.b {
        public h() {
        }

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

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

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            if (str.equalsIgnoreCase("yujia://webview/exit")) {
                HtmlX5DisplayActivity.this.finish();
                return true;
            }
            if (str.contains("showself://clearhistory")) {
                webView.clearHistory();
                return true;
            }
            if (str.contains("yujia://startPerform")) {
                HtmlX5DisplayActivity.this.N();
                return true;
            }
            if (str.startsWith("showself://getgold")) {
                com.showself.utils.c1.e.a(HtmlX5DisplayActivity.this);
                return true;
            }
            if (str.startsWith("showself")) {
                try {
                    Intent e2 = o.e(str, HtmlX5DisplayActivity.this);
                    if (e2 != null) {
                        if (str.startsWith("showself://recharge/")) {
                            if (HtmlX5DisplayActivity.this.q == null) {
                                HtmlX5DisplayActivity htmlX5DisplayActivity = HtmlX5DisplayActivity.this;
                                htmlX5DisplayActivity.q = new com.showself.utils.c1.c(htmlX5DisplayActivity, 0);
                            }
                            HtmlX5DisplayActivity.this.q.c(e2.getStringExtra(AuthActivity.ACTION_KEY));
                        } else if (!HtmlX5DisplayActivity.this.l) {
                            o.h(HtmlX5DisplayActivity.this, e2);
                        }
                    }
                } catch (Exception e3) {
                    e3.printStackTrace();
                }
                return true;
            }
            if (str.contains("checkmweb")) {
                HashMap hashMap = new HashMap();
                hashMap.put("Referer", "http://www.beeshow.tv");
                webView.loadUrl(str, hashMap);
                return true;
            }
            if (str.startsWith("weixin://wap/pay?")) {
                try {
                    Intent intent = new Intent();
                    intent.setAction("android.intent.action.VIEW");
                    intent.setData(Uri.parse(str));
                    HtmlX5DisplayActivity.this.startActivity(intent);
                } catch (Exception unused) {
                    Utils.Y0(HtmlX5DisplayActivity.this.getApplicationContext(), R.string.no_install_wx_tip);
                }
                return true;
            }
            if (HtmlX5DisplayActivity.this.M(str)) {
                try {
                    Intent parseUri = Intent.parseUri(str, 1);
                    parseUri.addCategory("android.intent.category.BROWSABLE");
                    parseUri.setComponent(null);
                    HtmlX5DisplayActivity.this.startActivity(parseUri);
                } catch (Exception e4) {
                    e4.printStackTrace();
                }
                return true;
            }
            if (str.startsWith("http:") || str.startsWith("https:")) {
                webView.loadUrl(str);
                return false;
            }
            try {
                HtmlX5DisplayActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
            } catch (Exception unused2) {
            }
            return true;
        }
    }

    private class i implements DownloadListener {
        private i() {
        }

        @Override
        public void onDownloadStart(String str, String str2, String str3, String str4, long j2) {
            HtmlX5DisplayActivity.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
        }

        i(HtmlX5DisplayActivity htmlX5DisplayActivity, a aVar) {
            this();
        }
    }

    public void I() {
        if (!this.p.b()) {
            Utils.X0(R.string.camera_permission_lack_prompt);
            return;
        }
        if (!this.p.a()) {
            Utils.X0(R.string.record_permission_lack_prompt);
            return;
        }
        com.r.c.a aVar = new com.r.c.a();
        aVar.b(AuthActivity.ACTION_KEY, 20);
        aVar.b("fuid", r0.y(this).getUserId());
        new com.r.c.c(com.r.c.c.k("serv_interact_shall.php", 0), aVar, new com.r.c.b(1), this).y(new f());
    }

    private ShareData J() {
        ShareData shareData = new ShareData();
        String str = this.a;
        shareData.content = str;
        shareData.title = str;
        String url = this.f2676e.getUrl();
        if (url.indexOf(LocationInfo.NA) > 0) {
            url = url.substring(0, url.indexOf(LocationInfo.NA));
        }
        if (url.equals(this.b)) {
            url = this.b;
        }
        shareData.url = url;
        shareData.image = "https://pics.beeshow.tv/icons/logo120.png";
        return shareData;
    }

    @TargetApi(21)
    private void K(int i2, int i3, Intent intent) {
        Uri[] uriArr;
        if (i2 != 1 || this.o == null) {
            return;
        }
        if (i3 != -1 || intent == null) {
            uriArr = null;
        } else {
            String dataString = intent.getDataString();
            ClipData clipData = intent.getClipData();
            if (clipData != null) {
                uriArr = new Uri[clipData.getItemCount()];
                for (int i4 = 0; i4 < clipData.getItemCount(); i4++) {
                    uriArr[i4] = clipData.getItemAt(i4).getUri();
                }
            } else {
                uriArr = null;
            }
            if (dataString != null) {
                uriArr = new Uri[]{Uri.parse(dataString)};
            }
        }
        this.o.onReceiveValue(uriArr);
        this.o = null;
    }

    private void L(File file) {
        runOnUiThread(new d(file));
    }

    public void N() {
        if (this.p == null) {
            this.p = new com.r.a.a(this);
        }
        this.p.c(new String[]{"android.permission.CAMERA", "android.permission.RECORD_AUDIO"}, new e());
    }

    private void O(Bitmap bitmap) {
        File file = new File(Environment.getExternalStorageDirectory(), "mifeng");
        if (!file.exists()) {
            file.mkdir();
        }
        File file2 = new File(file, this.f2680i.split(CookieSpec.PATH_DELIM)[r1.length - 1]);
        try {
            FileOutputStream fileOutputStream = new FileOutputStream(file2);
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
            fileOutputStream.flush();
            fileOutputStream.close();
            L(file2);
        } catch (IOException e2) {
            runOnUiThread(new c());
            e2.printStackTrace();
        }
    }

    private void P(int i2) {
        com.showself.ui.h.d.c.f(i2, 100003, this, J(), new com.showself.ui.h.b.c(this));
    }

    private void Q() {
        Dialog dialog = new Dialog(this, 2131755755);
        View inflate = LayoutInflater.from(this).inflate(R.layout.share_dialog, (ViewGroup) null);
        ImageView imageView = (ImageView) inflate.findViewById(R.id.iv_share_wx_space);
        ImageView imageView2 = (ImageView) inflate.findViewById(R.id.iv_share_wx_friend);
        ImageView imageView3 = (ImageView) inflate.findViewById(R.id.iv_share_qzone);
        ImageView imageView4 = (ImageView) inflate.findViewById(R.id.iv_share_qq);
        ImageView imageView5 = (ImageView) inflate.findViewById(R.id.iv_share_sina);
        imageView.setOnClickListener(this);
        imageView2.setOnClickListener(this);
        imageView3.setOnClickListener(this);
        imageView4.setOnClickListener(this);
        imageView5.setOnClickListener(this);
        dialog.setContentView(inflate);
        dialog.getWindow().setLayout(-1, -2);
        dialog.getWindow().setGravity(80);
        dialog.getWindow().setWindowAnimations(2131755745);
        dialog.setCanceledOnTouchOutside(true);
        dialog.show();
    }

    public boolean M(String str) {
        if (str.contains("platformapi/startApp")) {
            return true;
        }
        return Build.VERSION.SDK_INT > 23 && str.contains("platformapi") && str.contains("startApp");
    }

    public void R(String str) {
        try {
            URLConnection openConnection = new URL(str).openConnection();
            int contentLength = ((HttpURLConnection) openConnection).getContentLength();
            openConnection.connect();
            InputStream inputStream = openConnection.getInputStream();
            BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream, contentLength);
            Bitmap decodeStream = BitmapFactory.decodeStream(bufferedInputStream);
            bufferedInputStream.close();
            inputStream.close();
            if (decodeStream != null) {
                O(decodeStream);
            }
        } catch (Exception e2) {
            runOnUiThread(new b());
            e2.printStackTrace();
        }
    }

    @Override
    @TargetApi(19)
    public void init() {
        a aVar = null;
        u0.q(this, null);
        if (getIntent().getBooleanExtra("noTitleBar", false)) {
            u0.h(this);
            findViewById(R.id.btn_title_relative).setVisibility(8);
        } else if (u0.e()) {
            View findViewById = findViewById(2131299795);
            findViewById.getLayoutParams().height = u0.d();
            u0.j(this, findViewById, getResources().getDrawable(R.drawable.navigationbar_bg), true);
        }
        u0.h(this);
        String stringExtra = getIntent().getStringExtra("title");
        this.a = stringExtra;
        try {
            if (!TextUtils.isEmpty(stringExtra)) {
                this.a = URLDecoder.decode(this.a, "UTF-8");
            }
        } catch (UnsupportedEncodingException e2) {
            e2.printStackTrace();
        }
        this.c = getIntent().getStringExtra("url");
        this.f2681j = getIntent().getBooleanExtra("supportPicDownload", false);
        this.f2679h = getIntent().getIntExtra("type", 0);
        String str = this.c;
        if (str != null && !str.startsWith("http:") && !this.c.startsWith("https:")) {
            try {
                this.c = Utils.f(this.c);
            } catch (Exception unused) {
                this.c = "";
            }
        }
        String str2 = this.f2679h == 2 ? this.c.contains(LocationInfo.NA) ? "&activity=" : "?activity=" : this.c.contains(LocationInfo.NA) ? "&idCheckData=" : "?idCheckData=";
        this.b = this.c;
        String str3 = this.c + str2 + Utils.f0(this) + "&version=" + com.blankj.utilcode.util.d.a();
        this.c = str3;
        this.c = com.sjnet.i.d.a.b.c(str3);
        TextView textView = (TextView) findViewById(R.id.tv_nav_title);
        this.d = textView;
        textView.setText(this.a);
        this.d.setSelected(true);
        this.f2682k = getIntent().getBooleanExtra("showShare", false);
        this.l = getIntent().getBooleanExtra("pushOrPull", false);
        TextView textView2 = (TextView) findViewById(R.id.tv_nav_right);
        this.m = textView2;
        if (this.f2682k) {
            textView2.setVisibility(0);
            this.m.setBackgroundResource(R.drawable.html_share_icon);
            RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.m.getLayoutParams();
            layoutParams.width = r.a(19.0f);
            layoutParams.height = r.a(19.0f);
            layoutParams.rightMargin = r.a(24.0f);
            this.m.setOnClickListener(this);
        }
        getWindow().setFlags(16777216, 16777216);
        ImageView imageView = new ImageView(this);
        this.r = imageView;
        imageView.setLayoutParams(new ViewGroup.LayoutParams(-1, -1));
        this.r.setImageResource(R.drawable.webview_error_view);
        this.r.setScaleType(ImageView.ScaleType.CENTER_CROP);
        this.f2676e = new SJX5WebView(this);
        this.f2676e.setWebViewClient(new h());
        this.f2676e.setDownloadListener(new i(this, aVar));
        this.f2676e.setWebChromeClient(this.t);
        this.f2676e.q(this.c);
        LinearLayout linearLayout = (LinearLayout) findViewById(R.id.setting_help_html);
        this.f2677f = linearLayout;
        linearLayout.addView(this.f2676e);
        Button button = (Button) findViewById(R.id.btn_nav_left);
        this.f2678g = button;
        button.setOnClickListener(this);
        if (this.f2681j) {
            this.f2676e.setOnLongClickListener(new a());
        }
    }

    @Override
    protected void onActivityResult(int i2, int i3, Intent intent) {
        super.onActivityResult(i2, i3, intent);
        com.showself.ui.h.d.c.d(i2, i3, intent);
        if (i2 == 1) {
            if (this.s == null && this.o == null) {
                return;
            }
            Uri data = (intent == null || i3 != -1) ? null : intent.getData();
            if (this.o != null) {
                K(i2, i3, intent);
                return;
            }
            ValueCallback<Uri> valueCallback = this.s;
            if (valueCallback != null) {
                valueCallback.onReceiveValue(data);
                this.s = null;
            }
        }
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.btn_nav_left:
                finish();
                break;
            case R.id.iv_share_qq:
                P(1);
                break;
            case R.id.iv_share_qzone:
                P(11);
                break;
            case R.id.iv_share_sina:
                P(3);
                break;
            case R.id.iv_share_wx_friend:
                P(2);
                break;
            case R.id.iv_share_wx_space:
                P(22);
                break;
            case R.id.tv_nav_right:
                Q();
                break;
        }
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.htmldisplay);
        init();
    }

    @Override
    protected void onDestroy() {
        this.f2676e.removeAllViews();
        this.f2677f.removeAllViews();
        this.f2676e.l();
        this.f2676e = null;
        super.onDestroy();
        CookieSyncManager.createInstance(getApplicationContext());
        CookieManager.getInstance().removeAllCookie();
    }

    public boolean onKeyDown(int i2, KeyEvent keyEvent) {
        if (this.n || i2 != 4 || !this.f2676e.i()) {
            return super/*android.app.Activity*/.onKeyDown(i2, keyEvent);
        }
        this.f2676e.m();
        return true;
    }

    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        com.showself.ui.h.d.c.e(intent);
    }

    @Override
    protected void onPause() {
        try {
            this.f2676e.getClass().getMethod("onPause", new Class[0]).invoke(this.f2676e, null);
        } catch (Exception e2) {
            e2.printStackTrace();
        }
        super.onPause();
    }

    @Override
    public void onRequestPermissionsResult(int i2, String[] strArr, int[] iArr) {
        super.onRequestPermissionsResult(i2, strArr, iArr);
        com.r.a.a aVar = this.p;
        if (aVar == null || aVar.e(i2, strArr, iArr)) {
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        this.f2676e.r();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    public void refresh(Object... objArr) {
    }

    protected void z(int i2, String str) {
        com.showself.ui.show.g.o(this, i2, str);
        finish();
    }
}