PSP Dragon Emulator v1.0版本的 MD5 值为:c6379fb6b63c27b6a7d2f2f6f6f51637
以下内容为反编译后的 InlineBannerAdCreator.java 源代码,内容仅作参考
package com.airpush.injector.internal;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import com.airpush.AirPush;
import com.airpush.injector.internal.ads.types.banners.image.ImageBannerController;
import com.airpush.injector.internal.ads.types.banners.image.ImageBannerCreative;
import com.airpush.injector.internal.ads.types.banners.image.ImageBannerJsonKeys;
import com.airpush.injector.internal.ads.types.banners.image.ImageBannerView;
import com.airpush.injector.internal.ads.types.banners.text.TextBannerController;
import com.airpush.injector.internal.ads.types.banners.text.TextBannerCreative;
import com.airpush.injector.internal.ads.types.banners.text.TextBannerView;
import com.airpush.injector.internal.ads.types.banners.web.WebBannerController;
import com.airpush.injector.internal.ads.types.banners.web.WebBannerCreative;
import com.airpush.injector.internal.ads.types.banners.web.WebBannerView;
import com.airpush.injector.internal.ads.types.mraid.MraidCreative;
import com.airpush.injector.internal.ads.types.mraid.banner.BannerMraidController;
import com.airpush.injector.internal.ads.types.mraid.banner.BannerMraidView;
import com.airpush.injector.internal.ads.types.vast.VastController;
import com.airpush.injector.internal.ads.types.vast.VastCreative;
import com.airpush.injector.internal.ads.types.vast.VastViewBase;
import com.airpush.injector.internal.ads.types.vast.nativ.VastNativeView;
import com.airpush.injector.internal.ads.types.vast.web.VastWebView;
import com.airpush.injector.internal.common.AirPushViewContainer;
import com.airpush.injector.internal.common.exceptions.AdException;
import com.airpush.injector.internal.common.exceptions.AdInternalException;
import com.airpush.injector.internal.parser.ICreative;
import com.airpush.injector.internal.skeleton.AdController;
import com.airpush.injector.internal.skeleton.AdCreator;
import com.airpush.injector.internal.skeleton.AdRequest;
import com.airpush.injector.internal.skeleton.AutoLoadedAdWithContainerCreator;
import com.airpush.injector.internal.skeleton.IAdRequest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
public class InlineBannerAdCreator extends AutoLoadedAdWithContainerCreator {
private int height;
private int width;
public InlineBannerAdCreator(Context context) {
super(context);
this.height = 0;
this.width = 0;
}
public InlineBannerAdCreator(Context context, int i, int i2) {
super(context);
this.height = 0;
this.width = 0;
this.height = i;
this.width = i2;
}
@Override
protected IAdRequest getAdRequest() {
return new AdRequest(getContext(), AirPush.getApiKey(), AirPush.getAppId()) {
@Override
protected void addRequestBodyParams(HashMap<String, String> hashMap) {
hashMap.put(ImageBannerJsonKeys.FILED_BANNER_TYPE, "inappad");
if (InlineBannerAdCreator.this.width <= 299 || InlineBannerAdCreator.this.height <= 49) {
return;
}
hashMap.put("cWidth", InlineBannerAdCreator.this.width + "");
hashMap.put("cHeight", InlineBannerAdCreator.this.height + "");
}
@Override
@NonNull
public URL getUrl() throws MalformedURLException {
if (AirPush.isTestModeEnabled()) {
return new URL("https://api.airpush.com/inappads/testinappadcall.php");
}
return new URL("https://api.airpush.com/inappads/inappadcall.php");
}
};
}
@Override
protected Class<? extends ICreative>[] getSupportedCreatives() {
return new Class[]{ImageBannerCreative.class, VastCreative.class, TextBannerCreative.class, WebBannerCreative.class, MraidCreative.class};
}
@Override
protected View getView(Context context, ICreative iCreative) throws AdInternalException {
if (iCreative.getAdTypeId() == 1) {
return new ImageBannerView(context, (ImageBannerCreative) iCreative);
}
if (iCreative.getAdTypeId() == 3) {
return new TextBannerView(context, (TextBannerCreative) iCreative);
}
if (iCreative.getAdTypeId() == 8) {
return new BannerMraidView(context, (MraidCreative) iCreative);
}
if (iCreative.getAdTypeId() == 5) {
return new WebBannerView(context, (WebBannerCreative) iCreative);
}
if (iCreative.getAdTypeId() == 2) {
VastCreative vastCreative = (VastCreative) iCreative;
if (vastCreative.getVideoParams().getPlayerType() == 0) {
return new VastWebView(context, vastCreative);
}
return new VastNativeView(context, vastCreative);
}
throw new AdInternalException("Received not supported creative");
}
@Override
protected AdController getController(AirPushViewContainer airPushViewContainer, View view, ICreative iCreative, AdCreator.IAdControllerEventsListener iAdControllerEventsListener) throws AdException {
if (iCreative.getAdTypeId() == 2) {
return new VastController(airPushViewContainer, (VastViewBase) view, (VastCreative) iCreative, iAdControllerEventsListener);
}
if (iCreative.getAdTypeId() == 5) {
return new WebBannerController(airPushViewContainer, (WebBannerView) view, (WebBannerCreative) iCreative, iAdControllerEventsListener);
}
if (iCreative.getAdTypeId() == 1) {
return new ImageBannerController(airPushViewContainer, (ImageBannerView) view, (ImageBannerCreative) iCreative, iAdControllerEventsListener);
}
if (iCreative.getAdTypeId() == 3) {
return new TextBannerController(airPushViewContainer, (TextBannerView) view, (TextBannerCreative) iCreative, iAdControllerEventsListener);
}
if (iCreative.getAdTypeId() == 8) {
return new BannerMraidController(airPushViewContainer, (BannerMraidView) view, (MraidCreative) iCreative, iAdControllerEventsListener);
}
throw new AdInternalException("Can't find suitable controller for creative Id: " + iCreative.getAdTypeId());
}
}