2023-08-17 10:46:24 +02:00
|
|
|
package android.widget;
|
|
|
|
|
|
|
|
import android.content.Context;
|
2023-08-22 13:51:37 +02:00
|
|
|
import android.content.res.TypedArray;
|
2024-03-30 11:04:21 +01:00
|
|
|
import android.graphics.drawable.Drawable;
|
2023-08-17 10:46:24 +02:00
|
|
|
import android.util.AttributeSet;
|
|
|
|
|
2023-09-01 12:55:04 +02:00
|
|
|
public class Button extends TextView {
|
2023-08-17 10:46:24 +02:00
|
|
|
|
2025-02-18 22:09:02 +01:00
|
|
|
private Drawable compoundDrawableLeft;
|
|
|
|
|
2023-08-17 10:46:24 +02:00
|
|
|
public Button(Context context) {
|
2025-02-15 21:15:56 +01:00
|
|
|
this(context, null);
|
2023-08-17 10:46:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public Button(Context context, AttributeSet attributeSet) {
|
2025-02-15 21:15:56 +01:00
|
|
|
this(context, attributeSet, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Button(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
|
|
this(context, attrs, defStyleAttr, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Button(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
|
|
super(context, attrs, defStyleAttr, defStyleRes);
|
2023-08-22 13:51:37 +02:00
|
|
|
|
2025-02-15 21:15:56 +01:00
|
|
|
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.TextView, 0, 0);
|
2023-08-22 13:51:37 +02:00
|
|
|
if (a.hasValue(com.android.internal.R.styleable.TextView_text)) {
|
|
|
|
setText(a.getText(com.android.internal.R.styleable.TextView_text));
|
|
|
|
}
|
2024-11-18 14:08:07 +01:00
|
|
|
|
|
|
|
if(getBackground() != null){
|
|
|
|
native_addClass(widget, "ATL-no-border");
|
|
|
|
}
|
2023-08-22 13:51:37 +02:00
|
|
|
a.recycle();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected native long native_constructor(Context context, AttributeSet attrs);
|
|
|
|
public native final void native_setText(long widget, String text);
|
2024-07-26 21:47:08 +02:00
|
|
|
@Override
|
|
|
|
protected native void nativeSetOnClickListener(long widget);
|
2025-02-18 22:09:02 +01:00
|
|
|
protected native void native_setCompoundDrawables(long widget, long paintable);
|
2023-08-22 13:51:37 +02:00
|
|
|
|
2023-09-01 12:55:04 +02:00
|
|
|
@Override
|
2024-02-15 21:08:13 +01:00
|
|
|
public void setText(CharSequence text) {
|
2023-08-22 13:51:37 +02:00
|
|
|
native_setText(widget, String.valueOf(text));
|
|
|
|
}
|
|
|
|
|
2024-03-16 12:49:28 +01:00
|
|
|
@Override
|
2024-08-25 11:20:01 +02:00
|
|
|
public native CharSequence getText();
|
2024-03-16 12:49:28 +01:00
|
|
|
|
2023-09-01 12:55:04 +02:00
|
|
|
@Override
|
|
|
|
public void setTextSize(float size) {}
|
|
|
|
|
2024-03-30 11:04:21 +01:00
|
|
|
@Override
|
2025-02-18 22:09:02 +01:00
|
|
|
public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom) {
|
|
|
|
compoundDrawableLeft = left;
|
|
|
|
native_setCompoundDrawables(widget, left != null ? left.paintable : 0);
|
|
|
|
}
|
2024-03-30 11:04:21 +01:00
|
|
|
|
2023-08-17 10:46:24 +02:00
|
|
|
}
|