Created
February 12, 2017 09:56
-
-
Save ayltai/983a2c1384615bb6f02dbb0036aff605 to your computer and use it in GitHub Desktop.
Populating ad fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.setTitle(this.nativeAd.getAdTitle()); | |
this.setText(this.nativeAd.getAdBody()); | |
final NativeAd.Image coverImage = this.nativeAd.getAdCoverImage(); | |
if (coverImage != null) this.setMainImageUrl(coverImage.getUrl()); | |
final NativeAd.Image icon = this.nativeAd.getAdIcon(); | |
if (icon != null) this.setIconImageUrl(icon.getUrl()); | |
this.setCallToAction(this.nativeAd.getAdCallToAction()); | |
this.setStarRating(FacebookNativeAd.getStarRatingValue(this.nativeAd.getAdStarRating())); | |
this.addExtra(FacebookNativeAd.SOCIAL_CONTEXT_FOR_AD, this.nativeAd.getAdSocialContext()); | |
final NativeAd.Image adChoicesIconImage = this.nativeAd.getAdChoicesIcon(); | |
if (adChoicesIconImage != null) { | |
this.setPrivacyInformationIconImageUrl(adChoicesIconImage.getUrl()); | |
this.setPrivacyInformationIconClickThroughUrl(this.nativeAd.getAdChoicesLinkUrl()); | |
} | |
this.preCacheImages(this.getImageUrls()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment