导航菜单

页面标题

页面副标题

饼干视频 v4.1.0 - f.java 源代码

正在查看: 饼干视频 v4.1.0 应用的 f.java JAVA 源代码文件

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


package com.octopus.ad.internal.view;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.provider.CalendarContract;
import android.util.Pair;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.octopus.ad.AdActivity;
import com.octopus.ad.R;
import com.octopus.ad.internal.utilities.HaoboLog;
import com.octopus.ad.internal.utilities.StringUtil;
import com.octopus.ad.internal.utilities.ViewUtil;
import com.octopus.ad.internal.utilities.W3CEvent;
import com.octopus.ad.internal.view.AdWebView;
import com.sigmob.sdk.base.mta.PointCategory;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Iterator;

@SuppressLint({"InlinedApi"})
public class f {
    public static final String[] a = {"default", "expanded"};
    public final AdWebView b;
    public int e;
    public int f;
    public boolean i;
    private int k;
    private int l;
    private Activity m;
    private ViewGroup n;
    private int p;
    private boolean j = false;
    public boolean c = false;
    public boolean d = false;
    public boolean g = false;
    public boolean h = false;
    private int[] o = new int[4];
    private boolean q = false;
    private g r = null;

    public static class AnonymousClass4 {
        public static final int[] a;

        static {
            int[] iArr = new int[AdActivity.b.values().length];
            a = iArr;
            try {
                iArr[AdActivity.b.landscape.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[AdActivity.b.portrait.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
            try {
                a[AdActivity.b.none.ordinal()] = 3;
            } catch (NoSuchFieldError unused3) {
            }
        }
    }

    public enum a {
        top_left,
        top_right,
        center,
        bottom_left,
        bottom_right,
        top_center,
        bottom_center
    }

    public enum b {
        STARTING_DEFAULT,
        STARTING_EXPANDED
    }

    public f(AdWebView adWebView) {
        this.b = adWebView;
    }

    private void c(ArrayList<Pair<String, String>> arrayList) {
        Iterator<Pair<String, String>> it = arrayList.iterator();
        String str = null;
        while (it.hasNext()) {
            Pair<String, String> next = it.next();
            if (((String) next.first).equals("uri")) {
                str = Uri.decode((String) next.second);
            }
        }
        if (StringUtil.isEmpty(str)) {
            return;
        }
        this.b.b(str);
        this.b.g();
    }

    private void d(ArrayList<Pair<String, String>> arrayList) {
        Iterator<Pair<String, String>> it = arrayList.iterator();
        String str = null;
        while (it.hasNext()) {
            Pair<String, String> next = it.next();
            if (((String) next.first).equals("uri")) {
                str = (String) next.second;
            }
        }
        if (str == null) {
            HaoboLog.d(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.store_picture_error));
            return;
        }
        final String decode = Uri.decode(str);
        AlertDialog.Builder builder = new AlertDialog.Builder(ViewUtil.getTopContext(this.b));
        builder.setTitle(R.string.store_picture_title);
        builder.setMessage(R.string.store_picture_message);
        builder.setPositiveButton(R.string.store_picture_accept, new DialogInterface.OnClickListener() {
            @Override
            @android.annotation.SuppressLint({"NewApi"})
            public void onClick(android.content.DialogInterface r7, int r8) {
                throw new UnsupportedOperationException("Method not decompiled: com.octopus.ad.internal.view.f.AnonymousClass2.onClick(android.content.DialogInterface, int):void");
            }
        });
        builder.setNegativeButton(R.string.store_picture_decline, new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialogInterface, int i) {
            }
        });
        builder.create().show();
    }

    private void e() {
        Activity activity = (Activity) this.b.getContextFromMutableContext();
        int[] iArr = new int[2];
        this.b.getLocationOnScreen(iArr);
        iArr[1] = iArr[1] - activity.getWindow().findViewById(android.R.id.content).getTop();
        this.b.measure(0, 0);
        int[] iArr2 = {this.b.getMeasuredWidth(), this.b.getMeasuredHeight()};
        ViewUtil.convertFromPixelsToDP(activity, iArr2);
        this.b.c(String.format("javascript:window.mraid.util.setDefaultPosition(%d, %d, %d, %d)", Integer.valueOf(iArr[0]), Integer.valueOf(iArr[1]), Integer.valueOf(iArr2[0]), Integer.valueOf(iArr2[1])));
    }

    private void f(java.util.ArrayList<android.util.Pair<java.lang.String, java.lang.String>> r2) {
        throw new UnsupportedOperationException("Method not decompiled: com.octopus.ad.internal.view.f.f(java.util.ArrayList):void");
    }

    private void g(ArrayList<Pair<String, String>> arrayList) {
        AdActivity.b bVar = AdActivity.b.none;
        Iterator<Pair<String, String>> it = arrayList.iterator();
        int i = 1;
        boolean z = true;
        while (it.hasNext()) {
            Pair<String, String> next = it.next();
            if (((String) next.first).equals("allow_orientation_change")) {
                z = Boolean.parseBoolean((String) next.second);
            } else if (((String) next.first).equals("force_orientation")) {
                bVar = a((String) next.second);
            }
        }
        if (this.c || this.b.a.k()) {
            AdWebView adWebView = this.b;
            Activity c = adWebView.d ? c() : (Activity) ViewUtil.getTopContext(adWebView);
            if (z) {
                AdActivity.b(c);
                return;
            }
            int i2 = AnonymousClass4.a[bVar.ordinal()];
            if (i2 == 1) {
                i = 2;
            } else if (i2 != 2) {
                i = 0;
            }
            AdActivity.a(c, i);
        }
    }

    private void h(ArrayList<Pair<String, String>> arrayList) {
        Iterator<Pair<String, String>> it = arrayList.iterator();
        int i = 0;
        int i2 = -1;
        boolean z = true;
        int i3 = 0;
        String str = "top-right";
        int i4 = -1;
        while (it.hasNext()) {
            Pair<String, String> next = it.next();
            try {
                if (((String) next.first).equals("w")) {
                    i2 = Integer.parseInt((String) next.second);
                } else if (((String) next.first).equals("h")) {
                    i4 = Integer.parseInt((String) next.second);
                } else if (((String) next.first).equals("offset_x")) {
                    i = Integer.parseInt((String) next.second);
                } else if (((String) next.first).equals("offset_y")) {
                    i3 = Integer.parseInt((String) next.second);
                } else if (((String) next.first).equals("custom_close_position")) {
                    str = (String) next.second;
                } else if (((String) next.first).equals("allow_offscreen")) {
                    z = Boolean.parseBoolean((String) next.second);
                }
            } catch (NumberFormatException unused) {
                HaoboLog.d(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.number_format));
                return;
            }
        }
        if (i2 > this.k && i4 > this.l) {
            this.b.c("javascript:mraid.util.errorEvent('Resize called with resizeProperties larger than the screen.', 'mraid.resize()')");
            return;
        }
        a aVar = a.top_right;
        try {
            aVar = a.valueOf(str.replace('-', '_'));
        } catch (IllegalArgumentException unused2) {
        }
        int i5 = i2;
        int i6 = i4;
        int i7 = i;
        int i8 = i3;
        boolean z2 = z;
        HaoboLog.d(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.resize, i5, i6, i7, i8, str, z2));
        this.b.a(i5, i6, i7, i8, aVar, z2);
        this.b.g();
        this.b.c("javascript:window.mraid.util.stateChangeEvent('resized');");
        this.d = true;
    }

    public void b(ArrayList<Pair<String, String>> arrayList) {
        AdActivity.b bVar = AdActivity.b.none;
        Iterator<Pair<String, String>> it = arrayList.iterator();
        String str = null;
        final AdActivity.b bVar2 = bVar;
        final boolean z = true;
        int i = -1;
        int i2 = -1;
        boolean z2 = false;
        while (it.hasNext()) {
            Pair<String, String> next = it.next();
            if (((String) next.first).equals("w")) {
                try {
                    i = Integer.parseInt((String) next.second);
                } catch (NumberFormatException unused) {
                }
            } else if (((String) next.first).equals("h")) {
                i2 = Integer.parseInt((String) next.second);
            } else if (((String) next.first).equals("useCustomClose")) {
                z2 = Boolean.parseBoolean((String) next.second);
            } else if (((String) next.first).equals("url")) {
                str = Uri.decode((String) next.second);
            } else if (((String) next.first).equals("allow_orientation_change")) {
                z = Boolean.parseBoolean((String) next.second);
            } else if (((String) next.first).equals("force_orientation")) {
                bVar2 = a((String) next.second);
            }
        }
        if (StringUtil.isEmpty(str)) {
            this.b.a(i, i2, z2, this, z, bVar2);
        } else {
            try {
                g gVar = new g(this.b.a, this);
                this.r = gVar;
                gVar.a(str);
                this.b.a.a(this.r.getMRAIDImplementation(), z2, new AdWebView.b() {
                    @Override
                    public void a() {
                        if (f.this.c() != null) {
                            f.this.r.a(f.this.c(), z, bVar2);
                            AdViewImpl.setMRAIDFullscreenListener(null);
                        }
                    }
                });
            } catch (Exception e) {
                HaoboLog.e(HaoboLog.baseLogTag, "Exception initializing the redirect webview: " + e.getMessage());
            }
        }
        this.b.c("javascript:window.mraid.util.stateChangeEvent('expanded');");
        this.c = true;
        if (this.b.a.k()) {
            return;
        }
        this.b.a.getAdDispatcher().b();
    }

    public void a(AdWebView adWebView, String str) {
        if (this.j) {
            return;
        }
        String str2 = this.b.a.j() ? "inline" : "interstitial";
        boolean equals = str.equals(a[b.STARTING_EXPANDED.ordinal()]);
        this.q = equals;
        this.b.d = equals;
        adWebView.c("javascript:window.mraid.util.setPlacementType('" + str2 + "')");
        if (!this.q) {
            a(adWebView);
            g();
            f();
            e();
        }
        this.b.p();
        adWebView.c("javascript:window.mraid.util.stateChangeEvent('" + str + "')");
        adWebView.c("javascript:window.mraid.util.readyEvent();");
        this.e = this.b.getLayoutParams().width;
        this.f = this.b.getLayoutParams().height;
        this.j = true;
        a(this.b.q());
    }

    public Activity c() {
        return this.m;
    }

    private void f() {
        if (this.b.getContextFromMutableContext() instanceof Activity) {
            Activity activity = (Activity) this.b.getContextFromMutableContext();
            int[] screenSizeAsPixels = ViewUtil.getScreenSizeAsPixels(activity);
            int i = screenSizeAsPixels[0];
            int top = screenSizeAsPixels[1] - activity.getWindow().findViewById(android.R.id.content).getTop();
            float f = activity.getResources().getDisplayMetrics().density;
            int i2 = (int) ((top / f) + 0.5f);
            int i3 = (int) ((i / f) + 0.5f);
            this.b.c("javascript:window.mraid.util.setMaxSize(" + i3 + ", " + i2 + ")");
        }
    }

    private void e(ArrayList<Pair<String, String>> arrayList) {
        Iterator<Pair<String, String>> it = arrayList.iterator();
        String str = null;
        while (it.hasNext()) {
            Pair<String, String> next = it.next();
            if (((String) next.first).equals("uri")) {
                str = (String) next.second;
            }
        }
        if (str == null) {
            HaoboLog.d(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.play_vide_no_uri));
            return;
        }
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setFlags(268435456);
        try {
            intent.setDataAndType(Uri.parse(URLDecoder.decode(str, "UTF-8")), "video/mp4");
            try {
                this.b.getContext().startActivity(intent);
                this.b.g();
            } catch (ActivityNotFoundException unused) {
            }
        } catch (UnsupportedEncodingException unused2) {
            HaoboLog.d(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.unsupported_encoding));
        }
    }

    private void g() {
        if (this.b.getContextFromMutableContext() instanceof Activity) {
            int[] screenSizeAsDP = ViewUtil.getScreenSizeAsDP((Activity) this.b.getContextFromMutableContext());
            this.k = screenSizeAsDP[0];
            this.l = screenSizeAsDP[1];
            this.b.c("javascript:window.mraid.util.setScreenSize(" + this.k + ", " + this.l + ")");
        }
    }

    public ViewGroup d() {
        return this.n;
    }

    private void a(AdWebView adWebView, String str, boolean z) {
        adWebView.c(String.format("javascript:window.mraid.util.setSupports('%s', %s)", str, String.valueOf(z)));
    }

    @SuppressLint({"NewApi"})
    private void a(AdWebView adWebView) {
        if (a(new Intent("android.intent.action.VIEW", Uri.parse("sms:5555555555")))) {
            a(adWebView, "sms", true);
        }
        if (a(new Intent("android.intent.action.VIEW", Uri.parse("tel:5555555555")))) {
            a(adWebView, "tel", true);
        }
        if (a(new Intent("android.intent.action.EDIT").setData(CalendarContract.Events.CONTENT_URI))) {
            a(adWebView, "calendar", true);
            this.h = true;
        } else if (a(new Intent("android.intent.action.EDIT").setType(com.sigmob.sdk.mraid.i.a))) {
            a(adWebView, "calendar", true);
            this.h = true;
            W3CEvent.useMIME = true;
        }
        if (this.b.getContext().getPackageManager().checkPermission("android.permission.WRITE_EXTERNAL_STORAGE", this.b.getContext().getPackageName()) == 0) {
            a(adWebView, "storePicture", true);
            this.g = true;
        }
        a(adWebView, "inlineVideo", true);
    }

    public void b() {
        boolean q = this.b.q();
        if (this.i != q) {
            a(q);
        }
    }

    public boolean a(Intent intent) {
        return this.b.getContext().getPackageManager().queryIntentActivities(intent, 0).size() > 0;
    }

    public void a(boolean z) {
        if (this.j) {
            this.i = z;
            this.b.c("javascript:window.mraid.util.setIsViewable(" + z + ")");
        }
    }

    public void a(int i, int i2, int i3, int i4) {
        int[] iArr = this.o;
        if (iArr[0] == i && iArr[1] == i2 && iArr[2] == i3 && iArr[3] == i4) {
            return;
        }
        iArr[0] = i;
        iArr[1] = i2;
        iArr[2] = i3;
        iArr[3] = i4;
        Activity activity = (Activity) this.b.getContextFromMutableContext();
        int[] iArr2 = {i, i2 - activity.getWindow().findViewById(android.R.id.content).getTop(), i3, i4};
        ViewUtil.convertFromPixelsToDP(activity, iArr2);
        int i5 = iArr2[0];
        int i6 = iArr2[1];
        int i7 = iArr2[2];
        int i8 = iArr2[3];
        this.b.c(String.format("javascript:window.mraid.util.setCurrentPosition(%d, %d, %d, %d)", Integer.valueOf(i5), Integer.valueOf(i6), Integer.valueOf(i7), Integer.valueOf(i8)));
        this.b.c(String.format("javascript:window.mraid.util.sizeChangeEvent(%d, %d)", Integer.valueOf(i7), Integer.valueOf(i8)));
    }

    public void a() {
        if (!this.c && !this.d && !this.q) {
            if (this.b.a.k()) {
                this.b.a.getAdDispatcher().a();
                Activity activity = (Activity) this.b.getContextFromMutableContext();
                if (activity == null || activity.isFinishing() || !(activity instanceof AdActivity)) {
                    return;
                }
                activity.finish();
                return;
            }
            this.b.n();
            return;
        }
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(this.b.getLayoutParams());
        layoutParams.height = this.f;
        layoutParams.width = this.e;
        layoutParams.gravity = 17;
        this.b.setLayoutParams(layoutParams);
        this.b.o();
        this.b.c("javascript:window.mraid.util.stateChangeEvent('default');");
        if (!this.b.a.k() && !this.q) {
            this.b.a.getAdDispatcher().a();
        }
        Activity activity2 = (Activity) this.b.getContextFromMutableContext();
        if (activity2 != null) {
            activity2.setRequestedOrientation(-1);
        }
        this.c = false;
        this.d = false;
        this.r = null;
    }

    public void a(ArrayList<Pair<String, String>> arrayList) {
        this.b.setMRAIDUseCustomClose(Boolean.parseBoolean((String) arrayList.get(0).second));
    }

    public void a(String str, boolean z) {
        String replaceFirst = str.replaceFirst("mraid://", "");
        String[] split = replaceFirst.split("\\?");
        String replaceAll = split[0].replaceAll("/", "");
        ArrayList<Pair<String, String>> arrayList = new ArrayList<>();
        if (split.length > 1) {
            for (String str2 : replaceFirst.substring(replaceFirst.indexOf("?") + 1).split("&")) {
                String[] split2 = str2.split("=");
                if (split2.length >= 2 && !StringUtil.isEmpty(split2[1]) && !"undefined".equals(split2[1])) {
                    arrayList.add(new Pair<>(split2[0], split2[1]));
                }
            }
        }
        if (replaceAll.equals("expand")) {
            if (z) {
                b(arrayList);
                return;
            } else {
                HaoboLog.w(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.no_user_interaction, replaceFirst));
                return;
            }
        }
        if (replaceAll.equals(PointCategory.CLOSE)) {
            a();
            return;
        }
        if (replaceAll.equals("resize")) {
            if (z) {
                h(arrayList);
                return;
            } else {
                HaoboLog.w(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.no_user_interaction, replaceFirst));
                return;
            }
        }
        if (replaceAll.equals("setOrientationProperties")) {
            g(arrayList);
            return;
        }
        if (this.h && replaceAll.equals("createCalendarEvent")) {
            if (z) {
                f(arrayList);
                return;
            } else {
                HaoboLog.w(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.no_user_interaction, replaceFirst));
                return;
            }
        }
        if (replaceAll.equals("playVideo")) {
            if (z) {
                e(arrayList);
                return;
            } else {
                HaoboLog.w(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.no_user_interaction, replaceFirst));
                return;
            }
        }
        if (this.g && replaceAll.equals("storePicture")) {
            if (z) {
                d(arrayList);
                return;
            } else {
                HaoboLog.w(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.no_user_interaction, replaceFirst));
                return;
            }
        }
        if (replaceAll.equals("open")) {
            if (z) {
                c(arrayList);
                return;
            } else {
                HaoboLog.w(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.no_user_interaction, replaceFirst));
                return;
            }
        }
        if (replaceAll.equals("setUseCustomClose")) {
            a(arrayList);
        } else {
            if (replaceAll.equals("enable")) {
                return;
            }
            HaoboLog.d(HaoboLog.mraidLogTag, HaoboLog.getString(R.string.unsupported_mraid, replaceAll));
        }
    }

    private AdActivity.b a(String str) {
        AdActivity.b bVar = AdActivity.b.none;
        if (str.equals("landscape")) {
            return AdActivity.b.landscape;
        }
        return str.equals("portrait") ? AdActivity.b.portrait : bVar;
    }

    public void a(int i) {
        if (this.p != i) {
            this.p = i;
            f();
            g();
        }
    }

    public void a(Activity activity) {
        this.m = activity;
    }

    public void a(ViewGroup viewGroup) {
        this.n = viewGroup;
    }
}