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