Merge remote-tracking branch 'origin/master'

pull/2729/head
kunfei 2 years ago
commit f315265309
  1. 5
      app/src/main/java/io/legado/app/ui/association/VerificationCodeDialog.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt

@ -103,8 +103,9 @@ class VerificationCodeDialog() : BaseDialogFragment(R.layout.dialog_verification
transition: Transition<in Bitmap>? transition: Transition<in Bitmap>?
) { ) {
view ?: return view ?: return
ImageProvider.bitmapLruCache.put(url, resource) val bitmap = resource.copy(resource.config, true)
binding.verificationCodeImageView.setImageBitmap(resource) ImageProvider.bitmapLruCache.put(url, bitmap)
binding.verificationCodeImageView.setImageBitmap(bitmap)
} }
override fun onLoadCleared(placeholder: Drawable?) { override fun onLoadCleared(placeholder: Drawable?) {

@ -280,7 +280,8 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
exportProgress.remove(book.bookUrl) exportProgress.remove(book.bookUrl)
exportMsg[book.bookUrl] = it.localizedMessage ?: "ERROR" exportMsg[book.bookUrl] = it.localizedMessage ?: "ERROR"
upAdapterLiveData.postValue(book.bookUrl) upAdapterLiveData.postValue(book.bookUrl)
it.printOnDebug() it.printStackTrace()
AppLog.put("导出epub书籍<${book.name}>出错\n${it.localizedMessage}", it)
}.onSuccess { }.onSuccess {
exportProgress.remove(book.bookUrl) exportProgress.remove(book.bookUrl)
exportMsg[book.bookUrl] = context.getString(R.string.export_success) exportMsg[book.bookUrl] = context.getString(R.string.export_success)
@ -482,7 +483,6 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
val stream = ByteArrayOutputStream() val stream = ByteArrayOutputStream()
resource.compress(Bitmap.CompressFormat.JPEG, 100, stream) resource.compress(Bitmap.CompressFormat.JPEG, 100, stream)
val byteArray: ByteArray = stream.toByteArray() val byteArray: ByteArray = stream.toByteArray()
resource.recycle()
stream.close() stream.close()
epubBook.coverImage = Resource(byteArray, "Images/cover.jpg") epubBook.coverImage = Resource(byteArray, "Images/cover.jpg")
} }

Loading…
Cancel
Save