Fix jxl loading

This commit is contained in:
T8RIN
2024-11-16 02:52:58 +03:00
parent 897f7fb9b3
commit d0d97df39c
3 changed files with 17 additions and 15 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@
/.idea
/libs/nQuant/build
/.kotlin/errors/
/.kotlin

View File

@ -71,6 +71,7 @@ import ru.tech.imageresizershrinker.core.ui.widget.modifier.container
import ru.tech.imageresizershrinker.core.ui.widget.modifier.fadingEdges
import ru.tech.imageresizershrinker.core.ui.widget.text.AutoSizeText
import ru.tech.imageresizershrinker.core.ui.widget.text.TitleItem
import kotlin.math.roundToInt
@Composable
fun QualitySelector(
@ -139,10 +140,10 @@ fun QualitySelector(
stringResource(R.string.quality)
} else stringResource(R.string.effort),
icon = if (isQuality) currentIcon else Icons.Rounded.Stream,
valueRange = type.compressionRange.let { it.first.toFloat()..it.last.toFloat() },
steps = type.compressionRange.let { it.last - it.first - 1 },
valueRange = type.compressionRange.let { it.first.toFloat()..it.endInclusive.toFloat() },
steps = type.compressionRange.let { it.endInclusive - it.first - 1 },
internalStateTransformation = {
it.toInt().coerceIn(type.compressionRange).toFloat()
it.roundToInt().coerceIn(type.compressionRange).toFloat()
},
onValueChange = {
when (type) {
@ -181,7 +182,7 @@ fun QualitySelector(
text = stringResource(
R.string.effort_sub,
type.compressionRange.first,
type.compressionRange.last
type.compressionRange.endInclusive
),
fontSize = 12.sp,
textAlign = TextAlign.Center,
@ -208,11 +209,11 @@ fun QualitySelector(
valueRange = 0f..4f,
steps = 3,
internalStateTransformation = {
it.toInt().coerceIn(0..4).toFloat()
it.roundToInt().coerceIn(0..4).toFloat()
},
onValueChange = {
jxlQuality?.copy(
speed = it.toInt()
speed = it.roundToInt()
)?.coerceIn(imageFormat)?.let(onQualityChange)
},
behaveAsContainer = false
@ -275,11 +276,11 @@ fun QualitySelector(
icon = Icons.Outlined.ColorLens,
valueRange = 2f..1024f,
internalStateTransformation = {
it.toInt().coerceIn(2..1024).toFloat()
it.roundToInt().coerceIn(2..1024).toFloat()
},
onValueChange = {
pngLossyQuality?.copy(
maxColors = it.toInt()
maxColors = it.roundToInt()
)?.coerceIn(imageFormat)?.let(onQualityChange)
},
behaveAsContainer = false
@ -365,11 +366,11 @@ fun QualitySelector(
valueRange = 0f..51f,
steps = 50,
internalStateTransformation = {
it.toInt().coerceIn(0..51).toFloat()
it.roundToInt().coerceIn(0..51).toFloat()
},
onValueChange = {
heicQuality?.copy(
constantRateFactor = it.toInt()
constantRateFactor = it.roundToInt()
)?.coerceIn(imageFormat)?.let(onQualityChange)
},
behaveAsContainer = false

View File

@ -3,8 +3,8 @@ androidMinSdk = "21"
androidTargetSdk = "35"
androidCompileSdk = "35"
versionName = "3.1.0-rc01"
versionCode = "156"
versionName = "3.1.0-rc02"
versionCode = "157"
jvmTarget = "17"
@ -14,8 +14,8 @@ trickle = "1.2.2"
avifCoder = "2.0.8"
avifCoderCoil = "2.0.8"
aire = "0.15.4"
jxlCoder = "2.4.0.1"
jxlCoderCoil = "2.4.0.1"
jxlCoder = "2.4.0.4"
jxlCoderCoil = "2.4.0.4"
jpegliCoder = "1.0.1"
tesseract = "4.7.0"
@ -45,7 +45,7 @@ hilt = "2.52"
gms = "4.4.2"
ktor = "3.0.1"
coil = "3.0.2"
coil = "3.0.3"
appCompat = "1.7.0"
androidxCore = "1.15.0"
androidxLifecycle = "2.9.0-alpha07"