NativeAdViewHolder

class NativeAdViewHolder(val presentation: NativeAdPresentation, val root: NativeAdView, val content: LinearLayout, val label: TextView, val media: MediaView?, val mediaFrame: View?, val icon: ImageView?, val iconFrame: View?, val headline: TextView, val body: TextView?, val advertiser: TextView, val callToAction: TextView?, decorate: NativeAdViewHolder.(palette: NativeAdPalette, style: NativeAdStyle) -> Unit? = null)(source)

Strong references to the views a native ad binds to, so binding never needs findViewById.

Parameters

decorate

Runs at the end of applyPalette, for a custom NativeAdViewFactory whose layout has views the holder does not know about (a card behind part of the ad, a header icon) or that finishes a known view differently (a disclosure label drawn as a title instead of a chip). It runs on every repaint, so it follows theme changes the same way the holder's own views do.

Constructors

Link copied to clipboard
constructor(presentation: NativeAdPresentation, root: NativeAdView, content: LinearLayout, label: TextView, media: MediaView?, mediaFrame: View?, icon: ImageView?, iconFrame: View?, headline: TextView, body: TextView?, advertiser: TextView, callToAction: TextView?, decorate: NativeAdViewHolder.(palette: NativeAdPalette, style: NativeAdStyle) -> Unit? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val media: MediaView?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val root: NativeAdView

Functions

Link copied to clipboard
fun applyPalette(palette: NativeAdPalette, style: NativeAdStyle = NativeAdStyle())
Link copied to clipboard
fun bind(nativeAd: NativeAd, sponsoredLabel: String)