private void a(FlurryAdNative paramFlurryAdNative, boolean paramBoolean) { if (paramBoolean) { paramFlurryAdNative.removeTrackingView(); paramFlurryAdNative.destroy(); } if (e.contains(paramFlurryAdNative)) { e.remove(paramFlurryAdNative); } if (f.contains(paramFlurryAdNative)) { f.remove(paramFlurryAdNative); } }
public FlurryAdNative a(int paramInt) { Object localObject = null; if (paramInt >= e.size()) {} FlurryAdNative localFlurryAdNative; do { do { return (FlurryAdNative) localObject; } while (e.size() <= 0); localFlurryAdNative = (FlurryAdNative) e.get(paramInt); localObject = localFlurryAdNative; } while (!localFlurryAdNative.isExpired()); a(localFlurryAdNative, true); return a(paramInt); }
/** Destroys all queued ads and removes them from memory */ void destroyAds() { mFetchFailCount = 0; mIsCurrentlyFetching = false; if (mCurrentFlurryAdNative != null) { mCurrentFlurryAdNative.destroy(); } for (FlurryAdNative adNative : AD_QUEUE) { adNative.destroy(); } AD_QUEUE.clear(); RETRY_FETCH_HANDLER.removeMessages(0); }
@Override public void onFetched(FlurryAdNative flurryAdNative) { if (isAdUsable(flurryAdNative)) { AD_QUEUE.addLast(flurryAdNative); mFetchFailCount = 0; mFetchSucceedCount += 1; /* Inform the fetch listener that an ad has been fetched so it can get the ad from FlurryNativeAdFetcher#popLoadedAd() whenever it wants. */ if (mFetchListener != null) { mFetchListener.onAdFetched(); } for (FlurryAdNativeListener listener : mExternalListeners) { listener.onFetched(flurryAdNative); } } else { flurryAdNative.destroy(); } // Replenish immediately replenishAdQueue(); }
private void replenishAdQueue() { if (AD_QUEUE.size() < PREFETCHED_ADS_SIZE && mFetchFailCount < MAX_FETCH_ATTEMPT && mFetchSucceedCount < MAX_ADS_TO_FETCH) { mIsCurrentlyFetching = true; Context context = mContextReference.get(); mCurrentFlurryAdNative = new FlurryAdNative(context, mAdSpaceName); if (mFlurryAdTargeting != null) { mCurrentFlurryAdNative.setTargeting(mFlurryAdTargeting); } mCurrentFlurryAdNative.setListener(internalListener); mCurrentFlurryAdNative.fetchAd(); } else { mIsCurrentlyFetching = false; } }
@Override public void onError( FlurryAdNative flurryAdNative, FlurryAdErrorType flurryAdErrorType, int errorCode) { if (flurryAdErrorType == FlurryAdErrorType.FETCH) { mFetchFailCount++; flurryAdNative.destroy(); } // Retry after some delay RETRY_FETCH_HANDLER.postDelayed(RETRY_FETCH_RUNNABLE, RETRY_TIME_MILLI); for (FlurryAdNativeListener listener : mExternalListeners) { listener.onError(flurryAdNative, flurryAdErrorType, errorCode); } Log.w(TAG, "onError. Error code: " + errorCode); }
private boolean a(FlurryAdNative paramFlurryAdNative) { if ((paramFlurryAdNative.isReady()) && (!paramFlurryAdNative.isExpired())) { if (paramFlurryAdNative.isVideoAd()) { if ((!paramFlurryAdNative.isReady()) || (paramFlurryAdNative.isExpired()) || (paramFlurryAdNative.getAsset("headline") == null) || (paramFlurryAdNative.getAsset("videoUrl") == null) || (paramFlurryAdNative.getAsset("source") == null)) {} } while ((paramFlurryAdNative.isReady()) && (!paramFlurryAdNative.isExpired()) && (paramFlurryAdNative.getAsset("headline") != null) && (paramFlurryAdNative.getAsset("secHqImage") != null) && (paramFlurryAdNative.getAsset("source") != null)) { return true; return false; } return false; } return false; }
private boolean isAdUsable(FlurryAdNative nativeAd) { return nativeAd != null && nativeAd.isReady() && !nativeAd.isExpired(); }