remove View.haveComplexMeasure as it is redundant with haveCustomMeasure

Makes haveCustomMeasure true by default. And disable it for widgets
which previously set haveComplexMeasure
This commit is contained in:
Julian Winkler
2024-03-12 18:19:43 +01:00
parent c0bc875c11
commit f852c2bbc9
9 changed files with 13 additions and 17 deletions

View File

@@ -813,8 +813,7 @@ public class View extends Object {
private boolean layoutRequested = true;
private int oldWidth;
private int oldHeight;
private boolean haveCustomMeasure;
protected boolean haveComplexMeasure = false;
protected boolean haveCustomMeasure = true;
private int visibility = View.VISIBLE;
private float alpha = 1.0f;
@@ -936,7 +935,7 @@ public class View extends Object {
* We decide between simple widgets which handles MEASURE_SPEC_AT_MOST the same way as
* MEASURE_SPEC_EXACTLY, and complex widgets which handles MEASURE_SPEC_AT_MOST by measuring the content
*/
protected native void native_measure(long widget, int widthMeasureSpec, int heightMeasureSpec, boolean isComplex);
protected native void native_measure(long widget, int widthMeasureSpec, int heightMeasureSpec);
protected native void native_layout(long widget, int l, int t, int r, int b);
protected native void native_requestLayout(long widget);
protected native void native_setBackgroundDrawable(long widget, long paintable);
@@ -976,7 +975,7 @@ public class View extends Object {
if (haveCustomMeasure) // calling native_measure here would create infinite loop
setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec), getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec));
else
native_measure(widget, widthMeasureSpec, heightMeasureSpec, haveComplexMeasure);
native_measure(widget, widthMeasureSpec, heightMeasureSpec);
}
public void setPressed(boolean pressed) {

View File

@@ -27,7 +27,6 @@ public class ViewGroup extends View implements ViewParent, ViewManager {
super(context, attrs, defStyleAttr);
children = new ArrayList<View>();
haveComplexMeasure = true;
}
public void addView(View child) {

View File

@@ -27,7 +27,7 @@ public class ImageView extends View {
public ImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
haveComplexMeasure = true;
haveCustomMeasure = false;
if (attrs != null) {
int resid = attrs.getAttributeResourceValue("http://schemas.android.com/apk/res/android", "src", 0);
if (resid != 0 && !getResources().getString(resid).endsWith(".xml")) {

View File

@@ -14,7 +14,7 @@ public class ProgressBar extends View {
public ProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
haveComplexMeasure = true;
haveCustomMeasure = false;
TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ProgressBar, defStyle, 0);
setIndeterminate(a.getBoolean(com.android.internal.R.styleable.ProgressBar_indeterminate, false));
a.recycle();

View File

@@ -8,12 +8,12 @@ public class Space extends View {
public Space(Context context) {
super(context);
haveComplexMeasure = true;
haveCustomMeasure = false;
}
public Space(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
haveComplexMeasure = true;
haveCustomMeasure = false;
}
}

View File

@@ -60,7 +60,7 @@ public class TextView extends View {
}
} catch(java.lang.Exception e) { System.out.println("exception while inflating TextView:"); e.printStackTrace(); }
a.recycle();
haveComplexMeasure = true;
haveCustomMeasure = false;
}
@Override