Remove voice input model picker, which is no longer relevant

This commit is contained in:
Aleksandras Kostarevas 2024-04-02 12:29:29 -05:00
parent 20acfb57c6
commit 314df88693
2 changed files with 7 additions and 66 deletions

View File

@ -276,9 +276,10 @@ enum class NavigationItemStyle {
} }
@Composable @Composable
fun NavigationItem(title: String, style: NavigationItemStyle, navigate: () -> Unit, icon: Painter? = null) { fun NavigationItem(title: String, style: NavigationItemStyle, navigate: () -> Unit, icon: Painter? = null, subtitle: String? = null) {
SettingItem( SettingItem(
title = title, title = title,
subtitle = subtitle,
onClick = navigate, onClick = navigate,
icon = { icon = {
icon?.let { icon?.let {

View File

@ -41,67 +41,6 @@ import org.futo.inputmethod.latin.uix.settings.useDataStore
import org.futo.voiceinput.shared.ENGLISH_MODELS import org.futo.voiceinput.shared.ENGLISH_MODELS
import org.futo.voiceinput.shared.types.ModelLoader import org.futo.voiceinput.shared.types.ModelLoader
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ModelPicker(label: String, options: List<ModelLoader>, setting: SettingsKey<Int>) {
val (modelIndex, setModelIndex) = useDataStore(key = setting.key, default = setting.default)
var expanded by remember { mutableStateOf(false) }
Box(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
) {
ExposedDropdownMenuBox(
expanded = expanded,
onExpandedChange = {
expanded = !expanded
},
modifier = Modifier.align(Alignment.Center)
) {
TextField(
readOnly = true,
value = stringResource(options[modelIndex].name),
onValueChange = { },
label = { Text(label) },
trailingIcon = {
ExposedDropdownMenuDefaults.TrailingIcon(
expanded = expanded
)
},
colors = ExposedDropdownMenuDefaults.textFieldColors(
focusedLabelColor = MaterialTheme.colorScheme.onPrimaryContainer,
focusedLeadingIconColor = MaterialTheme.colorScheme.onPrimaryContainer,
focusedIndicatorColor = MaterialTheme.colorScheme.onPrimaryContainer,
focusedTrailingIconColor = MaterialTheme.colorScheme.onPrimaryContainer,
),
modifier = Modifier.menuAnchor()
)
ExposedDropdownMenu(
expanded = expanded,
onDismissRequest = {
expanded = false
}
) {
options.forEachIndexed { i, selectionOption ->
DropdownMenuItem(
text = {
Text(stringResource(selectionOption.name))
},
onClick = {
setModelIndex(i)
expanded = false
}
)
}
}
}
}
}
@Preview @Preview
@Composable @Composable
fun VoiceInputScreen(navController: NavHostController = rememberNavController()) { fun VoiceInputScreen(navController: NavHostController = rememberNavController()) {
@ -146,10 +85,11 @@ fun VoiceInputScreen(navController: NavHostController = rememberNavController())
setting = DISALLOW_SYMBOLS setting = DISALLOW_SYMBOLS
) )
ModelPicker( NavigationItem(
"English Model Option", title = "Languages",
ENGLISH_MODELS, subtitle = "To change the model, visit Languages menu",
ENGLISH_MODEL_INDEX style = NavigationItemStyle.Misc,
navigate = { navController.navigate("languages") }
) )
} }
} }