Merge pull request #15807 from endragor/fix-android-text-input-crash
Fix Android onTextChanged crash
This commit is contained in:
commit
d46bdd0436
@ -103,13 +103,16 @@ public class GodotTextInputWrapper implements TextWatcher, OnEditorActionListene
|
|||||||
public void onTextChanged(final CharSequence pCharSequence, final int start, final int before, final int count) {
|
public void onTextChanged(final CharSequence pCharSequence, final int start, final int before, final int count) {
|
||||||
//Log.d(TAG, "onTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",before: " + before);
|
//Log.d(TAG, "onTextChanged(" + pCharSequence + ")start: " + start + ",count: " + count + ",before: " + before);
|
||||||
|
|
||||||
|
final int[] newChars = new int[count];
|
||||||
|
for (int i = start; i < start + count; ++i) {
|
||||||
|
newChars[i - start] = pCharSequence.charAt(i);
|
||||||
|
}
|
||||||
mView.queueEvent(new Runnable() {
|
mView.queueEvent(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
for (int i = start; i < start + count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
final int ch = pCharSequence.charAt(i);
|
GodotLib.key(0, newChars[i], true);
|
||||||
GodotLib.key(0, ch, true);
|
GodotLib.key(0, newChars[i], false);
|
||||||
GodotLib.key(0, ch, false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user