Search in sources :

Example 1 with HeaderTravelVH

use of net.osmand.plus.wikivoyage.explore.travelcards.HeaderTravelCard.HeaderTravelVH in project Osmand by osmandapp.

the class ExploreRvAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) {
    BaseTravelCard item = getItem(position);
    if (viewHolder instanceof HeaderTravelVH && item instanceof HeaderTravelCard) {
        HeaderTravelCard headerTravelCard = (HeaderTravelCard) item;
        headerTravelCard.setArticleItemCount(getArticleItemCount());
        headerTravelCard.bindViewHolder(viewHolder);
    } else if (viewHolder instanceof ArticleTravelVH && item instanceof TravelGpxCard) {
        TravelGpxCard travelGpxCard = (TravelGpxCard) item;
        travelGpxCard.setLastItem(position == getLastArticleItemIndex());
        travelGpxCard.bindViewHolder(viewHolder);
    } else if (viewHolder instanceof ArticleTravelVH && item instanceof ArticleTravelCard) {
        ArticleTravelCard articleTravelCard = (ArticleTravelCard) item;
        articleTravelCard.setLastItem(position == getLastArticleItemIndex());
        articleTravelCard.bindViewHolder(viewHolder);
    } else {
        item.bindViewHolder(viewHolder);
    }
}
Also used : ArticleTravelCard(net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard) BaseTravelCard(net.osmand.plus.wikivoyage.explore.travelcards.BaseTravelCard) HeaderTravelVH(net.osmand.plus.wikivoyage.explore.travelcards.HeaderTravelCard.HeaderTravelVH) HeaderTravelCard(net.osmand.plus.wikivoyage.explore.travelcards.HeaderTravelCard) TravelGpxCard(net.osmand.plus.wikivoyage.explore.travelcards.TravelGpxCard) ArticleTravelVH(net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard.ArticleTravelVH)

Aggregations

ArticleTravelCard (net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard)1 ArticleTravelVH (net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard.ArticleTravelVH)1 BaseTravelCard (net.osmand.plus.wikivoyage.explore.travelcards.BaseTravelCard)1 HeaderTravelCard (net.osmand.plus.wikivoyage.explore.travelcards.HeaderTravelCard)1 HeaderTravelVH (net.osmand.plus.wikivoyage.explore.travelcards.HeaderTravelCard.HeaderTravelVH)1 TravelGpxCard (net.osmand.plus.wikivoyage.explore.travelcards.TravelGpxCard)1