android/view/View: clean up retrieval of id

This commit is contained in:
Mis012
2024-03-07 15:48:53 +01:00
parent 7207587b2f
commit 4e3b180dd7

View File

@@ -834,13 +834,8 @@ public class View extends Object {
widget = native_constructor(context, attrs);
if (attrs != null) {
int id = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "id", 0);
if (id != 0) {
this.id = id;
}
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.View, defStyle, 0);
this.id = a.getResourceId(com.android.internal.R.styleable.View_id, View.NO_ID);
if (a.hasValue(com.android.internal.R.styleable.View_background)) {
Drawable background = a.getDrawable(com.android.internal.R.styleable.View_background);