add NO_LANGUAGE inside remember

should fix GH-1678
This commit is contained in:
Helium314 2025-06-08 21:42:33 +02:00
parent e21168b1d3
commit af5c41c83c

View file

@ -57,8 +57,11 @@ fun DictionaryScreen(
val enabledLanguages = SubtypeSettings.getEnabledSubtypes(true).map { it.locale().language }
val cachedDictFolders = DictionaryInfoUtils.getCacheDirectories(ctx).map { it.name }
val comparer = compareBy<Locale>({ it.language !in enabledLanguages }, { it.toLanguageTag() !in cachedDictFolders}, { it.displayName })
val dictionaryLocales = remember { getDictionaryLocales(ctx).sortedWith(comparer).toMutableList() }
dictionaryLocales.add(0, Locale(SubtypeLocaleUtils.NO_LANGUAGE))
val dictionaryLocales = remember {
getDictionaryLocales(ctx).sortedWith(comparer).toMutableList().apply {
add(0, Locale(SubtypeLocaleUtils.NO_LANGUAGE))
}
}
var selectedLocale: Locale? by remember { mutableStateOf(null) }
var showAddDictDialog by remember { mutableStateOf(false) }
val dictPicker = dictionaryFilePicker(selectedLocale)