2022-10-02 23:06:56 +02:00
|
|
|
package android.widget;
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
2024-03-30 11:04:21 +01:00
|
|
|
import android.graphics.drawable.Drawable;
|
2023-08-22 13:55:56 +02:00
|
|
|
import android.text.Editable;
|
2023-09-12 23:18:47 +02:00
|
|
|
import android.text.SpannableStringBuilder;
|
2023-09-01 13:03:40 +02:00
|
|
|
import android.text.TextWatcher;
|
2023-07-14 18:02:04 +02:00
|
|
|
import android.util.AttributeSet;
|
2022-10-02 23:06:56 +02:00
|
|
|
|
|
|
|
|
public class EditText extends TextView {
|
2023-06-22 11:45:46 +02:00
|
|
|
public EditText(Context context) {
|
2022-10-02 23:06:56 +02:00
|
|
|
super(context);
|
|
|
|
|
}
|
2023-07-14 18:02:04 +02:00
|
|
|
|
|
|
|
|
public EditText(Context context, AttributeSet attrs) {
|
|
|
|
|
super(context, attrs);
|
|
|
|
|
}
|
2023-08-22 13:55:56 +02:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected native long native_constructor(Context context, AttributeSet attrs);
|
|
|
|
|
protected native String native_getText(long widget);
|
2023-09-01 13:03:40 +02:00
|
|
|
protected native void native_addTextChangedListener(long widget, TextWatcher watcher);
|
2023-11-08 18:00:31 +01:00
|
|
|
protected native void native_setOnEditorActionListener(long widget, OnEditorActionListener l);
|
2024-03-20 23:05:17 +01:00
|
|
|
protected native void native_setText(long widget, String text);
|
2023-08-22 13:55:56 +02:00
|
|
|
|
|
|
|
|
public Editable getText() {
|
2023-09-12 23:18:47 +02:00
|
|
|
return new SpannableStringBuilder(native_getText(widget));
|
2023-08-22 13:55:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Editable getEditableText() {
|
2023-09-12 23:18:47 +02:00
|
|
|
return new SpannableStringBuilder(native_getText(widget));
|
2023-08-22 13:55:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2024-03-20 23:05:17 +01:00
|
|
|
public void setText(CharSequence text) {
|
|
|
|
|
native_setText(widget, String.valueOf(text));
|
|
|
|
|
}
|
2023-08-22 13:55:56 +02:00
|
|
|
@Override
|
|
|
|
|
public void setTextSize(float size) {}
|
|
|
|
|
|
2023-09-01 13:03:40 +02:00
|
|
|
@Override
|
|
|
|
|
public void addTextChangedListener(TextWatcher watcher) {
|
|
|
|
|
native_addTextChangedListener(widget, watcher);
|
|
|
|
|
}
|
2023-11-08 18:00:31 +01:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setOnEditorActionListener(OnEditorActionListener l) {
|
|
|
|
|
native_setOnEditorActionListener(widget, l);
|
|
|
|
|
}
|
2024-03-30 11:04:21 +01:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {}
|
2022-10-02 23:06:56 +02:00
|
|
|
}
|