diff --git a/leankeykeyboard/build.gradle b/leankeykeyboard/build.gradle index bc5a470..cb3880f 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 74 - versionName "4.3.24" + versionCode 75 + versionName "4.3.25" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 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 097bfc2..b203ee5 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 @@ -155,6 +155,10 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi this.commitKey(this.mContainer.getCurrFocus()); } + /** + * NOTE: where all magic happens. Input from virtual kbd is processed here. + * @param focus current key + */ private void commitKey(LeanbackKeyboardContainer.KeyFocus focus) { if (mContainer != null && focus != null) { switch (focus.type) { @@ -163,7 +167,7 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi return; case KeyFocus.TYPE_ACTION: // NOTE: user presses Go, Send, Search etc mInputListener.onEntry(InputListener.ENTRY_TYPE_ACTION, 0, null); - mContext.hideWindow(); // SmartYouTubeTV fix: force hide keyboard + // mContext.hideWindow(); // SmartYouTubeTV fix: force hide keyboard return; case KeyFocus.TYPE_SUGGESTION: mInputListener.onEntry(InputListener.ENTRY_TYPE_SUGGESTION, 0, mContainer.getSuggestionText(focus.index)); @@ -747,31 +751,37 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi @Override public boolean onTouch(View view, MotionEvent event) { Object tag = view.getTag(); - if (TAG_GO.equals(tag)) { - fakeKeyIndex(0, KeyFocus.TYPE_ACTION); - } else { - switch (event.getAction()) { - case MotionEvent.ACTION_DOWN: - moveSelectorToPoint(event.getX(), event.getY()); - fakeClickDown(); - beginLongClickCountdown(); + boolean isEnterKey = TAG_GO.equals(tag); + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: + if (isEnterKey) { break; - case MotionEvent.ACTION_UP: - if (!clickConsumed) { - clickConsumed = true; - if (isDoubleClick()) { - mContainer.onKeyLongPress(); - break; - } + } - fakeClickUp(); + moveSelectorToPoint(event.getX(), event.getY()); + fakeClickDown(); + beginLongClickCountdown(); + break; + case MotionEvent.ACTION_UP: + if (isEnterKey) { + fakeKeyIndex(0, KeyFocus.TYPE_ACTION); + break; + } + + if (!clickConsumed) { + clickConsumed = true; + if (isDoubleClick()) { + mContainer.onKeyLongPress(); + break; } - fakeLongClickUp(); - break; - default: - return false; - } + fakeClickUp(); + } + + fakeLongClickUp(); + break; + default: + return false; } return true; diff --git a/leankeykeyboard/src/main/java/com/google/leanback/ime/LeanbackImeService.java b/leankeykeyboard/src/main/java/com/google/leanback/ime/LeanbackImeService.java index 41f0869..187bde2 100644 --- a/leankeykeyboard/src/main/java/com/google/leanback/ime/LeanbackImeService.java +++ b/leankeykeyboard/src/main/java/com/google/leanback/ime/LeanbackImeService.java @@ -163,7 +163,14 @@ public class LeanbackImeService extends InputMethodService { connection.commitText(text, 1); mEnterSpaceBeforeCommitting = true; case InputListener.ENTRY_TYPE_ACTION: // NOTE: user presses Go, Send, Search etc - sendDefaultEditorAction(false); + boolean result = sendDefaultEditorAction(true); + + if (result) { + hideWindow(); // NOTE: SmartYouTubeTV hide kbd on search page fix + } else { + sendEnterKey(connection); + } + updateSuggestions = false; break; case InputListener.ENTRY_TYPE_LEFT: @@ -211,6 +218,10 @@ public class LeanbackImeService extends InputMethodService { } } + private void sendEnterKey(InputConnection connection) { + connection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER)); + } + @Override public View onCreateInputView() { mInputView = mKeyboardController.getView(); diff --git a/leankeykeyboard/src/main/res/xml/qwerty_fa.xml b/leankeykeyboard/src/main/res/xml/qwerty_fa.xml index 257ebe8..42f21de 100644 --- a/leankeykeyboard/src/main/res/xml/qwerty_fa.xml +++ b/leankeykeyboard/src/main/res/xml/qwerty_fa.xml @@ -37,7 +37,8 @@ - + +