Rename Duplicates sensitivity to Tolerance and move it to the translatable resources
This commit is contained in:
parent
c22595537e
commit
9df9b68d4c
|
@ -2,18 +2,36 @@ package com.artemchep.keyguard.common.usecase
|
|||
|
||||
import com.artemchep.keyguard.common.model.DSecret
|
||||
import com.artemchep.keyguard.common.model.DSecretDuplicateGroup
|
||||
import com.artemchep.keyguard.res.Res
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
interface CipherDuplicatesCheck :
|
||||
(List<DSecret>, CipherDuplicatesCheck.Sensitivity) -> List<DSecretDuplicateGroup> {
|
||||
@Serializable
|
||||
enum class Sensitivity(
|
||||
val title: StringResource,
|
||||
val threshold: Float,
|
||||
) {
|
||||
MAX(0.3f),
|
||||
HIGH(0.15f),
|
||||
NORMAL(0f),
|
||||
LOW(-0.1f),
|
||||
MIN(-0.15f),
|
||||
MAX(
|
||||
title = Res.strings.tolerance_min,
|
||||
threshold = 0.3f,
|
||||
),
|
||||
HIGH(
|
||||
title = Res.strings.tolerance_low,
|
||||
threshold = 0.15f,
|
||||
),
|
||||
NORMAL(
|
||||
title = Res.strings.tolerance_normal,
|
||||
threshold = 0f,
|
||||
),
|
||||
LOW(
|
||||
title = Res.strings.tolerance_high,
|
||||
threshold = -0.1f,
|
||||
),
|
||||
MIN(
|
||||
title = Res.strings.tolerance_max,
|
||||
threshold = -0.15f,
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ import androidx.compose.foundation.layout.width
|
|||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material.ExperimentalMaterialApi
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.outlined.EdgesensorHigh
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.LocalContentColor
|
||||
|
@ -127,25 +130,24 @@ fun DuplicatesListScreen(
|
|||
mutableStateOf(false)
|
||||
}
|
||||
|
||||
val normalContentColor = LocalContentColor.current
|
||||
TextButton(
|
||||
onClick = {
|
||||
isAutofillWindowShowing = true
|
||||
},
|
||||
) {
|
||||
Column {
|
||||
Text(text = "Sensitivity")
|
||||
val textOrNull =
|
||||
loadableState.getOrNull()?.sensitivity?.name
|
||||
?.lowercase()
|
||||
?.capitalize()
|
||||
Text(
|
||||
text = stringResource(Res.strings.tolerance),
|
||||
)
|
||||
val textResOrNull =
|
||||
loadableState.getOrNull()?.sensitivity?.title
|
||||
ExpandedIfNotEmpty(
|
||||
valueOrNull = textOrNull,
|
||||
) { text ->
|
||||
valueOrNull = textResOrNull,
|
||||
) { textRes ->
|
||||
Text(
|
||||
text = text,
|
||||
text = stringResource(textRes),
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = normalContentColor
|
||||
color = LocalContentColor.current
|
||||
.combineAlpha(MediumEmphasisAlpha),
|
||||
)
|
||||
}
|
||||
|
|
|
@ -349,9 +349,7 @@ fun produceDuplicatesListState(
|
|||
.entries
|
||||
.map { s ->
|
||||
FlatItemAction(
|
||||
title = s.name
|
||||
.lowercase()
|
||||
.capitalize(),
|
||||
title = translate(s.title),
|
||||
onClick = {
|
||||
sensitivitySink.value = s
|
||||
},
|
||||
|
|
|
@ -370,6 +370,13 @@
|
|||
<string name="november">November</string>
|
||||
<string name="december">December</string>
|
||||
|
||||
<string name="tolerance">Tolerance</string>
|
||||
<string name="tolerance_min">Min</string>
|
||||
<string name="tolerance_low">Low</string>
|
||||
<string name="tolerance_normal">Normal</string>
|
||||
<string name="tolerance_high">High</string>
|
||||
<string name="tolerance_max">Max</string>
|
||||
|
||||
<string name="list_move_up">Move up</string>
|
||||
<string name="list_move_down">Move down</string>
|
||||
<string name="list_remove">Remove</string>
|
||||
|
|
Loading…
Reference in New Issue