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