Skip to content

Instantly share code, notes, and snippets.

@slavkoder
Created March 15, 2019 00:39
Show Gist options
  • Save slavkoder/8f5bfaabcb5730f994874d7005e50ba7 to your computer and use it in GitHub Desktop.
Save slavkoder/8f5bfaabcb5730f994874d7005e50ba7 to your computer and use it in GitHub Desktop.
Example of inner class
class FindViewHolder(val parent: View) {
val adunitTitle: TextView = parent.findViewById(R.id.adunitTitle)
val companyText: TextView = parent.findViewById(R.id.companyText)
val companyLogo: ImageView = parent.findViewById(R.id.companyLogo)
val unifiedNativeAdView: UnifiedNativeAdView = parent.findViewById(R.id.unifiedNativeAdView)
val mediaView: MediaView = parent.findViewById(R.id.mediaView)
val textWrapper: View = parent.findViewById(R.id.textWrapper)
}
private val vh: FindViewHolder
init {
View.inflate(context, LAYOUT_ID, this)
vh = FindViewHolder(this)
vh.unifiedNativeAdView.headlineView = vh.adunitTitle
vh.unifiedNativeAdView.advertiserView = vh.companyText
vh.unifiedNativeAdView.iconView = vh.companyLogo
vh.unifiedNativeAdView.callToActionView = vh.textWrapper
setupMediaView()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment