Compare commits

..

3 Commits

Author SHA1 Message Date
Patrick Goldinger
a146c6f846 Release v0.4.5 2025-01-13 02:10:22 +01:00
Patrick Goldinger
40ad937384 Merge branch 'main' into release/0.4 2025-01-13 02:08:25 +01:00
Patrick Goldinger
15b5dd9e3e Fix issues with all keys invisible detection (#2737) 2025-01-13 02:07:05 +01:00
5 changed files with 20 additions and 29 deletions

View File

@@ -166,10 +166,6 @@ class AppPrefs : PreferenceModel("florisboard-app-prefs") {
key = "devtools__enabled",
default = false,
)
val showLastLayoutComputation = boolean(
key = "devtools__show_last_layout_computation",
default = false,
)
val showPrimaryClip = boolean(
key = "devtools__show_primary_clip",
default = false,

View File

@@ -43,6 +43,7 @@ import dev.patrickgold.florisboard.app.florisPreferenceModel
import dev.patrickgold.florisboard.clipboardManager
import dev.patrickgold.florisboard.editorInstance
import dev.patrickgold.florisboard.ime.keyboard.CachedLayout
import dev.patrickgold.florisboard.ime.keyboard.DebugLayoutComputationResult
import dev.patrickgold.florisboard.ime.nlp.NlpInlineAutofill
import dev.patrickgold.florisboard.keyboardManager
import dev.patrickgold.florisboard.lib.FlorisLocale
@@ -65,7 +66,6 @@ fun DevtoolsOverlay(modifier: Modifier = Modifier) {
val devtoolsEnabled by prefs.devtools.enabled.observeAsState()
val showPrimaryClip by prefs.devtools.showPrimaryClip.observeAsState()
val showInputStateOverlay by prefs.devtools.showInputStateOverlay.observeAsState()
val showLastLayoutComputation by prefs.devtools.showLastLayoutComputation.observeAsState()
val showSpellingOverlay by prefs.devtools.showSpellingOverlay.observeAsState()
val showInlineAutofillOverlay by prefs.devtools.showInlineAutofillOverlay.observeAsState()
@@ -82,8 +82,8 @@ fun DevtoolsOverlay(modifier: Modifier = Modifier) {
if (devtoolsEnabled && showInputStateOverlay) {
DevtoolsInputStateOverlay()
}
if (devtoolsEnabled && showLastLayoutComputation || debugLayoutResult?.allLayoutsSuccess() == false) {
DevtoolsLastLayoutComputationOverlay()
if (debugLayoutResult?.allLayoutsSuccess() == false) {
DevtoolsLastLayoutComputationOverlay(debugLayoutResult)
}
if (devtoolsEnabled && showSpellingOverlay) {
DevtoolsSpellingOverlay()
@@ -137,13 +137,9 @@ private fun DevtoolsInputStateOverlay() {
}
@Composable
private fun DevtoolsLastLayoutComputationOverlay() {
val context = LocalContext.current
val keyboardManager by context.keyboardManager()
val debugLayoutResult by keyboardManager.layoutManager.debugLayoutComputationResultFlow.collectAsState()
private fun DevtoolsLastLayoutComputationOverlay(debugLayoutResult: DebugLayoutComputationResult?) {
@Composable
fun PrintResult(result: Result<CachedLayout>) {
fun PrintResult(result: Result<CachedLayout?>) {
if (result.isSuccess) {
DevtoolsText(text = "loaded: ${result.getOrNull()?.name}")
} else {

View File

@@ -73,12 +73,6 @@ fun DevtoolsScreen() = FlorisScreen {
summary = stringRes(R.string.devtools__show_input_state_overlay__summary),
enabledIf = { prefs.devtools.enabled isEqualTo true },
)
SwitchPreference(
prefs.devtools.showLastLayoutComputation,
title = "Show last layout computation",
summary = "Show the last layout computation in a dialog",
enabledIf = { prefs.devtools.enabled isEqualTo true },
)
SwitchPreference(
prefs.devtools.showSpellingOverlay,
title = stringRes(R.string.devtools__show_spelling_overlay__label),

View File

@@ -65,9 +65,9 @@ private data class CachedPopupMapping(
)
data class DebugLayoutComputationResult(
val main: Result<CachedLayout>,
val mod: Result<CachedLayout>,
val ext: Result<CachedLayout>,
val main: Result<CachedLayout?>,
val mod: Result<CachedLayout?>,
val ext: Result<CachedLayout?>,
) {
fun allLayoutsSuccess(): Boolean {
return main.isSuccess && mod.isSuccess && ext.isSuccess
@@ -96,8 +96,13 @@ class LayoutManager(context: Context) {
*
* @return A deferred result for a layout.
*/
private fun loadLayoutAsync(ltn: LTN?) = ioScope.runCatchingAsync {
require(ltn != null) { "Invalid argument value for 'ltn': null" }
private fun loadLayoutAsync(ltn: LTN?, allowNullLTN: Boolean) = ioScope.runCatchingAsync {
if (!allowNullLTN) {
requireNotNull(ltn) { "Invalid argument value for 'ltn': null" }
}
if (ltn == null) {
return@runCatchingAsync null
}
layoutCacheGuard.withLock {
val cached = layoutCache[ltn]
if (cached != null) {
@@ -176,7 +181,7 @@ class LayoutManager(context: Context) {
val extendedPopupsDefault = loadPopupMappingAsync()
val extendedPopups = loadPopupMappingAsync(subtype)
val mainLayoutResult = loadLayoutAsync(main).await()
val mainLayoutResult = loadLayoutAsync(main, allowNullLTN = false).await()
val mainLayout = mainLayoutResult.onFailure {
flogWarning { "$keyboardMode - main - $it" }
}.getOrNull()
@@ -196,11 +201,11 @@ class LayoutManager(context: Context) {
} else {
modifier
}
val modifierLayoutResult = loadLayoutAsync(modifierToLoad).await()
val modifierLayoutResult = loadLayoutAsync(modifierToLoad, allowNullLTN = true).await()
val modifierLayout = modifierLayoutResult.onFailure {
flogWarning { "$keyboardMode - mod - $it" }
}.getOrNull()
val extensionLayoutResult = loadLayoutAsync(extension).await()
val extensionLayoutResult = loadLayoutAsync(extension, allowNullLTN = true).await()
val extensionLayout = extensionLayoutResult.onFailure {
flogWarning { "$keyboardMode - ext - $it" }
}.getOrNull()

View File

@@ -13,5 +13,5 @@ projectCompileSdk=35
projectBuildToolsVersion=35.0.0
projectNdkVersion=26.1.10909125
projectVersionCode=102
projectVersionName=0.4.4
projectVersionCode=103
projectVersionName=0.4.5