|
|
@ -1,5 +1,6 @@ |
|
|
|
package io.legado.app.api.controller |
|
|
|
package io.legado.app.api.controller |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.core.graphics.drawable.toBitmap |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.api.ReturnData |
|
|
|
import io.legado.app.api.ReturnData |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
@ -43,11 +44,12 @@ object BookController { |
|
|
|
fun getCover(parameters: Map<String, List<String>>): ReturnData { |
|
|
|
fun getCover(parameters: Map<String, List<String>>): ReturnData { |
|
|
|
val returnData = ReturnData() |
|
|
|
val returnData = ReturnData() |
|
|
|
val coverPath = parameters["path"]?.firstOrNull() |
|
|
|
val coverPath = parameters["path"]?.firstOrNull() |
|
|
|
val ftBitmap = ImageLoader.loadBitmap(appCtx, coverPath) |
|
|
|
val ftBitmap = ImageLoader.loadBitmap(appCtx, coverPath).submit() |
|
|
|
.placeholder(CoverImageView.defaultDrawable) |
|
|
|
return try { |
|
|
|
.error(CoverImageView.defaultDrawable) |
|
|
|
returnData.setData(ftBitmap.get()) |
|
|
|
.submit() |
|
|
|
} catch (e: Exception) { |
|
|
|
return returnData.setData(ftBitmap.get()) |
|
|
|
returnData.setData(CoverImageView.defaultDrawable.toBitmap()) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|