|
|
@ -63,11 +63,6 @@ object BookCover { |
|
|
|
}.getOrDefault(appCtx.resources.getDrawable(R.drawable.image_cover_default, null)) |
|
|
|
}.getOrDefault(appCtx.resources.getDrawable(R.drawable.image_cover_default, null)) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun getBlurDefaultCover(context: Context): RequestBuilder<Drawable> { |
|
|
|
|
|
|
|
return ImageLoader.load(context, defaultDrawable) |
|
|
|
|
|
|
|
.apply(RequestOptions.bitmapTransform(BlurTransformation(context, 25))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun load( |
|
|
|
fun load( |
|
|
|
context: Context, |
|
|
|
context: Context, |
|
|
|
path: String?, |
|
|
|
path: String?, |
|
|
@ -90,16 +85,18 @@ object BookCover { |
|
|
|
path: String?, |
|
|
|
path: String?, |
|
|
|
loadOnlyWifi: Boolean = false |
|
|
|
loadOnlyWifi: Boolean = false |
|
|
|
): RequestBuilder<Drawable> { |
|
|
|
): RequestBuilder<Drawable> { |
|
|
|
|
|
|
|
val loadBlur = ImageLoader.load(context, defaultDrawable) |
|
|
|
|
|
|
|
.apply(RequestOptions.bitmapTransform(BlurTransformation(context, 25))) |
|
|
|
return if (AppConfig.useDefaultCover) { |
|
|
|
return if (AppConfig.useDefaultCover) { |
|
|
|
getBlurDefaultCover(context) |
|
|
|
loadBlur.centerCrop() |
|
|
|
.centerCrop() |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
val options = RequestOptions().set(OkHttpModelLoader.loadOnlyWifiOption, loadOnlyWifi) |
|
|
|
val options = RequestOptions().set(OkHttpModelLoader.loadOnlyWifiOption, loadOnlyWifi) |
|
|
|
ImageLoader.load(context, path) |
|
|
|
ImageLoader.load(context, path) |
|
|
|
.apply(options) |
|
|
|
.apply(options) |
|
|
|
.transition(DrawableTransitionOptions.withCrossFade(1500)) |
|
|
|
.transition(DrawableTransitionOptions.withCrossFade(1500)) |
|
|
|
.thumbnail(getBlurDefaultCover(context)) |
|
|
|
.thumbnail(loadBlur) |
|
|
|
.apply(RequestOptions.bitmapTransform(BlurTransformation(context, 25))) |
|
|
|
.apply(RequestOptions.bitmapTransform(BlurTransformation(context, 25))) |
|
|
|
|
|
|
|
.centerCrop() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|