perf(editor): 优化优先级文字获取性能
This commit is contained in:
parent
9f9485f274
commit
5c6ac565a3
1 changed files with 3 additions and 4 deletions
|
|
@ -24,7 +24,6 @@ import androidx.compose.material.icons.automirrored.outlined.Undo
|
||||||
import androidx.compose.material.icons.outlined.Delete
|
import androidx.compose.material.icons.outlined.Delete
|
||||||
import androidx.compose.material.icons.outlined.Save
|
import androidx.compose.material.icons.outlined.Save
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.material3.Icon
|
|
||||||
import androidx.compose.material3.Label
|
import androidx.compose.material3.Label
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.PlainTooltip
|
import androidx.compose.material3.PlainTooltip
|
||||||
|
|
@ -207,8 +206,8 @@ fun TodoEditorPage(
|
||||||
|
|
||||||
Spacer(Modifier.size(5.dp))
|
Spacer(Modifier.size(5.dp))
|
||||||
|
|
||||||
|
val priorityName = Priority.entries.map { it.getDisplayName(context) } // 要不要用 remember 呢
|
||||||
val interactionSource = remember { MutableInteractionSource() }
|
val interactionSource = remember { MutableInteractionSource() }
|
||||||
|
|
||||||
Slider(
|
Slider(
|
||||||
modifier = Modifier.semantics {
|
modifier = Modifier.semantics {
|
||||||
contentDescription = context.getString(R.string.label_priority)
|
contentDescription = context.getString(R.string.label_priority)
|
||||||
|
|
@ -218,7 +217,7 @@ fun TodoEditorPage(
|
||||||
VibrationUtils.performHapticFeedback(view, HapticFeedbackConstants.LONG_PRESS)
|
VibrationUtils.performHapticFeedback(view, HapticFeedbackConstants.LONG_PRESS)
|
||||||
priorityState = it
|
priorityState = it
|
||||||
},
|
},
|
||||||
valueRange = -10f..10f,
|
valueRange = -2f..2f,
|
||||||
steps = 3,
|
steps = 3,
|
||||||
interactionSource = interactionSource,
|
interactionSource = interactionSource,
|
||||||
thumb = {
|
thumb = {
|
||||||
|
|
@ -229,7 +228,7 @@ fun TodoEditorPage(
|
||||||
.sizeIn(45.dp, 25.dp)
|
.sizeIn(45.dp, 25.dp)
|
||||||
.wrapContentWidth()
|
.wrapContentWidth()
|
||||||
) {
|
) {
|
||||||
Text(Priority.fromFloat(priorityState).getDisplayName(context))
|
Text(priorityName[Priority.fromFloat(priorityState).ordinal])
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
interactionSource = interactionSource
|
interactionSource = interactionSource
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue