From 57251c8d96e83da7f1b9b9491519eeaa52deab61 Mon Sep 17 00:00:00 2001 From: Menny Even Danan Date: Wed, 17 Jun 2020 09:56:31 -0400 Subject: Allow suggestions in auto-complete text-view. #1331 --- .../com/anysoftkeyboard/ime/AnySoftKeyboardSuggestions.java | 8 ++------ .../AnySoftKeyboardDictionaryEnablingTest.java | 12 ++++++------ 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'ime/app') diff --git a/ime/app/src/main/java/com/anysoftkeyboard/ime/AnySoftKeyboardSuggestions.java b/ime/app/src/main/java/com/anysoftkeyboard/ime/AnySoftKeyboardSuggestions.java index 3c5b23370..93bc6d74e 100644 --- a/ime/app/src/main/java/com/anysoftkeyboard/ime/AnySoftKeyboardSuggestions.java +++ b/ime/app/src/main/java/com/anysoftkeyboard/ime/AnySoftKeyboardSuggestions.java @@ -415,12 +415,8 @@ public abstract class AnySoftKeyboardSuggestions extends AnySoftKeyboardKeyboard final int textFlag = attribute.inputType & EditorInfo.TYPE_MASK_FLAGS; if ((textFlag & EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS) - == EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS - || (textFlag & EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) - == EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) { - Logger.d( - TAG, - "Input requested NO_SUGGESTIONS, or it is AUTO_COMPLETE by itself."); + == EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS) { + Logger.d(TAG, "Input requested NO_SUGGESTIONS."); mPredictionOn = false; } diff --git a/ime/app/src/test/java/com/anysoftkeyboard/AnySoftKeyboardDictionaryEnablingTest.java b/ime/app/src/test/java/com/anysoftkeyboard/AnySoftKeyboardDictionaryEnablingTest.java index a054ee4c1..0841ffc24 100644 --- a/ime/app/src/test/java/com/anysoftkeyboard/AnySoftKeyboardDictionaryEnablingTest.java +++ b/ime/app/src/test/java/com/anysoftkeyboard/AnySoftKeyboardDictionaryEnablingTest.java @@ -18,7 +18,7 @@ import org.mockito.Mockito; @RunWith(AnySoftKeyboardRobolectricTestRunner.class) public class AnySoftKeyboardDictionaryEnablingTest extends AnySoftKeyboardBaseTest { - private static final String[] DICTIONATY_WORDS = + private static final String[] DICTIONARY_WORDS = new String[] { "high", "hello", "menny", "AnySoftKeyboard", "keyboard", "com/google", "low" }; @@ -27,9 +27,9 @@ public class AnySoftKeyboardDictionaryEnablingTest extends AnySoftKeyboardBaseTe public void setUp() throws Exception { UserDictionary userDictionary = new UserDictionary(getApplicationContext(), "en"); userDictionary.loadDictionary(); - for (int wordIndex = 0; wordIndex < DICTIONATY_WORDS.length; wordIndex++) { + for (int wordIndex = 0; wordIndex < DICTIONARY_WORDS.length; wordIndex++) { userDictionary.addWord( - DICTIONATY_WORDS[wordIndex], DICTIONATY_WORDS.length - wordIndex); + DICTIONARY_WORDS[wordIndex], DICTIONARY_WORDS.length - wordIndex); } userDictionary.close(); } @@ -159,15 +159,15 @@ public class AnySoftKeyboardDictionaryEnablingTest extends AnySoftKeyboardBaseTe } @Test - public void testDictionariesNotCreatedForAutoComplete() { + public void testDictionariesCreatedForAutoComplete() { final EditorInfo editorInfo = TestableAnySoftKeyboard.createEditorInfoTextWithSuggestions(); editorInfo.inputType += EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE; simulateFinishInputFlow(); simulateOnStartInputFlow(false, editorInfo); mAnySoftKeyboardUnderTest.simulateKeyPress('h'); - Assert.assertFalse(mAnySoftKeyboardUnderTest.isPredictionOn()); - Assert.assertFalse(mAnySoftKeyboardUnderTest.isAutoCorrect()); + Assert.assertTrue(mAnySoftKeyboardUnderTest.isPredictionOn()); + Assert.assertTrue(mAnySoftKeyboardUnderTest.isAutoCorrect()); } @Test -- cgit v1.2.3