package com.igaworks.ssp.common.adapter; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.os.Handler; import android.os.Looper; import android.widget.Button; import android.widget.ImageView; import android.widget.RatingBar; import android.widget.TextView; import com.google.android.gms.ads.AdError; import com.google.android.gms.ads.AdListener; import com.google.android.gms.ads.AdLoader; import com.google.android.gms.ads.AdRequest; import com.google.android.gms.ads.AdView; import com.google.android.gms.ads.FullScreenContentCallback; import com.google.android.gms.ads.LoadAdError; import com.google.android.gms.ads.MobileAds; import com.google.android.gms.ads.OnUserEarnedRewardListener; import com.google.android.gms.ads.interstitial.InterstitialAd; import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback; 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.google.android.gms.ads.rewarded.RewardItem; import com.google.android.gms.ads.rewarded.RewardedAd; import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback; import com.igaworks.ssp.AdSize; import com.igaworks.ssp.SdkInitListener; import com.igaworks.ssp.common.m.c; import com.igaworks.ssp.common.m.f; import com.igaworks.ssp.part.banner.AdPopcornSSPBannerAd; import com.igaworks.ssp.part.banner.listener.a; import com.igaworks.ssp.part.custom.AdPopcornSSPReactNativeAd; import com.igaworks.ssp.part.interstitial.listener.b; import com.igaworks.ssp.part.nativead.AdPopcornSSPNativeAd; import com.igaworks.ssp.part.splash.AdPopcornSSPSplashAd; import com.igaworks.ssp.part.video.AdPopcornSSPInterstitialVideoAd; import com.igaworks.ssp.part.video.AdPopcornSSPRewardVideoAd; import java.util.HashMap; /* loaded from: classes2.dex */ public class AdmobAdapter implements BaseMediationAdapter { private Runnable B; private int C; private AdListener D; /* renamed from: a, reason: collision with root package name */ private a f5892a; /* renamed from: b, reason: collision with root package name */ private b f5893b; /* renamed from: c, reason: collision with root package name */ private com.igaworks.ssp.part.nativead.listener.a f5894c; /* renamed from: d, reason: collision with root package name */ private com.igaworks.ssp.part.video.listener.b f5895d; /* renamed from: e, reason: collision with root package name */ private com.igaworks.ssp.part.video.listener.a f5896e; /* renamed from: f, reason: collision with root package name */ private com.igaworks.ssp.part.splash.listener.a f5897f; /* renamed from: g, reason: collision with root package name */ private com.igaworks.ssp.part.custom.listener.a f5898g; /* renamed from: i, reason: collision with root package name */ private AdView f5900i; /* renamed from: j, reason: collision with root package name */ private AdRequest f5901j; /* renamed from: k, reason: collision with root package name */ private InterstitialAd f5902k; /* renamed from: l, reason: collision with root package name */ private InterstitialAd f5903l; /* renamed from: m, reason: collision with root package name */ private AdLoader f5904m; /* renamed from: n, reason: collision with root package name */ private NativeAdView f5905n; /* renamed from: o, reason: collision with root package name */ private NativeAd f5906o; /* renamed from: p, reason: collision with root package name */ private RewardedAd f5907p; /* renamed from: q, reason: collision with root package name */ private String f5908q; /* renamed from: r, reason: collision with root package name */ private int f5909r; /* renamed from: s, reason: collision with root package name */ private int f5910s; /* renamed from: w, reason: collision with root package name */ private Runnable f5914w; /* renamed from: x, reason: collision with root package name */ private Runnable f5915x; /* renamed from: h, reason: collision with root package name */ private boolean f5899h = true; /* renamed from: t, reason: collision with root package name */ private boolean f5911t = true; /* renamed from: u, reason: collision with root package name */ private boolean f5912u = true; /* renamed from: v, reason: collision with root package name */ private Handler f5913v = new Handler(Looper.getMainLooper()); /* renamed from: y, reason: collision with root package name */ private boolean f5916y = false; /* renamed from: z, reason: collision with root package name */ private boolean f5917z = false; private Handler A = new Handler(Looper.getMainLooper()); @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void checkAdPopcornSSPNativeImpression() { } public void checkAdPopcornSSPReactNativeImpression() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void checkValidMediation() { this.D = new AdListener(this) { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.1 @Override // com.google.android.gms.ads.AdListener public void onAdFailedToLoad(LoadAdError loadAdError) { } }; com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdmobAdapter validCheckListener exist"); } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroyBannerAd() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.destroyBannerAd"); AdView adView = this.f5900i; if (adView != null) { adView.removeAllViews(); this.f5900i.setAdListener(null); this.f5900i.destroy(); } this.f5892a = null; stopBannerTimer(); } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroyInterstitial() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroyInterstitialVideoAd() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.destroyInterstitialVideoAd() : " + this.f5903l); this.f5917z = false; a(false); } catch (Exception unused) { } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroyNativeAd() { NativeAdView nativeAdView = this.f5905n; if (nativeAdView != null) { nativeAdView.destroy(); } if (this.f5904m != null) { this.f5904m = null; } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroyReactNativeAd() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroyRewardVideoAd() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.destroyRewardVideoAd() : " + this.f5907p); this.f5916y = false; a(true); } catch (Exception unused) { } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void destroySplashAd() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public String getBiddingToken(Context context) { return null; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public String getNetworkName() { return com.igaworks.ssp.common.b.ADMOB.c(); } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void initializeInAppBidding(Context context, c cVar, SdkInitListener sdkInitListener) { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void internalStopBannerAd() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.internalStopBannerAd"); AdView adView = this.f5900i; if (adView != null) { adView.setAdListener(null); } this.f5892a = null; stopBannerTimer(); } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void loadInterstitial(Context context, f fVar, boolean z10, final int i10) { try { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter loadInterstitial"); a(context); String a10 = fVar.d().a().get(i10).a(com.igaworks.ssp.common.b.ADMOB.c()); if (this.f5902k != null) { this.f5902k = null; } InterstitialAd.load(context, a10, new AdRequest.Builder().build(), new InterstitialAdLoadCallback() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.4 @Override // com.google.android.gms.ads.AdLoadCallback /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void onAdLoaded(InterstitialAd interstitialAd) { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter loadInterstitial onAdLoaded"); AdmobAdapter.this.f5902k = interstitialAd; if (AdmobAdapter.this.f5893b != null) { AdmobAdapter.this.f5893b.b(i10); } } @Override // com.google.android.gms.ads.AdLoadCallback public void onAdFailedToLoad(LoadAdError loadAdError) { AdmobAdapter.this.f5902k = null; String format = String.format("domain: %s, code: %d, message: %s", loadAdError.getDomain(), Integer.valueOf(loadAdError.getCode()), loadAdError.getMessage()); com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitial onAdFailedToLoad " + format); if (AdmobAdapter.this.f5893b != null) { AdmobAdapter.this.f5893b.c(i10); } } }); } catch (Exception e10) { b bVar = this.f5893b; if (bVar != null) { bVar.c(i10); } com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void loadInterstitialVideoAd(Context context, AdPopcornSSPInterstitialVideoAd adPopcornSSPInterstitialVideoAd, f fVar, boolean z10, int i10) { com.igaworks.ssp.part.video.listener.a aVar; try { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter loadInterstitialVideoAd"); this.f5917z = true; this.f5909r = i10; this.f5912u = true; if (adPopcornSSPInterstitialVideoAd.getNetworkScheduleTimeout() > 0) { if (this.f5913v == null) { this.f5913v = new Handler(); } if (this.f5915x == null) { this.f5915x = new Runnable() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.12 @Override // java.lang.Runnable public void run() { if (AdmobAdapter.this.f5912u) { com.igaworks.ssp.common.o.m.a.b(Thread.currentThread(), String.format("Time out in : %s", AdmobAdapter.this.getNetworkName())); AdmobAdapter.this.a(false); if (!AdmobAdapter.this.f5917z || AdmobAdapter.this.f5896e == null) { return; } AdmobAdapter.this.f5896e.c(AdmobAdapter.this.f5909r); } } }; } this.f5913v.postDelayed(this.f5915x, adPopcornSSPInterstitialVideoAd.getNetworkScheduleTimeout()); } a(context); String a10 = fVar.d().a().get(i10).a(com.igaworks.ssp.common.b.ADMOB.c()); if (this.f5903l != null) { this.f5903l = null; } InterstitialAd.load(context, a10, new AdRequest.Builder().build(), new InterstitialAdLoadCallback() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.13 @Override // com.google.android.gms.ads.AdLoadCallback /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void onAdLoaded(InterstitialAd interstitialAd) { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitialVideo onAdLoaded"); AdmobAdapter.this.f5903l = interstitialAd; AdmobAdapter.this.a(false); if (!AdmobAdapter.this.f5917z || AdmobAdapter.this.f5896e == null) { return; } AdmobAdapter.this.f5896e.b(AdmobAdapter.this.f5909r); } @Override // com.google.android.gms.ads.AdLoadCallback public void onAdFailedToLoad(LoadAdError loadAdError) { AdmobAdapter.this.f5902k = null; String format = String.format("domain: %s, code: %d, message: %s", loadAdError.getDomain(), Integer.valueOf(loadAdError.getCode()), loadAdError.getMessage()); com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitialVideo onAdFailedToLoad " + format); AdmobAdapter.this.a(false); if (!AdmobAdapter.this.f5917z || AdmobAdapter.this.f5896e == null) { return; } AdmobAdapter.this.f5896e.c(AdmobAdapter.this.f5909r); } }); } catch (Exception e10) { a(false); com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); if (!this.f5917z || (aVar = this.f5896e) == null) { return; } aVar.c(this.f5909r); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void loadNativeAd(Context context, f fVar, boolean z10, final int i10, final AdPopcornSSPNativeAd adPopcornSSPNativeAd) { try { if (adPopcornSSPNativeAd.getAdMobViewBinder() == null) { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter viewBinder is null"); com.igaworks.ssp.part.nativead.listener.a aVar = this.f5894c; if (aVar != null) { aVar.a(i10, 3); return; } return; } com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter loadNativeAd"); AdLoader.Builder builder = new AdLoader.Builder(context, fVar.d().a().get(i10).a(com.igaworks.ssp.common.b.ADMOB.c())); builder.forNativeAd(new NativeAd.OnNativeAdLoadedListener() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.10 @Override // com.google.android.gms.ads.nativead.NativeAd.OnNativeAdLoadedListener public void onNativeAdLoaded(NativeAd nativeAd) { try { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter onNativeAdLoaded"); if (AdmobAdapter.this.f5906o != null) { AdmobAdapter.this.f5906o.destroy(); } AdmobAdapter.this.f5906o = nativeAd; AdmobAdapter admobAdapter = AdmobAdapter.this; admobAdapter.a(admobAdapter.f5906o, adPopcornSSPNativeAd); if (AdmobAdapter.this.f5894c != null) { AdmobAdapter.this.f5894c.a(i10); } if (AdmobAdapter.this.f5905n != null) { AdmobAdapter.this.f5905n.setVisibility(0); } } catch (Exception e10) { e10.printStackTrace(); if (AdmobAdapter.this.f5894c != null) { AdmobAdapter.this.f5894c.a(i10, 1); } } } }); AdLoader build = builder.withAdListener(new AdListener() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.11 @Override // com.google.android.gms.ads.AdListener, com.google.android.gms.ads.internal.client.zza public void onAdClicked() { super.onAdClicked(); com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter nativeAd onAdClicked"); if (AdmobAdapter.this.f5894c != null) { AdmobAdapter.this.f5894c.onClicked(); } } @Override // com.google.android.gms.ads.AdListener public void onAdClosed() { super.onAdClosed(); } @Override // com.google.android.gms.ads.AdListener public void onAdFailedToLoad(LoadAdError loadAdError) { String format = String.format("responseInfo: %s, code: %d, message: %s", loadAdError.getResponseInfo(), Integer.valueOf(loadAdError.getCode()), loadAdError.getMessage()); com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter NativeAd onAdFailedToLoad : " + format); if (AdmobAdapter.this.f5894c != null) { AdmobAdapter.this.f5894c.a(i10, 2); } } @Override // com.google.android.gms.ads.AdListener public void onAdImpression() { super.onAdImpression(); com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter nativeAd onAdImpression"); if (AdmobAdapter.this.f5894c != null) { AdmobAdapter.this.f5894c.onImpression(); } } @Override // com.google.android.gms.ads.AdListener public void onAdLoaded() { super.onAdLoaded(); } @Override // com.google.android.gms.ads.AdListener public void onAdOpened() { super.onAdOpened(); } }).build(); if (adPopcornSSPNativeAd.getAdMobViewBinder().nativeAdViewId != 0) { this.f5905n = (NativeAdView) adPopcornSSPNativeAd.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().nativeAdViewId); } build.loadAd(new AdRequest.Builder().build()); } catch (Exception e10) { e10.printStackTrace(); com.igaworks.ssp.part.nativead.listener.a aVar2 = this.f5894c; if (aVar2 != null) { aVar2.a(i10, 0); } } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void loadReactNativeAd(Context context, f fVar, boolean z10, int i10, AdPopcornSSPReactNativeAd adPopcornSSPReactNativeAd) { com.igaworks.ssp.part.custom.listener.a aVar = this.f5898g; if (aVar != null) { aVar.a(i10, 2); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void loadRewardVideoAd(Context context, AdPopcornSSPRewardVideoAd adPopcornSSPRewardVideoAd, f fVar, boolean z10, int i10) { com.igaworks.ssp.part.video.listener.b bVar; try { this.f5916y = true; com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.loadRewardVideoAd()"); this.f5910s = i10; this.f5911t = true; if (adPopcornSSPRewardVideoAd.getNetworkScheduleTimeout() > 0) { if (this.f5913v == null) { this.f5913v = new Handler(); } if (this.f5914w == null) { this.f5914w = new Runnable() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.6 @Override // java.lang.Runnable public void run() { if (AdmobAdapter.this.f5911t) { com.igaworks.ssp.common.o.m.a.b(Thread.currentThread(), String.format("Time out in : %s", AdmobAdapter.this.getNetworkName())); AdmobAdapter.this.a(true); if (!AdmobAdapter.this.f5916y || AdmobAdapter.this.f5895d == null) { return; } AdmobAdapter.this.f5895d.c(AdmobAdapter.this.f5910s); } } }; } this.f5913v.postDelayed(this.f5914w, adPopcornSSPRewardVideoAd.getNetworkScheduleTimeout()); } com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.loadRewardVideoAd() load ad"); this.f5908q = fVar.d().a().get(i10).a(com.igaworks.ssp.common.b.ADMOB.c()); RewardedAd.load(context, this.f5908q, new AdRequest.Builder().build(), new RewardedAdLoadCallback() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.7 @Override // com.google.android.gms.ads.AdLoadCallback /* renamed from: a, reason: merged with bridge method [inline-methods] */ public void onAdLoaded(RewardedAd rewardedAd) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter RV onAdLoaded"); AdmobAdapter.this.a(true); AdmobAdapter.this.f5907p = rewardedAd; if (!AdmobAdapter.this.f5916y || AdmobAdapter.this.f5895d == null) { return; } AdmobAdapter.this.f5895d.b(AdmobAdapter.this.f5910s); } @Override // com.google.android.gms.ads.AdLoadCallback public void onAdFailedToLoad(LoadAdError loadAdError) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter RV onAdFailedToLoad() : " + loadAdError.getMessage()); AdmobAdapter.this.f5907p = null; AdmobAdapter.this.a(true); if (!AdmobAdapter.this.f5916y || AdmobAdapter.this.f5895d == null) { return; } AdmobAdapter.this.f5895d.c(AdmobAdapter.this.f5910s); } }); } catch (Exception e10) { a(true); com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); if (!this.f5916y || (bVar = this.f5895d) == null) { return; } bVar.c(this.f5910s); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void loadSplashAd(Context context, f fVar, int i10, AdPopcornSSPSplashAd adPopcornSSPSplashAd) { com.igaworks.ssp.part.splash.listener.a aVar = this.f5897f; if (aVar != null) { aVar.a(i10, 2); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void onPauseBanner() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void onResumeBanner() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void pauseInterstitialVideoAd() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void pauseRewardVideoAd() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.pauseRewardVideoAd()"); } catch (Exception unused) { } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void resumeInterstitial() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void resumeInterstitialVideoAd() { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void resumeRewardVideoAd() { try { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.resumeRewardVideoAd()"); } catch (Exception unused) { } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setBannerMediationAdapterEventListener(a aVar) { this.f5892a = aVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setCustomExtras(HashMap hashMap) { } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setInterstitialMediationAdapterEventListener(b bVar) { this.f5893b = bVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setInterstitialVideoMediationAdapterEventListener(com.igaworks.ssp.part.video.listener.a aVar) { this.f5896e = aVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setNativeMediationAdapterEventListener(com.igaworks.ssp.part.nativead.listener.a aVar) { this.f5894c = aVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setReactNativeMediationAdapterEventListener(com.igaworks.ssp.part.custom.listener.a aVar) { this.f5898g = aVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setRewardVideoMediationAdapterEventListener(com.igaworks.ssp.part.video.listener.b bVar) { this.f5895d = bVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void setSplashMediationAdapterEventListener(com.igaworks.ssp.part.splash.listener.a aVar) { this.f5897f = aVar; } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void showInterstitial(Context context, f fVar, boolean z10, final int i10) { try { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter showInterstitial"); InterstitialAd interstitialAd = this.f5902k; if (interstitialAd != null) { interstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.5 @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdDismissedFullScreenContent() { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitial onAdDismissedFullScreenContent"); AdmobAdapter.this.f5902k = null; if (AdmobAdapter.this.f5893b != null) { AdmobAdapter.this.f5893b.e(0); } } @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdFailedToShowFullScreenContent(AdError adError) { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitial onAdFailedToShowFullScreenContent"); AdmobAdapter.this.f5902k = null; if (AdmobAdapter.this.f5893b != null) { AdmobAdapter.this.f5893b.d(i10); } } @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdShowedFullScreenContent() { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitial onAdShowedFullScreenContent"); if (AdmobAdapter.this.f5893b != null) { AdmobAdapter.this.f5893b.a(i10); } } }); this.f5902k.show((Activity) context); } else { b bVar = this.f5893b; if (bVar != null) { bVar.d(i10); } } } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); b bVar2 = this.f5893b; if (bVar2 != null) { bVar2.d(i10); } } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void showInterstitialVideoAd(Context context, f fVar, boolean z10, int i10) { com.igaworks.ssp.part.video.listener.a aVar; com.igaworks.ssp.part.video.listener.a aVar2; try { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter showInterstitialVideoAd"); InterstitialAd interstitialAd = this.f5903l; if (interstitialAd != null) { interstitialAd.setFullScreenContentCallback(new FullScreenContentCallback() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.14 @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdDismissedFullScreenContent() { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitialVideo onAdDismissedFullScreenContent"); AdmobAdapter.this.f5903l = null; if (AdmobAdapter.this.f5896e != null) { AdmobAdapter.this.f5896e.a(); } AdmobAdapter.this.f5917z = false; } @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdFailedToShowFullScreenContent(AdError adError) { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitialVideo onAdFailedToShowFullScreenContent"); AdmobAdapter.this.f5903l = null; if (!AdmobAdapter.this.f5917z || AdmobAdapter.this.f5896e == null) { return; } AdmobAdapter.this.f5896e.d(AdmobAdapter.this.f5909r); } @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdShowedFullScreenContent() { com.igaworks.ssp.common.o.m.a.c(Thread.currentThread(), "AdmobAdapter interstitialVideo onAdShowedFullScreenContent"); if (!AdmobAdapter.this.f5917z || AdmobAdapter.this.f5896e == null) { return; } AdmobAdapter.this.f5896e.a(AdmobAdapter.this.f5909r); } }); this.f5903l.show((Activity) context); } else if (this.f5917z && (aVar2 = this.f5896e) != null) { aVar2.d(this.f5909r); } } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); if (!this.f5917z || (aVar = this.f5896e) == null) { return; } aVar.d(this.f5909r); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void showRewardVideoAd(Context context, f fVar, boolean z10, final int i10) { com.igaworks.ssp.part.video.listener.b bVar; com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter.showRewardVideoAd()"); RewardedAd rewardedAd = this.f5907p; if (rewardedAd != null) { rewardedAd.setFullScreenContentCallback(new FullScreenContentCallback() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.8 @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdDismissedFullScreenContent() { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter RV onAdDismissedFullScreenContent()"); AdmobAdapter.this.f5907p = null; if (AdmobAdapter.this.f5895d != null) { AdmobAdapter.this.f5895d.a(); } } @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdFailedToShowFullScreenContent(AdError adError) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter RV onAdFailedToShowFullScreenContent()"); AdmobAdapter.this.f5907p = null; if (!AdmobAdapter.this.f5916y || AdmobAdapter.this.f5895d == null) { return; } AdmobAdapter.this.f5895d.d(i10); } @Override // com.google.android.gms.ads.FullScreenContentCallback public void onAdShowedFullScreenContent() { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdMobAdapter RV onAdShowedFullScreenContent()"); if (!AdmobAdapter.this.f5916y || AdmobAdapter.this.f5895d == null) { return; } AdmobAdapter.this.f5895d.a(i10); } }); this.f5907p.show((Activity) context, new OnUserEarnedRewardListener() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.9 @Override // com.google.android.gms.ads.OnUserEarnedRewardListener public void onUserEarnedReward(RewardItem rewardItem) { if (AdmobAdapter.this.f5895d != null) { AdmobAdapter.this.f5895d.a(com.igaworks.ssp.common.b.ADMOB.a(), true); } AdmobAdapter.this.f5916y = false; } }); } else { if (!this.f5916y || (bVar = this.f5895d) == null) { return; } bVar.d(i10); } } @Override // com.igaworks.ssp.common.adapter.BaseMediationAdapter public void startBannerAd(Context context, AdSize adSize, final AdPopcornSSPBannerAd adPopcornSSPBannerAd, f fVar, boolean z10, int i10) { try { this.f5899h = true; this.C = i10; if (adPopcornSSPBannerAd.getNetworkScheduleTimeout() > 0) { if (this.A == null) { this.A = new Handler(); } if (this.B == null) { this.B = new Runnable() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.2 @Override // java.lang.Runnable public void run() { if (AdmobAdapter.this.f5899h) { com.igaworks.ssp.common.o.m.a.b(Thread.currentThread(), String.format("Time out in : %s", AdmobAdapter.this.getNetworkName())); if (AdmobAdapter.this.f5892a != null) { AdmobAdapter.this.f5892a.a(AdmobAdapter.this.C); } } } }; } this.A.postDelayed(this.B, adPopcornSSPBannerAd.getNetworkScheduleTimeout()); } a(context); com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "AdmobAdapter.startBannerAd()"); String a10 = fVar.d().a().get(i10).a(com.igaworks.ssp.common.b.ADMOB.c()); if (this.f5900i == null) { AdView adView = new AdView(context); this.f5900i = adView; adView.setAdSize(adSize == AdSize.BANNER_320x50 ? com.google.android.gms.ads.AdSize.BANNER : adSize == AdSize.BANNER_320x100 ? com.google.android.gms.ads.AdSize.LARGE_BANNER : com.google.android.gms.ads.AdSize.MEDIUM_RECTANGLE); this.f5900i.setAdUnitId(a10); } else { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), "already exist AdMobView"); } this.f5901j = new AdRequest.Builder().build(); this.f5900i.setAdListener(new AdListener() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.3 @Override // com.google.android.gms.ads.AdListener, com.google.android.gms.ads.internal.client.zza public void onAdClicked() { super.onAdClicked(); com.igaworks.ssp.common.o.m.a.b(Thread.currentThread(), "AdMobAdapter banner onAdClicked"); if (AdmobAdapter.this.f5892a != null) { AdmobAdapter.this.f5892a.a(); } } @Override // com.google.android.gms.ads.AdListener public void onAdFailedToLoad(LoadAdError loadAdError) { super.onAdFailedToLoad(loadAdError); try { com.igaworks.ssp.common.o.m.a.b(Thread.currentThread(), "AdMobAdapter failed to load in " + AdmobAdapter.this.getNetworkName() + ", error code : " + loadAdError.getCode()); AdmobAdapter.this.stopBannerTimer(); if (AdmobAdapter.this.f5892a != null) { AdmobAdapter.this.f5892a.a(AdmobAdapter.this.C); } } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); } } @Override // com.google.android.gms.ads.AdListener public void onAdLoaded() { super.onAdLoaded(); com.igaworks.ssp.common.o.m.a.b(Thread.currentThread(), "AdMobAdapter banner onAdLoaded"); try { adPopcornSSPBannerAd.removeAllViewsInLayout(); adPopcornSSPBannerAd.removeAllViews(); adPopcornSSPBannerAd.addView(AdmobAdapter.this.f5900i); AdmobAdapter.this.stopBannerTimer(); if (AdmobAdapter.this.f5892a != null) { AdmobAdapter.this.f5892a.b(AdmobAdapter.this.C); } AdPopcornSSPBannerAd adPopcornSSPBannerAd2 = adPopcornSSPBannerAd; if (adPopcornSSPBannerAd2 == null || !adPopcornSSPBannerAd2.getAutoBgColor()) { return; } adPopcornSSPBannerAd.setVisibility(4); new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { // from class: com.igaworks.ssp.common.adapter.AdmobAdapter.3.1 @Override // java.lang.Runnable public void run() { AdPopcornSSPBannerAd adPopcornSSPBannerAd3; try { try { AdmobAdapter.this.f5900i.buildDrawingCache(); Bitmap drawingCache = AdmobAdapter.this.f5900i.getDrawingCache(); if (drawingCache != null) { adPopcornSSPBannerAd.setBackgroundColor(drawingCache.getPixel(1, 1)); } adPopcornSSPBannerAd3 = adPopcornSSPBannerAd; if (adPopcornSSPBannerAd3 == null) { return; } } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); adPopcornSSPBannerAd3 = adPopcornSSPBannerAd; if (adPopcornSSPBannerAd3 == null) { return; } } adPopcornSSPBannerAd3.setVisibility(0); } catch (Throwable th) { AdPopcornSSPBannerAd adPopcornSSPBannerAd4 = adPopcornSSPBannerAd; if (adPopcornSSPBannerAd4 != null) { adPopcornSSPBannerAd4.setVisibility(0); } throw th; } } }, 350L); } catch (Exception e10) { com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); AdmobAdapter.this.stopBannerTimer(); if (AdmobAdapter.this.f5892a != null) { AdmobAdapter.this.f5892a.a(AdmobAdapter.this.C); } } } }); this.f5900i.loadAd(this.f5901j); } catch (Exception e10) { stopBannerTimer(); a aVar = this.f5892a; if (aVar != null) { aVar.a(this.C); } com.igaworks.ssp.common.o.m.a.a(Thread.currentThread(), e10); } } public void stopBannerTimer() { try { this.f5899h = false; Handler handler = this.A; if (handler != null) { handler.removeCallbacks(this.B); } } catch (Exception unused) { } } private void a(Context context) { try { MobileAds.initialize(context); } catch (Exception unused) { } } /* JADX INFO: Access modifiers changed from: private */ public void a(NativeAd nativeAd, AdPopcornSSPNativeAd adPopcornSSPNativeAd) { if (adPopcornSSPNativeAd.getAdMobViewBinder().mediaViewId != 0) { this.f5905n.setMediaView((MediaView) this.f5905n.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().mediaViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().headlineViewId != 0) { NativeAdView nativeAdView = this.f5905n; nativeAdView.setHeadlineView(nativeAdView.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().headlineViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().bodyViewId != 0) { NativeAdView nativeAdView2 = this.f5905n; nativeAdView2.setBodyView(nativeAdView2.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().bodyViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().callToActionId != 0) { NativeAdView nativeAdView3 = this.f5905n; nativeAdView3.setCallToActionView(nativeAdView3.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().callToActionId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().iconViewId != 0) { NativeAdView nativeAdView4 = this.f5905n; nativeAdView4.setIconView(nativeAdView4.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().iconViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().priceViewId != 0) { NativeAdView nativeAdView5 = this.f5905n; nativeAdView5.setPriceView(nativeAdView5.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().priceViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().starRatingViewId != 0) { NativeAdView nativeAdView6 = this.f5905n; nativeAdView6.setStarRatingView(nativeAdView6.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().starRatingViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().storeViewId != 0) { NativeAdView nativeAdView7 = this.f5905n; nativeAdView7.setStoreView(nativeAdView7.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().storeViewId)); } if (adPopcornSSPNativeAd.getAdMobViewBinder().advertiserViewId != 0) { NativeAdView nativeAdView8 = this.f5905n; nativeAdView8.setAdvertiserView(nativeAdView8.findViewById(adPopcornSSPNativeAd.getAdMobViewBinder().advertiserViewId)); } ((TextView) this.f5905n.getHeadlineView()).setText(nativeAd.getHeadline()); if (nativeAd.getBody() == null) { if (this.f5905n.getBodyView() != null) { this.f5905n.getBodyView().setVisibility(4); } } else if (this.f5905n.getBodyView() != null) { this.f5905n.getBodyView().setVisibility(0); ((TextView) this.f5905n.getBodyView()).setText(nativeAd.getBody()); } if (nativeAd.getCallToAction() == null) { if (this.f5905n.getCallToActionView() != null) { this.f5905n.getCallToActionView().setVisibility(4); } } else if (this.f5905n.getCallToActionView() != null) { this.f5905n.getCallToActionView().setVisibility(0); ((Button) this.f5905n.getCallToActionView()).setText(nativeAd.getCallToAction()); } if (nativeAd.getIcon() == null) { if (this.f5905n.getIconView() != null) { this.f5905n.getIconView().setVisibility(8); } } else if (this.f5905n.getIconView() != null) { ((ImageView) this.f5905n.getIconView()).setImageDrawable(nativeAd.getIcon().getDrawable()); this.f5905n.getIconView().setVisibility(0); } if (nativeAd.getPrice() == null) { if (this.f5905n.getPriceView() != null) { this.f5905n.getPriceView().setVisibility(4); } } else if (this.f5905n.getPriceView() != null) { this.f5905n.getPriceView().setVisibility(0); ((TextView) this.f5905n.getPriceView()).setText(nativeAd.getPrice()); } if (nativeAd.getStore() == null) { if (this.f5905n.getStoreView() != null) { this.f5905n.getStoreView().setVisibility(4); } } else if (this.f5905n.getStoreView() != null) { this.f5905n.getStoreView().setVisibility(0); ((TextView) this.f5905n.getStoreView()).setText(nativeAd.getStore()); } if (nativeAd.getStarRating() == null) { if (this.f5905n.getStarRatingView() != null) { this.f5905n.getStarRatingView().setVisibility(4); } } else if (this.f5905n.getStarRatingView() != null) { ((RatingBar) this.f5905n.getStarRatingView()).setRating(nativeAd.getStarRating().floatValue()); this.f5905n.getStarRatingView().setVisibility(0); } if (nativeAd.getAdvertiser() == null) { if (this.f5905n.getAdvertiserView() != null) { this.f5905n.getAdvertiserView().setVisibility(4); } } else if (this.f5905n.getAdvertiserView() != null) { ((TextView) this.f5905n.getAdvertiserView()).setText(nativeAd.getAdvertiser()); this.f5905n.getAdvertiserView().setVisibility(0); } this.f5905n.setNativeAd(nativeAd); adPopcornSSPNativeAd.removeView(this.f5905n); adPopcornSSPNativeAd.addView(this.f5905n); } /* JADX INFO: Access modifiers changed from: private */ public void a(boolean z10) { Handler handler; Runnable runnable; try { if (z10) { this.f5911t = false; handler = this.f5913v; if (handler == null) { return; } else { runnable = this.f5914w; } } else { this.f5912u = false; handler = this.f5913v; if (handler == null) { return; } else { runnable = this.f5915x; } } handler.removeCallbacks(runnable); } catch (Exception unused) { } } }