Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64040f0407 | ||
|
|
0c1abdd507 | ||
|
|
53594e3343 | ||
|
|
c6c06b87c5 |
@@ -24,8 +24,8 @@ android {
|
||||
applicationId = "dev.patrickgold.florisboard"
|
||||
minSdkVersion(23)
|
||||
targetSdkVersion(30)
|
||||
versionCode(42)
|
||||
versionName("0.3.11")
|
||||
versionCode(43)
|
||||
versionName("0.3.12")
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ class TextInputManager private constructor() : CoroutineScope by MainScope(), In
|
||||
}
|
||||
smartbarView?.updateSmartbarState()
|
||||
flogInfo(LogTopic.IMS_EVENTS) { "current word: ${activeEditorInstance.cachedInput.currentWord.text}" }
|
||||
if (activeEditorInstance.isComposingEnabled && !inputEventDispatcher.isPressed(KeyCode.DELETE)) {
|
||||
if (activeEditorInstance.isComposingEnabled && !inputEventDispatcher.isPressed(KeyCode.DELETE) && !isGlidePostEffect) {
|
||||
if (activeEditorInstance.shouldReevaluateComposingSuggestions) {
|
||||
activeEditorInstance.shouldReevaluateComposingSuggestions = false
|
||||
activeDictionary?.let {
|
||||
|
||||
@@ -10,6 +10,7 @@ import dev.patrickgold.florisboard.ime.text.TextInputManager
|
||||
import dev.patrickgold.florisboard.ime.text.keyboard.TextKey
|
||||
import kotlinx.coroutines.*
|
||||
import org.json.JSONObject
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
* Handles the [GlideTypingClassifier]. Basically responsible for linking [GlideTypingGesture.Detector]
|
||||
@@ -62,6 +63,7 @@ class GlideTypingManager : GlideTypingGesture.Listener, CoroutineScope by MainSc
|
||||
}
|
||||
|
||||
private val wordDataCache = hashMapOf<String, Int>()
|
||||
|
||||
/**
|
||||
* Set the word data for the internal gesture classifier
|
||||
*/
|
||||
@@ -70,7 +72,8 @@ class GlideTypingManager : GlideTypingGesture.Listener, CoroutineScope by MainSc
|
||||
if (wordDataCache.isEmpty()) {
|
||||
// FIXME: get this info from dictionary.
|
||||
val data =
|
||||
AssetManager.default().loadTextAsset(AssetRef(AssetSource.Assets, "ime/dict/data.json")).getOrThrow()
|
||||
AssetManager.default().loadTextAsset(AssetRef(AssetSource.Assets, "ime/dict/data.json"))
|
||||
.getOrThrow()
|
||||
val json = JSONObject(data)
|
||||
wordDataCache.putAll(json.keys().asSequence().map { Pair(it, json.getInt(it)) })
|
||||
}
|
||||
@@ -102,7 +105,10 @@ class GlideTypingManager : GlideTypingGesture.Listener, CoroutineScope by MainSc
|
||||
textInputManager.isGlidePostEffect = true
|
||||
textInputManager.smartbarView?.setCandidateSuggestionWords(
|
||||
time,
|
||||
suggestions.take(maxSuggestionsToShow).map { textInputManager.fixCase(it) }
|
||||
suggestions.subList(
|
||||
1.coerceAtMost(min(commit.compareTo(false), suggestions.size)),
|
||||
maxSuggestionsToShow.coerceAtMost(suggestions.size)
|
||||
).map { textInputManager.fixCase(it) }
|
||||
)
|
||||
textInputManager.smartbarView?.updateCandidateSuggestionCapsState()
|
||||
if (commit && suggestions.isNotEmpty()) {
|
||||
|
||||
@@ -4,14 +4,18 @@ import android.util.SparseArray
|
||||
import androidx.collection.LruCache
|
||||
import androidx.core.util.set
|
||||
import dev.patrickgold.florisboard.ime.core.Subtype
|
||||
import dev.patrickgold.florisboard.ime.keyboard.Key
|
||||
import dev.patrickgold.florisboard.ime.text.key.KeyCode
|
||||
import dev.patrickgold.florisboard.ime.text.keyboard.TextKey
|
||||
import dev.patrickgold.florisboard.ime.text.keyboard.TextKeyData
|
||||
import java.text.Normalizer
|
||||
import java.util.*
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.math.*
|
||||
|
||||
private fun TextKey.baseCode(): Int {
|
||||
return (data as? TextKeyData)?.code ?: KeyCode.UNSPECIFIED
|
||||
}
|
||||
|
||||
/**
|
||||
* Classifies gestures by comparing them with an "ideal gesture".
|
||||
*
|
||||
@@ -95,7 +99,7 @@ class StatisticalGlideTypingClassifier : GlideTypingClassifier {
|
||||
keysByCharacter.clear()
|
||||
keys.clear()
|
||||
keyViews.forEach {
|
||||
keysByCharacter[it.computedData.code] = it
|
||||
keysByCharacter[it.baseCode()] = it
|
||||
keys.add(it)
|
||||
}
|
||||
layoutSubtype = subtype
|
||||
@@ -271,7 +275,7 @@ class StatisticalGlideTypingClassifier : GlideTypingClassifier {
|
||||
* @return A list of likely words.
|
||||
*/
|
||||
fun pruneByExtremities(
|
||||
userGesture: Gesture, keys: Iterable<Key>
|
||||
userGesture: Gesture, keys: Iterable<TextKey>
|
||||
): ArrayList<String> {
|
||||
val remainingWords = ArrayList<String>()
|
||||
val startX = userGesture.getFirstX()
|
||||
@@ -338,7 +342,7 @@ class StatisticalGlideTypingClassifier : GlideTypingClassifier {
|
||||
else -> {
|
||||
val firstKey = keysByCharacter[firstBaseChar.code]
|
||||
val lastKey = keysByCharacter[lastBaseChar.code]
|
||||
Pair(firstKey.computedData.code, lastKey.computedData.code)
|
||||
Pair(firstKey.baseCode(), lastKey.baseCode())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,16 +357,16 @@ class StatisticalGlideTypingClassifier : GlideTypingClassifier {
|
||||
* @return A list of the n closest keys.
|
||||
*/
|
||||
private fun findNClosestKeys(
|
||||
x: Float, y: Float, n: Int, keys: Iterable<Key>
|
||||
x: Float, y: Float, n: Int, keys: Iterable<TextKey>
|
||||
): Iterable<Int> {
|
||||
val keyDistances = HashMap<Key, Float>()
|
||||
val keyDistances = HashMap<TextKey, Float>()
|
||||
for (key in keys) {
|
||||
val distance = Gesture.distance(key.visibleBounds.centerX().toFloat(), key.visibleBounds.centerY().toFloat(), x, y)
|
||||
keyDistances[key] = distance
|
||||
}
|
||||
|
||||
return keyDistances.entries.sortedWith { c1, c2 -> c1.value.compareTo(c2.value) }.take(n)
|
||||
.map { (it.key as? TextKey)?.computedData?.code ?: KeyCode.UNSPECIFIED }
|
||||
.map { it.key.baseCode() }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
5
fastlane/metadata/android/en-US/changelogs/43.txt
Normal file
5
fastlane/metadata/android/en-US/changelogs/43.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
This version is a hotfix release which makes glide typing
|
||||
fully usable again (in v0.3.11 you couldn't glide while shift
|
||||
or caps was active).
|
||||
|
||||
Detailed changelog: https://github.com/florisboard/florisboard/releases/tag/v0.3.12
|
||||
Reference in New Issue
Block a user