提交 059086be 编写于 作者: T Takeshi Hagikura

Suppress the creation of the boolean array in the every onMeasure method

to reduce the frequency of GC.

Change-Id: If96c13d4931d4416eff74cb0c945553e648db49e
上级 ddeeadc7
......@@ -31,6 +31,7 @@ import android.widget.RelativeLayout;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
......@@ -258,8 +259,9 @@ public class FlexboxLayout extends ViewGroup {
if (isOrderChangedFromLastMeasurement()) {
mReorderedIndices = createReorderedIndices();
}
// TODO: Move the object allocation to other methods instead of onMeasure
mChildrenFrozen = new boolean[getChildCount()];
if (mChildrenFrozen == null || mChildrenFrozen.length < getChildCount()) {
mChildrenFrozen = new boolean[getChildCount()];
}
// TODO: Only calculate the children views which are affected from the last measure.
......@@ -276,6 +278,8 @@ public class FlexboxLayout extends ViewGroup {
throw new IllegalStateException(
"Invalid value for the flex direction is set: " + mFlexDirection);
}
Arrays.fill(mChildrenFrozen, false);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册