Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
package com.ironsource.adapters.admob.banner;
import android.widget.FrameLayout;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.LoadAdError;
import com.ironsource.adapters.admob.AdMobAdapter;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.mediationsdk.sdk.BannerSmashListener;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
/* loaded from: classes2.dex */
public class AdMobBannerAdListener extends AdListener {
private String mAdUnitId;
private AdView mAdView;
private BannerSmashListener mListener;
public AdMobBannerAdListener(BannerSmashListener bannerSmashListener, String str, AdView adView) {
this.mListener = bannerSmashListener;
this.mAdUnitId = str;
this.mAdView = adView;
}
@Override // com.google.android.gms.ads.AdListener
public void onAdLoaded() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
if (this.mListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
if (this.mAdView == null) {
IronLog.INTERNAL.verbose("adView is null");
return;
}
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
layoutParams.gravity = 17;
this.mListener.onBannerAdLoaded(this.mAdView, layoutParams);
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdFailedToLoad(LoadAdError loadAdError) {
String str;
IronSourceError buildLoadFailedError;
IronLog ironLog = IronLog.ADAPTER_CALLBACK;
ironLog.verbose("adUnitId = " + this.mAdUnitId);
if (this.mListener == null) {
IronLog.INTERNAL.verbose("listener is null");
return;
}
if (loadAdError != null) {
str = loadAdError.getMessage() + "( " + loadAdError.getCode() + " ) ";
if (loadAdError.getCause() != null) {
str = str + " Caused by - " + loadAdError.getCause();
}
if (AdMobAdapter.isNoFillError(loadAdError.getCode())) {
buildLoadFailedError = new IronSourceError(606, str);
} else {
buildLoadFailedError = ErrorBuilder.buildLoadFailedError(str);
}
} else {
str = "Banner failed to load (loadAdError is null)";
buildLoadFailedError = ErrorBuilder.buildLoadFailedError("Banner failed to load (loadAdError is null)");
}
ironLog.error(str + str);
this.mListener.onBannerAdLoadFailed(buildLoadFailedError);
}
@Override // com.google.android.gms.ads.AdListener
public void onAdImpression() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdShown();
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdClicked() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdClicked();
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdOpened() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdScreenPresented();
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdClosed() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdScreenDismissed();
}
}
}

View File

@@ -0,0 +1,292 @@
package com.ironsource.adapters.admob.banner;
import android.os.Bundle;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.google.android.gms.ads.AdFormat;
import com.google.android.gms.ads.AdLoader;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdSize;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.VideoOptions;
import com.google.android.gms.ads.nativead.NativeAd;
import com.google.android.gms.ads.nativead.NativeAdOptions;
import com.ironsource.adapters.admob.AdMobAdapter;
import com.ironsource.environment.ContextProvider;
import com.ironsource.mediationsdk.AdapterUtils;
import com.ironsource.mediationsdk.ISBannerSize;
import com.ironsource.mediationsdk.IronSource;
import com.ironsource.mediationsdk.IronSourceBannerLayout;
import com.ironsource.mediationsdk.adapter.AbstractBannerAdapter;
import com.ironsource.mediationsdk.bidding.BiddingDataCallback;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.sdk.BannerSmashListener;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
import java.util.Iterator;
import java.util.concurrent.ConcurrentHashMap;
import org.json.JSONObject;
/* loaded from: classes2.dex */
public class AdMobBannerAdapter extends AbstractBannerAdapter<AdMobAdapter> {
private final String IS_NATIVE;
private final ConcurrentHashMap<String, AdView> mAdUnitIdToBannerAd;
private final ConcurrentHashMap<String, BannerSmashListener> mAdUnitIdToListener;
public final ConcurrentHashMap<String, NativeAd> mAdUnitIdToNativeBannerAd;
public AdMobBannerAdapter(AdMobAdapter adMobAdapter) {
super(adMobAdapter);
this.IS_NATIVE = "isNative";
this.mAdUnitIdToListener = new ConcurrentHashMap<>();
this.mAdUnitIdToBannerAd = new ConcurrentHashMap<>();
this.mAdUnitIdToNativeBannerAd = new ConcurrentHashMap<>();
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public void initBanners(String str, String str2, @NonNull JSONObject jSONObject, @NonNull BannerSmashListener bannerSmashListener) {
initBannersInternal(jSONObject, bannerSmashListener);
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public void initBannerForBidding(String str, String str2, @NonNull JSONObject jSONObject, @NonNull BannerSmashListener bannerSmashListener) {
initBannersInternal(jSONObject, bannerSmashListener);
}
private void initBannersInternal(@NonNull JSONObject jSONObject, @NonNull BannerSmashListener bannerSmashListener) {
String adUnitIdKey = getAdapter().getAdUnitIdKey();
String configStringValueFromKey = getConfigStringValueFromKey(jSONObject, adUnitIdKey);
if (TextUtils.isEmpty(configStringValueFromKey)) {
bannerSmashListener.onBannerInitFailed(ErrorBuilder.buildInitFailedError(getAdUnitIdMissingErrorString(adUnitIdKey), "Banner"));
return;
}
IronLog.ADAPTER_API.verbose("adUnitId = " + configStringValueFromKey);
this.mAdUnitIdToListener.put(configStringValueFromKey, bannerSmashListener);
if (getAdapter().getInitState() == AdMobAdapter.InitState.INIT_STATE_SUCCESS) {
IronLog.INTERNAL.verbose("onBannerInitSuccess - adUnitId = " + configStringValueFromKey);
bannerSmashListener.onBannerInitSuccess();
return;
}
if (getAdapter().getInitState() == AdMobAdapter.InitState.INIT_STATE_FAILED) {
IronLog.INTERNAL.verbose("onBannerInitFailed - adUnitId = " + configStringValueFromKey);
bannerSmashListener.onBannerInitFailed(ErrorBuilder.buildInitFailedError("AdMob sdk init failed", "Banner"));
return;
}
getAdapter().initSDK(jSONObject);
}
@Override // com.ironsource.mediationsdk.adapter.AbstractAdUnitAdapter, com.ironsource.mediationsdk.INetworkInitCallbackListener
public void onNetworkInitCallbackSuccess() {
Iterator<BannerSmashListener> it = this.mAdUnitIdToListener.values().iterator();
while (it.hasNext()) {
it.next().onBannerInitSuccess();
}
}
@Override // com.ironsource.mediationsdk.adapter.AbstractAdUnitAdapter, com.ironsource.mediationsdk.INetworkInitCallbackListener
public void onNetworkInitCallbackFailed(String str) {
Iterator<BannerSmashListener> it = this.mAdUnitIdToListener.values().iterator();
while (it.hasNext()) {
it.next().onBannerInitFailed(ErrorBuilder.buildInitFailedError(str, "Banner"));
}
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public void loadBanner(@NonNull JSONObject jSONObject, JSONObject jSONObject2, @NonNull IronSourceBannerLayout ironSourceBannerLayout, @NonNull BannerSmashListener bannerSmashListener) {
loadBannerInternal(jSONObject, jSONObject2, null, ironSourceBannerLayout, bannerSmashListener);
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public void loadBannerForBidding(@NonNull JSONObject jSONObject, JSONObject jSONObject2, String str, @NonNull IronSourceBannerLayout ironSourceBannerLayout, @NonNull BannerSmashListener bannerSmashListener) {
loadBannerInternal(jSONObject, jSONObject2, str, ironSourceBannerLayout, bannerSmashListener);
}
private void loadBannerInternal(@NonNull final JSONObject jSONObject, final JSONObject jSONObject2, final String str, @NonNull final IronSourceBannerLayout ironSourceBannerLayout, @NonNull final BannerSmashListener bannerSmashListener) {
final String configStringValueFromKey = getConfigStringValueFromKey(jSONObject, getAdapter().getAdUnitIdKey());
IronLog.ADAPTER_API.verbose("adUnitId = " + configStringValueFromKey);
if (ironSourceBannerLayout == null) {
IronLog.INTERNAL.error("banner is null");
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildNoConfigurationAvailableError("banner is null"));
} else {
final boolean parseBoolean = Boolean.parseBoolean(getConfigStringValueFromKey(jSONObject, "isNative"));
postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.admob.banner.AdMobBannerAdapter.1
@Override // java.lang.Runnable
public void run() {
try {
AdRequest createAdRequest = AdMobBannerAdapter.this.getAdapter().createAdRequest(jSONObject2, str);
if (parseBoolean) {
AdMobBannerAdapter.this.loadNativeBanner(ironSourceBannerLayout, bannerSmashListener, configStringValueFromKey, createAdRequest, jSONObject);
return;
}
AdSize adSize = AdMobBannerAdapter.this.getAdSize(ironSourceBannerLayout.getSize(), AdapterUtils.isLargeScreen(ContextProvider.getInstance().getApplicationContext()));
if (adSize == null) {
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.unsupportedBannerSize(AdMobBannerAdapter.this.getAdapter().getProviderName()));
return;
}
AdView adView = new AdView(ContextProvider.getInstance().getApplicationContext());
adView.setAdSize(adSize);
adView.setAdUnitId(configStringValueFromKey);
adView.setAdListener(new AdMobBannerAdListener(bannerSmashListener, configStringValueFromKey, adView));
AdMobBannerAdapter.this.mAdUnitIdToBannerAd.put(configStringValueFromKey, adView);
IronLog.ADAPTER_API.verbose("loadAd");
adView.loadAd(createAdRequest);
} catch (Exception e) {
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.buildLoadFailedError("AdMobAdapter loadBanner exception " + e.getMessage()));
}
}
});
}
}
/* JADX INFO: Access modifiers changed from: private */
public void loadNativeBanner(IronSourceBannerLayout ironSourceBannerLayout, BannerSmashListener bannerSmashListener, String str, AdRequest adRequest, JSONObject jSONObject) {
if (!isNativeBannerSizeSupported(ironSourceBannerLayout.getSize(), AdapterUtils.isLargeScreen(ContextProvider.getInstance().getApplicationContext()))) {
IronLog.INTERNAL.error("size not supported, size = " + ironSourceBannerLayout.getSize().getDescription());
bannerSmashListener.onBannerAdLoadFailed(ErrorBuilder.unsupportedBannerSize(getAdapter().getProviderName()));
return;
}
IronLog.ADAPTER_API.verbose("adUnitId = " + str);
NativeTemplateType createTemplateType = NativeTemplateType.createTemplateType(jSONObject, ironSourceBannerLayout.getSize());
AdMobNativeBannerAdListener adMobNativeBannerAdListener = new AdMobNativeBannerAdListener(this, bannerSmashListener, str, ironSourceBannerLayout.getSize(), createTemplateType);
new AdLoader.Builder(ironSourceBannerLayout.getContext(), str).forNativeAd(adMobNativeBannerAdListener).withNativeAdOptions(createNativeAdOptions(createTemplateType)).withAdListener(adMobNativeBannerAdListener).build().loadAd(adRequest);
}
private NativeAdOptions createNativeAdOptions(NativeTemplateType nativeTemplateType) {
NativeAdOptions.Builder builder = new NativeAdOptions.Builder();
builder.setVideoOptions(new VideoOptions.Builder().setStartMuted(true).build());
builder.setAdChoicesPlacement(nativeTemplateType.getAdChoicesPlacement());
builder.setMediaAspectRatio(nativeTemplateType.getMediaAspectRatio());
return builder.build();
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public void destroyBanner(@NonNull final JSONObject jSONObject) {
postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.admob.banner.AdMobBannerAdapter.2
@Override // java.lang.Runnable
public void run() {
try {
AdMobBannerAdapter adMobBannerAdapter = AdMobBannerAdapter.this;
String configStringValueFromKey = adMobBannerAdapter.getConfigStringValueFromKey(jSONObject, adMobBannerAdapter.getAdapter().getAdUnitIdKey());
IronLog.ADAPTER_API.verbose("adUnitId = " + configStringValueFromKey);
if (AdMobBannerAdapter.this.mAdUnitIdToBannerAd.containsKey(configStringValueFromKey)) {
AdView adView = (AdView) AdMobBannerAdapter.this.mAdUnitIdToBannerAd.get(configStringValueFromKey);
if (adView != null) {
adView.destroy();
}
AdMobBannerAdapter.this.mAdUnitIdToBannerAd.remove(configStringValueFromKey);
}
if (AdMobBannerAdapter.this.mAdUnitIdToNativeBannerAd.containsKey(configStringValueFromKey)) {
NativeAd nativeAd = AdMobBannerAdapter.this.mAdUnitIdToNativeBannerAd.get(configStringValueFromKey);
if (nativeAd != null) {
nativeAd.destroy();
}
AdMobBannerAdapter.this.mAdUnitIdToNativeBannerAd.remove(configStringValueFromKey);
}
} catch (Exception e) {
IronLog.ADAPTER_API.error("e = " + e);
}
}
});
}
@Override // com.ironsource.mediationsdk.sdk.ReleaseMemoryAdapterInterface
public void releaseMemory(@NonNull IronSource.AD_UNIT ad_unit, JSONObject jSONObject) {
postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.admob.banner.AdMobBannerAdapter.3
@Override // java.lang.Runnable
public void run() {
Iterator it = AdMobBannerAdapter.this.mAdUnitIdToBannerAd.values().iterator();
while (it.hasNext()) {
((AdView) it.next()).destroy();
}
Iterator<NativeAd> it2 = AdMobBannerAdapter.this.mAdUnitIdToNativeBannerAd.values().iterator();
while (it2.hasNext()) {
it2.next().destroy();
}
AdMobBannerAdapter.this.mAdUnitIdToBannerAd.clear();
AdMobBannerAdapter.this.mAdUnitIdToListener.clear();
AdMobBannerAdapter.this.mAdUnitIdToNativeBannerAd.clear();
}
});
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public void collectBannerBiddingData(@NonNull JSONObject jSONObject, JSONObject jSONObject2, BiddingDataCallback biddingDataCallback) {
IronSourceBannerLayout ironSourceBannerLayout;
Bundle bundle = new Bundle();
if (jSONObject2 != null && (ironSourceBannerLayout = (IronSourceBannerLayout) jSONObject2.opt("bannerLayout")) != null) {
ISBannerSize size = ironSourceBannerLayout.getSize();
if (size.isAdaptive()) {
AdSize adSize = getAdSize(size, AdapterUtils.isLargeScreen(ContextProvider.getInstance().getApplicationContext()));
bundle.putInt("adaptive_banner_w", adSize.getWidth());
bundle.putInt("adaptive_banner_h", adSize.getHeight());
IronLog.ADAPTER_API.verbose("adaptive banner width = " + adSize.getWidth() + ", height = " + adSize.getHeight());
}
}
getAdapter().collectBiddingData(biddingDataCallback, AdFormat.BANNER, bundle);
}
@Override // com.ironsource.mediationsdk.adapter.AbstractBannerAdapter, com.ironsource.mediationsdk.sdk.BannerAdapterInterface
public int getAdaptiveHeight(int i) {
int height = getAdaptiveBannerSize(i).getHeight();
IronLog.ADAPTER_API.verbose("height - " + height + " for width - " + i);
return height;
}
public AdSize getAdSize(ISBannerSize iSBannerSize, boolean z) {
AdSize adSize;
String description = iSBannerSize.getDescription();
description.hashCode();
switch (description) {
case "RECTANGLE":
adSize = AdSize.MEDIUM_RECTANGLE;
break;
case "LARGE":
adSize = AdSize.LARGE_BANNER;
break;
case "SMART":
if (!z) {
adSize = AdSize.BANNER;
break;
} else {
adSize = AdSize.LEADERBOARD;
break;
}
case "BANNER":
adSize = AdSize.BANNER;
break;
case "CUSTOM":
adSize = new AdSize(iSBannerSize.getWidth(), iSBannerSize.getHeight());
break;
default:
adSize = null;
break;
}
try {
if (iSBannerSize.isAdaptive() && adSize != null) {
AdSize adaptiveBannerSize = getAdaptiveBannerSize(iSBannerSize.containerParams.getWidth());
IronLog.INTERNAL.verbose("default height - " + adSize.getHeight() + " adaptive height - " + adaptiveBannerSize.getHeight() + " container height - " + iSBannerSize.containerParams.getHeight() + " default width - " + adSize.getWidth() + " container width - " + iSBannerSize.containerParams.getWidth());
return adaptiveBannerSize;
}
} catch (Exception unused) {
IronLog.INTERNAL.error("containerParams is not supported");
}
return adSize;
}
private static AdSize getAdaptiveBannerSize(int i) {
return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(ContextProvider.getInstance().getApplicationContext(), i);
}
private boolean isNativeBannerSizeSupported(ISBannerSize iSBannerSize, boolean z) {
String description = iSBannerSize.getDescription();
description.hashCode();
switch (description) {
case "RECTANGLE":
case "LARGE":
case "BANNER":
return true;
case "SMART":
return !z;
default:
return false;
}
}
}

View File

@@ -0,0 +1,119 @@
package com.ironsource.adapters.admob.banner;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.LoadAdError;
import com.google.android.gms.ads.nativead.NativeAd;
import com.ironsource.adapters.admob.AdMobAdapter;
import com.ironsource.environment.ContextProvider;
import com.ironsource.mediationsdk.AbstractAdapter;
import com.ironsource.mediationsdk.ISBannerSize;
import com.ironsource.mediationsdk.logger.IronLog;
import com.ironsource.mediationsdk.logger.IronSourceError;
import com.ironsource.mediationsdk.sdk.BannerSmashListener;
import com.ironsource.mediationsdk.utils.ErrorBuilder;
import java.lang.ref.WeakReference;
/* loaded from: classes2.dex */
public class AdMobNativeBannerAdListener extends AdListener implements NativeAd.OnNativeAdLoadedListener {
private final String mAdUnitId;
private final WeakReference<AdMobBannerAdapter> mBannerAdapter;
private final ISBannerSize mBannerSize;
private final BannerSmashListener mListener;
private final NativeTemplateType mTemplateType;
public AdMobNativeBannerAdListener(AdMobBannerAdapter adMobBannerAdapter, BannerSmashListener bannerSmashListener, String str, ISBannerSize iSBannerSize, NativeTemplateType nativeTemplateType) {
this.mBannerAdapter = new WeakReference<>(adMobBannerAdapter);
this.mListener = bannerSmashListener;
this.mAdUnitId = str;
this.mBannerSize = iSBannerSize;
this.mTemplateType = nativeTemplateType;
}
@Override // com.google.android.gms.ads.nativead.NativeAd.OnNativeAdLoadedListener
public void onNativeAdLoaded(final NativeAd nativeAd) {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
AbstractAdapter.postOnUIThread(new Runnable() { // from class: com.ironsource.adapters.admob.banner.AdMobNativeBannerAdListener.1
@Override // java.lang.Runnable
public void run() {
if (AdMobNativeBannerAdListener.this.mListener != null) {
if (AdMobNativeBannerAdListener.this.mBannerAdapter == null || AdMobNativeBannerAdListener.this.mBannerAdapter.get() == null) {
IronLog.INTERNAL.verbose("adapter is null");
return;
}
AdMobNativeBannerViewHandler adMobNativeBannerViewHandler = new AdMobNativeBannerViewHandler(AdMobNativeBannerAdListener.this.mBannerSize, AdMobNativeBannerAdListener.this.mTemplateType, ContextProvider.getInstance().getApplicationContext());
new AdMobNativeBannerViewBinder().bindView(nativeAd, adMobNativeBannerViewHandler.getNativeAdView(), AdMobNativeBannerAdListener.this.mTemplateType);
((AdMobBannerAdapter) AdMobNativeBannerAdListener.this.mBannerAdapter.get()).mAdUnitIdToNativeBannerAd.put(AdMobNativeBannerAdListener.this.mAdUnitId, nativeAd);
AdMobNativeBannerAdListener.this.mListener.onBannerAdLoaded(adMobNativeBannerViewHandler.getNativeAdView(), adMobNativeBannerViewHandler.getLayoutParams());
return;
}
IronLog.INTERNAL.verbose("listener is null");
}
});
}
@Override // com.google.android.gms.ads.AdListener
public void onAdFailedToLoad(LoadAdError loadAdError) {
IronSourceError buildLoadFailedError;
IronLog ironLog = IronLog.ADAPTER_CALLBACK;
ironLog.verbose("adUnitId = " + this.mAdUnitId);
if (this.mListener == null) {
IronLog.INTERNAL.verbose("listener is null");
return;
}
String str = loadAdError.getMessage() + "( " + loadAdError.getCode() + " ) ";
if (loadAdError.getCause() != null) {
str = str + " Caused by - " + loadAdError.getCause();
}
if (AdMobAdapter.isNoFillError(loadAdError.getCode())) {
buildLoadFailedError = new IronSourceError(606, str);
} else {
buildLoadFailedError = ErrorBuilder.buildLoadFailedError(str);
}
ironLog.error(str + str);
this.mListener.onBannerAdLoadFailed(buildLoadFailedError);
}
@Override // com.google.android.gms.ads.AdListener
public void onAdImpression() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdShown();
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdClicked() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdClicked();
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdOpened() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdScreenPresented();
}
}
@Override // com.google.android.gms.ads.AdListener
public void onAdClosed() {
IronLog.ADAPTER_CALLBACK.verbose("adUnitId = " + this.mAdUnitId);
BannerSmashListener bannerSmashListener = this.mListener;
if (bannerSmashListener == null) {
IronLog.INTERNAL.verbose("listener is null");
} else {
bannerSmashListener.onBannerAdScreenDismissed();
}
}
}

View File

@@ -0,0 +1,112 @@
package com.ironsource.adapters.admob.banner;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.android.gms.ads.nativead.MediaView;
import com.google.android.gms.ads.nativead.NativeAd;
import com.google.android.gms.ads.nativead.NativeAdView;
import com.ironsource.adapters.admob.R;
/* loaded from: classes2.dex */
public class AdMobNativeBannerViewBinder {
private NativeAdView mAdView;
private NativeAd mNativeAd;
private NativeTemplateType mTemplateType;
public void bindView(NativeAd nativeAd, NativeAdView nativeAdView, NativeTemplateType nativeTemplateType) {
this.mAdView = nativeAdView;
this.mNativeAd = nativeAd;
this.mTemplateType = nativeTemplateType;
populateView();
this.mAdView.setNativeAd(nativeAd);
}
private void populateView() {
populateIconView();
populateHeadlineView();
populateAdvertiserView();
populateBodyView();
populateMediaView();
populateCallToActionView();
}
private void populateIconView() {
ImageView imageView = (ImageView) this.mAdView.findViewById(R.id.ad_app_icon);
if (imageView != null) {
this.mAdView.setIconView(imageView);
if (this.mNativeAd.getIcon() != null && this.mNativeAd.getIcon().getDrawable() != null) {
imageView.setImageDrawable(this.mNativeAd.getIcon().getDrawable());
this.mAdView.getIconView().setVisibility(0);
} else {
this.mAdView.getIconView().setVisibility(8);
}
}
}
private void populateHeadlineView() {
TextView textView = (TextView) this.mAdView.findViewById(R.id.ad_headline);
if (textView != null) {
if (this.mNativeAd.getHeadline() != null) {
this.mAdView.setHeadlineView(textView);
textView.setText(this.mNativeAd.getHeadline());
textView.setVisibility(0);
return;
}
textView.setVisibility(8);
}
}
private void populateAdvertiserView() {
TextView textView = (TextView) this.mAdView.findViewById(R.id.ad_advertiser);
if (textView != null) {
if (this.mNativeAd.getAdvertiser() != null) {
this.mAdView.setAdvertiserView(textView);
textView.setText(this.mNativeAd.getAdvertiser());
textView.setVisibility(0);
return;
}
textView.setVisibility(8);
}
}
private void populateBodyView() {
TextView textView = (TextView) this.mAdView.findViewById(R.id.ad_body);
if (textView != null) {
if (this.mNativeAd.getBody() != null) {
this.mAdView.setBodyView(textView);
textView.setText(this.mNativeAd.getBody());
textView.setVisibility(0);
return;
}
textView.setVisibility(8);
}
}
private void populateMediaView() {
MediaView mediaView = (MediaView) this.mAdView.findViewById(R.id.ad_media);
if (mediaView != null) {
if (this.mNativeAd.getMediaContent() != null) {
boolean z = this.mNativeAd.getMediaContent().hasVideoContent() && this.mTemplateType.shouldHideVideoContent();
this.mAdView.setMediaView(mediaView);
mediaView.setMediaContent(this.mNativeAd.getMediaContent());
mediaView.setVisibility(z ? 8 : 0);
return;
}
mediaView.setVisibility(8);
}
}
private void populateCallToActionView() {
Button button = (Button) this.mAdView.findViewById(R.id.ad_call_to_action);
if (button != null) {
if (this.mNativeAd.getCallToAction() == null || this.mTemplateType.shouldHideCallToAction()) {
button.setVisibility(8);
return;
}
this.mAdView.setCallToActionView(button);
button.setText(this.mNativeAd.getCallToAction());
button.setVisibility(0);
}
}
}

View File

@@ -0,0 +1,45 @@
package com.ironsource.adapters.admob.banner;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import com.google.android.gms.ads.nativead.NativeAdView;
import com.ironsource.mediationsdk.AdapterUtils;
import com.ironsource.mediationsdk.ISBannerSize;
import com.vungle.ads.internal.protos.Sdk;
/* loaded from: classes2.dex */
public class AdMobNativeBannerViewHandler {
private final NativeAdView mAdView;
private FrameLayout.LayoutParams mLayoutParams;
private NativeTemplateType mTemplateType;
public FrameLayout.LayoutParams getLayoutParams() {
return this.mLayoutParams;
}
public NativeAdView getNativeAdView() {
return this.mAdView;
}
public AdMobNativeBannerViewHandler(ISBannerSize iSBannerSize, NativeTemplateType nativeTemplateType, Context context) {
this.mTemplateType = nativeTemplateType;
String description = iSBannerSize.getDescription();
description.hashCode();
switch (description) {
case "RECTANGLE":
this.mLayoutParams = new FrameLayout.LayoutParams(AdapterUtils.dpToPixels(context, 300), AdapterUtils.dpToPixels(context, 250));
break;
case "LARGE":
this.mLayoutParams = new FrameLayout.LayoutParams(AdapterUtils.dpToPixels(context, Sdk.SDKError.Reason.WEBVIEW_ERROR_VALUE), AdapterUtils.dpToPixels(context, 90));
break;
case "SMART":
case "BANNER":
this.mLayoutParams = new FrameLayout.LayoutParams(AdapterUtils.dpToPixels(context, Sdk.SDKError.Reason.WEBVIEW_ERROR_VALUE), AdapterUtils.dpToPixels(context, 50));
break;
}
this.mLayoutParams.gravity = 17;
this.mAdView = (NativeAdView) ((LayoutInflater) context.getSystemService("layout_inflater")).inflate(this.mTemplateType.getLayoutId(), (ViewGroup) null);
}
}

View File

@@ -0,0 +1,69 @@
package com.ironsource.adapters.admob.banner;
import com.ironsource.adapters.admob.R;
import com.ironsource.mediationsdk.ISBannerSize;
import org.json.JSONObject;
/* loaded from: classes2.dex */
enum NativeTemplateType {
NB_TMP_BASIC(R.layout.ad_mob_native_banner_template_basic_layout, true, true, 1, 1),
NB_TMP_BASIC_LARGE(R.layout.ad_mob_native_banner_template_basic_layout, false, true, 1, 1),
NB_TMP_ICON_TEXT(R.layout.ad_mob_native_banner_template_icon_text_layout, true, true, 1, 1),
NB_TMP_TEXT_CTA(R.layout.ad_mob_native_banner_template_text_cta_layout, false, true, 3, 1),
NB_TMP_RECT(R.layout.ad_mob_native_banner_template_rect_layout, false, false, 1, 1);
private static final String NATIVE_TEMPLATE_NAME = "nativeBannerTemplateName";
private final int mAdChoicesPlacement;
private final boolean mHideCallToAction;
private final boolean mHideVideoContent;
private final int mLayoutId;
private final int mMediaAspectRatio;
public int getAdChoicesPlacement() {
return this.mAdChoicesPlacement;
}
public int getLayoutId() {
return this.mLayoutId;
}
public int getMediaAspectRatio() {
return this.mMediaAspectRatio;
}
public boolean shouldHideCallToAction() {
return this.mHideCallToAction;
}
public boolean shouldHideVideoContent() {
return this.mHideVideoContent;
}
NativeTemplateType(int i, boolean z, boolean z2, int i2, int i3) {
this.mLayoutId = i;
this.mHideCallToAction = z;
this.mHideVideoContent = z2;
this.mAdChoicesPlacement = i2;
this.mMediaAspectRatio = i3;
}
public static NativeTemplateType createTemplateType(JSONObject jSONObject, ISBannerSize iSBannerSize) {
String description = iSBannerSize.getDescription();
description.hashCode();
switch (description) {
case "RECTANGLE":
return NB_TMP_RECT;
case "LARGE":
return NB_TMP_BASIC_LARGE;
case "SMART":
case "BANNER":
try {
return valueOf(jSONObject.optString(NATIVE_TEMPLATE_NAME, NB_TMP_ICON_TEXT.toString()));
} catch (IllegalArgumentException unused) {
return NB_TMP_ICON_TEXT;
}
default:
return NB_TMP_BASIC;
}
}
}