CEInFeedHelper

CEInFeedHelper is the class that simplifies in-feed integration of Card Ad and Native Ad.

Public construct

Public methods

void

setAdSource(CEIFAdSource adSource)

set Ad source by your Ad format to CEInFeedHelper

void

onScrollStateChanged(int state)

check if the feed is idle or scrolling

Public methods

CEIFAdView

getAdView(int position)

request Ad view from CEInFeedHelper

void

setAdEventListener(CEIFHelperAdEventListener listener)

set Ad event listener to receive Ad status

boolean

isAd(int position)

check if this position is Ad

boolean

isAd(View view)

check if this view is Ad

synchronized void

reset()

reset the Ad cache to request new Ad when you want to reload the dataset

void

setItemCount(int originalCount)

set the number of original in-feed items into CEInFeedHelper

int

getAdjustedCount(int originalCount)

get the number of current in-feed items

int

getOriginalPosition(int position)

get the item's original position when there are Ad items in the view

int

getAdjustedPosition(final int originalPosition)

get the item's adjusted position when there are no Ad items in the view

Object

getAdData(int position)

request Ad object from CEInFeedHelper

int

getViewTypeCount()

always return 2, because there are 2 type of items, normal ones and Ads

setAdSource

void setAdSource(CEIFAdSource adSource)

set Ad source by your Ad format to CEInFeedHelper

Parameter

adSource

CEIFAdSource: In-feed Ad source info

onScrollStateChanged

void onScrollStateChanged(int state)

check if the feed is idle or scrolling

Parameter

state

int: the current scroll state

onScroll

void onScroll(int visiblePos, int visibleItems, int totalChildView)

check the scroll state

Parameter

visiblePos

int: the index of the first visible cell

visibleItems

int: the number of visible cells

totalChildView

int: the number of items in the list adapter

getAdView

CEIFAdView getAdView(int position)

request Ad view from CEInFeedHelper if you don't want to use CEIFAdapter/CEIFRecyclerViewAdapter

Parameter

position

int: the position of the in-feed content

setAdEventListener

void setAdEventListener(CEIFHelperAdEventListener listener)

set Ad event listener to receive Ad status

Parameter

listener

CEIFHelperAdEventListener: the listener for ad event callback

mInFeedHelper.setAdEventListener(new CEInFeedHelper.CEIFHelperAdEventListener() {
            @Override
            public void onAdClicked(int index, Object ad) {

            }

            @Override
            public void onAdImpression(int index, Object ad) {

            }

            @Override
            public void onAdMute(int index, Object ad) {

            }

            @Override
            public void onAdUnmute(int index, Object ad) {

            }

            @Override
            public void onAdVideoStart(int index, Object ad) {

            }

            @Override
            public void onAdVideoEnd(int index, Object ad) {

            }

            @Override
            public void onAdVideoProgress(int index, Object ad, int totalDuration, int currentPosition) {

            }
        });

isAd

boolean isAd(int position)

check if this position is Ad

Parameter

position

int: the Dataset's position

isAd

boolean isAd(View view)

check if this view is Ad

Parameter

view

View

reset

synchronized void reset()

reset the Ad cache to request new Ad when you want to reload the dataset. To be more specific, you can call this API when users pull down to refresh the in-feed page.

setItemCount

void setItemCount(int originalCount)

set the number of original in-feed items into CEInFeedHelper

Parameter

originalCount

int: the number of original in-feed items

getAdjustedCount

int getAdjustedCount(int originalCount)

get the number of current in-feed items

Parameter

originalCount

int: number of original in-feed items

getOriginalPosition

int getOriginalPosition(int position)

get the item's original position when there are Ad items in the view

Parameter

position

int: the in-feed item's current position

getAdjustedPosition

int getAdjustedPosition(final int originalPosition)

Parameter

originalPosition

int: the in-feed's item original position

getAdData

Object getAdData(int position)

request Ad object from CEInFeedHelper

Parameter

position

int: the Ad item's position

getViewTypeCount

int getViewTypeCount()

**always return 2, because there are 2 type of items, normal ones and Ads

Last updated