From e53316842c9ac946c6cb496f4bbaa8161bf88ded Mon Sep 17 00:00:00 2001 From: Yuriy Liskov Date: Wed, 18 Jul 2018 17:34:47 +0300 Subject: [PATCH] fix2: remember selected kbd --- leankeykeyboard/build.gradle | 4 ++-- .../leanback/ime/LeanbackKeyboardContainer.java | 14 +++++++++----- .../leanback/ime/LeanbackKeyboardController.java | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/leankeykeyboard/build.gradle b/leankeykeyboard/build.gradle index d9e7e32..73148b0 100644 --- a/leankeykeyboard/build.gradle +++ b/leankeykeyboard/build.gradle @@ -8,8 +8,8 @@ android { applicationId "org.liskovsoft.leankeykeyboard.pro" minSdkVersion project.properties.minSdkVersion targetSdkVersion project.properties.targetSdkVersion - versionCode 65 - versionName "4.3.15" + versionCode 67 + versionName "4.3.17" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardContainer.java b/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardContainer.java index dc923bb..2f2dade 100644 --- a/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardContainer.java +++ b/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardContainer.java @@ -868,7 +868,7 @@ public boolean onKeyLongPress() { setTouchState(LeanbackKeyboardContainer.TOUCH_STATE_NO_TOUCH); return true; } else if (keyCode == LeanbackKeyboardView.ASCII_SPACE) { - switchToNextKeyboard(); + onLangKeyPress(); setTouchState(LeanbackKeyboardContainer.TOUCH_STATE_NO_TOUCH); return true; } else if (keyCode == LeanbackKeyboardView.KEYCODE_LANG_TOGGLE) { @@ -1117,14 +1117,18 @@ public void startVoiceRecording() { * Switch to next keyboard (looped). * {@link KeyboardManager KeyboardManager} is the source behind all keyboard implementations */ - public void switchToNextKeyboard() { + public void onLangKeyPress() { + switchToNextKeyboard(); + + showRunOnceDialog(); + } + + private void switchToNextKeyboard() { LeanbackKeyboardView keyboardView = mMainKeyboardView; Keyboard keyboard = mKeyboardManager.getNextKeyboard(); mInitialMainKeyboard = keyboard; mAbcKeyboard = keyboard; keyboardView.setKeyboard(keyboard); - - showRunOnceDialog(); } public void updateAddonKeyboard() { @@ -1157,7 +1161,7 @@ public void updateSuggestions(ArrayList suggestions) { } public void onLangKeyClick() { - switchToNextKeyboard(); + onLangKeyPress(); // setTouchState(LeanbackKeyboardContainer.TOUCH_STATE_NO_TOUCH); } diff --git a/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardController.java b/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardController.java index ecdb2bb..072aaf1 100644 --- a/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardController.java +++ b/leankeykeyboard/src/main/java/com/google/android/leanback/ime/LeanbackKeyboardController.java @@ -108,7 +108,7 @@ private boolean applyLETVFixesDown(int keyCode) { private boolean applyLETVFixesUp(int keyCode) { switch (keyCode) { case KeyEvent.KEYCODE_MENU: - this.mContainer.switchToNextKeyboard(); + this.mContainer.onLangKeyPress(); break; case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE: this.fakeKeyIndex(0, 2);