com.mopub.nativeads.NativeImageHelper Java Examples
The following examples show how to use
com.mopub.nativeads.NativeImageHelper.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TwitterStaticNativeAdRenderer.java From twitter-kit-android with Apache License 2.0 | 6 votes |
private void update(final TwitterStaticNativeAd staticNativeView, final StaticNativeAd staticNativeAd) { NativeRendererHelper.addTextView(staticNativeView.adTitleView, staticNativeAd.getTitle()); NativeRendererHelper.addTextView(staticNativeView.adTextView, staticNativeAd.getText()); NativeRendererHelper.addTextView(staticNativeView.callToActionView, staticNativeAd.getCallToAction()); NativeImageHelper.loadImageView(staticNativeAd.getMainImageUrl(), staticNativeView.mainImageView); NativeImageHelper.loadImageView(staticNativeAd.getIconImageUrl(), staticNativeView.adIconView); NativeRendererHelper.addPrivacyInformationIcon( staticNativeView.privacyInfoView, staticNativeAd.getPrivacyInformationIconImageUrl(), staticNativeAd.getPrivacyInformationIconClickThroughUrl()); }
Example #2
Source File: AppLovinCustomEventNative.java From SDK-Network-Adapters with MIT License | 5 votes |
@Override public void onNativeAdsLoaded(final List nativeAds) { final AppLovinNativeAd nativeAd = (AppLovinNativeAd) nativeAds.get( 0 ); log( DEBUG, "Native ad did load ad: " + nativeAd.getAdId() ); final List<String> imageUrls = new ArrayList<>( 2 ); if ( nativeAd.getIconUrl() != null ) imageUrls.add( nativeAd.getIconUrl() ); if ( nativeAd.getImageUrl() != null ) imageUrls.add( nativeAd.getImageUrl() ); // Please note: If/when we add support for videos, we must use AppLovin SDK's built-in precaching mechanism runOnUiThread( new Runnable() { @Override public void run() { NativeImageHelper.preCacheImages( context, imageUrls, new NativeImageHelper.ImageListener() { @Override public void onImagesCached() { handleNativeAdFinishedCaching( nativeAd ); } @Override public void onImagesFailedToCache(NativeErrorCode nativeErrorCode) { handleNativeAdFinishedCaching( nativeAd ); } } ); } } ); }