old
zlj 5 years ago
parent 1701a00435
commit ca7091a7e6
  1. 2
      app/src/main/assets/litepal.xml
  2. 18
      app/src/main/java/com/novel/read/activity/NovelReadActivity.kt
  3. 17
      app/src/main/java/com/novel/read/model/db/BookSignTable.java
  4. 4
      app/src/main/java/com/novel/read/model/db/ChapterInfoBean.java
  5. 1
      app/src/main/java/com/novel/read/model/db/CollBookBean.java
  6. 5
      app/src/main/java/com/novel/read/model/db/DownloadTaskBean.java

@ -17,5 +17,7 @@
<mapping class="com.novel.read.model.db.ChapterInfoBean" />
<!--章节详情表-->
<mapping class="com.novel.read.model.db.DownloadTaskBean" />
<!--书签表-->
<mapping class="com.novel.read.model.db.BookSignTable" />
</list>
</litepal>

@ -347,8 +347,8 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
)
) { _, which ->
when (which) {
0 //50章
-> {
0 -> {
//50章
val last = currentChapter + 50
if (last > mCollBook!!.bookChapters.size) {
downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size)
@ -356,16 +356,15 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
downLoadCache(mCollBook!!.bookChapters, last)
}
}
1 //后面所有
-> {
1 -> {
//后面所有
val lastBeans = ArrayList<BookChapterBean>()
for (i in currentChapter until mCollBook!!.bookChapters.size) {
lastBeans.add(mCollBook!!.bookChapters[i])
}
downLoadCache(lastBeans, mCollBook!!.bookChapters.size - currentChapter)
}
2 //所有
-> downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size)
2 -> downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size) //所有
else -> {
}
}
@ -396,7 +395,12 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
tvBookReadMode.text = resources.getString(R.string.book_read_mode_day)
val drawable = ContextCompat.getDrawable(this, R.drawable.ic_read_menu_night)
tvBookReadMode.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null)
cl_layout.setBackgroundColor(ContextCompat.getColor(this,ReadSettingManager.getInstance().pageStyle.bgColor))
cl_layout.setBackgroundColor(
ContextCompat.getColor(
this,
ReadSettingManager.getInstance().pageStyle.bgColor
)
)
}
}

@ -0,0 +1,17 @@
package com.novel.read.model.db;
import org.litepal.crud.LitePalSupport;
import java.io.Serializable;
/**
* create by zlj on 2019/11/6
* describe: 书签数据库
*/
public class BookSignTable extends LitePalSupport implements Serializable {
private String bookId;
private String content;
private long saveTime;
}

@ -1,9 +1,5 @@
package com.novel.read.model.db;
/**
* Created by newbiechen on 17-5-10.
*/
public class ChapterInfoBean {
/**
* title : 第一章 他叫白小纯

@ -10,7 +10,6 @@ import java.util.ArrayList;
import java.util.List;
/**
* Created by newbiechen on 17-5-8.
* 收藏的书籍
*/
public class CollBookBean extends LitePalSupport implements Serializable {

@ -70,11 +70,6 @@ public class DownloadTaskBean extends LitePalSupport {
public List<BookChapterBean> getBookChapterList() {
if (bookChapterList == null) {
// BookChapterBeanDao targetDao = daoSession.getBookChapterBeanDao();
// List<BookChapterBean> bookChapterListNew = targetDao
// ._queryDownloadTaskBean_BookChapterList(taskName);
List<BookChapterBean> bookChapterListNew = LitePal
.where("taskName=?", taskName).find(BookChapterBean.class);

Loading…
Cancel
Save