mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-19 05:39:10 +00:00
make text fields follow content language direction
This commit is contained in:
parent
0847bac3d5
commit
f06521c8ec
7 changed files with 19 additions and 4 deletions
|
@ -25,6 +25,8 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.graphics.asImageBitmap
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.style.TextDirection
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.drawable.toBitmap
|
||||
|
@ -90,3 +92,5 @@ fun <T>DropDownField(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
val contentTextDirectionStyle = TextStyle(textDirection = TextDirection.Content)
|
||||
|
|
|
@ -227,7 +227,8 @@ fun ExpandableSearchField(
|
|||
else onSearchChange(TextFieldValue())
|
||||
}) { CloseIcon(android.R.string.cancel) } },
|
||||
singleLine = true,
|
||||
colors = colors
|
||||
colors = colors,
|
||||
textStyle = contentTextDirectionStyle
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ import helium314.keyboard.settings.Theme
|
|||
import helium314.keyboard.settings.filePicker
|
||||
import helium314.keyboard.settings.previewDark
|
||||
import helium314.keyboard.settings.screens.SaveThoseColors
|
||||
import helium314.keyboard.settings.contentTextDirectionStyle
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.serialization.SerializationException
|
||||
import kotlinx.serialization.json.Json
|
||||
|
@ -187,7 +188,8 @@ private fun AddColorRow(onDismissRequest: () -> Unit, userColors: Collection<Str
|
|||
onValueChange = { textValue = it },
|
||||
modifier = Modifier.weight(1f),
|
||||
singleLine = true,
|
||||
label = label
|
||||
label = label,
|
||||
textStyle = contentTextDirectionStyle,
|
||||
)
|
||||
EditButton(currentName.isNotBlank() && currentName !in userColors) {
|
||||
onDismissRequest()
|
||||
|
|
|
@ -29,6 +29,7 @@ import helium314.keyboard.latin.utils.getStringResourceOrName
|
|||
import helium314.keyboard.settings.CloseIcon
|
||||
import helium314.keyboard.settings.SettingsActivity
|
||||
import helium314.keyboard.settings.Theme
|
||||
import helium314.keyboard.settings.contentTextDirectionStyle
|
||||
import helium314.keyboard.settings.initPreview
|
||||
import helium314.keyboard.settings.previewDark
|
||||
import kotlinx.coroutines.Job
|
||||
|
@ -92,6 +93,7 @@ fun LayoutEditDialog(
|
|||
isError = !nameValid,
|
||||
supportingText = { if (!nameValid) Text(stringResource(R.string.name_invalid)) },
|
||||
trailingIcon = { if (!nameValid) CloseIcon(R.string.name_invalid) },
|
||||
textStyle = contentTextDirectionStyle,
|
||||
)
|
||||
},
|
||||
checkTextValid = { text ->
|
||||
|
|
|
@ -50,6 +50,7 @@ import helium314.keyboard.settings.EditButton
|
|||
import helium314.keyboard.settings.Setting
|
||||
import helium314.keyboard.settings.SettingsActivity
|
||||
import helium314.keyboard.settings.Theme
|
||||
import helium314.keyboard.settings.contentTextDirectionStyle
|
||||
import helium314.keyboard.settings.layoutFilePicker
|
||||
import helium314.keyboard.settings.layoutIntent
|
||||
import helium314.keyboard.settings.previewDark
|
||||
|
@ -140,7 +141,8 @@ private fun AddLayoutRow(onNewLayout: (String) -> Unit, layoutType: LayoutType,
|
|||
value = textValue,
|
||||
onValueChange = { textValue = it },
|
||||
modifier = Modifier.weight(1f),
|
||||
singleLine = true
|
||||
singleLine = true,
|
||||
textStyle = contentTextDirectionStyle,
|
||||
)
|
||||
EditButton(textValue.text.isNotEmpty() && LayoutUtilsCustom.getLayoutName(textValue.text, layoutType) !in userLayouts) {
|
||||
onNewLayout(textValue.text)
|
||||
|
|
|
@ -22,6 +22,7 @@ import androidx.compose.ui.text.input.TextFieldValue
|
|||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.window.DialogProperties
|
||||
import helium314.keyboard.settings.Theme
|
||||
import helium314.keyboard.settings.contentTextDirectionStyle
|
||||
import helium314.keyboard.settings.previewDark
|
||||
|
||||
// mostly taken from StreetComplete / SCEE
|
||||
|
@ -76,7 +77,8 @@ fun TextInputDialog(
|
|||
.focusRequester(focusRequester),
|
||||
label = textInputLabel,
|
||||
keyboardOptions = KeyboardOptions(keyboardType = keyboardType),
|
||||
singleLine = singleLine
|
||||
singleLine = singleLine,
|
||||
textStyle = contentTextDirectionStyle,
|
||||
)
|
||||
},
|
||||
properties = properties,
|
||||
|
|
|
@ -58,6 +58,7 @@ import helium314.keyboard.settings.CloseIcon
|
|||
import helium314.keyboard.settings.SearchScreen
|
||||
import helium314.keyboard.settings.SettingsActivity
|
||||
import helium314.keyboard.settings.Theme
|
||||
import helium314.keyboard.settings.contentTextDirectionStyle
|
||||
import helium314.keyboard.settings.dialogs.ColorPickerDialog
|
||||
import helium314.keyboard.settings.previewDark
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -137,6 +138,7 @@ fun ColorsScreen(
|
|||
// supportingText = { if (!nameValid) Text(stringResource(R.string.name_invalid)) } // todo: this is cutting off bottom half of the actual text...
|
||||
trailingIcon = { if (!nameValid) CloseIcon(R.string.name_invalid) },
|
||||
singleLine = true,
|
||||
textStyle = contentTextDirectionStyle,
|
||||
)
|
||||
},
|
||||
menu = listOf(
|
||||
|
|
Loading…
Add table
Reference in a new issue