diff options
| author | Jules Aguillon | 2021-04-18 23:31:59 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2021-04-18 23:31:59 +0200 |
| commit | 2f8eae628f9ffe90a9e4254a800b6d69398abe6a (patch) | |
| tree | b203068d65a653f08cd901bcbedaa3cee560a380 /srcs | |
| parent | 81803c406a82862602aa5e350fcc07692e9f16a6 (diff) | |
| download | unexpected-keyboard-2f8eae628f9ffe90a9e4254a800b6d69398abe6a.tar.gz unexpected-keyboard-2f8eae628f9ffe90a9e4254a800b6d69398abe6a.zip | |
Fix crash when no current input binding
Broken recently. Restore previous code
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/Keyboard2.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java index 0be7913..b95c067 100644 --- a/srcs/juloo.keyboard2/Keyboard2.java +++ b/srcs/juloo.keyboard2/Keyboard2.java @@ -7,6 +7,7 @@ import android.content.SharedPreferences; import android.graphics.Typeface; import android.inputmethodservice.InputMethodService; import android.os.Bundle; +import android.os.IBinder; import android.text.InputType; import android.preference.PreferenceManager; import android.view.inputmethod.EditorInfo; @@ -100,7 +101,7 @@ public class Keyboard2 extends InputMethodService public void onStartInputView(EditorInfo info, boolean restarting) { InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); - _config.shouldOfferSwitchingToNextInputMethod = imm.shouldOfferSwitchingToNextInputMethod(getCurrentInputBinding().getConnectionToken()); + _config.shouldOfferSwitchingToNextInputMethod = imm.shouldOfferSwitchingToNextInputMethod(getConnectionToken()); refreshSubtype(imm.getCurrentInputMethodSubtype()); if ((info.inputType & InputType.TYPE_CLASS_NUMBER) != 0) _keyboardView.setKeyboard(getLayout(R.xml.numeric)); @@ -154,8 +155,7 @@ public class Keyboard2 extends InputMethodService else if (key.eventCode == KeyValue.EVENT_CHANGE_METHOD) { InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE); - - imm.switchToNextInputMethod(getCurrentInputBinding().getConnectionToken(), false); + imm.switchToNextInputMethod(getConnectionToken(), false); } else if ((flags & (KeyValue.FLAG_CTRL | KeyValue.FLAG_ALT)) != 0) handleMetaKeyUp(key, flags); @@ -201,4 +201,9 @@ public class Keyboard2 extends InputMethodService getCurrentInputConnection().sendKeyEvent(event); getCurrentInputConnection().sendKeyEvent(KeyEvent.changeAction(event, KeyEvent.ACTION_UP)); } + + private IBinder getConnectionToken() + { + return getWindow().getWindow().getAttributes().token; + } } |
