mirror of
https://github.com/mihonapp/mihon.git
synced 2025-05-19 17:15:31 +02:00
Hide Hardware Bitmap Threshold setting if unusable
This hides the setting from the UI if the user's device in on Coil's list of devices with problematic hardware bitmap implementations. Also moved HARDWARE_BITMAP_UNSUPPORTED into the ImageUtil as a property for more ergonomic access across the project.
This commit is contained in:
parent
533b2d0b26
commit
27099b77d3
@ -62,6 +62,7 @@ import logcat.LogPriority
|
||||
import okhttp3.Headers
|
||||
import tachiyomi.core.common.util.lang.launchNonCancellable
|
||||
import tachiyomi.core.common.util.lang.withUIContext
|
||||
import tachiyomi.core.common.util.system.ImageUtil
|
||||
import tachiyomi.core.common.util.system.logcat
|
||||
import tachiyomi.domain.manga.interactor.ResetViewerFlags
|
||||
import tachiyomi.i18n.MR
|
||||
@ -341,7 +342,8 @@ object SettingsAdvancedScreen : SearchableSettings {
|
||||
subtitleProvider = { value, options ->
|
||||
stringResource(MR.strings.pref_hardware_bitmap_threshold_summary, options[value].orEmpty())
|
||||
},
|
||||
enabled = GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT,
|
||||
enabled = ImageUtil.HARDWARE_BITMAP_UNSUPPORTED ||
|
||||
GLUtil.DEVICE_TEXTURE_LIMIT > GLUtil.SAFE_TEXTURE_LIMIT,
|
||||
entries = GLUtil.CUSTOM_TEXTURE_LIMIT_OPTIONS
|
||||
.mapIndexed { index, option ->
|
||||
val display = if (index == 0) {
|
||||
|
@ -573,10 +573,6 @@ object ImageUtil {
|
||||
}
|
||||
|
||||
private val optimalImageHeight = getDisplayMaxHeightInPx * 2
|
||||
}
|
||||
|
||||
val getDisplayMaxHeightInPx: Int
|
||||
get() = Resources.getSystem().displayMetrics.let { max(it.heightPixels, it.widthPixels) }
|
||||
|
||||
/**
|
||||
* Taken from Coil
|
||||
@ -588,7 +584,7 @@ val getDisplayMaxHeightInPx: Int
|
||||
* [Google's official device list](https://support.google.com/googleplay/answer/1727131?hl=en).
|
||||
*
|
||||
*/
|
||||
private val HARDWARE_BITMAP_UNSUPPORTED = when (Build.VERSION.SDK_INT) {
|
||||
val HARDWARE_BITMAP_UNSUPPORTED = when (Build.VERSION.SDK_INT) {
|
||||
26 -> run {
|
||||
val model = Build.MODEL ?: return@run false
|
||||
|
||||
@ -692,3 +688,7 @@ private val HARDWARE_BITMAP_UNSUPPORTED = when (Build.VERSION.SDK_INT) {
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
val getDisplayMaxHeightInPx: Int
|
||||
get() = Resources.getSystem().displayMetrics.let { max(it.heightPixels, it.widthPixels) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user