use of de.tum.in.tumcampusapp.component.ui.tufilm.FilmCard in project TumCampusApp by TCA-Team.
the class NewsAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(Card.CardViewHolder holder, int position) {
NewsViewHolder nHolder = (NewsViewHolder) holder;
NewsCard card;
if (news.get(position).isFilm()) {
card = new FilmCard(mContext);
} else {
card = new NewsCard(mContext);
}
card.setNews(news.get(position));
nHolder.setCurrentCard(card);
bindNewsView(net, holder, news.get(position), mContext);
}
use of de.tum.in.tumcampusapp.component.ui.tufilm.FilmCard in project TumCampusApp by TCA-Team.
the class NewsController method onRequestCard.
/**
* Adds the newest news card
*
* @param context Context
*/
@Override
public void onRequestCard(Context context) {
Collection<Integer> sources = getActiveSources(context);
List<News> news;
if (Utils.getSettingBool(context, "card_news_latest_only", true)) {
news = newsDao.getBySourcesLatest(sources.toArray(new Integer[sources.size()]));
} else {
news = newsDao.getBySources(sources.toArray(new Integer[sources.size()]));
}
// Display resulting cards
for (News n : news) {
NewsCard card;
if (n.isFilm()) {
card = new FilmCard(context);
} else {
card = new NewsCard(context);
}
card.setNews(n);
card.apply();
}
}