package com.topon import android.content.Context import android.widget.FrameLayout import com.secmtp.sdk.nativead.api.ATNativeAdView class ToponNativeAdView(context: Context) : FrameLayout(context) { private val adContainer = ATNativeAdView(context) private val contentView = FrameLayout(context) init { adContainer.layoutParams = LayoutParams( LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT ) super.addView(adContainer) adContainer.addView( contentView, LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) ) } fun adContainer(): ATNativeAdView = adContainer fun contentView(): FrameLayout = contentView fun addReactSubview(child: android.view.View, index: Int) { contentView.addView(child, index) } fun removeReactSubviewAt(index: Int) { contentView.removeViewAt(index) } fun reactSubviewCount(): Int = contentView.childCount fun reactSubviewAt(index: Int): android.view.View? = contentView.getChildAt(index) }