mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 15:32:48 +00:00
don't care about icons for invisible keyboard
This commit is contained in:
parent
6e6bbbd0da
commit
5d173d0981
2 changed files with 12 additions and 4 deletions
|
@ -20,9 +20,11 @@ import org.dslul.openboard.inputmethod.latin.common.Constants
|
||||||
import org.dslul.openboard.inputmethod.latin.common.splitOnWhitespace
|
import org.dslul.openboard.inputmethod.latin.common.splitOnWhitespace
|
||||||
import org.dslul.openboard.inputmethod.latin.define.DebugFlags
|
import org.dslul.openboard.inputmethod.latin.define.DebugFlags
|
||||||
import org.dslul.openboard.inputmethod.latin.settings.Settings
|
import org.dslul.openboard.inputmethod.latin.settings.Settings
|
||||||
|
import org.dslul.openboard.inputmethod.latin.spellcheck.AndroidSpellCheckerService
|
||||||
import org.dslul.openboard.inputmethod.latin.utils.InputTypeUtils
|
import org.dslul.openboard.inputmethod.latin.utils.InputTypeUtils
|
||||||
import org.dslul.openboard.inputmethod.latin.utils.RunInLocale
|
import org.dslul.openboard.inputmethod.latin.utils.RunInLocale
|
||||||
import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils
|
import org.dslul.openboard.inputmethod.latin.utils.ScriptUtils
|
||||||
|
import org.dslul.openboard.inputmethod.latin.utils.SubtypeLocaleUtils
|
||||||
import org.dslul.openboard.inputmethod.latin.utils.sumOf
|
import org.dslul.openboard.inputmethod.latin.utils.sumOf
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
|
||||||
|
@ -628,6 +630,13 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
|
||||||
|
|
||||||
private fun String.replaceIconWithLabelIfNoDrawable(): String {
|
private fun String.replaceIconWithLabelIfNoDrawable(): String {
|
||||||
if (params.mIconsSet.getIconDrawable(KeyboardIconsSet.getIconId(this)) != null) return this
|
if (params.mIconsSet.getIconDrawable(KeyboardIconsSet.getIconId(this)) != null) return this
|
||||||
|
if (params.mId.mWidth == AndroidSpellCheckerService.SPELLCHECKER_DUMMY_KEYBOARD_WIDTH
|
||||||
|
&& params.mId.mHeight == AndroidSpellCheckerService.SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT
|
||||||
|
&& !params.mId.mSubtype.rawSubtype.extraValue.contains(Constants.Subtype.ExtraValue.EMOJI_CAPABLE)
|
||||||
|
)
|
||||||
|
// fake keyboard that is used by spell checker (for key coordinates), but not shown to the user
|
||||||
|
// often this doesn't have any icons loaded, and there is no need to bother with this
|
||||||
|
return this
|
||||||
val id = context.resources.getIdentifier("label_$this", "string", context.packageName)
|
val id = context.resources.getIdentifier("label_$this", "string", context.packageName)
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
val message = "no resource for label $this in ${params.mId}"
|
val message = "no resource for label $this in ${params.mId}"
|
||||||
|
|
|
@ -45,8 +45,8 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
|
||||||
|
|
||||||
public static final String PREF_USE_CONTACTS_KEY = "pref_spellcheck_use_contacts";
|
public static final String PREF_USE_CONTACTS_KEY = "pref_spellcheck_use_contacts";
|
||||||
|
|
||||||
private static final int SPELLCHECKER_DUMMY_KEYBOARD_WIDTH = 480;
|
public static final int SPELLCHECKER_DUMMY_KEYBOARD_WIDTH = 480;
|
||||||
private static final int SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT = 301;
|
public static final int SPELLCHECKER_DUMMY_KEYBOARD_HEIGHT = 301;
|
||||||
|
|
||||||
private static final String DICTIONARY_NAME_PREFIX = "spellcheck_";
|
private static final String DICTIONARY_NAME_PREFIX = "spellcheck_";
|
||||||
|
|
||||||
|
@ -156,8 +156,7 @@ public final class AndroidSpellCheckerService extends SpellCheckerService
|
||||||
public boolean isValidWord(final Locale locale, final String word) {
|
public boolean isValidWord(final Locale locale, final String word) {
|
||||||
mSemaphore.acquireUninterruptibly();
|
mSemaphore.acquireUninterruptibly();
|
||||||
try {
|
try {
|
||||||
DictionaryFacilitator dictionaryFacilitatorForLocale =
|
DictionaryFacilitator dictionaryFacilitatorForLocale = mDictionaryFacilitatorCache.get(locale);
|
||||||
mDictionaryFacilitatorCache.get(locale);
|
|
||||||
return dictionaryFacilitatorForLocale.isValidSpellingWord(word);
|
return dictionaryFacilitatorForLocale.isValidSpellingWord(word);
|
||||||
} finally {
|
} finally {
|
||||||
mSemaphore.release();
|
mSemaphore.release();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue