优化
This commit is contained in:
@@ -146,7 +146,7 @@ object ReadBook : CoroutineScope by MainScope() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun upReadTime() {
|
fun upReadTime() {
|
||||||
Coroutine.async {
|
Coroutine.async(executeContext = IO) {
|
||||||
readRecord.readTime = readRecord.readTime + System.currentTimeMillis() - readStartTime
|
readRecord.readTime = readRecord.readTime + System.currentTimeMillis() - readStartTime
|
||||||
readStartTime = System.currentTimeMillis()
|
readStartTime = System.currentTimeMillis()
|
||||||
readRecord.lastRead = System.currentTimeMillis()
|
readRecord.lastRead = System.currentTimeMillis()
|
||||||
@@ -537,7 +537,7 @@ object ReadBook : CoroutineScope by MainScope() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
preDownloadTask?.cancel()
|
preDownloadTask?.cancel()
|
||||||
preDownloadTask = Coroutine.async {
|
preDownloadTask = Coroutine.async(executeContext = IO) {
|
||||||
//预下载
|
//预下载
|
||||||
launch {
|
launch {
|
||||||
val maxChapterIndex = min(durChapterIndex + AppConfig.preDownloadNum, chapterSize)
|
val maxChapterIndex = min(durChapterIndex + AppConfig.preDownloadNum, chapterSize)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class NetworkChangedListener(private val context: Context) {
|
|||||||
return@lazy null
|
return@lazy null
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission", "UnspecifiedRegisterReceiverFlag")
|
||||||
fun register() {
|
fun register() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
networkCallback?.let {
|
networkCallback?.let {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package io.legado.app.receiver
|
package io.legado.app.receiver
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@@ -19,6 +20,7 @@ class SharedReceiverActivity : AppCompatActivity() {
|
|||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ObsoleteSdkInt")
|
||||||
private fun initIntent() {
|
private fun initIntent() {
|
||||||
when {
|
when {
|
||||||
intent.action == Intent.ACTION_SEND && intent.type == receivingType -> {
|
intent.action == Intent.ACTION_SEND && intent.type == receivingType -> {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
|
|
||||||
private fun upCoverByRule(book: Book) {
|
private fun upCoverByRule(book: Book) {
|
||||||
execute {
|
execute {
|
||||||
if (book.customCoverUrl.isNullOrBlank()) {
|
if (book.coverUrl.isNullOrBlank() && book.customCoverUrl.isNullOrBlank()) {
|
||||||
BookCover.searchCover(book)?.let { coverUrl ->
|
BookCover.searchCover(book)?.let { coverUrl ->
|
||||||
book.customCoverUrl = coverUrl
|
book.customCoverUrl = coverUrl
|
||||||
bookData.postValue(book)
|
bookData.postValue(book)
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
binding.readView.upStatusBar()
|
binding.readView.upStatusBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
ReadBook.readStartTime = System.currentTimeMillis()
|
ReadBook.readStartTime = System.currentTimeMillis()
|
||||||
@@ -1118,8 +1119,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.onError {
|
}.onError {
|
||||||
AppLog.putDebug(it.localizedMessage)
|
AppLog.put("执行购买操作出错\n${it.localizedMessage}", it, true)
|
||||||
toastOnUi(it.localizedMessage)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
noButton()
|
noButton()
|
||||||
@@ -1153,6 +1153,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
ReadAloud.resume(this)
|
ReadAloud.resume(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> ReadAloud.pause(this)
|
else -> ReadAloud.pause(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user