mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-18 13:22:03 +00:00
confirm color in color picker dialog on done, fixes GH-1443
This commit is contained in:
parent
a3fcce26a7
commit
525c4e59b6
1 changed files with 8 additions and 2 deletions
|
@ -7,6 +7,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
|
@ -24,6 +25,7 @@ import androidx.compose.ui.graphics.PaintingStyle
|
|||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.text.TextRange
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
@ -109,8 +111,12 @@ fun ColorPickerDialog(
|
|||
)
|
||||
TextField(
|
||||
value = textValue,
|
||||
// todo: KeyboardType.Password is a crappy way of avoiding suggestions... is there really no way in compose?
|
||||
keyboardOptions = KeyboardOptions(autoCorrectEnabled = false, keyboardType = KeyboardType.Password),
|
||||
keyboardOptions = KeyboardOptions(
|
||||
autoCorrectEnabled = false,
|
||||
keyboardType = KeyboardType.Password, // todo: KeyboardType.Password is a crappy way of avoiding suggestions... is there really no way in compose?
|
||||
imeAction = ImeAction.Done,
|
||||
),
|
||||
keyboardActions = KeyboardActions(onDone = { onDismissRequest(); onConfirmed(controller.selectedColor.value.toArgb()) }),
|
||||
onValueChange = {
|
||||
textValue = it
|
||||
val androidColor = runCatching { android.graphics.Color.parseColor("#${it.text}") }.getOrNull()
|
||||
|
|
Loading…
Add table
Reference in a new issue