Search in sources :

Example 1 with RecommendationBase

use of com.mxt.anitrend.model.entity.base.RecommendationBase in project anitrend-app by AniTrend.

the class MediaRecommendationsFragment method onChanged.

@Override
public void onChanged(@Nullable ConnectionContainer<PageContainer<RecommendationBase>> content) {
    if (content != null) {
        if (!content.isEmpty()) {
            if (content.getConnection().hasPageInfo())
                getPresenter().setPageInfo(content.getConnection().getPageInfo());
            ArrayList<RecyclerItem> entityMap = new ArrayList<>();
            for (RecommendationBase recommendation : content.getConnection().getPageData()) {
                if (recommendation.getMediaRecommendation() != null)
                    entityMap.add(recommendation.getMediaRecommendation());
            }
            onPostProcessed(entityMap);
        }
    } else
        onPostProcessed(Collections.emptyList());
    if (mAdapter.getItemCount() < 1)
        onPostProcessed(null);
}
Also used : RecommendationBase(com.mxt.anitrend.model.entity.base.RecommendationBase) ArrayList(java.util.ArrayList) RecyclerItem(com.mxt.anitrend.model.entity.group.RecyclerItem)

Aggregations

RecommendationBase (com.mxt.anitrend.model.entity.base.RecommendationBase)1 RecyclerItem (com.mxt.anitrend.model.entity.group.RecyclerItem)1 ArrayList (java.util.ArrayList)1