Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/src/main/java/helium314/keyboard/latin/InputView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class InputView @JvmOverloads constructor(
if (mNavBarBottomInsets > 0) return mNavBarBottomInsets
val insets = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
rootWindowInsets?.getInsets(WindowInsets.Type.navigationBars())?.bottom ?: 0
} else {
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
@Suppress("DEPRECATION")
rootWindowInsets?.systemWindowInsetBottom ?: 0
} else {
0 // View.getRootWindowInsets needs API 23, the insets come from onApplyWindowInsets
}
if (insets > 0) {
mNavBarBottomInsets = insets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,16 @@ object UnicodeStyleEngine {
if (colon < 0) return null
val name = line.substring(0, colon).trim()
if (name.isEmpty()) return null
val cps = line.substring(colon + 1).codePoints().filter { !Character.isWhitespace(it) }.toArray()
return if (cps.size == 52 || cps.size == 62) name to cps else null
// plain loop: String.codePoints() and IntStream need API 24, the app supports API 21/23
val rest = line.substring(colon + 1)
val cps = ArrayList<Int>(62)
var i = 0
while (i < rest.length) {
val cp = rest.codePointAt(i)
if (!Character.isWhitespace(cp)) cps.add(cp)
i += Character.charCount(cp)
}
return if (cps.size == 52 || cps.size == 62) name to cps.toIntArray() else null
}

private fun buildReverseMap(styles: List<StyleDefinition>): Map<Int, Int> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class SettingsContainer(context: Context) {

/** settings screen (destination) that shows a setting, for jumping there from the search */
private val screens: Map<String, String> = HashMap<String, String>().apply {
settingsWithScreens.forEach { (setting, destination) -> if (destination != null) putIfAbsent(setting.key, destination) }
settingsWithScreens.forEach { (setting, destination) -> if (destination != null && !containsKey(setting.key)) put(setting.key, destination) }
}

operator fun get(key: Any): Setting? = map[key]
Expand Down
Loading