package com.applovin.mediation.adapters; import android.R; import android.app.Activity; import android.content.Context; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.view.ViewGroup; import android.widget.RelativeLayout; import androidx.annotation.Nullable; import com.applovin.impl.sdk.utils.BundleUtils; import com.applovin.mediation.MaxAdFormat; import com.applovin.mediation.adapter.MaxAdViewAdapter; import com.applovin.mediation.adapter.MaxAdapter; import com.applovin.mediation.adapter.MaxAdapterError; import com.applovin.mediation.adapter.MaxAppOpenAdapter; import com.applovin.mediation.adapter.MaxInterstitialAdapter; import com.applovin.mediation.adapter.MaxNativeAdAdapter; import com.applovin.mediation.adapter.MaxRewardedAdapter; import com.applovin.mediation.adapter.MaxSignalProvider; import com.applovin.mediation.adapter.listeners.MaxAdViewAdapterListener; import com.applovin.mediation.adapter.listeners.MaxAppOpenAdapterListener; import com.applovin.mediation.adapter.listeners.MaxInterstitialAdapterListener; import com.applovin.mediation.adapter.listeners.MaxNativeAdAdapterListener; import com.applovin.mediation.adapter.listeners.MaxRewardedAdapterListener; import com.applovin.mediation.adapter.listeners.MaxSignalCollectionListener; import com.applovin.mediation.adapter.parameters.MaxAdapterInitializationParameters; import com.applovin.mediation.adapter.parameters.MaxAdapterResponseParameters; import com.applovin.mediation.adapter.parameters.MaxAdapterSignalCollectionParameters; import com.applovin.mediation.adapters.mintegral.BuildConfig; import com.applovin.mediation.nativeAds.MaxNativeAd; import com.applovin.mediation.nativeAds.MaxNativeAdView; import com.applovin.sdk.AppLovinSdk; import com.applovin.sdk.AppLovinSdkUtils; import com.mbridge.msdk.MBridgeConstans; import com.mbridge.msdk.foundation.download.core.DownloadCommon; import com.mbridge.msdk.foundation.entity.CampaignEx; import com.mbridge.msdk.foundation.same.net.Aa; import com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener; import com.mbridge.msdk.interstitialvideo.out.MBBidInterstitialVideoHandler; import com.mbridge.msdk.interstitialvideo.out.MBInterstitialVideoHandler; import com.mbridge.msdk.mbbid.out.BidConstants; import com.mbridge.msdk.mbbid.out.BidManager; import com.mbridge.msdk.nativex.view.MBMediaView; import com.mbridge.msdk.out.BannerAdListener; import com.mbridge.msdk.out.BannerSize; import com.mbridge.msdk.out.Campaign; import com.mbridge.msdk.out.Frame; import com.mbridge.msdk.out.MBBannerView; import com.mbridge.msdk.out.MBBidNativeHandler; import com.mbridge.msdk.out.MBBidRewardVideoHandler; import com.mbridge.msdk.out.MBConfiguration; import com.mbridge.msdk.out.MBRewardVideoHandler; import com.mbridge.msdk.out.MBSplashHandler; import com.mbridge.msdk.out.MBSplashLoadListener; import com.mbridge.msdk.out.MBSplashShowListener; import com.mbridge.msdk.out.MBridgeIds; import com.mbridge.msdk.out.MBridgeSDKFactory; import com.mbridge.msdk.out.NativeListener; import com.mbridge.msdk.out.OnMBMediaViewListener; import com.mbridge.msdk.out.RewardInfo; import com.mbridge.msdk.out.RewardVideoListener; import com.mbridge.msdk.system.MBridgeSDKImpl; import com.mbridge.msdk.widget.MBAdChoice; import csdk.gluads.max.EAMax; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; /* loaded from: classes2.dex */ public class MintegralMediationAdapter extends MediationAdapterBase implements MaxInterstitialAdapter, MaxAppOpenAdapter, MaxRewardedAdapter, MaxAdViewAdapter, MaxSignalProvider, MaxNativeAdAdapter { private static final String APP_ID_PARAMETER = "app_id"; private static final String APP_KEY_PARAMETER = "app_key"; private static final String BAD_REQUEST = "request parameter is null"; private static final int DEFAULT_IMAGE_TASK_TIMEOUT_SECONDS = 5; private static final String EXCEPTION_APP_ID_EMPTY = "EXCEPTION_APP_ID_EMPTY"; private static final String EXCEPTION_APP_NOT_FOUND = "EXCEPTION_APP_NOT_FOUND"; private static final String EXCEPTION_IV_RECALLNET_INVALIDATE = "EXCEPTION_IV_RECALLNET_INVALIDATE"; private static final String EXCEPTION_RETURN_EMPTY = "EXCEPTION_RETURN_EMPTY"; private static final String EXCEPTION_SIGN_ERROR = "EXCEPTION_SIGN_ERROR"; private static final String EXCEPTION_TIMEOUT = "EXCEPTION_TIMEOUT"; private static final String EXCEPTION_UNIT_ADTYPE_ERROR = "EXCEPTION_UNIT_ADTYPE_ERROR"; private static final String EXCEPTION_UNIT_ID_EMPTY = "EXCEPTION_UNIT_ID_EMPTY"; private static final String EXCEPTION_UNIT_NOT_FOUND = "EXCEPTION_UNIT_NOT_FOUND"; private static final String EXCEPTION_UNIT_NOT_FOUND_IN_APP = "EXCEPTION_UNIT_NOT_FOUND_IN_APP"; private static final String NETWORK_ERROR = "network exception"; private static final String NETWORK_IO_ERROR = "Network error,I/O exception"; private static final String NOT_INITIALIZED = "init error"; private static final String NO_FILL_1 = "no ads available can show"; private static final String NO_FILL_2 = "no ads available"; private static final String NO_FILL_3 = "no server ads available"; private static final String NO_FILL_4 = "no ads source"; private static final String NO_FILL_5 = "load no ad"; private static final String TIMEOUT = "load timeout"; private static final String UNIT_ID_EMPTY = "UnitId is null"; private static String sSdkVersion; private List clickableViews; private MBBannerView mbBannerView; private MBBidInterstitialVideoHandler mbBidInterstitialVideoHandler; private MBBidNativeHandler mbBidNativeAdViewHandler; private MBBidNativeHandler mbBidNativeHandler; private MBBidRewardVideoHandler mbBidRewardVideoHandler; private MBInterstitialVideoHandler mbInterstitialVideoHandler; private MBRewardVideoHandler mbRewardVideoHandler; private MBSplashHandler mbSplashHandler; private String mbUnitId; private MaxNativeAd nativeAd; private Campaign nativeAdCampaign; private ViewGroup nativeAdContainer; private static final AtomicBoolean initialized = new AtomicBoolean(); private static final ExecutorService executor = Executors.newCachedThreadPool(); private static final Map mbInterstitialVideoHandlers = new HashMap(); private static final Map mbBidInterstitialVideoHandlers = new HashMap(); private static final Map mbRewardVideoHandlers = new HashMap(); private static final Map mbBidRewardVideoHandlers = new HashMap(); private static final MintegralMediationAdapterRouter router = (MintegralMediationAdapterRouter) MediationAdapterRouter.getSharedInstance(MintegralMediationAdapterRouter.class); public MintegralMediationAdapter(AppLovinSdk appLovinSdk) { super(appLovinSdk); } @Override // com.applovin.mediation.adapter.MaxAdapter public void initialize(MaxAdapterInitializationParameters maxAdapterInitializationParameters, Activity activity, MaxAdapter.OnCompletionListener onCompletionListener) { if (EAMax.adapterDisabled(getClass().getName(), onCompletionListener)) { throw new RuntimeException("Adapter is disabled."); } MBridgeConstans.DEBUG = maxAdapterInitializationParameters.isTesting(); if (initialized.compareAndSet(false, true)) { setChannelCode(); String string = maxAdapterInitializationParameters.getServerParameters().getString("app_id"); String string2 = maxAdapterInitializationParameters.getServerParameters().getString("app_key"); log("Initializing Mintegral SDK with app id: " + string + " and app key: " + string2 + "..."); MBridgeSDKImpl mBridgeSDK = MBridgeSDKFactory.getMBridgeSDK(); Context context = getContext(activity); Boolean hasUserConsent = maxAdapterInitializationParameters.hasUserConsent(); if (hasUserConsent != null) { boolean booleanValue = hasUserConsent.booleanValue(); mBridgeSDK.setUserPrivateInfoType(context, MBridgeConstans.AUTHORITY_ALL_INFO, booleanValue ? 1 : 0); mBridgeSDK.setConsentStatus(context, booleanValue ? 1 : 0); } Boolean isDoNotSell = maxAdapterInitializationParameters.isDoNotSell(); if (isDoNotSell != null && isDoNotSell.booleanValue()) { mBridgeSDK.setDoNotTrackStatus(context, true); } mBridgeSDK.init(mBridgeSDK.getMBConfigurationMap(string, string2), context); } onCompletionListener.onCompletion(MaxAdapter.InitializationStatus.DOES_NOT_APPLY, null); } @Override // com.applovin.mediation.adapter.MaxAdapter public String getSdkVersion() { if (sSdkVersion == null) { sSdkVersion = getVersionString(MBConfiguration.class, "SDK_VERSION"); } return sSdkVersion; } @Override // com.applovin.mediation.adapter.MaxAdapter public String getAdapterVersion() { return BuildConfig.VERSION_NAME; } @Override // com.applovin.mediation.adapter.MaxAdapter public void onDestroy() { MBInterstitialVideoHandler mBInterstitialVideoHandler = this.mbInterstitialVideoHandler; if (mBInterstitialVideoHandler != null) { mBInterstitialVideoHandler.setInterstitialVideoListener(null); this.mbInterstitialVideoHandler = null; } MBBidInterstitialVideoHandler mBBidInterstitialVideoHandler = this.mbBidInterstitialVideoHandler; if (mBBidInterstitialVideoHandler != null) { mBBidInterstitialVideoHandler.setInterstitialVideoListener(null); this.mbBidInterstitialVideoHandler = null; } MBSplashHandler mBSplashHandler = this.mbSplashHandler; if (mBSplashHandler != null) { mBSplashHandler.onDestroy(); this.mbSplashHandler.setSplashLoadListener(null); this.mbSplashHandler.setSplashShowListener(null); this.mbSplashHandler = null; } MBRewardVideoHandler mBRewardVideoHandler = this.mbRewardVideoHandler; if (mBRewardVideoHandler != null) { mBRewardVideoHandler.setRewardVideoListener(null); this.mbRewardVideoHandler = null; } MBBidRewardVideoHandler mBBidRewardVideoHandler = this.mbBidRewardVideoHandler; if (mBBidRewardVideoHandler != null) { mBBidRewardVideoHandler.setRewardVideoListener(null); this.mbBidRewardVideoHandler = null; } MBBannerView mBBannerView = this.mbBannerView; if (mBBannerView != null) { mBBannerView.release(); this.mbBannerView = null; } MBBidNativeHandler mBBidNativeHandler = this.mbBidNativeHandler; if (mBBidNativeHandler != null) { mBBidNativeHandler.unregisterView(this.nativeAdContainer, this.clickableViews, this.nativeAdCampaign); this.mbBidNativeHandler.bidRelease(); this.mbBidNativeHandler.setAdListener(null); this.mbBidNativeHandler = null; } MBBidNativeHandler mBBidNativeHandler2 = this.mbBidNativeAdViewHandler; if (mBBidNativeHandler2 != null) { mBBidNativeHandler2.unregisterView(this.nativeAdContainer, this.clickableViews, this.nativeAdCampaign); this.mbBidNativeAdViewHandler.bidRelease(); this.mbBidNativeAdViewHandler.setAdListener(null); this.mbBidNativeAdViewHandler = null; } MaxNativeAd maxNativeAd = this.nativeAd; if (maxNativeAd != null) { if (maxNativeAd.getMediaView() instanceof MBMediaView) { ((MBMediaView) this.nativeAd.getMediaView()).destory(); } this.nativeAd = null; } this.nativeAdCampaign = null; router.removeAdapter(this, this.mbUnitId); } @Override // com.applovin.mediation.adapter.MaxSignalProvider public void collectSignal(MaxAdapterSignalCollectionParameters maxAdapterSignalCollectionParameters, Activity activity, MaxSignalCollectionListener maxSignalCollectionListener) { String buyerUid; if (EAMax.adapterDisabled(getClass().getName(), maxSignalCollectionListener)) { throw new RuntimeException("Adapter is disabled."); } log("Collecting signal..."); String adUnitId = maxAdapterSignalCollectionParameters.getAdUnitId(); if (AppLovinSdkUtils.isValidString(adUnitId)) { Bundle bundle = Bundle.EMPTY; Bundle bundle2 = BundleUtils.getBundle(adUnitId, bundle, BundleUtils.getBundle("credentials", bundle, maxAdapterSignalCollectionParameters.getServerParameters())); HashMap hashMap = new HashMap(3); hashMap.put(BidConstants.BID_FILTER_KEY_PLACEMENT_ID, BundleUtils.getString("placement_id", "", bundle2)); hashMap.put(BidConstants.BID_FILTER_KEY_UNIT_ID, BundleUtils.getString("ad_unit_id", "", bundle2)); hashMap.put(BidConstants.BID_FILTER_KEY_AD_TYPE, toMintegralAdType(maxAdapterSignalCollectionParameters.getAdFormat())); buyerUid = BidManager.getBuyerUid(getContext(activity), hashMap); } else { buyerUid = BidManager.getBuyerUid(getContext(activity)); } maxSignalCollectionListener.onSignalCollected(buyerUid); } @Override // com.applovin.mediation.adapter.MaxInterstitialAdapter public void loadInterstitialAd(MaxAdapterResponseParameters maxAdapterResponseParameters, Activity activity, MaxInterstitialAdapterListener maxInterstitialAdapterListener) { if (EAMax.adapterDisabled(getClass().getName(), maxInterstitialAdapterListener)) { throw new RuntimeException("Adapter is disabled."); } boolean containsKey = maxAdapterResponseParameters.getServerParameters().containsKey("is_muted"); int i = maxAdapterResponseParameters.getServerParameters().getBoolean("is_muted") ? 1 : 2; this.mbUnitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); String string = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); MintegralMediationAdapterRouter mintegralMediationAdapterRouter = router; mintegralMediationAdapterRouter.addInterstitialAdapter(this, maxInterstitialAdapterListener, this.mbUnitId); if (AppLovinSdkUtils.isValidString(maxAdapterResponseParameters.getBidResponse())) { log("Loading bidding interstitial ad for unit id: " + this.mbUnitId + " and placement id: " + string + "..."); Map map = mbBidInterstitialVideoHandlers; if (map.containsKey(this.mbUnitId)) { this.mbBidInterstitialVideoHandler = map.get(this.mbUnitId); } else { MBBidInterstitialVideoHandler mBBidInterstitialVideoHandler = new MBBidInterstitialVideoHandler(activity, string, this.mbUnitId); this.mbBidInterstitialVideoHandler = mBBidInterstitialVideoHandler; map.put(this.mbUnitId, mBBidInterstitialVideoHandler); } this.mbBidInterstitialVideoHandler.setInterstitialVideoListener(mintegralMediationAdapterRouter.getInterstitialListener()); if (containsKey) { this.mbBidInterstitialVideoHandler.playVideoMute(i); } this.mbBidInterstitialVideoHandler.loadFromBid(maxAdapterResponseParameters.getBidResponse()); return; } log("Loading mediated interstitial ad for unit id: " + this.mbUnitId + " and placement id: " + string + "..."); Map map2 = mbInterstitialVideoHandlers; if (map2.containsKey(this.mbUnitId)) { this.mbInterstitialVideoHandler = map2.get(this.mbUnitId); } else { MBInterstitialVideoHandler mBInterstitialVideoHandler = new MBInterstitialVideoHandler(activity, string, this.mbUnitId); this.mbInterstitialVideoHandler = mBInterstitialVideoHandler; map2.put(this.mbUnitId, mBInterstitialVideoHandler); } this.mbInterstitialVideoHandler.setInterstitialVideoListener(mintegralMediationAdapterRouter.getInterstitialListener()); if (this.mbInterstitialVideoHandler.isReady()) { log("A mediated interstitial ad is ready already"); if (AppLovinSdkUtils.isValidString(this.mbInterstitialVideoHandler.getCreativeIdWithUnitId())) { Bundle bundle = new Bundle(1); bundle.putString(CampaignEx.JSON_KEY_CREATIVE_ID, this.mbInterstitialVideoHandler.getCreativeIdWithUnitId()); mintegralMediationAdapterRouter.onAdLoaded(this.mbUnitId, bundle); return; } mintegralMediationAdapterRouter.onAdLoaded(this.mbUnitId); return; } if (containsKey) { this.mbInterstitialVideoHandler.playVideoMute(i); } this.mbInterstitialVideoHandler.load(); } @Override // com.applovin.mediation.adapter.MaxInterstitialAdapter public void showInterstitialAd(MaxAdapterResponseParameters maxAdapterResponseParameters, Activity activity, MaxInterstitialAdapterListener maxInterstitialAdapterListener) { if (EAMax.adapterDisabled(getClass().getName(), maxInterstitialAdapterListener)) { throw new RuntimeException("Adapter is disabled."); } MintegralMediationAdapterRouter mintegralMediationAdapterRouter = router; mintegralMediationAdapterRouter.addShowingAdapter(this); MBBidInterstitialVideoHandler mBBidInterstitialVideoHandler = this.mbBidInterstitialVideoHandler; if (mBBidInterstitialVideoHandler != null && mBBidInterstitialVideoHandler.isBidReady()) { log("Showing bidding interstitial..."); this.mbBidInterstitialVideoHandler.showFromBid(); return; } MBInterstitialVideoHandler mBInterstitialVideoHandler = this.mbInterstitialVideoHandler; if (mBInterstitialVideoHandler != null && mBInterstitialVideoHandler.isReady()) { log("Showing mediated interstitial..."); this.mbInterstitialVideoHandler.show(); } else { log("Unable to show interstitial - no ad loaded..."); mintegralMediationAdapterRouter.onAdDisplayFailed(this.mbUnitId, new MaxAdapterError(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, "Ad Display Failed", 0, "Interstitial ad not ready")); } } @Override // com.applovin.mediation.adapters.MediationAdapterBase, com.applovin.mediation.adapter.MaxAppOpenAdapter public void loadAppOpenAd(MaxAdapterResponseParameters maxAdapterResponseParameters, @Nullable Activity activity, MaxAppOpenAdapterListener maxAppOpenAdapterListener) { this.mbUnitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); String string = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); if (activity == null) { log("App open ad \"" + string + "\" load failed: Activity is null"); maxAppOpenAdapterListener.onAppOpenAdLoadFailed(MaxAdapterError.MISSING_ACTIVITY); return; } log("Loading bidding app open ad for unit id: " + this.mbUnitId + " and placement id: " + string + "..."); this.mbSplashHandler = new MBSplashHandler(activity, string, this.mbUnitId); AppOpenAdListener appOpenAdListener = new AppOpenAdListener(maxAppOpenAdapterListener); this.mbSplashHandler.setSplashLoadListener(appOpenAdListener); this.mbSplashHandler.setSplashShowListener(appOpenAdListener); this.mbSplashHandler.preLoadByToken(maxAdapterResponseParameters.getBidResponse()); } @Override // com.applovin.mediation.adapters.MediationAdapterBase, com.applovin.mediation.adapter.MaxAppOpenAdapter public void showAppOpenAd(MaxAdapterResponseParameters maxAdapterResponseParameters, @Nullable Activity activity, MaxAppOpenAdapterListener maxAppOpenAdapterListener) { String bidResponse = maxAdapterResponseParameters.getBidResponse(); MBSplashHandler mBSplashHandler = this.mbSplashHandler; if (mBSplashHandler == null || !mBSplashHandler.isReady(bidResponse)) { log("Unable to show app open ad - no ad loaded..."); maxAppOpenAdapterListener.onAppOpenAdDisplayFailed(new MaxAdapterError(MaxAdapterError.AD_DISPLAY_FAILED, 0, "App open ad not ready")); return; } if (activity == null) { log("App open ad \"" + this.mbUnitId + "\" display failed: Activity is null"); maxAppOpenAdapterListener.onAppOpenAdDisplayFailed(MaxAdapterError.MISSING_ACTIVITY); return; } log("Showing app open ad..."); RelativeLayout relativeLayout = new RelativeLayout(getContext(activity)); ((ViewGroup) activity.getWindow().getDecorView().findViewById(R.id.content)).addView(relativeLayout); this.mbSplashHandler.show(relativeLayout, bidResponse); } @Override // com.applovin.mediation.adapter.MaxRewardedAdapter public void loadRewardedAd(MaxAdapterResponseParameters maxAdapterResponseParameters, Activity activity, MaxRewardedAdapterListener maxRewardedAdapterListener) { if (EAMax.adapterDisabled(getClass().getName(), maxRewardedAdapterListener)) { throw new RuntimeException("Adapter is disabled."); } boolean containsKey = maxAdapterResponseParameters.getServerParameters().containsKey("is_muted"); int i = maxAdapterResponseParameters.getServerParameters().getBoolean("is_muted") ? 1 : 2; this.mbUnitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); String string = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); MintegralMediationAdapterRouter mintegralMediationAdapterRouter = router; mintegralMediationAdapterRouter.addRewardedAdapter(this, maxRewardedAdapterListener, this.mbUnitId); if (AppLovinSdkUtils.isValidString(maxAdapterResponseParameters.getBidResponse())) { log("Loading bidding rewarded ad for unit id: " + this.mbUnitId + " and placement id: " + string + "..."); Map map = mbBidRewardVideoHandlers; if (map.containsKey(this.mbUnitId)) { this.mbBidRewardVideoHandler = map.get(this.mbUnitId); } else { MBBidRewardVideoHandler mBBidRewardVideoHandler = new MBBidRewardVideoHandler(activity, string, this.mbUnitId); this.mbBidRewardVideoHandler = mBBidRewardVideoHandler; map.put(this.mbUnitId, mBBidRewardVideoHandler); } this.mbBidRewardVideoHandler.setRewardVideoListener(mintegralMediationAdapterRouter.getRewardedListener()); if (containsKey) { this.mbBidRewardVideoHandler.playVideoMute(i); } this.mbBidRewardVideoHandler.loadFromBid(maxAdapterResponseParameters.getBidResponse()); return; } log("Loading mediated rewarded ad for unit id: " + this.mbUnitId + " and placement id: " + string + "..."); Map map2 = mbRewardVideoHandlers; if (map2.containsKey(this.mbUnitId)) { this.mbRewardVideoHandler = map2.get(this.mbUnitId); } else { MBRewardVideoHandler mBRewardVideoHandler = new MBRewardVideoHandler(activity, string, this.mbUnitId); this.mbRewardVideoHandler = mBRewardVideoHandler; map2.put(this.mbUnitId, mBRewardVideoHandler); } this.mbRewardVideoHandler.setRewardVideoListener(mintegralMediationAdapterRouter.getRewardedListener()); if (this.mbRewardVideoHandler.isReady()) { log("A mediated rewarded ad is ready already"); if (AppLovinSdkUtils.isValidString(this.mbRewardVideoHandler.getCreativeIdWithUnitId())) { Bundle bundle = new Bundle(1); bundle.putString(CampaignEx.JSON_KEY_CREATIVE_ID, this.mbRewardVideoHandler.getCreativeIdWithUnitId()); mintegralMediationAdapterRouter.onAdLoaded(this.mbUnitId, bundle); return; } mintegralMediationAdapterRouter.onAdLoaded(this.mbUnitId); return; } if (containsKey) { this.mbRewardVideoHandler.playVideoMute(i); } this.mbRewardVideoHandler.load(); } @Override // com.applovin.mediation.adapter.MaxRewardedAdapter public void showRewardedAd(MaxAdapterResponseParameters maxAdapterResponseParameters, Activity activity, MaxRewardedAdapterListener maxRewardedAdapterListener) { if (EAMax.adapterDisabled(getClass().getName(), maxRewardedAdapterListener)) { throw new RuntimeException("Adapter is disabled."); } MintegralMediationAdapterRouter mintegralMediationAdapterRouter = router; mintegralMediationAdapterRouter.addShowingAdapter(this); configureReward(maxAdapterResponseParameters); Bundle serverParameters = maxAdapterResponseParameters.getServerParameters(); String string = serverParameters.getString("reward_id", ""); String string2 = serverParameters.getString("user_id", ""); MBBidRewardVideoHandler mBBidRewardVideoHandler = this.mbBidRewardVideoHandler; if (mBBidRewardVideoHandler != null && mBBidRewardVideoHandler.isBidReady()) { log("Showing bidding rewarded ad..."); this.mbBidRewardVideoHandler.showFromBid(string, string2); return; } MBRewardVideoHandler mBRewardVideoHandler = this.mbRewardVideoHandler; if (mBRewardVideoHandler != null && mBRewardVideoHandler.isReady()) { log("Showing mediated rewarded ad..."); this.mbRewardVideoHandler.show(string, string2); } else { log("Unable to show rewarded ad - no ad loaded..."); mintegralMediationAdapterRouter.onAdDisplayFailed(this.mbUnitId, new MaxAdapterError(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, "Ad Display Failed", 0, "Rewarded ad not ready")); } } @Override // com.applovin.mediation.adapter.MaxAdViewAdapter public void loadAdViewAd(MaxAdapterResponseParameters maxAdapterResponseParameters, MaxAdFormat maxAdFormat, Activity activity, final MaxAdViewAdapterListener maxAdViewAdapterListener) { this.mbUnitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); String string = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); boolean z = maxAdapterResponseParameters.getServerParameters().getBoolean("is_native"); StringBuilder sb = new StringBuilder(); sb.append("Loading"); sb.append(z ? " native " : " "); sb.append(maxAdFormat.getLabel()); sb.append(" AdView ad for placement: "); sb.append(string); sb.append("..."); log(sb.toString()); if (z) { Map nativeProperties = MBBidNativeHandler.getNativeProperties(string, this.mbUnitId); nativeProperties.put("ad_num", 1); nativeProperties.put(MBridgeConstans.NATIVE_VIDEO_SUPPORT, Boolean.TRUE); NativeAdViewListener nativeAdViewListener = new NativeAdViewListener(maxAdapterResponseParameters, maxAdFormat, getContext(activity), maxAdViewAdapterListener); MBBidNativeHandler mBBidNativeHandler = new MBBidNativeHandler(nativeProperties, getContext(activity)); this.mbBidNativeAdViewHandler = mBBidNativeHandler; mBBidNativeHandler.setAdListener(nativeAdViewListener); this.mbBidNativeAdViewHandler.bidLoad(maxAdapterResponseParameters.getBidResponse()); return; } MBBannerView mBBannerView = new MBBannerView(getContext(activity)); this.mbBannerView = mBBannerView; mBBannerView.init(toBannerSize(maxAdFormat), string, this.mbUnitId); this.mbBannerView.setAllowShowCloseBtn(false); this.mbBannerView.setRefreshTime(0); this.mbBannerView.setBannerAdListener(new BannerAdListener() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.1 @Override // com.mbridge.msdk.out.BannerAdListener public void onLoadSuccessed(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad loaded for: " + mBridgeIds); if (!AppLovinSdkUtils.isValidString(MintegralMediationAdapter.this.mbBannerView.getCreativeIdWithUnitId())) { maxAdViewAdapterListener.onAdViewAdLoaded(MintegralMediationAdapter.this.mbBannerView); return; } Bundle bundle = new Bundle(1); bundle.putString(CampaignEx.JSON_KEY_CREATIVE_ID, MintegralMediationAdapter.this.mbBannerView.getCreativeIdWithUnitId()); maxAdViewAdapterListener.onAdViewAdLoaded(MintegralMediationAdapter.this.mbBannerView, bundle); } @Override // com.mbridge.msdk.out.BannerAdListener public void onLoadFailed(MBridgeIds mBridgeIds, String str) { MintegralMediationAdapter.this.log("Banner ad failed to load: " + str + " for: " + mBridgeIds); maxAdViewAdapterListener.onAdViewAdLoadFailed(MintegralMediationAdapter.toMaxError(str)); } @Override // com.mbridge.msdk.out.BannerAdListener public void onLogImpression(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad displayed"); maxAdViewAdapterListener.onAdViewAdDisplayed(); } @Override // com.mbridge.msdk.out.BannerAdListener public void onClick(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad clicked"); maxAdViewAdapterListener.onAdViewAdClicked(); } @Override // com.mbridge.msdk.out.BannerAdListener public void onLeaveApp(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad will leave application"); } @Override // com.mbridge.msdk.out.BannerAdListener public void showFullScreen(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad expanded"); maxAdViewAdapterListener.onAdViewAdExpanded(); } @Override // com.mbridge.msdk.out.BannerAdListener public void closeFullScreen(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad collapsed"); maxAdViewAdapterListener.onAdViewAdCollapsed(); } @Override // com.mbridge.msdk.out.BannerAdListener public void onCloseBanner(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("Banner ad closed"); } }); if (AppLovinSdkUtils.isValidString(maxAdapterResponseParameters.getBidResponse())) { this.mbBannerView.loadFromBid(maxAdapterResponseParameters.getBidResponse()); } else { this.mbBannerView.load(); } } @Override // com.applovin.mediation.adapters.MediationAdapterBase, com.applovin.mediation.adapter.MaxNativeAdAdapter public void loadNativeAd(MaxAdapterResponseParameters maxAdapterResponseParameters, Activity activity, MaxNativeAdAdapterListener maxNativeAdAdapterListener) { this.mbUnitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); String string = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); log("Loading bidding native ad for unit id: " + this.mbUnitId + " and placement id: " + string + "..."); Map nativeProperties = MBBidNativeHandler.getNativeProperties(string, this.mbUnitId); nativeProperties.put("ad_num", 1); nativeProperties.put(MBridgeConstans.NATIVE_VIDEO_SUPPORT, Boolean.TRUE); NativeAdListener nativeAdListener = new NativeAdListener(maxAdapterResponseParameters, getContext(activity), maxNativeAdAdapterListener); MBBidNativeHandler mBBidNativeHandler = new MBBidNativeHandler(nativeProperties, getContext(activity)); this.mbBidNativeHandler = mBBidNativeHandler; mBBidNativeHandler.setAdListener(nativeAdListener); this.mbBidNativeHandler.bidLoad(maxAdapterResponseParameters.getBidResponse()); } /* JADX INFO: Access modifiers changed from: private */ public MaxNativeAdView createMaxNativeAdViewWithNativeAd(MaxNativeAd maxNativeAd, String str, Context context) { if (str.contains("vertical")) { if (str.equals("vertical")) { return new MaxNativeAdView(maxNativeAd, maxNativeAd.getFormat() == MaxAdFormat.LEADER ? "vertical_leader_template" : "vertical_media_banner_template", context); } return new MaxNativeAdView(maxNativeAd, str, context); } if (!AppLovinSdkUtils.isValidString(str)) { str = "media_banner_template"; } return new MaxNativeAdView(maxNativeAd, str, context); } private static String toMintegralAdType(MaxAdFormat maxAdFormat) { if (maxAdFormat == MaxAdFormat.INTERSTITIAL) { return BidConstants.BID_FILTER_VALUE_AD_TYPE_INTERSTITIAL_VIDEO; } if (maxAdFormat == MaxAdFormat.REWARDED) { return BidConstants.BID_FILTER_VALUE_AD_TYPE_REWARD_VIDEO; } if (maxAdFormat == MaxAdFormat.APP_OPEN) { return BidConstants.BID_FILTER_VALUE_AD_TYPE_SPLASH; } if (maxAdFormat == MaxAdFormat.BANNER || maxAdFormat == MaxAdFormat.LEADER || maxAdFormat == MaxAdFormat.MREC) { return BidConstants.BID_FILTER_VALUE_AD_TYPE_BANNER; } return maxAdFormat == MaxAdFormat.NATIVE ? BidConstants.BID_FILTER_VALUE_AD_TYPE_NATIVE : "-1"; } /* JADX INFO: Access modifiers changed from: private */ public static MaxAdapterError toMaxError(String str) { MaxAdapterError maxAdapterError; if (NOT_INITIALIZED.equals(str) || str.contains(EXCEPTION_IV_RECALLNET_INVALIDATE)) { maxAdapterError = MaxAdapterError.NOT_INITIALIZED; } else if (str.contains(NO_FILL_1) || str.contains(NO_FILL_2) || str.contains(NO_FILL_3) || str.contains(NO_FILL_4) || str.contains(NO_FILL_5) || str.contains("EXCEPTION_RETURN_EMPTY")) { maxAdapterError = MaxAdapterError.NO_FILL; } else if (NETWORK_ERROR.equalsIgnoreCase(str) || str.contains(NETWORK_IO_ERROR)) { maxAdapterError = MaxAdapterError.NO_CONNECTION; } else if (BAD_REQUEST.equalsIgnoreCase(str)) { maxAdapterError = MaxAdapterError.BAD_REQUEST; } else if (TIMEOUT.equalsIgnoreCase(str) || str.contains(EXCEPTION_TIMEOUT)) { maxAdapterError = MaxAdapterError.TIMEOUT; } else if (str.contains(EXCEPTION_SIGN_ERROR) || str.contains(EXCEPTION_UNIT_NOT_FOUND) || str.contains(EXCEPTION_UNIT_ID_EMPTY) || str.contains(EXCEPTION_UNIT_NOT_FOUND_IN_APP) || str.contains(EXCEPTION_UNIT_ADTYPE_ERROR) || str.contains(EXCEPTION_APP_ID_EMPTY) || str.contains(EXCEPTION_APP_NOT_FOUND) || str.contains(UNIT_ID_EMPTY)) { maxAdapterError = MaxAdapterError.INVALID_CONFIGURATION; } else { maxAdapterError = MaxAdapterError.UNSPECIFIED; } return new MaxAdapterError(maxAdapterError.getErrorCode(), maxAdapterError.getErrorMessage(), 0, str); } private Context getContext(Activity activity) { return activity != null ? activity.getApplicationContext() : getApplicationContext(); } private BannerSize toBannerSize(MaxAdFormat maxAdFormat) { if (maxAdFormat == MaxAdFormat.BANNER || maxAdFormat == MaxAdFormat.LEADER) { return new BannerSize(3, 0, 0); } if (maxAdFormat == MaxAdFormat.MREC) { return new BannerSize(2, 0, 0); } throw new IllegalArgumentException("Unsupported ad format: " + maxAdFormat); } /* JADX INFO: Access modifiers changed from: private */ public List getClickableViews(MaxNativeAdView maxNativeAdView) { if (AppLovinSdk.VERSION_CODE < 11050300) { ArrayList arrayList = new ArrayList(5); if (maxNativeAdView.getTitleTextView() != null) { arrayList.add(maxNativeAdView.getTitleTextView()); } if (maxNativeAdView.getAdvertiserTextView() != null) { arrayList.add(maxNativeAdView.getAdvertiserTextView()); } if (maxNativeAdView.getBodyTextView() != null) { arrayList.add(maxNativeAdView.getBodyTextView()); } if (maxNativeAdView.getCallToActionButton() != null) { arrayList.add(maxNativeAdView.getCallToActionButton()); } if (maxNativeAdView.getIconImageView() != null) { arrayList.add(maxNativeAdView.getIconImageView()); } return arrayList; } return maxNativeAdView.getClickableViews(); } private void setChannelCode() { try { Method declaredMethod = Aa.class.getDeclaredMethod(DownloadCommon.DOWNLOAD_REPORT_FIND_FILE_RESULT_VALUE_B, String.class); declaredMethod.setAccessible(true); declaredMethod.invoke(Aa.class, "Y+H6DFttYrPQYcI9+F2F+F5/Hv=="); } catch (Throwable th) { e("Failed to set channel code", th); } } public static class MintegralMediationAdapterRouter extends MediationAdapterRouter { private final InterstitialVideoListener interstitialVideoListener = new InterstitialVideoListener() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.MintegralMediationAdapterRouter.1 @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onVideoLoadSuccess(MBridgeIds mBridgeIds) { String creativeIdWithUnitId; MintegralMediationAdapterRouter.this.log("Interstitial successfully loaded and video has been downloaded for: " + mBridgeIds); String unitId = mBridgeIds.getUnitId(); MBInterstitialVideoHandler mBInterstitialVideoHandler = (MBInterstitialVideoHandler) MintegralMediationAdapter.mbInterstitialVideoHandlers.get(unitId); MBBidInterstitialVideoHandler mBBidInterstitialVideoHandler = (MBBidInterstitialVideoHandler) MintegralMediationAdapter.mbBidInterstitialVideoHandlers.get(unitId); if (mBBidInterstitialVideoHandler != null) { creativeIdWithUnitId = mBBidInterstitialVideoHandler.getCreativeIdWithUnitId(); } else { creativeIdWithUnitId = mBInterstitialVideoHandler.getCreativeIdWithUnitId(); } if (AppLovinSdkUtils.isValidString(creativeIdWithUnitId)) { Bundle bundle = new Bundle(1); bundle.putString(CampaignEx.JSON_KEY_CREATIVE_ID, creativeIdWithUnitId); MintegralMediationAdapterRouter.this.onAdLoaded(unitId, bundle); return; } MintegralMediationAdapterRouter.this.onAdLoaded(unitId); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onLoadSuccess(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Interstitial successfully loaded but video still needs to be downloaded for: " + mBridgeIds); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onVideoLoadFail(MBridgeIds mBridgeIds, String str) { MintegralMediationAdapterRouter.this.log("Interstitial failed to load: " + str + " for: " + mBridgeIds); MintegralMediationAdapterRouter.this.onAdLoadFailed(mBridgeIds.getUnitId(), MintegralMediationAdapter.toMaxError(str)); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onAdShow(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Interstitial displayed"); MintegralMediationAdapterRouter.this.onAdDisplayed(mBridgeIds.getUnitId()); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onShowFail(MBridgeIds mBridgeIds, String str) { MaxAdapterError maxAdapterError = new MaxAdapterError(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, "Ad Display Failed", 0, str); MintegralMediationAdapterRouter.this.log("Interstitial failed to show: " + maxAdapterError); MintegralMediationAdapterRouter.this.onAdDisplayFailed(mBridgeIds.getUnitId(), maxAdapterError); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onVideoAdClicked(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Interstitial clicked"); MintegralMediationAdapterRouter.this.onAdClicked(mBridgeIds.getUnitId()); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onAdClose(MBridgeIds mBridgeIds, RewardInfo rewardInfo) { MintegralMediationAdapterRouter.this.log("Interstitial hidden"); MintegralMediationAdapterRouter.this.onAdHidden(mBridgeIds.getUnitId()); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onVideoComplete(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Interstitial video completed"); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onAdCloseWithIVReward(MBridgeIds mBridgeIds, RewardInfo rewardInfo) { MintegralMediationAdapterRouter.this.log("Interstitial with reward hidden"); } @Override // com.mbridge.msdk.interstitialvideo.out.InterstitialVideoListener public void onEndcardShow(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Interstitial endcard shown"); } }; private final RewardVideoListener rewardVideoListener = new RewardVideoListener() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.MintegralMediationAdapterRouter.2 @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onVideoLoadSuccess(MBridgeIds mBridgeIds) { String creativeIdWithUnitId; MintegralMediationAdapterRouter.this.log("Rewarded ad successfully loaded and video has been downloaded for: " + mBridgeIds); String unitId = mBridgeIds.getUnitId(); MBRewardVideoHandler mBRewardVideoHandler = (MBRewardVideoHandler) MintegralMediationAdapter.mbRewardVideoHandlers.get(unitId); MBBidRewardVideoHandler mBBidRewardVideoHandler = (MBBidRewardVideoHandler) MintegralMediationAdapter.mbBidRewardVideoHandlers.get(unitId); if (mBBidRewardVideoHandler != null) { creativeIdWithUnitId = mBBidRewardVideoHandler.getCreativeIdWithUnitId(); } else { creativeIdWithUnitId = mBRewardVideoHandler.getCreativeIdWithUnitId(); } if (AppLovinSdkUtils.isValidString(creativeIdWithUnitId)) { Bundle bundle = new Bundle(1); bundle.putString(CampaignEx.JSON_KEY_CREATIVE_ID, creativeIdWithUnitId); MintegralMediationAdapterRouter.this.onAdLoaded(unitId, bundle); return; } MintegralMediationAdapterRouter.this.onAdLoaded(unitId); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onLoadSuccess(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Rewarded ad successfully loaded but video still needs to be downloaded for: " + mBridgeIds); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onVideoLoadFail(MBridgeIds mBridgeIds, String str) { MintegralMediationAdapterRouter.this.log("Rewarded ad failed to load: " + str + " for: " + mBridgeIds); MintegralMediationAdapterRouter.this.onAdLoadFailed(mBridgeIds.getUnitId(), MintegralMediationAdapter.toMaxError(str)); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onAdShow(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Rewarded ad displayed"); MintegralMediationAdapterRouter.this.onAdDisplayed(mBridgeIds.getUnitId()); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onShowFail(MBridgeIds mBridgeIds, String str) { MaxAdapterError maxAdapterError = new MaxAdapterError(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, "Ad Display Failed", 0, str); MintegralMediationAdapterRouter.this.log("Rewarded ad failed to show: " + maxAdapterError); MintegralMediationAdapterRouter.this.onAdDisplayFailed(mBridgeIds.getUnitId(), maxAdapterError); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onVideoAdClicked(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Rewarded ad clicked"); MintegralMediationAdapterRouter.this.onAdClicked(mBridgeIds.getUnitId()); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onAdClose(MBridgeIds mBridgeIds, RewardInfo rewardInfo) { MintegralMediationAdapterRouter.this.log("Rewarded ad hidden"); String unitId = mBridgeIds.getUnitId(); if (rewardInfo.isCompleteView()) { MintegralMediationAdapterRouter mintegralMediationAdapterRouter = MintegralMediationAdapterRouter.this; mintegralMediationAdapterRouter.onUserRewarded(unitId, mintegralMediationAdapterRouter.getReward(unitId)); } else if (MintegralMediationAdapterRouter.this.shouldAlwaysRewardUser(unitId)) { MintegralMediationAdapterRouter mintegralMediationAdapterRouter2 = MintegralMediationAdapterRouter.this; mintegralMediationAdapterRouter2.onUserRewarded(unitId, mintegralMediationAdapterRouter2.getReward(unitId)); } MintegralMediationAdapterRouter.this.onAdHidden(unitId); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onVideoComplete(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Rewarded ad video completed"); } @Override // com.mbridge.msdk.out.RewardVideoListener, com.mbridge.msdk.video.bt.module.b.g public void onEndcardShow(MBridgeIds mBridgeIds) { MintegralMediationAdapterRouter.this.log("Rewarded ad endcard shown"); } }; public InterstitialVideoListener getInterstitialListener() { return this.interstitialVideoListener; } public RewardVideoListener getRewardedListener() { return this.rewardVideoListener; } private MintegralMediationAdapterRouter() { } @Override // com.applovin.mediation.adapters.MediationAdapterRouter public void initialize(MaxAdapterInitializationParameters maxAdapterInitializationParameters, Activity activity, MaxAdapter.OnCompletionListener onCompletionListener) { if (EAMax.adapterDisabled(getClass().getName(), onCompletionListener)) { throw new RuntimeException("Adapter is disabled."); } } } public class AppOpenAdListener implements MBSplashLoadListener, MBSplashShowListener { private final MaxAppOpenAdapterListener listener; private AppOpenAdListener(MaxAppOpenAdapterListener maxAppOpenAdapterListener) { this.listener = maxAppOpenAdapterListener; } @Override // com.mbridge.msdk.out.MBSplashLoadListener public void onLoadSuccessed(MBridgeIds mBridgeIds, int i) { Bundle bundle; MintegralMediationAdapter.this.log("App open ad loaded for: " + mBridgeIds); String creativeIdWithUnitId = MintegralMediationAdapter.this.mbSplashHandler.getCreativeIdWithUnitId(); if (AppLovinSdkUtils.isValidString(creativeIdWithUnitId)) { bundle = new Bundle(1); bundle.putString(CampaignEx.JSON_KEY_CREATIVE_ID, creativeIdWithUnitId); } else { bundle = null; } this.listener.onAppOpenAdLoaded(bundle); } @Override // com.mbridge.msdk.out.MBSplashLoadListener public void onLoadFailed(MBridgeIds mBridgeIds, String str, int i) { MaxAdapterError maxError = MintegralMediationAdapter.toMaxError(str); MintegralMediationAdapter.this.log("App open ad failed to load: " + maxError); this.listener.onAppOpenAdLoadFailed(maxError); } @Override // com.mbridge.msdk.out.MBSplashLoadListener public void isSupportZoomOut(MBridgeIds mBridgeIds, boolean z) { MintegralMediationAdapter.this.log("App open ad supports zoom out: " + z); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onShowSuccessed(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("App open ad displayed"); this.listener.onAppOpenAdDisplayed(); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onShowFailed(MBridgeIds mBridgeIds, String str) { MaxAdapterError maxAdapterError = new MaxAdapterError(MaxAdapterError.ERROR_CODE_AD_DISPLAY_FAILED, "Ad Display Failed", 0, str); MintegralMediationAdapter.this.log("App open ad failed to show: " + maxAdapterError); this.listener.onAppOpenAdDisplayFailed(maxAdapterError); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onAdClicked(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("App open ad clicked"); this.listener.onAppOpenAdClicked(); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onDismiss(MBridgeIds mBridgeIds, int i) { MintegralMediationAdapter.this.log("App open ad hidden"); this.listener.onAppOpenAdHidden(); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onAdTick(MBridgeIds mBridgeIds, long j) { MintegralMediationAdapter.this.log("App open ad ticked with " + j + " ms remaining"); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onZoomOutPlayStart(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("App open ad zoom out started"); } @Override // com.mbridge.msdk.out.MBSplashShowListener public void onZoomOutPlayFinish(MBridgeIds mBridgeIds) { MintegralMediationAdapter.this.log("App open ad zoom out finished"); } } public class NativeAdViewListener implements NativeListener.NativeAdListener, OnMBMediaViewListener { private final MaxAdFormat adFormat; private final Context context; private final MaxAdViewAdapterListener listener; private final String placementId; private final Bundle serverParameters; private final String unitId; public NativeAdViewListener(MaxAdapterResponseParameters maxAdapterResponseParameters, MaxAdFormat maxAdFormat, Context context, MaxAdViewAdapterListener maxAdViewAdapterListener) { this.serverParameters = maxAdapterResponseParameters.getServerParameters(); this.adFormat = maxAdFormat; this.context = context; this.listener = maxAdViewAdapterListener; this.unitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); this.placementId = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdLoaded(List list, int i) { if (list == null || list.isEmpty()) { MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad failed to load for unit id: " + this.unitId + " placement id: " + this.placementId + " with error: no fill"); this.listener.onAdViewAdLoadFailed(MaxAdapterError.NO_FILL); return; } final Campaign campaign = list.get(0); if (!TextUtils.isEmpty(campaign.getAppName())) { MintegralMediationAdapter.this.nativeAdCampaign = campaign; MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad loaded for unit id: " + this.unitId + " placement id: " + this.placementId); MintegralMediationAdapter.this.getCachingExecutorService().submit(new Runnable() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.NativeAdViewListener.1 @Override // java.lang.Runnable public void run() { String iconUrl = campaign.getIconUrl(); String imageUrl = campaign.getImageUrl(); NativeAdViewListener nativeAdViewListener = NativeAdViewListener.this; Future createDrawableFuture = MintegralMediationAdapter.this.createDrawableFuture(iconUrl, nativeAdViewListener.context.getResources()); new MaxNativeAd.MaxNativeAdImage(Uri.parse(imageUrl)); final MaxNativeAd.MaxNativeAdImage maxNativeAdImage = null; try { Drawable drawable = createDrawableFuture.get(BundleUtils.getInt("image_task_timeout_seconds", 5, NativeAdViewListener.this.serverParameters), TimeUnit.SECONDS); if (drawable != null) { maxNativeAdImage = new MaxNativeAd.MaxNativeAdImage(drawable); } } catch (Throwable th) { MintegralMediationAdapter.this.log("Failed to fetch icon image from URL: " + iconUrl, th); } AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.NativeAdViewListener.1.1 @Override // java.lang.Runnable public void run() { MBMediaView mBMediaView = new MBMediaView(NativeAdViewListener.this.context); mBMediaView.setNativeAd(campaign); mBMediaView.setOnMediaViewListener(NativeAdViewListener.this); MBAdChoice mBAdChoice = new MBAdChoice(NativeAdViewListener.this.context); mBAdChoice.setCampaign(campaign); MaxNativeAd.Builder mediaView = new MaxNativeAd.Builder().setAdFormat(NativeAdViewListener.this.adFormat).setTitle(campaign.getAppName()).setBody(campaign.getAppDesc()).setCallToAction(campaign.getAdCall()).setIcon(maxNativeAdImage).setOptionsView(mBAdChoice).setMediaView(mBMediaView); MintegralMediationAdapter mintegralMediationAdapter = MintegralMediationAdapter.this; mintegralMediationAdapter.nativeAd = mintegralMediationAdapter.new MaxMintegralNativeAd(mediaView); String string = BundleUtils.getString("template", "", NativeAdViewListener.this.serverParameters); MintegralMediationAdapter mintegralMediationAdapter2 = MintegralMediationAdapter.this; MaxNativeAdView createMaxNativeAdViewWithNativeAd = mintegralMediationAdapter2.createMaxNativeAdViewWithNativeAd(mintegralMediationAdapter2.nativeAd, string, NativeAdViewListener.this.context); MintegralMediationAdapter.this.nativeAd.prepareForInteraction(MintegralMediationAdapter.this.getClickableViews(createMaxNativeAdViewWithNativeAd), createMaxNativeAdViewWithNativeAd); NativeAdViewListener.this.listener.onAdViewAdLoaded(createMaxNativeAdViewWithNativeAd); } }); } }); return; } MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad failed to load for unit id: " + this.unitId + " placement id: " + this.placementId + " with error: missing required assets"); this.listener.onAdViewAdLoadFailed(new MaxAdapterError(MaxAdapterError.ERROR_CODE_MISSING_REQUIRED_NATIVE_AD_ASSETS, "Missing Native Ad Assets")); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdLoadError(String str) { MaxAdapterError maxError = MintegralMediationAdapter.toMaxError(str); MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad failed to load for unit id: " + this.unitId + " placement id: " + this.placementId + " with error: " + maxError); this.listener.onAdViewAdLoadFailed(maxError); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onLoggingImpression(int i) { MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad shown for unit id: " + this.unitId + " placement id: " + this.placementId); this.listener.onAdViewAdDisplayed(null); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdClick(Campaign campaign) { MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad clicked for unit id: " + this.unitId + " placement id: " + this.placementId); this.listener.onAdViewAdClicked(); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdFramesLoaded(List list) { MintegralMediationAdapter.this.log("Native " + this.adFormat.getLabel() + " ad frames loaded for unit id: " + this.unitId + " placement id: " + this.placementId); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onEnterFullscreen() { MintegralMediationAdapter.this.log("Media view entered fullscreen"); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onExitFullscreen() { MintegralMediationAdapter.this.log("Media view exited fullscreen"); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onStartRedirection(Campaign campaign, String str) { MintegralMediationAdapter.this.log("Media view started redirection with url: " + str); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onFinishRedirection(Campaign campaign, String str) { MintegralMediationAdapter.this.log("Media view finished redirection with url: " + str); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onRedirectionFailed(Campaign campaign, String str) { MintegralMediationAdapter.this.log("Media view redirection failed with url: " + str); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onVideoAdClicked(Campaign campaign) { MintegralMediationAdapter.this.log("Media view clicked for unit id: " + this.unitId + " placement id: " + this.placementId); this.listener.onAdViewAdClicked(); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onVideoStart() { MintegralMediationAdapter.this.log("Media view video started"); } } public class NativeAdListener implements NativeListener.NativeAdListener, OnMBMediaViewListener { private final Context context; private final MaxNativeAdAdapterListener listener; private final MaxAdapterResponseParameters parameters; private final String placementId; private final String unitId; public NativeAdListener(MaxAdapterResponseParameters maxAdapterResponseParameters, Context context, MaxNativeAdAdapterListener maxNativeAdAdapterListener) { this.parameters = maxAdapterResponseParameters; this.context = context; this.listener = maxNativeAdAdapterListener; this.unitId = maxAdapterResponseParameters.getThirdPartyAdPlacementId(); this.placementId = BundleUtils.getString("placement_id", maxAdapterResponseParameters.getServerParameters()); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdLoaded(List list, int i) { if (list == null || list.isEmpty()) { MintegralMediationAdapter.this.log("Native ad failed to load for unit id: " + this.unitId + " placement id: " + this.placementId + " with error: no fill"); this.listener.onNativeAdLoadFailed(MaxAdapterError.NO_FILL); return; } Campaign campaign = list.get(0); if (!AppLovinSdkUtils.isValidString(BundleUtils.getString("template", "", this.parameters.getServerParameters())) || !TextUtils.isEmpty(campaign.getAppName())) { MintegralMediationAdapter.this.nativeAdCampaign = campaign; MintegralMediationAdapter.this.log("Native ad loaded for unit id: " + this.unitId + " placement id: " + this.placementId); processNativeAd(campaign); return; } MintegralMediationAdapter.this.log("Native ad failed to load for unit id: " + this.unitId + " placement id: " + this.placementId + " with error: missing required assets"); this.listener.onNativeAdLoadFailed(new MaxAdapterError(MaxAdapterError.ERROR_CODE_MISSING_REQUIRED_NATIVE_AD_ASSETS, "Missing Native Ad Assets")); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdLoadError(String str) { MaxAdapterError maxError = MintegralMediationAdapter.toMaxError(str); MintegralMediationAdapter.this.log("Native ad failed to load for unit id: " + this.unitId + " placement id: " + this.placementId + " with error: " + maxError); this.listener.onNativeAdLoadFailed(maxError); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onLoggingImpression(int i) { MintegralMediationAdapter.this.log("Native ad shown for unit id: " + this.unitId + " placement id: " + this.placementId); this.listener.onNativeAdDisplayed(null); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdClick(Campaign campaign) { MintegralMediationAdapter.this.log("Native ad clicked for unit id: " + this.unitId + " placement id: " + this.placementId); this.listener.onNativeAdClicked(); } @Override // com.mbridge.msdk.out.NativeListener.NativeAdListener public void onAdFramesLoaded(List list) { MintegralMediationAdapter.this.log("Native ad frames loaded for unit id: " + this.unitId + " placement id: " + this.placementId); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onEnterFullscreen() { MintegralMediationAdapter.this.log("Media view entered fullscreen"); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onExitFullscreen() { MintegralMediationAdapter.this.log("Media view exited fullscreen"); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onStartRedirection(Campaign campaign, String str) { MintegralMediationAdapter.this.log("Media view started redirection with url: " + str); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onFinishRedirection(Campaign campaign, String str) { MintegralMediationAdapter.this.log("Media view finished redirection with url: " + str); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onRedirectionFailed(Campaign campaign, String str) { MintegralMediationAdapter.this.log("Media view redirection failed with url: " + str); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onVideoAdClicked(Campaign campaign) { MintegralMediationAdapter.this.log("Media view clicked for unit id: " + this.unitId + " placement id: " + this.placementId); this.listener.onNativeAdClicked(); } @Override // com.mbridge.msdk.out.OnMBMediaViewListener public void onVideoStart() { MintegralMediationAdapter.this.log("Media view video started"); } private void processNativeAd(final Campaign campaign) { MintegralMediationAdapter.this.getCachingExecutorService().submit(new Runnable() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.NativeAdListener.1 @Override // java.lang.Runnable public void run() { String iconUrl = campaign.getIconUrl(); String imageUrl = campaign.getImageUrl(); NativeAdListener nativeAdListener = NativeAdListener.this; Future createDrawableFuture = MintegralMediationAdapter.this.createDrawableFuture(iconUrl, nativeAdListener.context.getResources()); final MaxNativeAd.MaxNativeAdImage maxNativeAdImage = new MaxNativeAd.MaxNativeAdImage(Uri.parse(imageUrl)); final MaxNativeAd.MaxNativeAdImage maxNativeAdImage2 = null; try { Drawable drawable = createDrawableFuture.get(BundleUtils.getInt("image_task_timeout_seconds", 5, NativeAdListener.this.parameters.getServerParameters()), TimeUnit.SECONDS); if (drawable != null) { maxNativeAdImage2 = new MaxNativeAd.MaxNativeAdImage(drawable); } } catch (Throwable th) { MintegralMediationAdapter.this.log("Failed to fetch icon image from URL: " + iconUrl, th); } AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.mediation.adapters.MintegralMediationAdapter.NativeAdListener.1.1 @Override // java.lang.Runnable public void run() { MBMediaView mBMediaView = new MBMediaView(NativeAdListener.this.context); mBMediaView.setNativeAd(campaign); mBMediaView.setOnMediaViewListener(NativeAdListener.this); MBAdChoice mBAdChoice = new MBAdChoice(NativeAdListener.this.context); mBAdChoice.setCampaign(campaign); MaxNativeAd.Builder mediaView = new MaxNativeAd.Builder().setAdFormat(MaxAdFormat.NATIVE).setTitle(campaign.getAppName()).setBody(campaign.getAppDesc()).setCallToAction(campaign.getAdCall()).setIcon(maxNativeAdImage2).setOptionsView(mBAdChoice).setMediaView(mBMediaView); int i = AppLovinSdk.VERSION_CODE; if (i >= 11040399) { mediaView.setMainImage(maxNativeAdImage); } if (i >= 11070000) { mediaView.setStarRating(Double.valueOf(campaign.getRating())); } MintegralMediationAdapter mintegralMediationAdapter = MintegralMediationAdapter.this; mintegralMediationAdapter.nativeAd = mintegralMediationAdapter.new MaxMintegralNativeAd(mediaView); NativeAdListener.this.listener.onNativeAdLoaded(MintegralMediationAdapter.this.nativeAd, null); } }); } }); } } public class MaxMintegralNativeAd extends MaxNativeAd { public MaxMintegralNativeAd(MaxNativeAd.Builder builder) { super(builder); } @Override // com.applovin.mediation.nativeAds.MaxNativeAd public boolean prepareForInteraction(List list, ViewGroup viewGroup) { Campaign campaign = MintegralMediationAdapter.this.nativeAdCampaign; if (campaign == null) { MintegralMediationAdapter.this.e("Failed to register native ad views: native ad is null."); return false; } MintegralMediationAdapter.this.d("Preparing views for interaction: " + list + " with container: " + viewGroup); if (getFormat() == MaxAdFormat.NATIVE) { if (MintegralMediationAdapter.this.mbBidNativeHandler != null) { MintegralMediationAdapter.this.mbBidNativeHandler.registerView(viewGroup, list, campaign); } else { MintegralMediationAdapter.this.e("Failed to register native ad views: mbBidNativeHandler is null."); } } else if (MintegralMediationAdapter.this.mbBidNativeAdViewHandler != null) { MintegralMediationAdapter.this.mbBidNativeAdViewHandler.registerView(viewGroup, list, campaign); } else { MintegralMediationAdapter.this.e("Failed to register native ad views: mbBidNativeAdViewHandler is null."); } MintegralMediationAdapter.this.nativeAdContainer = viewGroup; MintegralMediationAdapter.this.clickableViews = list; return true; } } }