mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +00:00
parent
44eb296d38
commit
3306ffb849
3 changed files with 13 additions and 3 deletions
|
@ -17,10 +17,12 @@ import helium314.keyboard.keyboard.internal.keyboard_parser.floris.TextKeyData
|
|||
import helium314.keyboard.latin.common.isEmoji
|
||||
import helium314.keyboard.latin.define.DebugFlags
|
||||
import helium314.keyboard.latin.settings.Settings
|
||||
import helium314.keyboard.latin.utils.CUSTOM_LAYOUT_PREFIX
|
||||
import helium314.keyboard.latin.utils.POPUP_KEYS_LAYOUT
|
||||
import helium314.keyboard.latin.utils.POPUP_KEYS_NUMBER
|
||||
import helium314.keyboard.latin.utils.ScriptUtils
|
||||
import helium314.keyboard.latin.utils.ScriptUtils.script
|
||||
import helium314.keyboard.latin.utils.getCustomLayoutFiles
|
||||
import helium314.keyboard.latin.utils.replaceFirst
|
||||
import helium314.keyboard.latin.utils.splitAt
|
||||
import helium314.keyboard.latin.utils.sumOf
|
||||
|
@ -269,7 +271,7 @@ class KeyboardParser(private val params: KeyboardParams, private val context: Co
|
|||
}
|
||||
|
||||
private fun getNumberRow(): MutableList<KeyData> {
|
||||
val row = RawKeyboardParser.parseLayout("number_row.txt", params, context).first()
|
||||
val row = RawKeyboardParser.parseLayout(LAYOUT_NUMBER_ROW, params, context).first()
|
||||
val localizedNumbers = params.mLocaleKeyboardInfos.localizedNumberKeys
|
||||
if (localizedNumbers?.size != 10) return row
|
||||
if (Settings.getInstance().current.mLocalizedNumberRow) {
|
||||
|
@ -314,3 +316,4 @@ const val LAYOUT_NUMPAD_LANDSCAPE = "numpad_landscape"
|
|||
const val LAYOUT_NUMBER = "number"
|
||||
const val LAYOUT_PHONE = "phone"
|
||||
const val LAYOUT_PHONE_SYMBOLS = "phone_symbols"
|
||||
const val LAYOUT_NUMBER_ROW = "number_row"
|
||||
|
|
|
@ -37,7 +37,7 @@ object RawKeyboardParser {
|
|||
private val rawLayoutCache = hashMapOf<String, (KeyboardParams) -> MutableList<MutableList<KeyData>>>()
|
||||
|
||||
val symbolAndNumberLayouts = listOf(LAYOUT_SYMBOLS, LAYOUT_SYMBOLS_SHIFTED, LAYOUT_SYMBOLS_ARABIC,
|
||||
LAYOUT_NUMBER, LAYOUT_NUMPAD, LAYOUT_NUMPAD_LANDSCAPE, LAYOUT_PHONE, LAYOUT_PHONE_SYMBOLS)
|
||||
LAYOUT_NUMBER, LAYOUT_NUMPAD, LAYOUT_NUMPAD_LANDSCAPE, LAYOUT_PHONE, LAYOUT_PHONE_SYMBOLS, LAYOUT_NUMBER_ROW)
|
||||
|
||||
fun clearCache() = rawLayoutCache.clear()
|
||||
|
||||
|
@ -91,7 +91,12 @@ object RawKeyboardParser {
|
|||
try {
|
||||
getCustomLayoutFile(layoutFileName, context).readText()
|
||||
} catch (e: Exception) { // fall back to defaults if for some reason file is broken
|
||||
val name = if (layoutName.contains("functional")) "functional_keys.json" else "qwerty.txt"
|
||||
val name = when {
|
||||
layoutName.contains("functional") -> "functional_keys.json"
|
||||
layoutName.contains("number_row") -> "number_row.txt"
|
||||
layoutName.contains("symbols") -> "symbols.txt"
|
||||
else -> "qwerty.txt"
|
||||
}
|
||||
Log.e(TAG, "cannot open layout $layoutName, falling back to $name", e)
|
||||
context.assets.open("layouts${File.separator}$name").reader().use { it.readText() }
|
||||
}
|
||||
|
|
|
@ -529,6 +529,8 @@ disposition rather than other common dispositions for Latin languages. [CHAR LIM
|
|||
<string name="layout_numpad" tools:keep="@string/layout_numpad">Numpad</string>
|
||||
<!-- Name for numpad layout in landscape mode -->
|
||||
<string name="layout_numpad_landscape" tools:keep="@string/layout_numpad_landscape">Numpad (landscape)</string>
|
||||
<!-- Name for number row layout -->
|
||||
<string name="layout_number_row" tools:keep="@string/layout_number_row">Number row</string>
|
||||
<!-- Title for customizing background image -->
|
||||
<string name="customize_background_image">Set background image</string>
|
||||
<!-- Title for customizing currencies -->
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue