Fix RegionBitmapDecode usage
This commit is contained in:
@@ -28,7 +28,6 @@ import org.koitharu.kotatsu.BuildConfig
|
||||
import org.koitharu.kotatsu.browser.cloudflare.CaptchaNotifier
|
||||
import org.koitharu.kotatsu.core.db.MangaDatabase
|
||||
import org.koitharu.kotatsu.core.image.AvifImageDecoder
|
||||
import org.koitharu.kotatsu.core.image.RegionBitmapDecoder
|
||||
import org.koitharu.kotatsu.core.network.MangaHttpClient
|
||||
import org.koitharu.kotatsu.core.network.imageproxy.ImageProxyInterceptor
|
||||
import org.koitharu.kotatsu.core.os.AppShortcutManager
|
||||
@@ -82,9 +81,7 @@ interface AppModule {
|
||||
@Singleton
|
||||
fun provideMangaDatabase(
|
||||
@ApplicationContext context: Context,
|
||||
): MangaDatabase {
|
||||
return MangaDatabase(context)
|
||||
}
|
||||
): MangaDatabase = MangaDatabase(context)
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@@ -122,7 +119,6 @@ interface AppModule {
|
||||
.add(SvgDecoder.Factory())
|
||||
.add(CbzFetcher.Factory())
|
||||
.add(AvifImageDecoder.Factory())
|
||||
.add(RegionBitmapDecoder.Factory())
|
||||
.add(FaviconFetcher.Factory(context, okHttpClientLazy, mangaRepositoryFactory))
|
||||
.add(MangaPageKeyer())
|
||||
.add(pageFetcherFactory)
|
||||
|
||||
@@ -129,7 +129,7 @@ class RegionBitmapDecoder(
|
||||
inPreferredConfig = config
|
||||
}
|
||||
|
||||
class Factory : Decoder.Factory {
|
||||
object Factory : Decoder.Factory {
|
||||
|
||||
private val parallelismLock = Semaphore(DEFAULT_PARALLELISM)
|
||||
|
||||
@@ -137,11 +137,7 @@ class RegionBitmapDecoder(
|
||||
result: SourceResult,
|
||||
options: Options,
|
||||
imageLoader: ImageLoader
|
||||
): Decoder? = if (options.parameters.value<Boolean>(PARAM_REGION) == true) {
|
||||
RegionBitmapDecoder(result.source, options, parallelismLock)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
): Decoder = RegionBitmapDecoder(result.source, options, parallelismLock)
|
||||
|
||||
override fun equals(other: Any?) = other is Factory
|
||||
|
||||
@@ -151,7 +147,6 @@ class RegionBitmapDecoder(
|
||||
companion object {
|
||||
|
||||
const val PARAM_SCROLL = "scroll"
|
||||
const val PARAM_REGION = "region"
|
||||
const val SCROLL_UNDEFINED = -1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ fun ImageRequest.Builder.indicator(indicators: List<BaseProgressIndicator<*>>):
|
||||
|
||||
fun ImageRequest.Builder.decodeRegion(
|
||||
scroll: Int = RegionBitmapDecoder.SCROLL_UNDEFINED,
|
||||
): ImageRequest.Builder = setParameter(RegionBitmapDecoder.PARAM_REGION, true)
|
||||
): ImageRequest.Builder = decoderFactory(RegionBitmapDecoder.Factory)
|
||||
.setParameter(RegionBitmapDecoder.PARAM_SCROLL, scroll)
|
||||
|
||||
@Suppress("SpellCheckingInspection")
|
||||
|
||||
Reference in New Issue
Block a user