old
zlj 5 years ago
parent 1701a00435
commit ca7091a7e6
  1. 2
      app/src/main/assets/litepal.xml
  2. 20
      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.ChapterInfoBean" />
<!--章节详情表--> <!--章节详情表-->
<mapping class="com.novel.read.model.db.DownloadTaskBean" /> <mapping class="com.novel.read.model.db.DownloadTaskBean" />
<!--书签表-->
<mapping class="com.novel.read.model.db.BookSignTable" />
</list> </list>
</litepal> </litepal>

@ -347,8 +347,8 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
) )
) { _, which -> ) { _, which ->
when (which) { when (which) {
0 //50章 0 -> {
-> { //50章
val last = currentChapter + 50 val last = currentChapter + 50
if (last > mCollBook!!.bookChapters.size) { if (last > mCollBook!!.bookChapters.size) {
downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size) downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size)
@ -356,16 +356,15 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
downLoadCache(mCollBook!!.bookChapters, last) downLoadCache(mCollBook!!.bookChapters, last)
} }
} }
1 //后面所有 1 -> {
-> { //后面所有
val lastBeans = ArrayList<BookChapterBean>() val lastBeans = ArrayList<BookChapterBean>()
for (i in currentChapter until mCollBook!!.bookChapters.size) { for (i in currentChapter until mCollBook!!.bookChapters.size) {
lastBeans.add(mCollBook!!.bookChapters[i]) lastBeans.add(mCollBook!!.bookChapters[i])
} }
downLoadCache(lastBeans, mCollBook!!.bookChapters.size - currentChapter) downLoadCache(lastBeans, mCollBook!!.bookChapters.size - currentChapter)
} }
2 //所有 2 -> downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size) //所有
-> downLoadCache(mCollBook!!.bookChapters, mCollBook!!.bookChapters.size)
else -> { else -> {
} }
} }
@ -391,12 +390,17 @@ class NovelReadActivity : NovelBaseActivity(), DownloadService.OnDownloadListene
tvBookReadMode.text = resources.getString(R.string.book_read_mode_day) tvBookReadMode.text = resources.getString(R.string.book_read_mode_day)
val drawable = ContextCompat.getDrawable(this, R.drawable.ic_read_menu_moring) val drawable = ContextCompat.getDrawable(this, R.drawable.ic_read_menu_moring)
tvBookReadMode.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null) tvBookReadMode.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null)
cl_layout.setBackgroundColor(ContextCompat.getColor(this,R.color.nb_read_bg_night)) cl_layout.setBackgroundColor(ContextCompat.getColor(this, R.color.nb_read_bg_night))
} else { } else {
tvBookReadMode.text = resources.getString(R.string.book_read_mode_day) tvBookReadMode.text = resources.getString(R.string.book_read_mode_day)
val drawable = ContextCompat.getDrawable(this, R.drawable.ic_read_menu_night) val drawable = ContextCompat.getDrawable(this, R.drawable.ic_read_menu_night)
tvBookReadMode.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null) 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; package com.novel.read.model.db;
/**
* Created by newbiechen on 17-5-10.
*/
public class ChapterInfoBean { public class ChapterInfoBean {
/** /**
* title : 第一章 他叫白小纯 * title : 第一章 他叫白小纯

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

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

Loading…
Cancel
Save