예제 #1
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());
   }
 }
예제 #2
0
 @Override
 public void onViewCreated(View view, Bundle savedInstanceState) {
   super.onViewCreated(view, savedInstanceState);
   RecyclerView recycler = (RecyclerView) view.findViewById(R.id.chapter_list_recycler);
   recycler.setAdapter(adapter);
   refresh = ((SwipeRefreshLayout) view);
   refresh.setOnRefreshListener(
       () -> {
         adapter.clear();
         HttpUtils.getService().getChapterList(20, 1, type.getId()).enqueue(this);
       });
 }