Compare commits

...

2 Commits

Author SHA1 Message Date
Yuriy Liskov
a4d615bbf2 persian fix 2018-08-29 15:59:25 +03:00
Yuriy Liskov
5e8e68de44 persian fix; enter in editor fix 2018-08-20 16:05:06 +03:00
5 changed files with 55 additions and 26 deletions

View File

@@ -8,8 +8,8 @@ android {
applicationId "org.liskovsoft.leankeykeyboard.pro" applicationId "org.liskovsoft.leankeykeyboard.pro"
minSdkVersion project.properties.minSdkVersion minSdkVersion project.properties.minSdkVersion
targetSdkVersion project.properties.targetSdkVersion targetSdkVersion project.properties.targetSdkVersion
versionCode 74 versionCode 76
versionName "4.3.24" versionName "4.3.26"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

View File

@@ -155,6 +155,10 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
this.commitKey(this.mContainer.getCurrFocus()); 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) { private void commitKey(LeanbackKeyboardContainer.KeyFocus focus) {
if (mContainer != null && focus != null) { if (mContainer != null && focus != null) {
switch (focus.type) { switch (focus.type) {
@@ -163,7 +167,7 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
return; return;
case KeyFocus.TYPE_ACTION: // NOTE: user presses Go, Send, Search etc case KeyFocus.TYPE_ACTION: // NOTE: user presses Go, Send, Search etc
mInputListener.onEntry(InputListener.ENTRY_TYPE_ACTION, 0, null); mInputListener.onEntry(InputListener.ENTRY_TYPE_ACTION, 0, null);
mContext.hideWindow(); // SmartYouTubeTV fix: force hide keyboard // mContext.hideWindow(); // SmartYouTubeTV fix: force hide keyboard
return; return;
case KeyFocus.TYPE_SUGGESTION: case KeyFocus.TYPE_SUGGESTION:
mInputListener.onEntry(InputListener.ENTRY_TYPE_SUGGESTION, 0, mContainer.getSuggestionText(focus.index)); mInputListener.onEntry(InputListener.ENTRY_TYPE_SUGGESTION, 0, mContainer.getSuggestionText(focus.index));
@@ -747,31 +751,37 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
@Override @Override
public boolean onTouch(View view, MotionEvent event) { public boolean onTouch(View view, MotionEvent event) {
Object tag = view.getTag(); Object tag = view.getTag();
if (TAG_GO.equals(tag)) { boolean isEnterKey = TAG_GO.equals(tag);
fakeKeyIndex(0, KeyFocus.TYPE_ACTION); switch (event.getAction()) {
} else { case MotionEvent.ACTION_DOWN:
switch (event.getAction()) { if (isEnterKey) {
case MotionEvent.ACTION_DOWN:
moveSelectorToPoint(event.getX(), event.getY());
fakeClickDown();
beginLongClickCountdown();
break; 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(); fakeClickUp();
break; }
default:
return false; fakeLongClickUp();
} break;
default:
return false;
} }
return true; return true;

View File

@@ -163,7 +163,14 @@ public class LeanbackImeService extends InputMethodService {
connection.commitText(text, 1); connection.commitText(text, 1);
mEnterSpaceBeforeCommitting = true; mEnterSpaceBeforeCommitting = true;
case InputListener.ENTRY_TYPE_ACTION: // NOTE: user presses Go, Send, Search etc 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; updateSuggestions = false;
break; break;
case InputListener.ENTRY_TYPE_LEFT: 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 @Override
public View onCreateInputView() { public View onCreateInputView() {
mInputView = mKeyboardController.getView(); mInputView = mKeyboardController.getView();

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Keyboard android:keyWidth="@dimen/key_width" android:keyHeight="@dimen/key_height" android:horizontalGap="@dimen/keyboard_horizontal_gap" android:verticalGap="@dimen/keyboard_vertical_gap"
xmlns:android="http://schemas.android.com/apk/res/android">
<Row>
<Key android:keyLabel="آ" />
</Row>
</Keyboard>

View File

@@ -37,7 +37,8 @@
<Key android:keyLabel="ی" /> <Key android:keyLabel="ی" />
<Key android:keyLabel="ب" /> <Key android:keyLabel="ب" />
<Key android:keyLabel="ل" /> <Key android:keyLabel="ل" />
<Key android:keyLabel="ا" /> <!-- fix from Shobair Mohammadi <shobairmohammadi@gmail.com> -->
<Key android:keyLabel="ا|آ" android:popupKeyboard="@xml/accent_fa_a" />
<Key android:keyLabel="ت" /> <Key android:keyLabel="ت" />
<Key android:keyLabel="ن" /> <Key android:keyLabel="ن" />
<Key android:keyLabel="م" /> <Key android:keyLabel="م" />