public CSSNode removeChildAt(int i) { // Assertions.assertNotNull(mChildren); CSSNode removed = mChildren.remove(i); removed.mParent = null; dirty(); return removed; }
public void addChildAt(CSSNode child, int i) { if (child.mParent != null) { throw new IllegalStateException("Child already has a parent, it must be removed first."); } if (mChildren == null) { // 4 is kinda arbitrary, but the default of 10 seems really high for an average View. mChildren = new ArrayList<CSSNode>(4); } mChildren.add(i, child); child.mParent = this; dirty(); }
protected void dirty() { if (mLayoutState == LayoutState.DIRTY) { return; } else if (mLayoutState == LayoutState.HAS_NEW_LAYOUT) { throw new IllegalStateException( "Previous csslayout was ignored! markLayoutSeen() never called"); } mLayoutState = LayoutState.DIRTY; if (mParent != null) { mParent.dirty(); } }