Content Cards Fragment
A fragment to display Braze ContentCards.
Properties
A RecyclerView associated with ContentCardsFragment. Note that this will be null until Fragment.onCreateView is called.
An adapter to display when no cards are available for display.
Whether the system bar and display cutout insets are applied to the feed as padding, which apps targeting API 35 and higher need because the system draws them edge-to-edge.
A runnable to execute when the network is determined to be unavailable.
Functions
Creates and attaches a SimpleItemTouchHelperCallback to handle swipe-to-dismiss functionality.
A main thread runnable to handle ContentCardsUpdatedEvent on the main thread.
Handles the processing and rendering for a ContentCardsUpdatedEvent on the UI thread.
Called on the main thread when Content Cards cannot be refreshed because the network is unavailable. Logs the event, swaps in the empty cards adapter, and stops the refresh indicator. Integrators that want to surface a custom network-error UI (for example a Toast or Snackbar) should do so at the app layer using their own connectivity signals.
Set the IContentCardsViewBindingHandler responsible for rendering each Card in the RecyclerView. Note that this should only be set before the ContentCardsFragment is first displayed or the ContentCardAdapter will not update correctly.
Set the IContentCardsUpdateHandler for this ContentCardsFragment. This handler is for doing any work on Cards before being rendered in the ContentCards. If not set or set to null, the default handler will be used.
Swaps the current RecyclerView for a new one. If the current adapter matches the new adapter, then this method does nothing.
Starts or stops offsetting the feed by the system bar and display cutout insets, following isWindowInsetsHandlingEnabled. Apps targeting API 35 and higher need the offset, because the system draws them edge-to-edge.