Esempio n. 1
0
 @Override
 public void onResponse(Response<ChapterResult> response, Retrofit retrofit) {
   refresh.setRefreshing(false);
   List<ChapterEntity> chapterList = response.body().getChapterList();
   adapter.addAll(chapterList);
   chapterDao.insertOrReplaceInTx(chapterList);
 }
Esempio n. 2
0
 @Override
 public void setUserVisibleHint(boolean isVisibleToUser) {
   super.setUserVisibleHint(isVisibleToUser);
   if (isVisibleToUser && adapter.getItemCount() == 0) {
     QueryBuilder<ChapterEntity> queryBuilder = chapterDao.queryBuilder();
     if (type.getId() != 1) {
       queryBuilder.where(ChapterEntityDao.Properties.TypeId.eq(type.getId()));
     }
     Query<ChapterEntity> query =
         queryBuilder.limit(20).orderDesc(ChapterEntityDao.Properties.SendDate).build();
     adapter.addAll(query.list());
   }
 }