public interface CriteoNativeRenderer
| Modifier and Type | Method and Description |
|---|---|
android.view.View |
createNativeView(android.content.Context context,
android.view.ViewGroup parent)
Create a new empty native view that may be filled later.
|
void |
renderNativeView(RendererHelper helper,
android.view.View nativeView,
CriteoNativeAd nativeAd)
Fill the given native view with Ad payload.
|
@NonNull
android.view.View createNativeView(@NonNull
android.content.Context context,
@Nullable
android.view.ViewGroup parent)
Generally this method returns inflated XML Android Layout resource like:
LayoutInflater inflater = LayoutInflater.from(context);
return inflater.inflate(R.layout.my_native_ad, parent, false);
Note that parent is given so that inflated views are setup with the ViewGroup.LayoutParams corresponding to its parent. But you should not attach yet
your view to the parent. Your expected to attach it after the view is filled.
context - android contextparent - optional parent to get layout params fromvoid renderNativeView(@NonNull
RendererHelper helper,
@NonNull
android.view.View nativeView,
@NonNull
CriteoNativeAd nativeAd)
The native view is a one created by the createNativeView(Context, ViewGroup) method.
Note that, if you're using a recycler view, or any other mechanism reusing views, you may expect that for a same view this method can be called with different Ad payload. To avoid having residual data, you should clear the view. If you're not setting values conditionally, you should not be worried about this warning.
helper - helper class providing extension features, such as image loadingnativeView - the view to fill with datanativeAd - Ad payload that you can use