mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-09 16:17:44 +00:00
Slightly adjust the dictionary dialog (#1656)
This commit is contained in:
parent
97aec851e4
commit
0787a79de4
2 changed files with 19 additions and 6 deletions
|
@ -86,7 +86,6 @@ fun MissingDictionaryDialog(onDismissRequest: () -> Unit, locale: Locale) {
|
|||
fun createDictionaryTextAnnotated(locale: Locale): AnnotatedString {
|
||||
val knownDicts = mutableListOf<Pair<String, String>>()
|
||||
val builder = AnnotatedString.Builder()
|
||||
builder.appendLine(stringResource(R.string.dictionary_available))
|
||||
val context = LocalContext.current
|
||||
context.assets.open("dictionaries_in_dict_repo.csv").reader().forEachLine {
|
||||
if (it.isBlank()) return@forEachLine
|
||||
|
|
|
@ -38,7 +38,6 @@ import helium314.keyboard.settings.DeleteButton
|
|||
import helium314.keyboard.settings.ExpandButton
|
||||
import helium314.keyboard.settings.Theme
|
||||
import helium314.keyboard.settings.dictionaryFilePicker
|
||||
import helium314.keyboard.settings.preferences.PreferenceCategory
|
||||
import helium314.keyboard.settings.previewDark
|
||||
import helium314.keyboard.settings.screens.getUserAndInternalDictionaries
|
||||
import java.io.File
|
||||
|
@ -65,19 +64,34 @@ fun DictionaryDialog(
|
|||
val state = rememberScrollState()
|
||||
Column(Modifier.verticalScroll(state)) {
|
||||
if (hasInternal) {
|
||||
val color = if (mainDict == null) MaterialTheme.colorScheme.onSurface
|
||||
val color = if (mainDict == null) MaterialTheme.typography.titleSmall.color
|
||||
else MaterialTheme.colorScheme.onSurface.copy(alpha = 0.38f) // for disabled look
|
||||
Text(stringResource(R.string.internal_dictionary_summary), color = color, modifier = Modifier.fillMaxWidth())
|
||||
val bottomPadding = if (mainDict == null) 12.dp else 0.dp
|
||||
Text(stringResource(R.string.internal_dictionary_summary),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = bottomPadding),
|
||||
color = color,
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
}
|
||||
if (mainDict != null)
|
||||
DictionaryDetails(mainDict)
|
||||
if (addonDicts.isNotEmpty()) {
|
||||
PreferenceCategory(stringResource(R.string.dictionary_category_title))
|
||||
HorizontalDivider()
|
||||
Text(stringResource(R.string.dictionary_category_title),
|
||||
modifier = Modifier.padding(vertical = 12.dp),
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
addonDicts.forEach { DictionaryDetails(it) }
|
||||
}
|
||||
val dictString = createDictionaryTextAnnotated(locale)
|
||||
if (dictString.isNotEmpty()) {
|
||||
HorizontalDivider()
|
||||
Text(stringResource(R.string.dictionary_available),
|
||||
modifier = Modifier.padding(top = 12.dp, bottom = 4.dp),
|
||||
style = MaterialTheme.typography.titleSmall
|
||||
)
|
||||
Text(dictString, style = LocalTextStyle.current.merge(lineHeight = 1.8.em))
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +128,7 @@ private fun DictionaryDetails(dict: File) {
|
|||
Text(
|
||||
header.info(LocalConfiguration.current.locale()),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(horizontal = 10.dp)
|
||||
modifier = Modifier.padding(start = 10.dp, top = 0.dp, end = 10.dp, bottom = 12.dp)
|
||||
)
|
||||
}
|
||||
if (showDeleteDialog)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue