feat: 优化代码

pull/165/head
kunfei 5 years ago
parent 3b33b12bd0
commit 93de67f4ff
  1. 7
      app/src/main/java/io/legado/app/service/help/ReadBook.kt
  2. 12
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt
  3. 2
      app/src/main/res/drawable/ic_launcher1_b.xml
  4. BIN
      app/src/main/res/mipmap-hdpi/ic_launcher.png
  5. BIN
      app/src/main/res/mipmap-mdpi/ic_launcher.png
  6. BIN
      app/src/main/res/mipmap-xhdpi/ic_launcher.png
  7. BIN
      app/src/main/res/mipmap-xxhdpi/ic_launcher.png
  8. BIN
      app/src/main/res/mipmap-xxxhdpi/ic_launcher.png

@ -33,7 +33,7 @@ object ReadBook {
var curTextChapter: TextChapter? = null
var nextTextChapter: TextChapter? = null
var webBook: WebBook? = null
var msg: String? = null
private var msg: String? = null
private val loadingChapters = arrayListOf<Int>()
fun resetData(book: Book, noSource: (name: String, author: String) -> Unit) {
@ -64,6 +64,11 @@ object ReadBook {
}
}
fun upMsg(msg: String?) {
this.msg = msg
callBack?.upContent()
}
fun moveToNextPage() {
durPageIndex++
callBack?.upContent()

@ -117,15 +117,16 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
App.db.bookChapterDao().insert(*cList.toTypedArray())
App.db.bookDao().update(book)
ReadBook.chapterSize = cList.size
ReadBook.upMsg(null)
ReadBook.loadContent(resetPageOffset = true)
} else {
changeDruChapterIndex(cList)
}
} else {
toast(R.string.error_load_toc)
ReadBook.upMsg(context.getString(R.string.error_load_toc))
}
}?.onError {
toast(R.string.error_load_toc)
ReadBook.upMsg(context.getString(R.string.error_load_toc))
}
}
}
@ -133,6 +134,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
fun changeTo(book1: Book) {
execute {
ReadBook.upMsg(null)
ReadBook.book?.let {
App.db.bookDao().delete(it)
}
@ -171,11 +173,9 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
}
}
}.onStart {
ReadBook.msg = "正在自动换源"
ReadBook.callBack?.upContent()
ReadBook.upMsg("正在自动换源")
}.onFinally {
ReadBook.msg = null
ReadBook.callBack?.upContent()
ReadBook.upMsg(null)
}
}

@ -26,7 +26,7 @@
</path>
<path
android:pathData="M108,108H54V65c0,-12 54,-5 54,-5Z"
android:fillColor="#fff" />
android:fillColor="#f2f2f2" />
<path android:pathData="M71.5,69 L78,75V58a94.89,94.89 0,0 0,-13 0.75V75Z">
<aapt:attr name="android:fillColor">
<gradient

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Loading…
Cancel
Save