Compare commits

...

15 Commits
4.3.3 ... 4.3.9

Author SHA1 Message Date
Yuriy Liskov
a57eeff2ae bump to 4.3.9 2018-04-27 17:40:40 +03:00
Yuriy Liskov
63b5f290e3 Merge branch 'rabin111-master' 2018-04-27 17:20:11 +03:00
rabin
acc035d8ba correct Thai keyboard layout 2018-04-26 10:58:01 +07:00
Yuriy Liskov
0757a82e2b refactor last commit 2018-04-23 02:30:59 +03:00
Yuriy Liskov
d05415fb65 fixes for previous commit 2018-04-23 00:04:11 +03:00
Yuriy Liskov
b3afc8e7f2 store up to two chars in one key label (Thai fix) 2018-04-22 15:48:25 +03:00
Yuriy Liskov
5d94ae66ac FireTV fix (update2) 2018-03-26 00:02:20 +03:00
Yuriy Liskov
0ed1761b8e FireTV fix (update1) 2018-03-25 18:28:27 +03:00
Yuriy Liskov
e9cc575c31 FireTV fix (possible) 2018-03-25 16:46:58 +03:00
Yuriy Liskov
4262862a1b spell fix 2018-03-24 21:07:14 +02:00
Yuriy Liskov
1313101d70 img fix 2018-03-24 21:04:31 +02:00
Yuriy Liskov
643b7e5443 add Thai kbd (final?) 2018-03-22 23:56:08 +02:00
Yuriy Liskov
524b371c63 add Thai kbd (pre-final) 2018-03-22 23:46:16 +02:00
Yuriy Liskov
aebdadb0fa add Thai lang (update 1) 2018-03-21 23:59:05 +02:00
Yuriy Liskov
f54ec3e5b0 rename to Pro 2018-03-20 23:15:01 +02:00
16 changed files with 197 additions and 47 deletions

1
.gitignore vendored
View File

@@ -1,4 +1,5 @@
notes.txt notes.txt
/other
/files /files
/misc /misc
tmp/ tmp/

View File

@@ -1,4 +1,4 @@
![Logo of LeanKeyKeyboard](screenshots/leankeykeyboard-logo_small.png "Logo of LeanKeyKeyboard") LeanKeyKeyboard ![Logo of LeanKeyKeyboard](img/leankeykeyboard_logo_small.png "Logo of LeanKeyKeyboard") LeanKeyKeyboard
========= =========
[![MPLv2 License](http://img.shields.io/badge/license-MPLv2-blue.svg?style=flat-square)](https://www.mozilla.org/MPL/2.0/) [![MPLv2 License](http://img.shields.io/badge/license-MPLv2-blue.svg?style=flat-square)](https://www.mozilla.org/MPL/2.0/)
@@ -37,8 +37,9 @@ __Standard installation via ADB__
### Screenshots: ### Screenshots:
![Screenshot of LeanKeyKeyboard](screenshots/leankeykeyboard_screenshot_01.png "Screenshot of LeanKeyKeyboard") ![Screenshot of LeanKeyKeyboard](img/leankeykeyboard_screenshot_01.png "Screenshot of LeanKeyKeyboard")
![Screenshot of LeanKeyKeyboard](screenshots/leankeykeyboard_screenshot_02.png "Screenshot of LeanKeyKeyboard") ![Screenshot of LeanKeyKeyboard](img/leankeykeyboard_screenshot_02.png "Screenshot of LeanKeyKeyboard")
![Screenshot of LeanKeyKeyboard](img/leankeykeyboard_screenshot_03.png "Screenshot of LeanKeyKeyboard")
### Why using it: ### Why using it:
* LeanKeyKeyboard provides possibility to enter text with any length. * LeanKeyKeyboard provides possibility to enter text with any length.

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 59 KiB

View File

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

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 53 versionCode 59
versionName "4.3.3" versionName "4.3.9"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

View File

@@ -4,7 +4,7 @@
<uses-feature android:name="android.hardware.microphone" android:required="false"/> <uses-feature android:name="android.hardware.microphone" android:required="false"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/> <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
<application android:banner="@drawable/banner_app" android:label="LeanKey Keyboard Pro" android:icon="@drawable/ic_launcher" tools:targetApi="21"> <application android:banner="@drawable/banner_app" android:label="@string/ime_name" android:icon="@drawable/ic_launcher" tools:targetApi="21">
<activity android:launchMode="singleTop" android:name="com.liskovsoft.inputchooser.SettingsActivity"> <activity android:launchMode="singleTop" android:name="com.liskovsoft.inputchooser.SettingsActivity">
<meta-data android:name="package" android:value="com.android.settings"/> <meta-data android:name="package" android:value="com.android.settings"/>
<meta-data android:name="class" android:value="com.android.settings.Settings"/> <meta-data android:name="class" android:value="com.android.settings.Settings"/>
@@ -15,7 +15,7 @@
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/> <category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter> </intent-filter>
</activity> </activity>
<service android:label="LeanKey Keyboard" android:name="com.google.leanback.ime.LeanbackImeService" android:permission="android.permission.BIND_INPUT_METHOD"> <service android:label="@string/ime_service_name" android:name="com.google.leanback.ime.LeanbackImeService" android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter> <intent-filter>
<action android:name="android.view.InputMethod"/> <action android:name="android.view.InputMethod"/>
</intent-filter> </intent-filter>

View File

@@ -66,7 +66,6 @@ public class LeanbackKeyboardContainer {
public static final int DIRECTION_LEFT = 1; public static final int DIRECTION_LEFT = 1;
public static final int DIRECTION_RIGHT = 4; public static final int DIRECTION_RIGHT = 4;
private Keyboard mAbcKeyboard; private Keyboard mAbcKeyboard;
private Keyboard mAbcKeyboardRU;
private Button mActionButtonView; private Button mActionButtonView;
private final float mAlphaIn; private final float mAlphaIn;
private final float mAlphaOut; private final float mAlphaOut;
@@ -318,7 +317,9 @@ public class LeanbackKeyboardContainer {
} }
/** /**
* All keyboard settings applied here * Init currently displayed keyboard<br/>
* Note: all keyboard settings applied here<br/>
* Note: this method is called constantly on new field
* @param resources resources (not used) * @param resources resources (not used)
* @param info current ime attributes * @param info current ime attributes
*/ */
@@ -1120,6 +1121,7 @@ public class LeanbackKeyboardContainer {
LeanbackKeyboardView keyboardView = mMainKeyboardView; LeanbackKeyboardView keyboardView = mMainKeyboardView;
Keyboard keyboard = mKeyboardManager.getNextKeyboard(); Keyboard keyboard = mKeyboardManager.getNextKeyboard();
mInitialMainKeyboard = keyboard; mInitialMainKeyboard = keyboard;
mAbcKeyboard = keyboard;
keyboardView.setKeyboard(keyboard); keyboardView.setKeyboard(keyboard);
showRunOnceDialog(); showRunOnceDialog();

View File

@@ -5,6 +5,7 @@ import android.graphics.Rect;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.Keyboard.Key; import android.inputmethodservice.Keyboard.Key;
import android.os.Handler; import android.os.Handler;
import android.text.InputType;
import android.util.Log; import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
@@ -49,6 +50,7 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
private PointF mTempPoint; private PointF mTempPoint;
private LeanbackKeyboardController.TouchEventListener mTouchEventListener; private LeanbackKeyboardController.TouchEventListener mTouchEventListener;
private long prevTime; private long prevTime;
private boolean mShowInput;
public LeanbackKeyboardController(final InputMethodService context, final LeanbackKeyboardController.InputListener listener) { public LeanbackKeyboardController(final InputMethodService context, final LeanbackKeyboardController.InputListener listener) {
this(context, listener, new TouchNavSpaceTracker(), new LeanbackKeyboardContainer(context)); this(context, listener, new TouchNavSpaceTracker(), new LeanbackKeyboardContainer(context));
@@ -681,23 +683,39 @@ public class LeanbackKeyboardController implements LeanbackKeyboardContainer.Voi
} }
} }
public void onStartInput(EditorInfo var1) { public void onStartInput(EditorInfo info) {
if (this.mContainer != null) { if (mContainer != null) {
this.mContainer.onStartInput(var1); mContainer.onStartInput(info);
this.initInputView(); initInputView();
} }
//// prevent accidental kbd pop-up on FireTV devices
//// more info: https://forum.xda-developers.com/fire-tv/general/guide-change-screen-keyboard-to-leankey-t3527675/page2
//int maskAction = info.imeOptions & EditorInfo.IME_MASK_ACTION;
//mShowInput = maskAction != 0;
mShowInput = info.inputType != InputType.TYPE_NULL;
}
public boolean showInputView() {
return mShowInput;
}
private void onHideIme() {
mContext.requestHideSelf(InputMethodService.BACK_DISPOSITION_DEFAULT);
} }
public void onStartInputView() { public void onStartInputView() {
this.mKeyDownReceived = false; mKeyDownReceived = false;
if (this.mContainer != null) {
this.mContainer.onStartInputView(); if (mContainer != null) {
mContainer.onStartInputView();
} }
this.mDoubleClickDetector.reset(); mDoubleClickDetector.reset();
} }
@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 != null && "Go".equals(tag)) { if (tag != null && "Go".equals(tag)) {

View File

@@ -69,6 +69,56 @@ public class LeanbackKeyboardView extends FrameLayout {
private int mRowCount; private int mRowCount;
private int mShiftState; private int mShiftState;
private final int mUnfocusStartDelay; private final int mUnfocusStartDelay;
private final KeyConverter mConverter;
private class KeyConverter {
private static final int LOWER_CASE = 0;
private static final int UPPER_CASE = 1;
private void init(KeyHolder keyHolder) {
// store original label
// in case when two characters are stored in one label (e.g. "A|B")
if (keyHolder.key.text == null) {
keyHolder.key.text = keyHolder.key.label;
}
}
public void toLowerCase(KeyHolder keyHolder) {
extractChar(LOWER_CASE, keyHolder);
}
public void toUpperCase(KeyHolder keyHolder) {
extractChar(UPPER_CASE, keyHolder);
}
private void extractChar(int charCase, KeyHolder keyHolder) {
init(keyHolder);
CharSequence result = null;
CharSequence label = keyHolder.key.text;
String[] labels = splitLabels(label);
switch (charCase) {
case LOWER_CASE:
result = labels != null ? labels[0] : label.toString().toLowerCase();
break;
case UPPER_CASE:
result = labels != null ? labels[1] : label.toString().toUpperCase();
break;
}
keyHolder.key.label = result;
}
private String[] splitLabels(CharSequence label) {
String realLabel = label.toString();
String[] labels = realLabel.split("\\|");
return labels.length == 2 ? labels : null; // remember, we encoding two chars
}
}
public LeanbackKeyboardView(Context context, AttributeSet attrs) { public LeanbackKeyboardView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
@@ -92,29 +142,24 @@ public class LeanbackKeyboardView extends FrameLayout {
mClickAnimDur = res.getInteger(R.integer.clicked_anim_duration); mClickAnimDur = res.getInteger(R.integer.clicked_anim_duration);
mUnfocusStartDelay = res.getInteger(R.integer.unfocused_anim_delay); mUnfocusStartDelay = res.getInteger(R.integer.unfocused_anim_delay);
mInactiveMiniKbAlpha = res.getInteger(R.integer.inactive_mini_kb_alpha); mInactiveMiniKbAlpha = res.getInteger(R.integer.inactive_mini_kb_alpha);
mConverter = new KeyConverter();
} }
private CharSequence adjustCase(LeanbackKeyboardView.KeyHolder keyHolder) { private void adjustCase(LeanbackKeyboardView.KeyHolder keyHolder) {
CharSequence label = keyHolder.key.label; boolean flag;
CharSequence result = label;
if (label != null && label.length() < 3) {
boolean flag;
if (keyHolder.isInMiniKb && keyHolder.isInvertible) {
flag = true;
} else {
flag = false;
}
if (this.mKeyboard.isShifted() ^ flag) { if (keyHolder.isInMiniKb && keyHolder.isInvertible) {
result = label.toString().toUpperCase(); flag = true;
} else { } else {
result = label.toString().toLowerCase(); flag = false;
}
keyHolder.key.label = result;
} }
return result; // ^ equals to !=
if (mKeyboard.isShifted() ^ flag) {
mConverter.toUpperCase(keyHolder);
} else {
mConverter.toLowerCase(keyHolder);
}
} }
@SuppressLint("NewApi") @SuppressLint("NewApi")

View File

@@ -53,7 +53,7 @@ public class LeanbackImeService extends InputMethodService {
@SuppressLint("NewApi") @SuppressLint("NewApi")
public LeanbackImeService() { public LeanbackImeService() {
if (!this.enableHardwareAcceleration()) { if (!enableHardwareAcceleration()) {
Log.w("LbImeService", "Could not enable hardware acceleration"); Log.w("LbImeService", "Could not enable hardware acceleration");
} }
} }
@@ -224,15 +224,19 @@ public class LeanbackImeService extends InputMethodService {
return false; return false;
} }
/**
* At this point, decision whether to show kbd taking place
* @return whether to show kbd
*/
@SuppressLint("MissingSuperCall") @SuppressLint("MissingSuperCall")
@Override @Override
public boolean onEvaluateInputViewShown() { public boolean onEvaluateInputViewShown() {
return true; return mKeyboardController.showInputView();
} }
@Override @Override
public void onFinishInputView(boolean var1) { public void onFinishInputView(boolean finishingInput) {
super.onFinishInputView(var1); super.onFinishInputView(finishingInput);
this.sendBroadcast(new Intent(IME_CLOSE)); this.sendBroadcast(new Intent(IME_CLOSE));
this.mSuggestionsFactory.clearSuggestions(); this.mSuggestionsFactory.clearSuggestions();
} }
@@ -246,7 +250,7 @@ public class LeanbackImeService extends InputMethodService {
} }
public void onHideIme() { public void onHideIme() {
this.requestHideSelf(0); requestHideSelf(InputMethodService.BACK_DISPOSITION_DEFAULT);
} }
@Override @Override
@@ -266,10 +270,11 @@ public class LeanbackImeService extends InputMethodService {
return isInputViewShown() && mKeyboardController.onKeyUp(keyCode, event) || super.onKeyUp(keyCode, event); return isInputViewShown() && mKeyboardController.onKeyUp(keyCode, event) || super.onKeyUp(keyCode, event);
} }
@Override // FireTV fix
public boolean onShowInputRequested(int flags, boolean configChange) { //@Override
return true; //public boolean onShowInputRequested(int flags, boolean configChange) {
} // return true;
//}
@Override @Override
public int onStartCommand(final Intent intent, final int flags, final int startId) { public int onStartCommand(final Intent intent, final int flags, final int startId) {
@@ -298,6 +303,15 @@ public class LeanbackImeService extends InputMethodService {
@Override @Override
public void onStartInputView(EditorInfo info, boolean restarting) { public void onStartInputView(EditorInfo info, boolean restarting) {
super.onStartInputView(info, restarting); super.onStartInputView(info, restarting);
// FireTV: fix accidental kbd pop-ups
// more info: https://forum.xda-developers.com/fire-tv/general/guide-change-screen-keyboard-to-leankey-t3527675/page2
updateInputViewShown();
if (!mKeyboardController.showInputView()) {
onHideIme();
return;
}
mKeyboardController.onStartInputView(); mKeyboardController.onStartInputView();
sendBroadcast(new Intent(IME_OPEN)); sendBroadcast(new Intent(IME_OPEN));
if (mKeyboardController.areSuggestionsEnabled()) { if (mKeyboardController.areSuggestionsEnabled()) {

View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -15,6 +15,7 @@
<string-array name="additional_languages"> <string-array name="additional_languages">
<item>Russian|ru</item> <item>Russian|ru</item>
<item>Ukrainian|uk</item> <item>Ukrainian|uk</item>
<item>Thai|th</item>
<item>Hebrew|he</item> <item>Hebrew|he</item>
<item>Arabic|ar</item> <item>Arabic|ar</item>
<item>Bulgarian|bg</item> <item>Bulgarian|bg</item>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<string name="ime_name">LeanKey Keyboard</string> <string name="ime_name">LeanKey Keyboard Pro</string>
<string name="ime_service_name">LeanKey Keyboard</string> <string name="ime_service_name">LeanKey Keyboard Pro</string>
<string name="word_separators">" .,;:!? <string name="word_separators">" .,;:!?
()[]*&amp;@{}/&lt;>_+=|"</string> ()[]*&amp;@{}/&lt;>_+=|"</string>
<string name="label_go_key">Go</string> <string name="label_go_key">Go</string>
@@ -24,6 +24,6 @@
<string name="keyboardview_keycode_right">Right</string> <string name="keyboardview_keycode_right">Right</string>
<string name="keyboard_headset_required_to_hear_password">Plug in a headset to hear password keys spoken.</string> <string name="keyboard_headset_required_to_hear_password">Plug in a headset to hear password keys spoken.</string>
<string name="keyboard_password_character_no_headset">Dot.</string> <string name="keyboard_password_character_no_headset">Dot.</string>
<string name="language_dialog_title">Select desired keyboards</string> <string name="language_dialog_title">Select additional keyboards</string>
<string name="language_dialog_subtitle">To open dialog next time, long press on \'world\' button</string> <string name="language_dialog_subtitle">To open dialog next time, long press on \'world\' button</string>
</resources> </resources>

View File

@@ -0,0 +1,68 @@
<?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">
<!-- Thai keyboard -->
<!-- https://en.wikipedia.org/wiki/Thai_(Unicode_block) -->
<Row android:rowEdgeFlags="top">
<Key android:keyEdgeFlags="left" android:keyLabel="ๆ|๑" />
<Key android:keyLabel="ภ|๒" />
<Key android:keyLabel="ถ|๓" />
<Key android:keyLabel="ุ|ู" />
<Key android:keyLabel="ึ|๔" />
<Key android:keyLabel="ค|๕" />
<Key android:keyLabel="ต|๖" />
<Key android:keyLabel="จ|๗" />
<Key android:keyLabel="ข|๘" />
<Key android:keyLabel="ช|๙" />
<Key android:codes="-5" android:keyEdgeFlags="right" android:keyLabel="@string/keyboardview_keycode_delete" android:keyIcon="@drawable/ic_ime_delete" />
</Row>
<Row>
<!-- NOTE: example of adding different chars to uppercase/lowercase states -->
<!-- format is: android:keyLabel="lower_char|upper_char" e.g. android:keyLabel="ฝ|๒" -->
<Key android:keyLabel="ไ|" android:keyEdgeFlags="left" />
<Key android:keyLabel="ำ|ฎ" />
<Key android:keyLabel="พ|ฑ" />
<Key android:keyLabel="ะ|ธ" />
<Key android:keyLabel="ั|ํ" />
<Key android:keyLabel="ี|๊" />
<Key android:keyLabel="ร|ณ" />
<Key android:keyLabel="น|ฯ" />
<Key android:keyLabel="ย|ญ" />
<Key android:keyLabel="บ|ฐ" />
<Key android:keyLabel="ล|," android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:keyLabel="ฟ|ฤ" android:keyEdgeFlags="left" />
<Key android:keyLabel="ห|ฆ" />
<Key android:keyLabel="ก|ฏ" />
<Key android:keyLabel="ด|โ" />
<Key android:keyLabel="เ|ฌ" />
<Key android:keyLabel="้|็" />
<Key android:keyLabel="่|๋" />
<Key android:keyLabel="า|ษ" />
<Key android:keyLabel="ส|ศ" />
<Key android:keyLabel="ว|ซ" />
<Key android:keyLabel="ง|." android:keyEdgeFlags="right" />
</Row>
<Row>
<Key android:keyLabel="ผ|(" android:keyEdgeFlags="left" />
<Key android:keyLabel="ป|)" />
<Key android:keyLabel="แ|ฉ" />
<Key android:keyLabel="อ|ฮ" />
<Key android:keyLabel="ิ|ฺ" />
<Key android:keyLabel="ื|์" />
<Key android:keyLabel="ท|?" />
<Key android:keyLabel="ม|ฒ" />
<Key android:keyLabel="ใ|ฬ" />
<Key android:keyLabel="ฝ|ฦ" />
<Key android:keyLabel="ฃ|ฅ" android:keyEdgeFlags="right" />
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="-2" android:keyEdgeFlags="left" android:keyLabel="@string/keyboardview_keycode_mode_change" android:keyIcon="@drawable/ic_ime_symbols" />
<Key android:codes="-1" android:keyLabel="@string/keyboardview_keycode_shift" android:keyIcon="@drawable/ic_ime_shift_off" />
<Key android:codes="-9" android:keyLabel="@string/keyboardview_keycode_lang" android:keyIcon="@drawable/ic_ime_world" />
<Key android:keyWidth="@dimen/space_key_width" android:codes="32" android:keyLabel="@string/keyboardview_keycode_space" android:keyIcon="@drawable/ic_ime_space_th" />
<Key android:codes="-3" android:keyLabel="@string/keyboardview_keycode_left" android:keyIcon="@drawable/ic_ime_left_arrow" />
<Key android:codes="-4" android:keyEdgeFlags="right" android:keyLabel="@string/keyboardview_keycode_right" android:keyIcon="@drawable/ic_ime_right_arrow" />
</Row>
</Keyboard>