优化
This commit is contained in:
@@ -127,15 +127,16 @@ class AudioPlayService : BaseService(),
|
||||
upMediaSessionPlaybackState(PlaybackStateCompat.STATE_PLAYING)
|
||||
doDs()
|
||||
execute {
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
ImageLoader
|
||||
.loadBitmap(this@AudioPlayService, AudioPlay.book?.getDisplayCover())
|
||||
.submit()
|
||||
.get()
|
||||
}.onSuccess {
|
||||
cover = it
|
||||
upMediaMetadata()
|
||||
upAudioPlayNotification()
|
||||
if (it.width > 16 && it.height > 16) {
|
||||
cover = it
|
||||
upMediaMetadata()
|
||||
upAudioPlayNotification()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -156,14 +156,15 @@ abstract class BaseReadAloudService : BaseService(),
|
||||
toastOnUi("朗读定时 ${AppConfig.ttsTimer} 分钟")
|
||||
}
|
||||
execute {
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
ImageLoader
|
||||
.loadBitmap(this@BaseReadAloudService, ReadBook.book?.getDisplayCover())
|
||||
.submit()
|
||||
.get()
|
||||
}.onSuccess {
|
||||
cover = it
|
||||
upReadAloudNotification()
|
||||
if (it.width > 16 && it.height > 16) {
|
||||
cover = it
|
||||
upReadAloudNotification()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -500,7 +500,6 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
||||
/**
|
||||
* 保存图片
|
||||
*/
|
||||
@Suppress("BlockingMethodInNonBlockingContext")
|
||||
fun saveImage(src: String?, uri: Uri) {
|
||||
src ?: return
|
||||
val book = ReadBook.book ?: return
|
||||
|
||||
@@ -156,7 +156,7 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application)
|
||||
private fun importBookshelfByJson(json: String, groupId: Long) {
|
||||
execute {
|
||||
val bookSourceParts = appDb.bookSourceDao.allEnabledPart
|
||||
val semaphore = Semaphore(AppConfig.threadCount + 1)
|
||||
val semaphore = Semaphore(AppConfig.threadCount)
|
||||
GSON.fromJsonArray<Map<String, String?>>(json).getOrThrow().forEach { bookInfo ->
|
||||
val name = bookInfo["name"] ?: ""
|
||||
val author = bookInfo["author"] ?: ""
|
||||
|
||||
Reference in New Issue
Block a user