导航菜单

页面标题

页面副标题

BetterTogether v3.0.0 - m.java 源代码

正在查看: BetterTogether v3.0.0 应用的 m.java JAVA 源代码文件

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


package com.mopub.nativeads;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import com.mopub.common.ExternalViewabilitySessionManager;
import com.mopub.common.logging.MoPubLog;
import com.mopub.common.util.Numbers;
import com.mopub.nativeads.BaseNativeAd;
import com.mopub.nativeads.CustomEventNative;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public final class m extends StaticNativeAd {
    public final Context t;
    public final CustomEventNative.CustomEventNativeListener u;
    public final JSONObject v;
    public final ImpressionTracker w;
    public final NativeClickHandler x;
    public ExternalViewabilitySessionManager y;
    public final HashSet z = new HashSet();

    public m(Context context, JSONObject jSONObject, ImpressionTracker impressionTracker, NativeClickHandler nativeClickHandler, d dVar) {
        this.v = jSONObject;
        this.t = context.getApplicationContext();
        this.w = impressionTracker;
        this.x = nativeClickHandler;
        this.u = dVar;
    }

    public final void a(no.k kVar, Object obj) {
        String str = kVar.d;
        try {
            switch (no.j.a[kVar.ordinal()]) {
                case 1:
                    setMainImageUrl((String) obj);
                    return;
                case 2:
                    setIconImageUrl((String) obj);
                    return;
                case 3:
                    if (!(obj instanceof JSONArray)) {
                        throw new ClassCastException("Expected impression trackers of type JSONArray.");
                    }
                    JSONArray jSONArray = (JSONArray) obj;
                    for (int i = 0; i < jSONArray.length(); i++) {
                        try {
                            addImpressionTracker(jSONArray.getString(i));
                        } catch (JSONException unused) {
                            MoPubLog.log(MoPubLog.AdLogEvent.CUSTOM, "Unable to parse impression trackers.");
                        }
                    }
                    return;
                case 4:
                    setClickDestinationUrl((String) obj);
                    return;
                case 5:
                    c(obj);
                    return;
                case 6:
                    setCallToAction((String) obj);
                    return;
                case 7:
                    setTitle((String) obj);
                    return;
                case 8:
                    setText((String) obj);
                    return;
                case 9:
                    setStarRating(Numbers.parseDouble(obj));
                    return;
                case 10:
                    setPrivacyInformationIconImageUrl((String) obj);
                    return;
                case 11:
                    setPrivacyInformationIconClickThroughUrl((String) obj);
                    return;
                case 12:
                    setSponsored((String) obj);
                    MoPubLog.log(MoPubLog.AdapterLogEvent.CUSTOM, MoPubCustomEventNative.ADAPTER_NAME, "Unable to add JSON key to internal mapping: " + str);
                    return;
                default:
                    MoPubLog.log(MoPubLog.AdapterLogEvent.CUSTOM, MoPubCustomEventNative.ADAPTER_NAME, "Unable to add JSON key to internal mapping: " + str);
                    return;
            }
        } catch (ClassCastException e) {
            if (kVar.e) {
                throw e;
            }
            MoPubLog.log(MoPubLog.AdapterLogEvent.CUSTOM, MoPubCustomEventNative.ADAPTER_NAME, "Ignoring class cast exception for optional key: " + str);
        }
    }

    public final void b() {
        no.k kVar;
        HashSet hashSet = new HashSet();
        JSONObject jSONObject = this.v;
        Iterator<String> keys = jSONObject.keys();
        while (keys.hasNext()) {
            hashSet.add(keys.next());
        }
        if (!hashSet.containsAll(no.k.i)) {
            throw new IllegalArgumentException("JSONObject did not contain required keys.");
        }
        Iterator<String> keys2 = jSONObject.keys();
        while (true) {
            int i = 0;
            if (!keys2.hasNext()) {
                break;
            }
            String next = keys2.next();
            no.k[] values = no.k.values();
            int length = values.length;
            while (true) {
                if (i >= length) {
                    kVar = null;
                    break;
                }
                kVar = values[i];
                if (kVar.d.equals(next)) {
                    break;
                } else {
                    i++;
                }
            }
            if (kVar != null) {
                try {
                    a(kVar, jSONObject.opt(next));
                } catch (ClassCastException unused) {
                    throw new IllegalArgumentException(g0.b.k("JSONObject key (", next, ") contained unexpected value."));
                }
            } else {
                addExtra(next, jSONObject.opt(next));
            }
        }
        if (TextUtils.isEmpty(getPrivacyInformationIconClickThroughUrl())) {
            setPrivacyInformationIconClickThroughUrl("https://www.mopub.com/optout");
        }
        ArrayList arrayList = new ArrayList();
        if (!TextUtils.isEmpty(getMainImageUrl())) {
            arrayList.add(getMainImageUrl());
        }
        if (!TextUtils.isEmpty(getIconImageUrl())) {
            arrayList.add(getIconImageUrl());
        }
        if (!TextUtils.isEmpty(getPrivacyInformationIconImageUrl())) {
            arrayList.add(getPrivacyInformationIconImageUrl());
        }
        ArrayList arrayList2 = new ArrayList(getExtras().size());
        for (Map.Entry<String, Object> entry : getExtras().entrySet()) {
            String key = entry.getKey();
            if ((key != null && key.toLowerCase(Locale.US).endsWith("image")) && (entry.getValue() instanceof String)) {
                arrayList2.add((String) entry.getValue());
            }
        }
        arrayList.addAll(arrayList2);
        NativeImageHelper.preCacheImages(this.t, arrayList, new l(this));
    }

    public final void c(Object obj) {
        boolean z = obj instanceof JSONArray;
        if (!z) {
            addClickTracker((String) obj);
            return;
        }
        if (!z) {
            throw new ClassCastException("Expected click trackers of type JSONArray.");
        }
        JSONArray jSONArray = (JSONArray) obj;
        for (int i = 0; i < jSONArray.length(); i++) {
            try {
                addClickTracker(jSONArray.getString(i));
            } catch (JSONException unused) {
                MoPubLog.log(MoPubLog.AdLogEvent.CUSTOM, "Unable to parse click trackers.");
            }
        }
    }

    @Override
    public void clear(View view) {
        this.w.removeView(view);
        this.x.clearOnClickListener(view);
    }

    @Override
    public void destroy() {
        this.w.destroy();
        ExternalViewabilitySessionManager externalViewabilitySessionManager = this.y;
        if (externalViewabilitySessionManager != null) {
            externalViewabilitySessionManager.registerTrackedView(new View(this.t));
            this.y.endSession();
            this.y = null;
        }
        super.destroy();
    }

    @Override
    public void handleClick(View view) {
        MoPubLog.log(MoPubLog.AdapterLogEvent.CLICKED, MoPubCustomEventNative.ADAPTER_NAME);
        BaseNativeAd.NativeEventListener nativeEventListener = this.c;
        if (nativeEventListener != null) {
            nativeEventListener.onAdClicked();
        }
        this.x.openClickDestinationUrl(getClickDestinationUrl(), view);
    }

    @Override
    public void prepare(View view) {
        this.w.addView(view, this);
        this.x.setOnClickListener(view, this);
        ExternalViewabilitySessionManager externalViewabilitySessionManager = this.y;
        if (externalViewabilitySessionManager != null) {
            externalViewabilitySessionManager.registerTrackedView(view);
            return;
        }
        ExternalViewabilitySessionManager create = ExternalViewabilitySessionManager.create();
        this.y = create;
        create.createNativeSession(view, this.z);
        this.y.startSession();
    }

    @Override
    public void recordImpression(View view) {
        BaseNativeAd.NativeEventListener nativeEventListener = this.c;
        if (nativeEventListener != null) {
            nativeEventListener.onAdImpressed();
        }
        ExternalViewabilitySessionManager externalViewabilitySessionManager = this.y;
        if (externalViewabilitySessionManager != null) {
            externalViewabilitySessionManager.trackImpression();
        }
    }
}