Search in sources :

Example 1 with FilmCard

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);
}
Also used : FilmCard(de.tum.in.tumcampusapp.component.ui.tufilm.FilmCard)

Example 2 with FilmCard

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();
    }
}
Also used : News(de.tum.in.tumcampusapp.component.ui.news.model.News) FilmCard(de.tum.in.tumcampusapp.component.ui.tufilm.FilmCard)

Aggregations

FilmCard (de.tum.in.tumcampusapp.component.ui.tufilm.FilmCard)2 News (de.tum.in.tumcampusapp.component.ui.news.model.News)1