Stick Squad 3 v1.2.5.9版本的 MD5 值为:375cf7f77a7075270cd68d1397368279

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


package com.fusepowered.sa.android.publish.nativead;

import android.content.Context;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Parcel;
import android.os.Parcelable;
import com.fusepowered.sa.android.publish.f.d;
import com.fusepowered.sa.android.publish.f.g;
import com.fusepowered.sa.android.publish.f.o;
import com.fusepowered.sa.android.publish.model.AdDetails;
import com.fusepowered.sa.android.publish.nativead.StartAppNativeAd;

public class NativeAdDetails implements Parcelable, d.a, 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];
        }
    };
    private AdDetails a;
    private int b;

    private Bitmap f380c;
    private boolean d;
    private a e;

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

    public NativeAdDetails(Parcel parcel) {
        this.d = false;
        if (parcel.readInt() == 1) {
            this.a = (AdDetails) parcel.readParcelable(AdDetails.class.getClassLoader());
        }
        if (parcel.readInt() == 1) {
            a((Bitmap) parcel.readParcelable(Bitmap.class.getClassLoader()));
        }
        int readInt = parcel.readInt();
        this.d = false;
        if (readInt == 1) {
            this.d = true;
        }
        this.b = parcel.readInt();
    }

    public NativeAdDetails(AdDetails adDetails, NativeAdPreferences nativeAdPreferences, int i, a aVar) {
        this.d = false;
        g.a("StartAppNativeAd", 3, "Initializiang SingleAd [" + i + "]");
        this.a = adDetails;
        this.b = i;
        this.e = aVar;
        if (nativeAdPreferences.isAutoBitmapDownload()) {
            new d(getImageUrl(), this, i).a();
        } else {
            a();
        }
    }

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

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

    @Override
    public void a(Bitmap bitmap, int i) {
        a(bitmap);
        a();
    }

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

    @Override
    public StartAppNativeAd.b getCampaignAction() {
        StartAppNativeAd.b bVar = StartAppNativeAd.b.OPEN_MARKET;
        return (this.a == null || !this.a.isCPE()) ? bVar : StartAppNativeAd.b.LAUNCH_APP;
    }

    @Override
    public String getCategory() {
        return this.a != null ? this.a.getCategory() : "";
    }

    @Override
    public String getDescription() {
        return this.a != null ? this.a.getDescription() : "";
    }

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

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

    @Override
    public String getInstalls() {
        return this.a != null ? this.a.getInstalls() : "";
    }

    @Override
    public String getPackacgeName() {
        return this.a != null ? this.a.getPackageName() : "";
    }

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

    @Override
    public String getTitle() {
        return this.a != null ? this.a.getTitle() : "";
    }

    @Override
    public void sendClick(Context context) {
        if (this.a != null) {
            switch (getCampaignAction()) {
                case OPEN_MARKET:
                    if (this.a.isSmartRedirect()) {
                        o.a(context, this.a.getClickUrl(), 5000);
                        return;
                    } else {
                        o.c(context, this.a.getClickUrl());
                        return;
                    }
                case LAUNCH_APP:
                    o.a(getPackacgeName(), this.a.getIntentDetails(), this.a.getClickUrl(), context);
                    return;
                default:
                    return;
            }
        }
    }

    @Override
    public void sendImpression(Context context) {
        if (this.d) {
            g.a("StartAppNativeAd", 3, "Already sent impression for [" + this.b + "]");
            return;
        }
        this.d = true;
        if (this.a == null) {
            return;
        }
        g.a("StartAppNativeAd", 3, "Sending Impression for [" + this.b + "]");
        o.b(context, this.a.getTrackingUrl());
    }

    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();
    }

    @Override
    public void writeToParcel(Parcel parcel, int i) {
        int i2 = this.a != null ? 1 : 0;
        int i3 = getImageBitmap() != null ? 1 : 0;
        int i4 = this.d ? 1 : 0;
        parcel.writeInt(i2);
        if (i2 == 1) {
            parcel.writeParcelable(this.a, i);
        }
        parcel.writeInt(i3);
        if (i3 == 1) {
            parcel.writeParcelable(getImageBitmap(), i);
        }
        parcel.writeInt(i4);
        parcel.writeInt(this.b);
    }
}