Package 

Interface AdRenderer


  • @MainThread() 
    public interface AdRenderer
    
                        

    Produces a renderer-owned View for rendering a single ad.

    Attached optionally to ad.elo.androidsdk.EloAd for creatives that require view registration to count impressions and clicks. When a renderer is present, the SDK's Compose ad views embed the returned view via AndroidView { ... } instead of rendering Elo-styled chrome.

    Mirrors iOS AdRenderer. Methods are called from the main thread; the MainThread annotation propagates to all members for lint enforcement.

    • Method Summary

      Modifier and Type Method Description
      abstract View makeView(Context context) Build a fresh View containing chrome and registered asset slots.
      Unit update(View view) Bind ad data into a previously-built view.
      Unit release(View view) Release view-owned resources tied to view.
      Integer getMinimumDisplayHeightDp()
      • Methods inherited from class java.lang.Object

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

      • makeView

         abstract View makeView(Context context)

        Build a fresh View containing chrome and registered asset slots. Asset binding belongs in update so it can run separately from construction.

        Called once per Compose mount — every host (chat surface, list cell) gets its own View. Sharing one View across hosts breaks Android's "one parent per view" invariant.

      • update

         Unit update(View view)

        Bind ad data into a previously-built view. Runs on every recomposition with new inputs, including the first one immediately after makeView; Compose does not guarantee the view has been measured or laid out by then. For assets that need real bounds (e.g. a media view), defer binding inside update (e.g. view.doOnLayout { … }) or rely on the underlying SDK's own deferred binding.

        Default is a no-op for renderers that don't need per-update binding.

      • release

         Unit release(View view)

        Release view-owned resources tied to view. Called when the embedding composable leaves composition (or before the view is discarded on ad swap), via Compose's AndroidView(onRelease = ...) callback.

        Do not destroy ad-owned network objects here if the same AdRenderer may render again after a transient unmount. Put that cleanup behind EloAd.releaseResources() instead.

        Default is a no-op for renderers without view cleanup needs.