VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce

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


package com.startapp.android.publish.ads.nativead;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import com.ironsource.sdk.utils.Constants;
import com.startapp.android.publish.ads.nativead.StartAppNativeAd;
import com.startapp.android.publish.common.a;
import com.startapp.android.publish.common.commonUtils.j;
import com.startapp.android.publish.common.metaData.MetaData;
import com.startapp.android.publish.common.model.AdDetails;
import com.startapp.android.publish.common.model.AdPreferences;

public class NativeAdDetails implements Parcelable, NativeAdInterface {
    public static final Parcelable.Creator<NativeAdDetails> CREATOR = new Parcelable.Creator<NativeAdDetails>() {
        @Override
        public NativeAdDetails createFromParcel(Parcel parcel) {
            return new NativeAdDetails(parcel);
        }

        @Override
        public NativeAdDetails[] newArray(int i) {
            return new NativeAdDetails[i];
        }
    };
    int a;
    a b;
    private AdDetails c;
    private Bitmap d;
    private Bitmap e;
    private boolean f;
    private String g;

    protected interface a {
        void onNativeAdDetailsLoaded(int i);
    }

    public NativeAdDetails(AdDetails adDetails, NativeAdPreferences config, int identifier, a singleAdLoadedListener) {
        this.f = false;
        j.a("StartAppNativeAd", 3, "Initializiang SingleAd [" + identifier + Constants.RequestParameters.RIGHT_BRACKETS);
        this.c = adDetails;
        this.a = identifier;
        this.b = singleAdLoadedListener;
        if (config.isAutoBitmapDownload()) {
            new com.startapp.android.publish.common.a(getImageUrl(), new a.InterfaceC0086a() {
                @Override
                public void a(Bitmap bitmap, int i) {
                    NativeAdDetails.this.a(bitmap);
                    new com.startapp.android.publish.common.a(NativeAdDetails.this.getSecondaryImageUrl(), new a.InterfaceC0086a() {
                        @Override
                        public void a(Bitmap bitmap2, int i2) {
                            NativeAdDetails.this.b(bitmap2);
                            NativeAdDetails.this.a();
                        }
                    }, i).a();
                }
            }, identifier).a();
        } else {
            a();
        }
    }

    public String toString() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("         Title: [" + getTitle() + "]\n");
        stringBuffer.append("         Description: [" + getDescription().substring(0, 30) + "]...\n");
        stringBuffer.append("         Rating: [" + getRating() + "]\n");
        stringBuffer.append("         Installs: [" + getInstalls() + "]\n");
        stringBuffer.append("         Category: [" + getCategory() + "]\n");
        stringBuffer.append("         PackageName: [" + getPackacgeName() + "]\n");
        stringBuffer.append("         CampaginAction: [" + getCampaignAction() + "]\n");
        return stringBuffer.toString();
    }

    void a(Bitmap bitmap) {
        this.d = bitmap;
    }

    void b(Bitmap bitmap) {
        this.e = bitmap;
    }

    void a() {
        new Handler().post(new Runnable() {
            @Override
            public void run() {
                j.a("StartAppNativeAd", 3, "SingleAd [" + NativeAdDetails.this.a + "] Loaded");
                if (NativeAdDetails.this.b != null) {
                    NativeAdDetails.this.b.onNativeAdDetailsLoaded(NativeAdDetails.this.a);
                }
            }
        });
    }

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

    @Override
    public String getTitle() {
        if (this.c == null) {
            return "";
        }
        return this.c.getTitle();
    }

    @Override
    public String getDescription() {
        if (this.c == null) {
            return "";
        }
        return this.c.getDescription();
    }

    @Override
    public float getRating() {
        if (this.c == null) {
            return 5.0f;
        }
        return this.c.getRating();
    }

    @Override
    public String getImageUrl() {
        if (this.c == null) {
            return "http://www.dummy.com";
        }
        return this.c.getImageUrl();
    }

    @Override
    public String getSecondaryImageUrl() {
        if (this.c == null) {
            return "http://www.dummy.com";
        }
        return this.c.getSecondaryImageUrl();
    }

    @Override
    public Bitmap getImageBitmap() {
        return this.d;
    }

    @Override
    public Bitmap getSecondaryImageBitmap() {
        return this.e;
    }

    @Override
    public String getInstalls() {
        if (this.c == null) {
            return "";
        }
        return this.c.getInstalls();
    }

    @Override
    public String getCategory() {
        if (this.c == null) {
            return "";
        }
        return this.c.getCategory();
    }

    @Override
    public String getPackacgeName() {
        if (this.c == null) {
            return "";
        }
        return this.c.getPackageName();
    }

    @Override
    public StartAppNativeAd.b getCampaignAction() {
        StartAppNativeAd.b bVar = StartAppNativeAd.b.OPEN_MARKET;
        if (this.c != null && this.c.isCPE()) {
            return StartAppNativeAd.b.LAUNCH_APP;
        }
        return bVar;
    }

    @Override
    public Boolean isApp() {
        if (this.c == null) {
            return true;
        }
        return Boolean.valueOf(this.c.isApp());
    }

    public AdDetails b() {
        return this.c;
    }

    @Override
    public void sendClick(Context context) {
        if (this.c != null) {
            switch (getCampaignAction()) {
                case OPEN_MARKET:
                    boolean a2 = com.startapp.android.publish.adsCommon.b.a(context, AdPreferences.Placement.INAPP_NATIVE);
                    if (this.c.isSmartRedirect() && !a2) {
                        com.startapp.android.publish.adsCommon.b.a(context, this.c.getClickUrl(), this.c.getTrackingClickUrl(), this.c.getPackageName(), new com.startapp.android.publish.adsCommon.c.b(this.g), MetaData.getInstance().getSmartRedirectTimeout(), this.c.isStartappBrowserEnabled());
                        return;
                    } else {
                        com.startapp.android.publish.adsCommon.b.a(context, this.c.getClickUrl(), this.c.getTrackingClickUrl(), new com.startapp.android.publish.adsCommon.c.b(this.g), this.c.isStartappBrowserEnabled() && !a2);
                        return;
                    }
                case LAUNCH_APP:
                    com.startapp.android.publish.adsCommon.b.a(getPackacgeName(), this.c.getIntentDetails(), this.c.getClickUrl(), context, new com.startapp.android.publish.adsCommon.c.b(this.g));
                    return;
                default:
                    return;
            }
        }
    }

    @Override
    public void sendImpression(Context context) {
        if (!this.f) {
            this.f = true;
            if (this.c != null) {
                j.a("StartAppNativeAd", 3, "Sending Impression for [" + this.a + Constants.RequestParameters.RIGHT_BRACKETS);
                com.startapp.android.publish.adsCommon.b.a(context, this.c.getTrackingUrl(), new com.startapp.android.publish.adsCommon.c.b(this.g));
                return;
            }
            return;
        }
        j.a("StartAppNativeAd", 3, "Already sent impression for [" + this.a + Constants.RequestParameters.RIGHT_BRACKETS);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        int i = this.c != null ? 1 : 0;
        int i2 = getImageBitmap() != null ? 1 : 0;
        int i3 = getSecondaryImageBitmap() != null ? 1 : 0;
        int i4 = this.f ? 1 : 0;
        dest.writeInt(i);
        if (i == 1) {
            dest.writeParcelable(this.c, flags);
        }
        dest.writeInt(i2);
        if (i2 == 1) {
            dest.writeParcelable(getImageBitmap(), flags);
        }
        dest.writeInt(i3);
        if (i3 == 1) {
            dest.writeParcelable(getSecondaryImageBitmap(), flags);
        }
        dest.writeInt(i4);
        dest.writeInt(this.a);
        dest.writeString(this.g);
    }

    public NativeAdDetails(Parcel in) {
        this.f = false;
        if (in.readInt() == 1) {
            this.c = (AdDetails) in.readParcelable(AdDetails.class.getClassLoader());
        }
        if (in.readInt() == 1) {
            a((Bitmap) in.readParcelable(Bitmap.class.getClassLoader()));
        }
        if (in.readInt() == 1) {
            b((Bitmap) in.readParcelable(Bitmap.class.getClassLoader()));
        }
        int readInt = in.readInt();
        this.f = false;
        if (readInt == 1) {
            this.f = true;
        }
        this.a = in.readInt();
        this.g = in.readString();
    }
}