Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions app/src/main/java/helium314/keyboard/settings/KeyboardTestField.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: GPL-3.0-only
package helium314.keyboard.settings

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import helium314.keyboard.latin.R

/**
* Text field to try the keyboard directly in the settings, e.g. to see a changed theme
* or key size without leaving the settings.
*/
@Composable
fun KeyboardTestField(modifier: Modifier = Modifier) {
var text by rememberSaveable { mutableStateOf("") }
OutlinedTextField(
value = text,
onValueChange = { text = it },
label = { Text(stringResource(R.string.keyboard_test_field)) },
supportingText = { Text(stringResource(R.string.keyboard_test_field_hint)) },
trailingIcon = if (text.isEmpty()) null else {
{
IconButton(onClick = { text = "" }) {
Icon(painterResource(R.drawable.ic_close), stringResource(R.string.delete))
}
}
},
textStyle = contentTextDirectionStyle.merge(MaterialTheme.typography.bodyLarge),
maxLines = 3,
modifier = modifier
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 4.dp)
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import helium314.keyboard.settings.preferences.ListPreference
import helium314.keyboard.settings.SettingsWithoutKey
import helium314.keyboard.settings.Setting
import helium314.keyboard.settings.preferences.Preference
import helium314.keyboard.settings.KeyboardTestField
import helium314.keyboard.settings.SearchSettingsScreen
import helium314.keyboard.settings.SettingsActivity
import helium314.keyboard.settings.preferences.SliderPreference
Expand Down Expand Up @@ -158,7 +159,8 @@ fun AppearanceScreen(
SearchSettingsScreen(
onClickBack = onClickBack,
title = stringResource(R.string.settings_screen_appearance),
settings = items
settings = items,
headerContent = { KeyboardTestField() },
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import helium314.keyboard.latin.utils.ToolbarMode
import helium314.keyboard.latin.utils.getActivity
import helium314.keyboard.latin.utils.prefs
import helium314.keyboard.settings.fineTuneExpanded
import helium314.keyboard.settings.KeyboardTestField
import helium314.keyboard.settings.SearchSettingsScreen
import helium314.keyboard.settings.Setting
import helium314.keyboard.settings.SettingsActivity
Expand Down Expand Up @@ -109,7 +110,8 @@ fun SuggestionsScreen(
SearchSettingsScreen(
onClickBack = onClickBack,
title = stringResource(R.string.settings_screen_suggestions),
settings = items
settings = items,
headerContent = { KeyboardTestField() },
)
}

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
<string name="voice" tools:keep="@string/voice">Spracheingabe</string>
<string name="theme_name_dynamic" tools:keep="@string/theme_name_dynamic">Dynamische Farben</string>
<string name="settings_screen_appearance">Aussehen</string>
<string name="keyboard_test_field">Tastatur hier ausprobieren</string>
<string name="keyboard_test_field_hint">Änderungen sind beim nächsten Öffnen der Tastatur sichtbar</string>
<string name="show_popup_hints">Funktionale Hinweise anzeigen</string>
<string name="message_add_custom_layout">Datei in einem kompatiblen Format auswählen. Information zu den Formaten ist %s verfügbar.</string>
<string name="select_color_key_background">Tastenhintergrund</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1456,6 +1456,8 @@ New dictionary:
<string name="app_language_system">System default</string>
<!-- Settings screen title for appearance preferences -->
<string name="settings_screen_appearance">Appearance</string>
<string name="keyboard_test_field">Try the keyboard here</string>
<string name="keyboard_test_field_hint">Changes are shown the next time the keyboard opens</string>
<!-- Settings screen title for toolbar preferences -->
<string name="settings_screen_toolbar">Toolbar</string>
<string name="settings_screen_ai_integration">AI Integration</string>
Expand Down
Loading