千 千 结 漫 画 v5.08.01版本的 MD5 值为:5a7c0402f1ddab1f936443d048993d8e

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


package cn.ls.points.cpl.view;

import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.b0;
import android.c0;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.d0;
import android.f0;
import android.g0;
import android.graphics.Color;
import android.l0;
import android.n0;
import android.net.Uri;
import android.net.http.SslError;
import android.o0;
import android.os.Build;
import android.r0;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
import android.view.animation.LinearInterpolator;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.DownloadListener;
import android.webkit.JavascriptInterface;
import android.webkit.SslErrorHandler;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.Toast;
import android.x;
import android.z;
import com.kwad.v8.Platform;
import com.tachikoma.core.utility.UriUtil;
import java.io.File;
import java.util.Map;

public class CplView extends FrameLayout {
    public String A;
    public String B;
    public String C;
    public String D;
    public int E;
    public f0 F;
    public g0 G;
    public WebView q;
    public View r;
    public ObjectAnimator s;
    public String t;
    public boolean u;
    public boolean v;
    public boolean w;
    public Map<String, String> x;
    public boolean y;
    public boolean z;

    public class a implements n0.b {

        public class RunnableC0019a implements Runnable {
            public final String q;

            public RunnableC0019a(String str) {
                this.q = str;
            }

            @Override
            public void run() {
                CplView.this.r(this.q);
            }
        }

        public a() {
        }

        @Override
        public void a(String str) {
            if (CplView.this.q != null) {
                CplView.this.q.post(new RunnableC0019a(str));
            }
        }

        @Override
        public void a(boolean z) {
        }
    }

    public class b implements n0.b {
        public final String a;

        public b(String str) {
            this.a = str;
        }

        @Override
        public void a(String str) {
        }

        @Override
        public void a(boolean z) {
            CplView.this.A(this.a);
        }
    }

    public class c implements f0 {

        public class a implements Runnable {
            public final File q;

            public a(File file) {
                this.q = file;
            }

            @Override
            public void run() {
                CplView.this.d(100);
                CplView.this.i(this.q);
            }
        }

        public c() {
        }

        @Override
        public void a(File file, String str) {
            CplView.this.j(new a(file));
        }

        @Override
        public void onError(int i, String str, String str2) {
            if (str2.equals(CplView.this.C)) {
                CplView.this.d(100);
            }
        }

        @Override
        public void onPause(String str) {
            if (str.equals(CplView.this.C)) {
                CplView.this.d(100);
            }
        }

        @Override
        public void onProgress(int i, String str) {
            if (str.equals(CplView.this.C)) {
                CplView.this.d(i);
            }
        }

        @Override
        public void onStart(int i, String str) {
            Toast.makeText(CplView.this.getContext(), "请稍等...", 0).show();
            if (str.equals(CplView.this.C)) {
                CplView.this.d(i);
            }
        }
    }

    public class d implements Runnable {
        public d() {
        }

        @Override
        public void run() {
            if (CplView.this.q != null) {
                CplView.this.q.loadUrl("javascript:UnInstall_Return(1)");
            }
        }
    }

    public class e implements View.OnClickListener {
        public e() {
        }

        @Override
        public void onClick(View view) {
            if (CplView.this.q == null || TextUtils.isEmpty(CplView.this.t)) {
                return;
            }
            CplView.this.y();
            CplView.this.q.reload();
        }
    }

    public class f implements DownloadListener {
        public f() {
        }

        @Override
        public void onDownloadStart(String str, String str2, String str3, String str4, long j) {
            if (CplView.this.getContext() != null) {
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.addCategory("android.intent.category.BROWSABLE");
                intent.setData(Uri.parse(str));
                CplView.this.getContext().startActivity(intent);
            }
        }
    }

    public class g extends WebChromeClient {
        public g() {
        }

        @Override
        public void onProgressChanged(WebView webView, int i) {
            super.onProgressChanged(webView, i);
            if (i != 100) {
                CplView.this.y = true;
                CplView.this.y();
                return;
            }
            CplView.this.y = false;
            CplView.this.C();
            if (CplView.this.G != null) {
                CplView.this.G.e();
            }
        }

        @Override
        public void onReceivedTitle(WebView webView, String str) {
            super.onReceivedTitle(webView, str);
            if (CplView.this.G != null) {
                CplView.this.G.f(str);
            }
        }
    }

    public class h implements Runnable {
        public h() {
        }

        @Override
        public void run() {
            boolean n = x.c().n(CplView.this.getContext(), CplView.this.D);
            l0.a("CheckInstall:" + n);
            WebView webView = CplView.this.q;
            StringBuilder sb = new StringBuilder();
            sb.append("javascript:CheckInstall_Return(");
            sb.append(n ? "1" : "0");
            sb.append(")");
            webView.loadUrl(sb.toString());
        }
    }

    public class i implements Runnable {
        public i() {
        }

        @Override
        public void run() {
            if (CplView.this.G != null) {
                CplView.this.G.b();
            }
        }
    }

    public class j implements Runnable {
        public final int q;

        public j(int i) {
            this.q = i;
        }

        @Override
        public void run() {
            if (CplView.this.q != null) {
                CplView.this.q.loadUrl("javascript:DownloadProgress_Return(" + this.q + ")");
            }
        }
    }

    public class k extends WebViewClient {
        public k() {
        }

        public k(CplView cplView, a aVar) {
            this();
        }

        public final boolean a(String str) {
            String scheme = Uri.parse(str).getScheme();
            return (scheme == null || scheme.contains("http")) ? false : true;
        }

        public final void b(String str) {
            try {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
                intent.setFlags(268435456);
                CplView.this.getContext().startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        @Override
        public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
            sslErrorHandler.proceed();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView webView, String str) {
            if (!str.startsWith("tel:") && !str.startsWith("sms:") && !str.startsWith("mailto:")) {
                if (!a(str)) {
                    return super.shouldOverrideUrlLoading(webView, str);
                }
                if (str.startsWith(UriUtil.FILE_PREFIX)) {
                    webView.loadUrl(str);
                } else {
                    b(str);
                }
                return true;
            }
            try {
                Intent intent = new Intent("android.intent.action.VIEW");
                intent.addFlags(268435456);
                intent.setData(Uri.parse(str));
                CplView.this.getContext().startActivity(intent);
            } catch (ActivityNotFoundException e) {
                e.fillInStackTrace();
            }
            return true;
        }
    }

    public CplView(Context context) {
        this(context, null);
    }

    public CplView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public CplView(Context context, AttributeSet attributeSet, int i2) {
        super(context, attributeSet, i2);
        this.u = false;
        this.v = false;
        this.w = false;
        this.E = z.b;
        this.F = new c();
        View.inflate(context, c0.lib_view_cpl_layout, this);
        c();
        n();
    }

    private Activity getActivity() {
        g0 g0Var = this.G;
        return (g0Var == null || g0Var.a() == null) ? o0.s().g(getContext()) : this.G.a();
    }

    private String getCustomParams() {
        Map<String, String> map = this.x;
        if (map == null || map.size() <= 0) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        for (Map.Entry<String, String> entry : this.x.entrySet()) {
            sb.append("&" + entry.getKey() + "=" + entry.getValue());
        }
        return sb.toString();
    }

    private String getUserid() {
        return o0.s().w();
    }

    public final void A(String str) {
        x.c().i(str, getContext());
    }

    public final void C() {
        ObjectAnimator objectAnimator = this.s;
        if (objectAnimator != null) {
            objectAnimator.cancel();
        }
        View view = this.r;
        if (view != null) {
            view.clearAnimation();
            this.r.setRotation(0.0f);
        }
    }

    @JavascriptInterface
    public void CheckInstall(String str) {
        l0.a("CheckInstall:" + str);
        if (TextUtils.isEmpty(str) || this.q == null) {
            return;
        }
        this.D = str;
        j(new h());
    }

    @JavascriptInterface
    public void CurrentPagerApp(String str) {
        l0.a("CurrentPagerApp:" + str);
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.C = str;
    }

    public final String D() {
        StringBuilder sb = new StringBuilder();
        sb.append("&title=");
        sb.append((this.w || this.u) ? "0" : "1");
        return sb.toString();
    }

    public final String F() {
        StringBuilder sb = new StringBuilder();
        sb.append("&is_app=");
        sb.append(this.v ? "1" : "0");
        return sb.toString();
    }

    public void G() {
        y();
        n0.b().d(getActivity(), new a());
    }

    public void H(int i2, int i3, Intent intent) {
        n0.b().e(getContext(), i2, i3, intent);
    }

    public void I() {
        C();
        n0.b().n();
        x.c().l();
        x.c().o();
        WebView webView = this.q;
        if (webView != null) {
            webView.destroy();
        }
    }

    @JavascriptInterface
    public void InstallApp(String str) {
        l0.a("InstallApp:" + str);
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.C = str;
        i(null);
    }

    public void J() {
        WebView webView = this.q;
        if (webView != null) {
            webView.onPause();
        }
    }

    public void K(int i2, String[] strArr, int[] iArr) {
        n0.b().f(getContext(), i2, strArr, iArr);
    }

    public void L() {
        WebView webView = this.q;
        if (webView != null) {
            webView.onResume();
        }
        if (TextUtils.isEmpty(this.D)) {
            return;
        }
        if (x.c().n(getContext(), this.D)) {
            d(100);
        } else if (this.z) {
            this.z = false;
            this.q.post(new d());
        }
    }

    @JavascriptInterface
    public void OpenApp(String str) {
        l0.a("OpenApp:" + str);
        if (TextUtils.isEmpty(str)) {
            return;
        }
        this.D = str;
        if (x.c().n(getContext(), this.D)) {
            x.c().p(getContext(), this.D);
        }
    }

    @JavascriptInterface
    public void SdkBackPressed() {
        j(new i());
    }

    @JavascriptInterface
    public void SdkClose() {
        g0 g0Var = this.G;
        if (g0Var != null) {
            g0Var.d();
        }
    }

    @JavascriptInterface
    public void UnInstallApp(String str) {
        l0.a("UnInstallApp:" + str);
        this.z = true;
        if (TextUtils.isEmpty(str) || !n0.b().h(getContext(), "android.permission.REQUEST_DELETE_PACKAGES")) {
            return;
        }
        try {
            Intent intent = new Intent("android.intent.action.DELETE");
            intent.setData(Uri.parse("package:" + str));
            intent.addFlags(268435456);
            getContext().startActivity(intent);
        } catch (Throwable th) {
            th.printStackTrace();
        }
    }

    public final String b(String str, String str2, String str3, long j2, String str4, String str5) {
        StringBuilder sb;
        if ("2".equals(str)) {
            sb = new StringBuilder();
            sb.append("app_id=");
            sb.append(o0.s().m());
            sb.append("&deviceid=");
            sb.append(str3);
            sb.append("&timestamp=");
            sb.append(j2);
            sb.append("&sign=");
            sb.append(str4);
            sb.append("&type=2&androidosv=");
            sb.append(Build.VERSION.SDK_INT);
        } else {
            sb = new StringBuilder();
            sb.append("app_id=");
            sb.append(o0.s().m());
            sb.append("&userid=");
            sb.append(str2);
            sb.append("&deviceid=");
            sb.append(str3);
            sb.append("&timestamp=");
            sb.append(j2);
            sb.append("&androidosv=");
            sb.append(Build.VERSION.SDK_INT);
            sb.append("&sign=");
            sb.append(str4);
        }
        sb.append("&sdk_version=");
        sb.append(o0.s().x());
        sb.append("&imeis=");
        sb.append(str5);
        sb.append(F());
        sb.append(u());
        sb.append(D());
        sb.append("&is_sdk=1");
        sb.append(getCustomParams());
        return sb.toString();
    }

    public final void c() {
        findViewById(b0.lib_refresh).setOnClickListener(new e());
        this.r = findViewById(b0.lib_ic_refresh);
    }

    public final void d(int i2) {
        if (this.q == null || s()) {
            return;
        }
        this.q.post(new j(i2));
    }

    public WebView getWebView() {
        return this.q;
    }

    public final void i(File file) {
        if (file != null && file.exists()) {
            x.c().m(getContext(), file);
            return;
        }
        if (x.c().n(getContext(), this.D)) {
            x.c().p(getContext(), this.D);
            return;
        }
        if (TextUtils.isEmpty(this.C)) {
            Toast.makeText(getContext(), "地址为空", 0).show();
        } else if (x.c().j(getContext(), this.C)) {
            i(new File(x.c().f(this.C).getAbsolutePath()));
        } else {
            w(this.C);
        }
    }

    public final void j(Runnable runnable) {
        post(runnable);
    }

    public final void k(String str) {
        TextView textView = new TextView(getContext());
        textView.setBackgroundColor(Color.parseColor("#FFFFFF"));
        textView.setTextSize(1, 16.0f);
        textView.setTextColor(Color.parseColor("#666666"));
        textView.setGravity(17);
        textView.setText(str);
        addView(textView, new FrameLayout.LayoutParams(-1, -1));
        g0 g0Var = this.G;
        if (g0Var != null) {
            g0Var.c(str);
        }
    }

    @SuppressLint({"JavascriptInterface"})
    public final void n() {
        WebView webView = (WebView) findViewById(b0.lib_web);
        this.q = webView;
        WebSettings settings = webView.getSettings();
        settings.setJavaScriptEnabled(true);
        settings.setUseWideViewPort(true);
        settings.setLoadWithOverviewMode(true);
        settings.setSupportZoom(true);
        settings.setBuiltInZoomControls(true);
        settings.setDisplayZoomControls(false);
        settings.setCacheMode(1);
        settings.setAllowFileAccess(true);
        settings.setJavaScriptCanOpenWindowsAutomatically(true);
        settings.setLoadsImagesAutomatically(true);
        settings.setDefaultTextEncodingName(com.anythink.expressad.foundation.f.a.F);
        if (Build.VERSION.SDK_INT >= 21) {
            settings.setMixedContentMode(0);
        }
        settings.setDomStorageEnabled(true);
        settings.setDatabaseEnabled(true);
        this.q.setDownloadListener(new f());
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptCookie(true);
        if (Build.VERSION.SDK_INT >= 21) {
            cookieManager.setAcceptThirdPartyCookies(this.q, true);
        }
        CookieSyncManager.createInstance(getContext());
        CookieSyncManager.getInstance().sync();
        this.q.addJavascriptInterface(this, Platform.ANDROID);
        this.q.setWebViewClient(new k(this, null));
        this.q.setWebChromeClient(new g());
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        x.c().d(this.F);
    }

    @Override
    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        C();
        x.c().o();
    }

    public final void p(String str) {
        this.t = str;
        x.c().d(this.F);
        l0.a("open-->url:" + this.t);
        y();
        WebView webView = this.q;
        if (webView != null) {
            webView.loadUrl(this.t);
        }
    }

    public final void r(String str) {
        String a2;
        StringBuilder sb;
        StringBuilder sb2;
        String userid;
        String str2;
        String userid2;
        String str3;
        String str4;
        String sb3;
        String str5;
        this.B = str;
        long currentTimeMillis = System.currentTimeMillis();
        String j2 = n0.b().j(getContext());
        l0.a("open-->\naction:" + this.E + "\nimei:" + this.B + "\nimeis:" + j2 + "\nuid:" + getUserid() + "\naid:" + this.A + "\nis_fragment:" + this.u + "\nis_app:" + this.v);
        String m = o0.s().m();
        String u = o0.s().u();
        if (TextUtils.isEmpty(m)) {
            str5 = "请先调用初始化接口并传入apid !";
        } else {
            if (!TextUtils.isEmpty(u)) {
                if (TextUtils.isEmpty(getUserid())) {
                    a2 = r0.a(o0.s().m() + str + currentTimeMillis + o0.s().u());
                    int i2 = z.b;
                    int i3 = this.E;
                    if (i2 != i3) {
                        if (z.c != i3) {
                            if (z.d == i3) {
                                sb = new StringBuilder();
                                sb.append("http://dz.down5g.com/search?");
                            }
                            str4 = "未知的事件类型,事件类型请参阅LSSDK常量申明";
                            k(str4);
                            return;
                        }
                        if (!TextUtils.isEmpty(this.A)) {
                            sb2 = new StringBuilder();
                            sb2.append("http://dz.down5g.com/detail?");
                            userid = getUserid();
                            str2 = "2";
                            sb2.append(b(str2, userid, str, currentTimeMillis, a2, j2));
                            sb2.append("&ad_id=");
                            sb2.append(this.A);
                            sb3 = sb2.toString();
                            p(sb3);
                            return;
                        }
                        str4 = "未知的广告ID!请检查参数传入!";
                        k(str4);
                        return;
                    }
                    sb = new StringBuilder();
                    sb.append("http://dz.down5g.com/list?");
                    userid2 = getUserid();
                    str3 = "2";
                    sb.append(b(str3, userid2, str, currentTimeMillis, a2, j2));
                    sb3 = sb.toString();
                    p(sb3);
                    return;
                }
                a2 = r0.a(o0.s().m() + getUserid() + str + currentTimeMillis + o0.s().u());
                int i4 = z.b;
                int i5 = this.E;
                if (i4 != i5) {
                    if (z.c != i5) {
                        if (z.d == i5) {
                            sb = new StringBuilder();
                            sb.append("http://dz.down5g.com/search?");
                        }
                        str4 = "未知的事件类型,事件类型请参阅LSSDK常量申明";
                        k(str4);
                        return;
                    }
                    if (!TextUtils.isEmpty(this.A)) {
                        sb2 = new StringBuilder();
                        sb2.append("http://dz.down5g.com/detail?");
                        userid = getUserid();
                        str2 = "1";
                        sb2.append(b(str2, userid, str, currentTimeMillis, a2, j2));
                        sb2.append("&ad_id=");
                        sb2.append(this.A);
                        sb3 = sb2.toString();
                        p(sb3);
                        return;
                    }
                    str4 = "未知的广告ID!请检查参数传入!";
                    k(str4);
                    return;
                }
                sb = new StringBuilder();
                sb.append("http://dz.down5g.com/list?");
                userid2 = getUserid();
                str3 = "1";
                sb.append(b(str3, userid2, str, currentTimeMillis, a2, j2));
                sb3 = sb.toString();
                p(sb3);
                return;
            }
            str5 = "请先调用初始化接口并传入secretKey !";
        }
        k(str5);
    }

    public final boolean s() {
        if (getActivity() == null) {
            return true;
        }
        return getActivity().isFinishing();
    }

    public void setAction(int i2) {
        this.E = i2;
    }

    public void setAdid(String str) {
        this.A = str;
    }

    public void setCustomParams(Map<String, String> map) {
        this.x = map;
    }

    public void setDownloadEngine(d0 d0Var) {
        z.a().a(d0Var);
    }

    public void setIsFragment(boolean z) {
        this.u = z;
    }

    public void setOnPagerStatusListener(g0 g0Var) {
        this.G = g0Var;
    }

    public boolean t() {
        WebView webView = this.q;
        if (webView == null || !webView.canGoBack()) {
            return true;
        }
        this.q.goBack();
        return false;
    }

    public final String u() {
        StringBuilder sb = new StringBuilder();
        sb.append("&is_fragment=");
        sb.append(this.u ? "1" : "0");
        return sb.toString();
    }

    public final void w(String str) {
        if (n0.b().h(getContext(), "android.permission.WRITE_EXTERNAL_STORAGE")) {
            n0.b().l(getActivity(), new b(str));
        } else {
            A(str);
        }
    }

    public void x() {
        this.v = true;
    }

    public final void y() {
        View view = this.r;
        if (view == null) {
            return;
        }
        if (this.s == null) {
            ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, (Property<View, Float>) View.ROTATION, 0.0f, 360.0f);
            ofFloat.setRepeatCount(-1);
            ofFloat.setDuration(1000L);
            ofFloat.setInterpolator(new LinearInterpolator());
            this.s = ofFloat;
        }
        if (this.s.isRunning()) {
            return;
        }
        this.s.start();
    }
}