Class PublisherViewsClickHandler
-
- All Implemented Interfaces:
public final class PublisherViewsClickHandlerHandles click listener attachment and detachment for publisher views in native ads.
This class provides functionality to set up and tear down click listeners on various native ad view components such as title, description, icon, CTA, etc. It enables proper tracking of user interactions with different parts of the native ad.
-
-
Constructor Summary
Constructors Constructor Description PublisherViewsClickHandler()
-
Method Summary
Modifier and Type Method Description final UnitattachClickListeners(PublisherNativeViewData publisherNativeViewData, Function1<Short, Unit> onClick)Attaches click listeners to all views in the publisher native view data. final UnitdetachClickListeners(PublisherNativeViewData pubView)Detaches click listeners from all views in the publisher native view data. -
-
Method Detail
-
attachClickListeners
final Unit attachClickListeners(PublisherNativeViewData publisherNativeViewData, Function1<Short, Unit> onClick)
Attaches click listeners to all views in the publisher native view data.
This method sets up click listeners on all available native ad view components including parent view, title, description, icon, CTA, advertiser, rating, and ad choice views. Each click triggers the provided callback with the appropriate asset type.
- Parameters:
publisherNativeViewData- The PublisherNativeViewData containing all the views to attach listeners to.onClick- Callback function that receives the NativeAssetType of the clicked view.
-
detachClickListeners
final Unit detachClickListeners(PublisherNativeViewData pubView)
Detaches click listeners from all views in the publisher native view data.
This method removes all previously attached click listeners to prevent memory leaks and ensure proper cleanup when the native ad is no longer active. Should be called when the ad is being destroyed or when tracking should be stopped.
- Parameters:
pubView- The PublisherNativeViewData containing all the views to detach listeners from.
-
-
-
-