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. 52
      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)
}
}

@ -7,49 +7,49 @@
<path
android:pathData="M0,0h108v108h-108z"
android:fillColor="#4d4d4d" />
<path android:pathData="M0,108H54V65c0,-12 -54,-5 -54,-5Z">
<path android:pathData="M0,108H54V65c0,-12 -54,-5 -54,-5Z">
<aapt:attr name="android:fillColor">
<gradient
<gradient
android:startY="79.9"
android:startX="0.62"
android:endY="88.57"
android:endX="53.06"
android:type="linear">
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="1"
android:color="#FFCCCCCC" />
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="1"
android:color="#FFCCCCCC" />
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M108,108H54V65c0,-12 54,-5 54,-5Z"
android:fillColor="#fff" />
<path android:pathData="M71.5,69 L78,75V58a94.89,94.89 0,0 0,-13 0.75V75Z">
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
<gradient
android:startY="58.1"
android:startX="71.5"
android:endY="75"
android:endX="71.5"
android:type="linear">
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="0.24"
android:color="#FFFFE1DD" />
<item
android:offset="0.58"
android:color="#FFFFBEB6" />
<item
android:offset="0.84"
android:color="#FFFFA89D" />
<item
android:offset="1"
android:color="#FFFFA094" />
<item
android:offset="0"
android:color="#FFFFFFFF" />
<item
android:offset="0.24"
android:color="#FFFFE1DD" />
<item
android:offset="0.58"
android:color="#FFFFBEB6" />
<item
android:offset="0.84"
android:color="#FFFFA89D" />
<item
android:offset="1"
android:color="#FFFFA094" />
</gradient>
</aapt:attr>
</path>

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