Exemplo n.º 1
0
 @Override
 public View getView(int position, View convertView) {
   ArticleView view = (ArticleView) convertView;
   if (view == null) {
     view = ArticleView_.build(context);
   }
   Article article = getItem(position);
   Source source = sourceDao.queryForId(article.getSourceId());
   List<Tag> tags = null;
   if (source != null) {
     tags = tagDao.queryForNames(source.getTags());
   }
   view.bind(article, tags);
   return view;
 }
 public ArticleSyncAction queryForArticle(Article article) {
   try {
     return queryBuilder().where().eq(COLUMN_ARTICLEID, article.getId()).queryForFirst();
   } catch (SQLException e) {
     throw new RuntimeException(e);
   }
 }
 @SuppressWarnings("unchecked")
 public int deleteMarkStarredAndUnStarred(Article article) {
   try {
     DeleteBuilder<ArticleSyncAction, Integer> deleteBuilder = deleteBuilder();
     Where<ArticleSyncAction, Integer> where = deleteBuilder.where();
     where.and(
         where.eq(COLUMN_ARTICLEID, article.getId()),
         where
             .eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkStarred)
             .or()
             .eq(COLUMN_ACTION, ArticleSyncAction.Action.MarkUnstarred));
     return deleteBuilder.delete();
   } catch (SQLException e) {
     throw new RuntimeException(e);
   }
 }
Exemplo n.º 4
0
 private boolean isInList(Article article) {
   return article.isCached() == provider.getFilter().getType().equals(ArticleType.Newest);
 }