From 81cc428e92bb3bef80ccab507124af30cf755f62 Mon Sep 17 00:00:00 2001 From: Aleksandras Kostarevas Date: Thu, 11 Apr 2024 00:54:27 -0500 Subject: [PATCH] Add pre-alpha text to spacebar --- java/res/values/strings-uix.xml | 1 + .../futo/inputmethod/keyboard/MainKeyboardView.java | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/java/res/values/strings-uix.xml b/java/res/values/strings-uix.xml index cda9edbc5..0656f823b 100644 --- a/java/res/values/strings-uix.xml +++ b/java/res/values/strings-uix.xml @@ -42,4 +42,5 @@ Disable emoji suggestions Try typing hereā€¦ Externally imported model + Pre-Alpha \ No newline at end of file diff --git a/java/src/org/futo/inputmethod/keyboard/MainKeyboardView.java b/java/src/org/futo/inputmethod/keyboard/MainKeyboardView.java index c62adf8ce..16bd76ab2 100644 --- a/java/src/org/futo/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/org/futo/inputmethod/keyboard/MainKeyboardView.java @@ -815,10 +815,7 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy super.onDrawKeyTopVisuals(key, canvas, paint, params); final int code = key.getCode(); if (code == Constants.CODE_SPACE) { - // If input language are explicitly selected. - if (mLanguageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) { - drawLanguageOnSpacebar(key, canvas, paint); - } + drawLanguageOnSpacebar(key, canvas, paint); // Whether space key needs to show the "..." popup hint for special purposes if (key.isLongPressEnabled() && mHasMultipleEnabledIMEsOrSubtypes) { drawKeyPopupHint(key, canvas, paint, params); @@ -848,6 +845,12 @@ public final class MainKeyboardView extends KeyboardView implements DrawingProxy // Layout language name on spacebar. private String layoutLanguageOnSpacebar(final Paint paint, final RichInputMethodSubtype subtype, final int width) { + if (mLanguageOnSpacebarFormatType == LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) { + final String text = getContext().getString(R.string.spacebar_default_text); + if(fitsTextIntoWidth(width, text, paint)) { + return text; + } + } // Choose appropriate language name to fit into the width. if (mLanguageOnSpacebarFormatType == LanguageOnSpacebarUtils.FORMAT_TYPE_FULL_LOCALE) { final String fullText = subtype.getFullDisplayName();