2022-10-02 23:06:56 +02:00
|
|
|
package android.widget;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.res.ColorStateList;
|
|
|
|
import android.content.res.TypedArray;
|
2023-06-22 11:45:46 +02:00
|
|
|
import android.graphics.Typeface;
|
2022-10-02 23:06:56 +02:00
|
|
|
import android.text.InputFilter;
|
2023-06-22 11:45:46 +02:00
|
|
|
import android.text.TextPaint;
|
2023-08-17 10:46:24 +02:00
|
|
|
import android.text.TextUtils;
|
2022-10-02 23:06:56 +02:00
|
|
|
import android.text.TextWatcher;
|
2023-08-17 10:46:24 +02:00
|
|
|
import android.text.method.TransformationMethod;
|
2023-06-22 11:45:46 +02:00
|
|
|
import android.util.AttributeSet;
|
2023-08-22 14:41:01 +02:00
|
|
|
import android.view.Gravity;
|
2022-10-02 23:06:56 +02:00
|
|
|
import android.view.View;
|
|
|
|
|
|
|
|
public class TextView extends View {
|
|
|
|
public String text;
|
|
|
|
|
|
|
|
public TextView(int _id) { // FIXME
|
|
|
|
id = _id;
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:04 +02:00
|
|
|
public TextView(Context context, AttributeSet attrs) {
|
2023-08-22 14:41:01 +02:00
|
|
|
this(context, attrs, 0);
|
2022-10-02 23:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public TextView(Context context) {
|
2023-08-22 14:41:01 +02:00
|
|
|
this(context, null);
|
2022-10-02 23:06:56 +02:00
|
|
|
}
|
|
|
|
|
2023-08-17 10:46:24 +02:00
|
|
|
public TextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
2023-08-22 14:41:01 +02:00
|
|
|
super(context, attrs, defStyleAttr);
|
|
|
|
|
|
|
|
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TextView, defStyleAttr, 0);
|
|
|
|
if (a.hasValue(com.android.internal.R.styleable.TextView_text)) {
|
|
|
|
setText(a.getText(com.android.internal.R.styleable.TextView_text));
|
|
|
|
}
|
2023-08-22 18:50:08 +02:00
|
|
|
int ap = a.getResourceId(com.android.internal.R.styleable.TextView_textAppearance, -1);
|
2023-08-22 14:41:01 +02:00
|
|
|
a.recycle();
|
2023-08-22 18:50:08 +02:00
|
|
|
if (ap != -1) {
|
|
|
|
a = context.obtainStyledAttributes(ap, com.android.internal.R.styleable.TextAppearance);
|
|
|
|
if (a.hasValue(com.android.internal.R.styleable.TextAppearance_textSize)) {
|
|
|
|
setTextSize(a.getDimensionPixelSize(com.android.internal.R.styleable.TextAppearance_textSize, 10));
|
|
|
|
}
|
|
|
|
a.recycle();
|
|
|
|
}
|
2023-08-17 10:46:24 +02:00
|
|
|
}
|
|
|
|
|
2023-08-17 12:59:37 +02:00
|
|
|
@Override
|
|
|
|
protected native long native_constructor(Context context, AttributeSet attrs);
|
2022-10-02 23:06:56 +02:00
|
|
|
|
2023-08-22 13:55:56 +02:00
|
|
|
public void setText(CharSequence text) {
|
2023-06-22 11:45:46 +02:00
|
|
|
if (text == null) {
|
2022-10-02 23:06:56 +02:00
|
|
|
native_setText("NULL");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
native_setText(text.toString());
|
|
|
|
|
2023-06-22 11:45:46 +02:00
|
|
|
if (text instanceof android.text.Spanned)
|
2022-10-02 23:06:56 +02:00
|
|
|
native_set_markup(1);
|
|
|
|
}
|
|
|
|
|
2023-07-14 18:02:04 +02:00
|
|
|
public void setText(int resId) {
|
|
|
|
setText(getContext().getResources().getText(resId));
|
|
|
|
}
|
|
|
|
|
2022-10-02 23:06:56 +02:00
|
|
|
private native final void native_set_markup(int bool);
|
|
|
|
|
|
|
|
public native final void native_setText(String text);
|
2023-06-22 11:45:46 +02:00
|
|
|
public native void setTextSize(float size);
|
2022-10-02 23:06:56 +02:00
|
|
|
|
2023-06-22 11:45:46 +02:00
|
|
|
public void setTextColor(int color) {}
|
2022-10-02 23:06:56 +02:00
|
|
|
public void setTextColor(ColorStateList colors) {}
|
2023-06-22 11:45:46 +02:00
|
|
|
public void setTextSize(int unit, float size) {}
|
|
|
|
public void setTypeface(Typeface tf, int style) {}
|
|
|
|
public void setTypeface(Typeface tf) {}
|
|
|
|
public void setLineSpacing(float add, float mult) {}
|
2022-10-02 23:06:56 +02:00
|
|
|
public final void setLinksClickable(boolean whether) {}
|
|
|
|
|
|
|
|
public void setInputType(int type) {}
|
|
|
|
public void setFilters(InputFilter[] filters) {}
|
|
|
|
public void setCursorVisible(boolean visible) {}
|
|
|
|
public void setImeOptions(int imeOptions) {}
|
|
|
|
|
2023-06-22 11:45:46 +02:00
|
|
|
public final ColorStateList getTextColors() { return new ColorStateList(new int[][] {new int[0]}, new int[1]); }
|
|
|
|
public static ColorStateList getTextColors(Context context, TypedArray attrs) { return new ColorStateList(new int[][] {new int[0]}, new int[1]); }
|
2022-10-02 23:06:56 +02:00
|
|
|
|
|
|
|
public TextPaint getPaint() {
|
|
|
|
return new TextPaint();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void addTextChangedListener(TextWatcher watcher) {}
|
2023-06-22 11:45:46 +02:00
|
|
|
public void setOnEditorActionListener(TextView.OnEditorActionListener l) {}
|
2022-10-02 23:06:56 +02:00
|
|
|
|
2023-08-17 10:46:24 +02:00
|
|
|
public TransformationMethod getTransformationMethod() {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHintTextColor(ColorStateList colorStateList) {}
|
|
|
|
public void setLinkTextColor(ColorStateList colorStateList) {}
|
|
|
|
|
|
|
|
public void setSingleLine() {}
|
|
|
|
|
|
|
|
public void setEllipsize(TextUtils.TruncateAt truncateAt) {}
|
|
|
|
|
|
|
|
public void setTextAppearance(Context context, int appearance) {}
|
|
|
|
|
|
|
|
public void setMaxLines(int maxLines) {}
|
|
|
|
|
|
|
|
public void setMinWidth(int minWidth) {}
|
|
|
|
public void setMaxWidth(int maxWidth) {}
|
|
|
|
|
2023-08-22 14:41:01 +02:00
|
|
|
public Typeface getTypeface() {return null;}
|
|
|
|
|
|
|
|
public float getTextSize() {return 10;}
|
|
|
|
|
|
|
|
public int getGravity() {
|
|
|
|
return Gravity.CENTER;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getCompoundPaddingTop() {return 0;}
|
|
|
|
public int getCompoundPaddingBottom() {return 0;}
|
|
|
|
|
2022-10-02 23:06:56 +02:00
|
|
|
public static interface OnEditorActionListener {
|
|
|
|
}
|
|
|
|
}
|