Allow using RGB_565 on API < 26
And increase PageLoader cache size on API 26+
This commit is contained in:
1 parent
53b3190bbf
commit
d57983032e
2 files changed
+5
-2
No files matched your search
@@ -33,6 +33,7 @@ import coil3.network.NetworkFetcher
|
||||
import coil3.network.ktor3.asNetworkClient
|
||||
import coil3.request.ErrorResult
|
||||
import coil3.request.ImageRequest
|
||||
import coil3.request.allowRgb565
|
||||
import coil3.request.crossfade
|
||||
import coil3.serviceLoaderEnabled
|
||||
import coil3.util.DebugLogger
|
||||
@@ -173,6 +174,8 @@ class EhApplication :
|
||||
add(DownloadThumbInterceptor)
|
||||
if (isAtLeastO) {
|
||||
add(HardwareBitmapInterceptor)
|
||||
} else {
|
||||
allowRgb565(true)
|
||||
}
|
||||
add(CropBorderInterceptor)
|
||||
add(DetectBorderInterceptor)
|
||||
|
||||
@@ -30,7 +30,7 @@ import okio.Path
|
||||
|
||||
private val progressScope = CoroutineScope(Dispatchers.IO)
|
||||
private const val MAX_CACHE_SIZE = 512 * 1024 * 1024
|
||||
private const val MIN_CACHE_SIZE = 128 * 1024 * 1024
|
||||
private const val MIN_CACHE_SIZE = 256 * 1024 * 1024
|
||||
|
||||
context(CoroutineScope)
|
||||
abstract class PageLoader(val gid: Long, var startPage: Int, val size: Int, val hasAds: Boolean = false) : AutoCloseable {
|
||||
@@ -39,7 +39,7 @@ abstract class PageLoader(val gid: Long, var startPage: Int, val size: Int, val
|
||||
|
||||
private val cache = SieveCache<Int, Image>(
|
||||
maxSize = if (isAtLeastO) {
|
||||
(OSUtils.totalMemory / 16).toInt().coerceIn(MIN_CACHE_SIZE, MAX_CACHE_SIZE)
|
||||
(OSUtils.totalMemory / 8).toInt().coerceIn(MIN_CACHE_SIZE, MAX_CACHE_SIZE)
|
||||
} else {
|
||||
(OSUtils.appMaxMemory / 3 * 2).toInt()
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user