Class PublisherViewsClickHandler

  • All Implemented Interfaces:

    
    public final class PublisherViewsClickHandler
    
                        

    Handles 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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Unit attachClickListeners(PublisherNativeViewData publisherNativeViewData, Function1<Short, Unit> onClick) Attaches click listeners to all views in the publisher native view data.
      final Unit detachClickListeners(PublisherNativeViewData pubView) Detaches click listeners from all views in the publisher native view data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PublisherViewsClickHandler

        PublisherViewsClickHandler()
    • 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.