Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Commit 5d8cf0d

Browse files
committed
Feat[touch_char_input]: directly modify the Editable instead of relying on the internal TextView methods.
1 parent 2a44e8d commit 5d8cf0d

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/keyboard/TouchCharInput.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
import static android.content.Context.INPUT_METHOD_SERVICE;
55

6-
import android.annotation.SuppressLint;
76
import android.content.Context;
87
import android.text.Editable;
8+
import android.text.Selection;
99
import android.util.AttributeSet;
1010
import android.view.KeyEvent;
1111
import android.view.inputmethod.InputMethodManager;
@@ -78,13 +78,15 @@ public void switchKeyboardState(){
7878
* Clear the EditText from any leftover inputs
7979
* It does not affect the in-game input
8080
*/
81-
@SuppressLint("SetTextI18n")
8281
public void clear(){
8382
mIsDoingInternalChanges = true;
83+
// Edit the Editable directly as it doesn't affect the state
84+
// of the TextView.
85+
Editable editable = getEditableText();
86+
editable.clear();
8487
//Braille space, doesn't trigger keyboard auto-complete
85-
//replacing directly the text without though setText avoids notifying changes
86-
setText(TEXT_FILLER);
87-
setSelection(TEXT_FILLER.length());
88+
editable.append(TEXT_FILLER);
89+
Selection.setSelection(editable, TEXT_FILLER.length());
8890
mIsDoingInternalChanges = false;
8991
}
9092

0 commit comments

Comments
 (0)