Skip to content

Commit

Permalink
修复书架 读书记录问题
Browse files Browse the repository at this point in the history
  • Loading branch information
AnyMarvel committed Dec 22, 2021
1 parent 7562537 commit c111bd6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ public void onSuccess(String s) {
String linkUrl = TAG + chapterlist.get(i).getElementsByClass("chapterlist1").get(0).getElementsByTag("a").get(0).attr("href");
temp.setId(MD5Utils.strToMd5By16(linkUrl));
temp.setTitle(chapterlist.get(i).getElementsByClass("chapterlist1").get(0).getElementsByTag("a").get(0).text());
temp.setPosition(i);
temp.setLink(linkUrl);
temp.setBookId(collBookBean.get_id());
temp.setUnreadble(false);
Expand Down Expand Up @@ -256,6 +255,10 @@ public int compare(Map.Entry<Integer, BookChapterBean> o1, Map.Entry<Integer, Bo
}
Collections.reverse(chapterBeans);

for (int i = 0; i < chapterBeans.size(); i++) {
chapterBeans.get(i).setPosition(i);
}

return chapterBeans;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,18 @@ public ChapterInfoBean getChapterInfoBean(String folderName, String fileName) {
public String getRecordBookChapterTitle(CollBookBean book) {
BookRecordBean bookRecordBeans = mSession.getBookRecordBeanDao().queryBuilder().where(BookRecordBeanDao.Properties.BookId.eq(book.get_id())).unique();
if (bookRecordBeans != null) {
BookChapterBean currentBookChapterBean = mSession.getBookChapterBeanDao().queryBuilder()
.where(BookChapterBeanDao.Properties.BookId.eq(book.get_id()), BookChapterBeanDao.Properties.Position.eq(bookRecordBeans.getChapter())).unique();
BookChapterBean currentBookChapterBean = null;
try {
currentBookChapterBean = mSession.getBookChapterBeanDao().queryBuilder()
.where(BookChapterBeanDao.Properties.BookId.eq(book.get_id()), BookChapterBeanDao.Properties.Position.eq(bookRecordBeans.getChapter())).unique();

}catch (Exception e){
List<BookChapterBean> lists=mSession.getBookChapterBeanDao().queryBuilder()
.where(BookChapterBeanDao.Properties.BookId.eq(book.get_id())).list();
if (lists!=null && lists.size()>0){
currentBookChapterBean= lists.get(0);
}
}
if (currentBookChapterBean != null) {
return currentBookChapterBean.getTitle();
}
Expand Down

0 comments on commit c111bd6

Please sign in to comment.