ImageButton: implement setDrawable()

This commit is contained in:
Julian Winkler 2024-03-24 16:55:04 +01:00
parent 93b88ad0c3
commit 35f26faa90
4 changed files with 20 additions and 0 deletions

View file

@ -21,6 +21,8 @@ public class ImageButton extends ImageView {
protected native long native_constructor(Context context, AttributeSet attrs);
@Override
protected native void native_setPixbuf(long pixbuf);
@Override
protected native void native_setDrawable(long widget, long paintable);
protected native void native_setOnClickListener(long widget, OnClickListener l);
@Override

View file

@ -33,6 +33,8 @@ public class ImageView extends View {
if (resid != 0 && !getResources().getString(resid).endsWith(".xml")) {
bitmap = BitmapFactory.decodeResource(getResources(), resid);
native_setPixbuf(bitmap.pixbuf);
} else if (resid != 0) {
setImageDrawable(getResources().getDrawable(resid));
}
}
}