mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-21 22:59:10 +00:00
properly delete extracted internal main dictionary, and don't show empty dict folders
This commit is contained in:
parent
2df1fb926e
commit
3ca932db19
1 changed files with 3 additions and 2 deletions
|
@ -258,8 +258,8 @@ class LanguageSettingsDialog(
|
||||||
}
|
}
|
||||||
if (dictionaryType == DictionaryInfoUtils.DEFAULT_MAIN_DICT) {
|
if (dictionaryType == DictionaryInfoUtils.DEFAULT_MAIN_DICT) {
|
||||||
// replaced main dict, remove the one created from internal data
|
// replaced main dict, remove the one created from internal data
|
||||||
val internalMainDictFilename = DictionaryInfoUtils.getCacheDirectoryForLocale(this.toString(), context) +
|
val internalMainDictFilename = DictionaryInfoUtils.getCacheDirectoryForLocale(mainLocaleString, context) +
|
||||||
File.separator + DictionaryInfoUtils.getMainDictFilename(this.toString())
|
File.separator + DictionaryInfoUtils.getMainDictFilename(mainLocaleString)
|
||||||
File(internalMainDictFilename).delete()
|
File(internalMainDictFilename).delete()
|
||||||
}
|
}
|
||||||
val newDictBroadcast = Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION)
|
val newDictBroadcast = Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION)
|
||||||
|
@ -366,6 +366,7 @@ private fun getAvailableDictionaryLocales(context: Context, mainLocaleString: St
|
||||||
if (cachedDirectoryList != null) {
|
if (cachedDirectoryList != null) {
|
||||||
for (directory in cachedDirectoryList) {
|
for (directory in cachedDirectoryList) {
|
||||||
if (!directory.isDirectory) continue
|
if (!directory.isDirectory) continue
|
||||||
|
if (directory.list()?.isNotEmpty() != true) continue
|
||||||
val dirLocale = DictionaryInfoUtils.getWordListIdFromFileName(directory.name)
|
val dirLocale = DictionaryInfoUtils.getWordListIdFromFileName(directory.name)
|
||||||
if (dirLocale == mainLocaleString) continue
|
if (dirLocale == mainLocaleString) continue
|
||||||
val locale = dirLocale.toLocale()
|
val locale = dirLocale.toLocale()
|
||||||
|
|
Loading…
Add table
Reference in a new issue