forked from extern/Unexpected-Keyboard
switchToNextInputMethod key
This commit is contained in:
parent
162f17a7a0
commit
0b94395233
@ -11,4 +11,4 @@
|
|||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-22
|
target=android-23
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<key width="1.5" key0="backspace" key2="delete" />
|
<key width="1.5" key0="backspace" key2="delete" />
|
||||||
</row>
|
</row>
|
||||||
<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 key0="alt" key1="page_up" key2="end" key3="home" key4="page_down" />
|
||||||
<key width="4.4" key0="space" />
|
<key width="4.4" key0="space" />
|
||||||
<key key1="up" key2="right" key3="left" key4="down" />
|
<key key1="up" key2="right" key3="left" key4="down" />
|
||||||
|
@ -12,6 +12,7 @@ class KeyValue
|
|||||||
public static final int EVENT_SWITCH_NUMERIC = -4;
|
public static final int EVENT_SWITCH_NUMERIC = -4;
|
||||||
public static final int EVENT_SWITCH_EMOJI = -5;
|
public static final int EVENT_SWITCH_EMOJI = -5;
|
||||||
public static final int EVENT_SWITCH_BACK_EMOJI = -6;
|
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 char CHAR_NONE = '\0';
|
||||||
|
|
||||||
public static final int FLAG_KEEP_ON = 1;
|
public static final int FLAG_KEEP_ON = 1;
|
||||||
@ -193,5 +194,6 @@ class KeyValue
|
|||||||
|
|
||||||
new KeyValue("tab", "↹", '\t', KeyEvent.KEYCODE_TAB, 0);
|
new KeyValue("tab", "↹", '\t', KeyEvent.KEYCODE_TAB, 0);
|
||||||
new KeyValue("space", null, ' ', KeyEvent.KEYCODE_SPACE, 0);
|
new KeyValue("space", null, ' ', KeyEvent.KEYCODE_SPACE, 0);
|
||||||
|
new KeyValue("change_method", "⊞", CHAR_NONE, EVENT_CHANGE_METHOD, FLAG_NOREPEAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,11 @@ import android.os.Bundle;
|
|||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
public class Keyboard2 extends InputMethodService
|
public class Keyboard2 extends InputMethodService
|
||||||
implements SharedPreferences.OnSharedPreferenceChangeListener
|
implements SharedPreferences.OnSharedPreferenceChangeListener
|
||||||
@ -123,6 +125,12 @@ public class Keyboard2 extends InputMethodService
|
|||||||
}
|
}
|
||||||
else if (eventCode == KeyValue.EVENT_SWITCH_BACK_EMOJI)
|
else if (eventCode == KeyValue.EVENT_SWITCH_BACK_EMOJI)
|
||||||
setInputView(_keyboardView);
|
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)
|
else if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT)) != 0)
|
||||||
handleMetaKeyUp(key, flags);
|
handleMetaKeyUp(key, flags);
|
||||||
// else if (eventCode == KeyEvent.KEYCODE_DEL)
|
// else if (eventCode == KeyEvent.KEYCODE_DEL)
|
||||||
|
Loading…
Reference in New Issue
Block a user