implement EditText.setOnEditorActionListener()

This makes the NewPipe search work again
This commit is contained in:
Julian Winkler
2023-11-08 18:00:31 +01:00
parent 1aa1ee64c1
commit bcfb384ba4
6 changed files with 51 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ public class EditText extends TextView {
protected native long native_constructor(Context context, AttributeSet attrs);
protected native String native_getText(long widget);
protected native void native_addTextChangedListener(long widget, TextWatcher watcher);
protected native void native_setOnEditorActionListener(long widget, OnEditorActionListener l);
public Editable getText() {
return new SpannableStringBuilder(native_getText(widget));
@@ -37,4 +38,9 @@ public class EditText extends TextView {
public void addTextChangedListener(TextWatcher watcher) {
native_addTextChangedListener(widget, watcher);
}
@Override
public void setOnEditorActionListener(OnEditorActionListener l) {
native_setOnEditorActionListener(widget, l);
}
}

View File

@@ -16,6 +16,7 @@ import android.text.method.TransformationMethod;
import android.text.style.URLSpan;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.View;
public class TextView extends View {
@@ -186,6 +187,7 @@ public class TextView extends View {
public CharSequence getHint() {return "HINT";}
public static interface OnEditorActionListener {
public abstract boolean onEditorAction(TextView v, int actionId, KeyEvent event);
}
public static enum BufferType {