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 /srcs | |
| parent | 162f17a7a01b9518c2a36940ce68620c59f20d5e (diff) | |
| download | unexpected-keyboard-0b943952333c7578ef99b1bf09b39a18483efaf6.tar.gz unexpected-keyboard-0b943952333c7578ef99b1bf09b39a18483efaf6.zip | |
switchToNextInputMethod key
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyValue.java | 2 | ||||
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 8 |
2 files changed, 10 insertions, 0 deletions
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) |
