BrazeListAdapter

Default adapter used to display cards and log card impressions for the Braze news feed.

This allows the stream to reuse cards when they go out of view. IMPORTANT - When you add a new card, be sure to add the new view type and update the view count here A card generates an impression once per viewing per open ListView. If a card is viewed more than once in a particular ListView, it generates only one impression. If closed an reopened, a card will again generate an impression. This also takes into account the case of a card being off-screen in the ListView. The card only generates an impression when it actually scrolls onto the screen. IMPORTANT - You must call resetCardImpressionTracker() whenever the ListView is displayed. This will ensure that cards that come into view will be tracked according to the description above. Adding and removing cards to and from the adapter should be done using the following synchronized methods: add, clearclear(), replaceFeed

Constructors

Link copied to clipboard
constructor(context: Context, layoutResourceId: Int, cards: List<Card>)

Properties

Link copied to clipboard
Link copied to clipboard
val NO_SELECTION: Int = -2147483648

Functions

Link copied to clipboard
open fun add(card: Card)
Link copied to clipboard
open fun addAll(collection: Collection<out T>)
Link copied to clipboard
Link copied to clipboard
open fun batchSetCardsToRead(startIndex: Int, endIndex: Int)
Helper method to batch set cards to visually read after either an up or down scroll of the feed.
Link copied to clipboard
open fun clear()
Link copied to clipboard
open fun createFromResource(context: Context, textArrayResId: Int, textViewResId: Int): ArrayAdapter<CharSequence>
Link copied to clipboard
Link copied to clipboard
open fun getContext(): Context
Link copied to clipboard
open fun getCount(): Int
Link copied to clipboard
open fun getDropDownView(position: Int, convertView: View, parent: ViewGroup): View
Link copied to clipboard
Link copied to clipboard
open fun getFilter(): Filter
Link copied to clipboard
abstract fun getItem(p: Int): Any
open fun getItem(position: Int): T
Link copied to clipboard
open fun getItemId(position: Int): Long
Link copied to clipboard
open fun getItemViewType(position: Int): Int
Link copied to clipboard
open fun getPosition(item: T): Int
Link copied to clipboard
open fun getView(position: Int, convertView: View, @NonNull parent: ViewGroup): View
Always try to use a convert view if possible, otherwise create one from scratch.
Link copied to clipboard
open fun getViewTypeCount(): Int
Be sure to keep view count in sync with the number of card types in the stream.
Link copied to clipboard
open fun hasStableIds(): Boolean
Link copied to clipboard
open fun insert(object: T, index: Int)
Link copied to clipboard
open fun isEmpty(): Boolean
Link copied to clipboard
open fun isEnabled(position: Int): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun remove(object: T)
Link copied to clipboard
open fun replaceFeed(cards: List<Card>)
Link copied to clipboard
Resets the list of viewed cards.
Link copied to clipboard
Link copied to clipboard
open fun setDropDownViewResource(resource: Int)
Link copied to clipboard
Link copied to clipboard
open fun setNotifyOnChange(notifyOnChange: Boolean)
Link copied to clipboard
open fun sort(comparator: Comparator<in T>)
Link copied to clipboard