1
0
Fork 0

fix nullref on exiting dialer by long pressing of Back key on KYF33 (#262)

* fix nullref on exiting com.android.dialer by long pressing of Back key on KYF33

* fix misleading ModeDialer.toString()

* fix textField and inputType are assumed to be defined everywhere

* fix yet another potential case of currentInputConnection = null

---------

Co-authored-by: sspanak <doftor.livain@gmail.com>
This commit is contained in:
mcfrei 2023-05-26 11:18:24 +03:00 committed by GitHub
parent b3fde40aa2
commit 7f6af7d413
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 2 deletions

View file

@ -82,6 +82,7 @@ abstract class KeyPadHandler extends InputMethodService {
@Override
public void onStartInputView(EditorInfo inputField, boolean restarting) {
currentInputConnection = getCurrentInputConnection();
onRestart(inputField);
}

View file

@ -7,6 +7,8 @@ import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@ -27,8 +29,10 @@ import io.github.sspanak.tt9.ui.tray.SuggestionsBar;
public class TraditionalT9 extends KeyPadHandler {
// internal settings/data
private boolean isActive = false;
private TextField textField;
private InputType inputType;
@NotNull
private TextField textField = new TextField(null, null);
@NotNull
private InputType inputType = new InputType(null, null);
// editing mode
protected static final int NON_EDIT = 0;

View file

@ -1,5 +1,7 @@
package io.github.sspanak.tt9.ime.modes;
import androidx.annotation.NonNull;
import io.github.sspanak.tt9.ime.helpers.Key;
// see: InputType.isDialer()
@ -12,4 +14,10 @@ public class ModeDialer extends Mode123 {
public boolean onOtherKey(int key) {
return !Key.isDecimalSeparator(key) && super.onOtherKey(key);
}
@NonNull
@Override
public String toString() {
return "Dialer";
}
}