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


package com.duoyou.task.pro.d;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import com.baidu.idl.face.platform.FaceEnvironment;
import com.duoyou.task.pro.c.c;
import com.duoyou.task.pro.g.b;
import java.io.File;
import org.json.JSONObject;

public class e extends a {
    public WebView b;
    public Activity c;
    public View d;
    public View e;
    public ImageView f;
    public ProgressBar g;

    public class a {

        /* renamed from: com.duoyou.task.pro.d.e$a$a  reason: collision with other inner class name */
        public class RunnableC0043a implements Runnable {
            public final /* synthetic */ String a;

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

            public void run() {
                com.duoyou.task.pro.c.b bVar;
                try {
                    JSONObject jSONObject = new JSONObject(this.a);
                    bVar = new com.duoyou.task.pro.c.b();
                    bVar.a = jSONObject.optString("package_url");
                    bVar.b = jSONObject.optString("package_name");
                } catch (Exception e) {
                    e.printStackTrace();
                    bVar = null;
                }
                if (bVar == null) {
                    com.duoyou.task.pro.b.a.k(e.this.getContext(), "JSON格式解析失败");
                } else {
                    com.duoyou.task.pro.c.a.a().a(e.this.getContext(), bVar, new C0044a(bVar));
                }
            }

            /* renamed from: com.duoyou.task.pro.d.e$a$a$a  reason: collision with other inner class name */
            public class C0044a extends c {
                public final /* synthetic */ com.duoyou.task.pro.c.b a;

                public C0044a(com.duoyou.task.pro.c.b bVar) {
                    this.a = bVar;
                }

                @Override // com.duoyou.task.pro.c.c
                public void a(int i, long j, long j2, long j3) {
                    e.this.a(String.format("onProgress('%s', %d)", this.a.a, Integer.valueOf(i)));
                }

                @Override // com.duoyou.task.pro.c.c
                public void a(String str, String str2) {
                    com.duoyou.task.pro.b.a.k(e.this.getContext(), str2);
                }

                @Override // com.duoyou.task.pro.c.c
                /* renamed from: a */
                public void onSuccess(File file) {
                    e.this.a(String.format("onProgress('%s', %d)", this.a.a, 100));
                }
            }
        }

        public class b implements Runnable {
            public final /* synthetic */ String a;

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

            public void run() {
                if (TextUtils.isEmpty(this.a)) {
                    e.this.dismiss();
                    e.this.a.finish();
                    return;
                }
                try {
                    if (this.a.contains("://")) {
                        e.this.a.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(this.a)));
                        return;
                    }
                    Activity activity = e.this.a;
                    try {
                        Intent launchIntentForPackage = activity.getPackageManager().getLaunchIntentForPackage(this.a);
                        launchIntentForPackage.setFlags(270663680);
                        activity.startActivity(launchIntentForPackage);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
        }

        public a() {
        }

        @JavascriptInterface
        public void close() {
            e.this.dismiss();
        }

        @JavascriptInterface
        public void download(String str) {
            e.this.c.runOnUiThread(new RunnableC0043a(str));
        }

        @JavascriptInterface
        public void launchApp(String str) {
            e.this.c.runOnUiThread(new b(str));
        }
    }

    public e(Activity activity) {
        super(activity);
        this.c = activity;
    }

    public void a(String str) {
        if (Build.VERSION.SDK_INT >= 19) {
            WebView webView = this.b;
            webView.evaluateJavascript("javascript:" + str, null);
            return;
        }
        WebView webView2 = this.b;
        webView2.loadUrl("javascript:" + str);
    }

    public void onCreate(Bundle bundle) {
        WebView webView;
        int i;
        Context context;
        super.onCreate(bundle);
        setContentView(com.duoyou.task.pro.b.a.c(getContext(), "dy_helper_float_panel_layout"));
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        attributes.width = com.duoyou.task.pro.b.a.f(getContext());
        attributes.height = com.duoyou.task.pro.b.a.e(getContext());
        getWindow().setAttributes(attributes);
        getWindow().setBackgroundDrawable(new ColorDrawable());
        this.b = (WebView) findViewById(com.duoyou.task.pro.b.a.b(getContext(), "dy_web_view"));
        this.d = findViewById(com.duoyou.task.pro.b.a.b(getContext(), "dy_root_layout"));
        this.e = findViewById(com.duoyou.task.pro.b.a.b(getContext(), "dy_parent_layout"));
        this.g = (ProgressBar) findViewById(com.duoyou.task.pro.b.a.b(getContext(), "dy_progress_bar"));
        this.f = (ImageView) findViewById(com.duoyou.task.pro.b.a.b(getContext(), "dy_helper_loading_iv"));
        com.duoyou.task.pro.b.a.a(this.c, this.b);
        this.b.addJavascriptInterface(new a(), "dyhelper");
        this.g.setProgressDrawable(new ClipDrawable(new ColorDrawable(-22016), 3, 1));
        if (this.e != null) {
            try {
                int i2 = this.a.getResources().getConfiguration().orientation;
                RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.e.getLayoutParams();
                int a2 = com.duoyou.task.pro.b.a.a(getContext(), 14.0f);
                if (i2 == 2) {
                    layoutParams.width = (com.duoyou.task.pro.b.a.f(getContext()) * 4) / 7;
                    layoutParams.height = -1;
                    layoutParams.topMargin = a2;
                    layoutParams.bottomMargin = a2;
                    layoutParams.leftMargin = a2;
                    layoutParams.addRule(9);
                    webView = this.b;
                } else {
                    if (i2 == 1) {
                        int e2 = com.duoyou.task.pro.b.a.e(getContext());
                        layoutParams.width = -1;
                        layoutParams.height = (e2 * 4) / 7;
                        layoutParams.leftMargin = a2;
                        layoutParams.rightMargin = a2;
                        try {
                            Resources resources = getContext().getResources();
                            i = resources.getDimensionPixelSize(resources.getIdentifier("status_bar_height", "dimen", FaceEnvironment.OS));
                        } catch (Exception e3) {
                            e3.printStackTrace();
                            i = com.duoyou.task.pro.b.a.a(context, 20.0f);
                        }
                        layoutParams.bottomMargin = a2 + i;
                        layoutParams.addRule(12);
                        webView = this.b;
                    }
                    this.e.setLayoutParams(layoutParams);
                }
                webView.getSettings().setTextZoom(120);
                this.e.setLayoutParams(layoutParams);
            } catch (Exception e4) {
                e4.printStackTrace();
            }
        }
        this.b.loadUrl(b.a(getContext(), "https://h5.ads66.com/ball").concat("&from_source=dy_task_sdk"));
        this.d.setOnClickListener(new b(this));
        this.b.setWebChromeClient(new c(this));
        this.b.setWebViewClient(new d(this));
    }
}