MyRecorder v1.01.90.0219版本的 MD5 值为:c361f51174a0bf833abfa72929caf8d3
以下内容为反编译后的 Ad.java 源代码,内容仅作参考
package net.pubnative.lite.sdk.models;
import android.content.Context;
import android.net.Uri;
import android.text.TextUtils;
import android.view.View;
import android.widget.FrameLayout;
import com.facebook.appevents.internal.ViewHierarchyConstants;
import com.google.firebase.remoteconfig.FirebaseRemoteConfig;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import net.pubnative.lite.sdk.models.EndCardData;
import net.pubnative.lite.sdk.source.pnapi.R;
import net.pubnative.lite.sdk.utils.json.BindField;
import net.pubnative.lite.sdk.utils.json.JsonModel;
import net.pubnative.lite.sdk.views.PNAPIContentInfoView;
import org.json.JSONObject;
public class Ad extends JsonModel implements Serializable, Comparable<Ad> {
public static final String CONTENT_INFO_ICON_URL = "https://cdn.pubnative.net/static/adserver/contentinfo.png";
public static final String CONTENT_INFO_LINK_URL = "https://pubnative.net/content-info";
public static final String CONTENT_INFO_TEXT = "Learn about this ad";
private static final String DATA_CONTENTINFO_ICON_KEY = "icon";
private static final String DATA_CONTENTINFO_LINK_KEY = "link";
private static final String DATA_POINTS_NUMBER_KEY = "number";
private static final String DATA_TEXT_KEY = "text";
private static final int MIN_POINTS = 10;
private static final String PN_IMPRESSION_QUERY_PARAM = "t";
private static final String PN_IMPRESSION_URL = "got.pubnative.net";
private String adSourceName;
@BindField
public int assetgroupid;
@BindField
public List<AdData> assets;
@BindField
public List<AdData> beacons;
private boolean hasEndCard;
@BindField
public String link;
@BindField
public List<AdData> meta;
private String zoneId;
private static final String TAG = Ad.class.getSimpleName();
public static final Integer HTML_REWARDED_DEFAULT_SKIP_OFFSET = 3;
public enum AdType {
HTML,
VIDEO
}
public interface Beacon {
public static final String CLICK = "click";
public static final String CUSTOM_END_CARD_CLICK = "custom_endcard_click";
public static final String CUSTOM_END_CARD_IMPRESSION = "custom_endcard_impression";
public static final String IMPRESSION = "impression";
}
public Ad() {
this.hasEndCard = false;
}
public Ad(int i10, String str, AdType adType) {
this.hasEndCard = false;
this.assetgroupid = i10;
this.assets = new ArrayList();
this.assets.add(adType == AdType.VIDEO ? new AdData(APIAsset.VAST, APIAsset.VAST, str) : new AdData("html", APIAsset.HTML_BANNER, str));
}
public Ad(JSONObject jSONObject) throws Exception {
this.hasEndCard = false;
fromJson(jSONObject);
}
private PNAPIContentInfoView getCustomContentInfo(Context context, ContentInfo contentInfo, PNAPIContentInfoView.ContentInfoListener contentInfoListener) {
if (contentInfo == null || TextUtils.isEmpty(contentInfo.getIconUrl())) {
return null;
}
final PNAPIContentInfoView pNAPIContentInfoView = new PNAPIContentInfoView(context, getContentInfoIconXPosition());
pNAPIContentInfoView.setIconUrl(contentInfo.getIconUrl());
pNAPIContentInfoView.setIconClickUrl(contentInfo.getLinkUrl());
if (TextUtils.isEmpty(contentInfo.getText())) {
pNAPIContentInfoView.setContextText(CONTENT_INFO_TEXT);
} else {
pNAPIContentInfoView.setContextText(contentInfo.getText());
}
if (contentInfo.getWidth() != -1 && contentInfo.getHeight() != -1) {
pNAPIContentInfoView.setDpDimensions(contentInfo);
}
final ContentInfoIconAction contentInfoIconAction = getContentInfoIconAction();
pNAPIContentInfoView.setContentInfoDisplay(getContentInfoDisplay());
pNAPIContentInfoView.setContentInfoListener(contentInfoListener);
pNAPIContentInfoView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
Ad.lambda$getCustomContentInfo$1(PNAPIContentInfoView.this, contentInfoIconAction, view);
}
});
return pNAPIContentInfoView;
}
private PNAPIContentInfoView getDefaultContentInfo(Context context, boolean z7, PNAPIContentInfoView.ContentInfoListener contentInfoListener) {
final PNAPIContentInfoView pNAPIContentInfoView = new PNAPIContentInfoView(context, getContentInfoIconXPosition());
pNAPIContentInfoView.setIconUrl(CONTENT_INFO_ICON_URL, true);
pNAPIContentInfoView.setIconClickUrl(CONTENT_INFO_LINK_URL);
pNAPIContentInfoView.setContextText(CONTENT_INFO_TEXT);
pNAPIContentInfoView.setContentInfoListener(contentInfoListener);
final ContentInfoIconAction contentInfoIconAction = getContentInfoIconAction();
pNAPIContentInfoView.setContentInfoDisplay(getContentInfoDisplay());
pNAPIContentInfoView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
Ad.lambda$getDefaultContentInfo$2(PNAPIContentInfoView.this, view);
}
});
pNAPIContentInfoView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
Ad.lambda$getDefaultContentInfo$3(PNAPIContentInfoView.this, contentInfoIconAction, view);
}
});
return pNAPIContentInfoView;
}
private Integer getSkipOffset(RemoteConfig remoteConfig) {
return (Integer) getRemoteConfig(remoteConfig);
}
public static void lambda$getContentInfo$0(PNAPIContentInfoView pNAPIContentInfoView, ContentInfoIconAction contentInfoIconAction, View view) {
if (TextUtils.isEmpty(pNAPIContentInfoView.getIconClickURL())) {
return;
}
if (contentInfoIconAction == ContentInfoIconAction.OPEN) {
((PNAPIContentInfoView) view).openLink();
} else {
((PNAPIContentInfoView) view).openLayout();
}
}
public static void lambda$getCustomContentInfo$1(PNAPIContentInfoView pNAPIContentInfoView, ContentInfoIconAction contentInfoIconAction, View view) {
if (TextUtils.isEmpty(pNAPIContentInfoView.getIconClickURL())) {
return;
}
if (contentInfoIconAction == ContentInfoIconAction.OPEN) {
((PNAPIContentInfoView) view).openLink();
} else {
((PNAPIContentInfoView) view).openLayout();
}
}
public static void lambda$getDefaultContentInfo$2(PNAPIContentInfoView pNAPIContentInfoView, View view) {
if (TextUtils.isEmpty(pNAPIContentInfoView.getIconClickURL())) {
return;
}
((PNAPIContentInfoView) view).openLink();
}
public static void lambda$getDefaultContentInfo$3(PNAPIContentInfoView pNAPIContentInfoView, ContentInfoIconAction contentInfoIconAction, View view) {
if (TextUtils.isEmpty(pNAPIContentInfoView.getIconClickURL())) {
return;
}
if (contentInfoIconAction == ContentInfoIconAction.OPEN) {
((PNAPIContentInfoView) view).openLink();
} else {
((PNAPIContentInfoView) view).openLayout();
}
}
@Override
public int compareTo(Ad ad2) {
return (ad2.getECPM() != null ? ad2.getECPM().intValue() : 0) - (getECPM() != null ? getECPM().intValue() : 0);
}
public AdData find(String str, List<AdData> list) {
if (list != null) {
for (AdData adData : list) {
if (str.equals(adData.type)) {
return adData;
}
}
}
return null;
}
public List<AdData> findAll(String str, List<AdData> list) {
ArrayList arrayList = null;
if (list != null) {
for (AdData adData : list) {
if (str.equals(adData.type)) {
if (arrayList == null) {
arrayList = new ArrayList();
}
arrayList.add(adData);
}
}
}
return arrayList;
}
public String getAdSourceName() {
return this.adSourceName;
}
public AdData getAsset(String str) {
return find(str, this.assets);
}
public int getAssetHeight(String str) {
AdData asset = getAsset(str);
if (asset != null) {
return asset.getHeight();
}
return -1;
}
public String getAssetHtml(String str) {
AdData asset = getAsset(str);
if (asset != null) {
return asset.getHtml();
}
return null;
}
public String getAssetUrl(String str) {
AdData asset = getAsset(str);
if (asset != null) {
return asset.getURL();
}
return null;
}
public int getAssetWidth(String str) {
AdData asset = getAsset(str);
if (asset != null) {
return asset.getWidth();
}
return -1;
}
public String getAudioState() {
return (String) getRemoteConfig(RemoteConfig.AUDIO_STATE);
}
public Integer getBackButtonDelay() {
return (Integer) getRemoteConfig(RemoteConfig.BACK_BUTTON_DELAY);
}
public List<AdData> getBeacons(String str) {
return findAll(str, this.beacons);
}
public View getContentInfo(Context context, PNAPIContentInfoView.ContentInfoListener contentInfoListener) {
boolean z7;
String str = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_URL);
String str2 = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_ICON_URL);
String str3 = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_TEXT);
final ContentInfoIconAction contentInfoIconAction = getContentInfoIconAction();
ContentInfoDisplay contentInfoDisplay = getContentInfoDisplay();
AdData meta = getMeta(APIMeta.CONTENT_INFO);
if (TextUtils.isEmpty(str)) {
str = (meta == null || TextUtils.isEmpty(meta.getStringField("link"))) ? CONTENT_INFO_LINK_URL : meta.getStringField("link");
}
if (TextUtils.isEmpty(str2)) {
str2 = (meta == null || TextUtils.isEmpty(meta.getStringField("icon"))) ? CONTENT_INFO_ICON_URL : meta.getStringField("icon");
z7 = false;
} else {
z7 = true;
}
if (TextUtils.isEmpty(str3)) {
str3 = (meta == null || TextUtils.isEmpty(meta.getText())) ? CONTENT_INFO_TEXT : meta.getText();
}
final PNAPIContentInfoView pNAPIContentInfoView = new PNAPIContentInfoView(context, getContentInfoIconXPosition());
pNAPIContentInfoView.setIconUrl(str2, false, z7);
pNAPIContentInfoView.setIconClickUrl(str);
pNAPIContentInfoView.setContextText(str3);
pNAPIContentInfoView.setContentInfoListener(contentInfoListener);
pNAPIContentInfoView.setContentInfoDisplay(contentInfoDisplay);
pNAPIContentInfoView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
Ad.lambda$getContentInfo$0(PNAPIContentInfoView.this, contentInfoIconAction, view);
}
});
return pNAPIContentInfoView;
}
public String getContentInfoClickUrl() {
String str = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_URL);
return !TextUtils.isEmpty(str) ? str : getMeta(APIMeta.CONTENT_INFO).getStringField("link");
}
public FrameLayout getContentInfoContainer(Context context, ContentInfo contentInfo, PNAPIContentInfoView.ContentInfoListener contentInfoListener) {
String str;
String str2;
View customContentInfo = getCustomContentInfo(context, contentInfo, contentInfoListener);
if (customContentInfo == null) {
customContentInfo = getContentInfo(context, contentInfoListener);
}
if (customContentInfo != null) {
FrameLayout frameLayout = new FrameLayout(context);
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
int i10 = 8388611;
int i11 = 48;
if (getContentInfoIconXPosition() == null || getContentInfoIconXPosition() != ContentInfoIconXPosition.RIGHT) {
str = ViewHierarchyConstants.DIMENSION_LEFT_KEY;
} else {
i10 = 8388613;
str = "right";
}
if (getContentInfoIconYPosition() == null || getContentInfoIconYPosition() != ContentInfoIconYPosition.BOTTOM) {
str2 = ViewHierarchyConstants.DIMENSION_TOP_KEY;
} else {
i11 = 80;
str2 = "bottom";
}
layoutParams.gravity = i10 | i11;
String string = context.getResources().getString(R.string.content_info_icon);
frameLayout.setContentDescription(string + " - " + str2 + " " + str);
frameLayout.setLayoutParams(layoutParams);
frameLayout.addView(customContentInfo);
return frameLayout;
}
return null;
}
public FrameLayout getContentInfoContainer(Context context, PNAPIContentInfoView.ContentInfoListener contentInfoListener) {
return getContentInfoContainer(context, null, contentInfoListener);
}
public ContentInfoDisplay getContentInfoDisplay() {
String str = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_DISPLAY);
return TextUtils.isEmpty(str) ? ContentInfoDisplay.SYSTEM_BROWSER : ContentInfoDisplay.fromString(str);
}
public ContentInfoIconAction getContentInfoIconAction() {
String str = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_ICON_CLICK_ACTION);
return TextUtils.isEmpty(str) ? ContentInfoIconAction.EXPAND : ContentInfoIconAction.fromString(str);
}
public String getContentInfoIconUrl() {
String str = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_ICON_URL);
return !TextUtils.isEmpty(str) ? str : getMeta(APIMeta.CONTENT_INFO).getStringField("icon");
}
public ContentInfoIconXPosition getContentInfoIconXPosition() {
return ContentInfoIconXPosition.getDefaultXPosition();
}
public ContentInfoIconYPosition getContentInfoIconYPosition() {
return ContentInfoIconYPosition.getDefaultYPosition();
}
public String getContentInfoText() {
String str = (String) getRemoteConfig(RemoteConfig.CONTENT_INFO_TEXT);
if (TextUtils.isEmpty(str)) {
AdData meta = getMeta(APIMeta.CONTENT_INFO);
return !TextUtils.isEmpty(meta.getText()) ? meta.getText() : CONTENT_INFO_TEXT;
}
return str;
}
public String getCreativeId() {
AdData meta = getMeta(APIMeta.CREATIVE_ID);
if (meta == null) {
return "";
}
String stringField = meta.getStringField("text");
return TextUtils.isEmpty(stringField) ? "" : stringField;
}
public EndCardData getCustomEndCard() {
AdData asset = getAsset(APIAsset.CUSTOM_END_CARD);
if (asset != null) {
return new EndCardData(EndCardData.Type.HTML_RESOURCE, asset.getStringField("html"), Boolean.TRUE);
}
return null;
}
public CustomEndCardDisplay getCustomEndCardDisplay() {
return CustomEndCardDisplay.fromString((String) getRemoteConfig(RemoteConfig.CUSTOM_END_CARD_DISPLAY));
}
public Integer getECPM() {
AdData meta = getMeta(APIMeta.POINTS);
if (meta == null) {
return 10;
}
Integer intField = meta.getIntField(DATA_POINTS_NUMBER_KEY);
return Integer.valueOf(intField != null ? intField.intValue() : 10);
}
public Integer getEndCardCloseDelay() {
Integer num = (Integer) getRemoteConfig(RemoteConfig.END_CARD_CLOSE_DELAY);
if (num == null || num.intValue() < 0) {
return null;
}
return num;
}
public Boolean getFullScreenClickability() {
return (Boolean) getRemoteConfig(RemoteConfig.FULL_SCREEN_CLICKABILITY);
}
public Integer getHtmlSkipOffset() {
return getSkipOffset(RemoteConfig.HTML_SKIP_OFFSET);
}
public String getImpressionId() {
List<AdData> beacons = getBeacons("impression");
String str = "";
if (beacons != null) {
boolean z7 = false;
for (int i10 = 0; i10 < beacons.size() && !z7; i10++) {
AdData adData = beacons.get(i10);
if (!TextUtils.isEmpty(adData.getURL())) {
Uri parse = Uri.parse(adData.getURL());
if (parse.getAuthority().equals(PN_IMPRESSION_URL)) {
String queryParameter = parse.getQueryParameter(PN_IMPRESSION_QUERY_PARAM);
if (!TextUtils.isEmpty(queryParameter)) {
str = queryParameter;
z7 = true;
}
}
}
}
}
return str;
}
public Integer getImpressionMinVisibleTime() {
Integer num = (Integer) getRemoteConfig(RemoteConfig.IMP_TRACKING_VISIBLE_TIME);
if (num == null || num.intValue() < 0) {
return null;
}
return num;
}
public String getImpressionTrackingMethod() {
return (String) getRemoteConfig(RemoteConfig.IMP_TRACKING_METHOD);
}
public Double getImpressionVisiblePercent() {
Double d10 = (Double) getRemoteConfig(RemoteConfig.IMP_TRACKING_VISIBLE_PERCENT);
if (d10 == null || d10.doubleValue() < FirebaseRemoteConfig.DEFAULT_VALUE_FOR_DOUBLE) {
return null;
}
return d10;
}
public AdData getMeta(String str) {
return find(str, this.meta);
}
public Boolean getMraidExpand() {
return (Boolean) getRemoteConfig(RemoteConfig.MRAID_EXPAND);
}
public Integer getMraidRewardedSkipOffset() {
return getSkipOffset(RemoteConfig.REWARDED_HTML_SKIP_OFFSET);
}
public Integer getNativeCloseButtonDelay() {
return (Integer) getRemoteConfig(RemoteConfig.NATIVE_CLOSE_BUTTON_DELAY);
}
public <T> T getRemoteConfig(RemoteConfig remoteConfig) {
JSONObject jSONObjectField;
AdData meta = getMeta(APIMeta.REMOTE_CONFIGS);
T t10 = null;
if (meta != null && meta.haseField("jsondata").booleanValue() && (jSONObjectField = meta.getJSONObjectField("jsondata")) != null && jSONObjectField.has(remoteConfig.fieldName)) {
try {
Class<?> cls = remoteConfig.type;
if (cls == String.class) {
t10 = (T) jSONObjectField.getString(remoteConfig.fieldName);
} else if (cls == Integer.class) {
t10 = (T) Integer.valueOf(jSONObjectField.getInt(remoteConfig.fieldName));
} else if (cls == Double.class) {
t10 = (T) Double.valueOf(jSONObjectField.getDouble(remoteConfig.fieldName));
} else if (cls == Boolean.class) {
t10 = (T) Boolean.valueOf(jSONObjectField.getBoolean(remoteConfig.fieldName));
}
} catch (Exception unused) {
}
}
return t10;
}
public String getVast() {
AdData asset = getAsset(APIAsset.VAST);
if (asset != null) {
return asset.getStringField(APIAsset.VAST);
}
return null;
}
public Integer getVideoRewardedSkipOffset() {
return getSkipOffset(RemoteConfig.REWARDED_VIDEO_SKIP_OFFSET);
}
public Integer getVideoSkipOffset() {
return getSkipOffset(RemoteConfig.VIDEO_SKIP_OFFSET);
}
public String getZoneId() {
return this.zoneId;
}
public boolean hasCustomEndCard() {
return getAsset(APIAsset.CUSTOM_END_CARD) != null;
}
public boolean hasEndCard() {
return this.hasEndCard;
}
public Boolean isCustomEndCardEnabled() {
return (Boolean) getRemoteConfig(RemoteConfig.CUSTOM_END_CARD_ENABLED);
}
public Boolean isEndCardEnabled() {
return (Boolean) getRemoteConfig(RemoteConfig.END_CARD_ENABLED);
}
public Boolean needCloseInterAfterFinish() {
return (Boolean) getRemoteConfig(RemoteConfig.CLOSE_INTER_AFTER_FINISH);
}
public Boolean needCloseRewardAfterFinish() {
return (Boolean) getRemoteConfig(RemoteConfig.CLOSE_REWARD_AFTER_FINISH);
}
public void setAdSourceName(String str) {
this.adSourceName = str;
}
public void setHasEndCard(boolean z7) {
this.hasEndCard = z7;
}
public void setZoneId(String str) {
this.zoneId = str;
}
}