diff options
| author | juloo | 2016-12-11 22:45:58 +0100 |
|---|---|---|
| committer | juloo | 2016-12-11 22:45:58 +0100 |
| commit | 0b943952333c7578ef99b1bf09b39a18483efaf6 (patch) | |
| tree | 1e473b159f53349b2f3815a390e588510b805be7 | |
| parent | 162f17a7a01b9518c2a36940ce68620c59f20d5e (diff) | |
| download | unexpected-keyboard-0b943952333c7578ef99b1bf09b39a18483efaf6.tar.gz unexpected-keyboard-0b943952333c7578ef99b1bf09b39a18483efaf6.zip | |
switchToNextInputMethod key
| -rw-r--r-- | project.properties | 2 | ||||
| -rw-r--r-- | res/xml/qwerty.xml | 2 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 2 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 8 |
4 files changed, 12 insertions, 2 deletions
diff --git a/project.properties b/project.properties index 00cf62b..916037e 100644 --- a/project.properties +++ b/project.properties @@ -11,4 +11,4 @@ #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. -target=android-22 +target=android-23 diff --git a/res/xml/qwerty.xml b/res/xml/qwerty.xml index af9bb3b..20bc45e 100644 --- a/res/xml/qwerty.xml +++ b/res/xml/qwerty.xml @@ -35,7 +35,7 @@ <key width="1.5" key0="backspace" key2="delete" /> </row> <row> - <key width="1.8" key0="ctrl" key3="switch_numeric" /> + <key width="1.8" key0="ctrl" key1="change_method" key3="switch_numeric" /> <key key0="alt" key1="page_up" key2="end" key3="home" key4="page_down" /> <key width="4.4" key0="space" /> <key key1="up" key2="right" key3="left" key4="down" /> diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index 6435f22..50a528d 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -12,6 +12,7 @@ class KeyValue public static final int EVENT_SWITCH_NUMERIC = -4; public static final int EVENT_SWITCH_EMOJI = -5; public static final int EVENT_SWITCH_BACK_EMOJI = -6; + public static final int EVENT_CHANGE_METHOD = -7; public static final char CHAR_NONE = '\0'; public static final int FLAG_KEEP_ON = 1; @@ -193,5 +194,6 @@ class KeyValue new KeyValue("tab", "↹", '\t', KeyEvent.KEYCODE_TAB, 0); new KeyValue("space", null, ' ', KeyEvent.KEYCODE_SPACE, 0); + new KeyValue("change_method", "⊞", CHAR_NONE, EVENT_CHANGE_METHOD, FLAG_NOREPEAT); } } diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 3d4fda5..6123093 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -9,9 +9,11 @@ import android.os.Bundle; import android.text.InputType; import android.preference.PreferenceManager; import android.view.inputmethod.EditorInfo; +import android.view.inputmethod.InputMethodManager; import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; +import android.util.Log; public class Keyboard2 extends InputMethodService implements SharedPreferences.OnSharedPreferenceChangeListener @@ -123,6 +125,12 @@ public class Keyboard2 extends InputMethodService } else if (eventCode == KeyValue.EVENT_SWITCH_BACK_EMOJI) setInputView(_keyboardView); + else if (eventCode == KeyValue.EVENT_CHANGE_METHOD) + { + InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); + + imm.switchToNextInputMethod(getWindow().getWindow().getAttributes().token, false); + } else if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT)) != 0) handleMetaKeyUp(key, flags); // else if (eventCode == KeyEvent.KEYCODE_DEL) |
