Horis 1 سال پیش
والد
کامیت
1d3dfd2da1

+ 5 - 4
app/src/main/java/io/legado/app/service/AudioPlayService.kt

@@ -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
-            upMediaMetadata()
-            upAudioPlayNotification()
+            if (it.width > 16 && it.height > 16) {
+                cover = it
+                upMediaMetadata()
+                upAudioPlayNotification()
+            }
         }
         }
     }
     }
 
 

+ 4 - 3
app/src/main/java/io/legado/app/service/BaseReadAloudService.kt

@@ -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
-            upReadAloudNotification()
+            if (it.width > 16 && it.height > 16) {
+                cover = it
+                upReadAloudNotification()
+            }
         }
         }
     }
     }
 
 

+ 0 - 1
app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@@ -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

+ 1 - 1
app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfViewModel.kt

@@ -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"] ?: ""