mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 14:19:08 +00:00
remove the / at the end of layout folders
because apparently android 7 asset manager does not understand it fixes #1393
This commit is contained in:
parent
ee33140106
commit
43f5dd555b
3 changed files with 5 additions and 4 deletions
|
@ -22,7 +22,7 @@ enum class LayoutType {
|
|||
return map
|
||||
}
|
||||
|
||||
val LayoutType.folder get() = "layouts${File.separator}${name.lowercase()}${File.separator}"
|
||||
val LayoutType.folder get() = "layouts${File.separator}${name.lowercase()}"
|
||||
|
||||
val LayoutType.displayNameId get() = when (this) {
|
||||
MAIN -> R.string.subtype_no_language
|
||||
|
|
|
@ -5,6 +5,7 @@ import helium314.keyboard.latin.R
|
|||
import helium314.keyboard.latin.settings.Defaults.default
|
||||
import helium314.keyboard.latin.utils.LayoutType.Companion.folder
|
||||
import helium314.keyboard.latin.utils.ScriptUtils.script
|
||||
import java.io.File
|
||||
import java.util.Locale
|
||||
|
||||
// for layouts provided by the app
|
||||
|
@ -28,8 +29,8 @@ object LayoutUtils {
|
|||
fun getContent(layoutType: LayoutType, layoutName: String, context: Context): String {
|
||||
val layouts = context.assets.list(layoutType.folder)!!
|
||||
layouts.firstOrNull { it.startsWith("$layoutName.") }
|
||||
?.let { return context.assets.open(layoutType.folder + it).reader().readText() }
|
||||
?.let { return context.assets.open(layoutType.folder + File.separator + it).reader().readText() }
|
||||
val fallback = layouts.first { it.startsWith(layoutType.default) } // must exist!
|
||||
return context.assets.open(layoutType.folder + fallback).reader().readText()
|
||||
return context.assets.open(layoutType.folder + File.separator + fallback).reader().readText()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ object LayoutUtilsCustom {
|
|||
fun isCustomLayout(layoutName: String) = layoutName.startsWith(CUSTOM_LAYOUT_PREFIX)
|
||||
|
||||
fun getLayoutFile(layoutName: String, layoutType: LayoutType, context: Context): File {
|
||||
val file = File(DeviceProtectedUtils.getFilesDir(context), layoutType.folder + layoutName)
|
||||
val file = File(DeviceProtectedUtils.getFilesDir(context), layoutType.folder + File.separator + layoutName)
|
||||
file.parentFile?.mkdirs()
|
||||
return file
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue