@Test public void testRemoveChild() { mItemGroup.addChild(CHILD_1); mItemGroup.addChild(CHILD_2); mItemGroup.addChild(CHILD_3); mItemGroup.removeChild(CHILD_2); assertSame("Item at position 0 should be child1", CHILD_1, mItemGroup.getItemAt(0)); assertSame("Item at position 1 should be child3", CHILD_3, mItemGroup.getItemAt(1)); assertEquals("Should have 2 children", 2, mItemGroup.getCount()); verify(mObserver).onItemRangeRemoved(eq(mItemGroup), eq(1), eq(1)); }
public boolean removeChild(ItemHierarchy child) { final int childIndex = identityIndexOf(mChildren, child); final int childPosition = getChildPosition(childIndex); mDirty = true; if (childIndex != -1) { final int childCount = child.getCount(); mChildren.remove(childIndex); child.unregisterObserver(this); if (childCount > 0) { notifyItemRangeRemoved(childPosition, childCount); } return true; } return false; }
ItemGroup extends AbstractItemHierarchy implements ItemInflater.ItemParent,
        ItemHierarchy.Observer { public boolean removeChild(ItemHierarchy child) { final int childIndex = identityIndexOf(mChildren, child); final int childPosition = getChildPosition(childIndex); mDirty = true; if (childIndex != -1) { final int childCount = child.getCount(); mChildren.remove(childIndex); child.unregisterObserver(this); if (childCount > 0) { notifyItemRangeRemoved(childPosition, childCount); } return true; } return false; } }
ItemGroup extends AbstractItemHierarchy implements ItemInflater.ItemParent,
        ItemHierarchy.Observer { public boolean removeChild(ItemHierarchy child) { final int childIndex = identityIndexOf(mChildren, child); final int childPosition = getChildPosition(childIndex); mDirty = true; if (childIndex != -1) { final int childCount = child.getCount(); mChildren.remove(childIndex); child.unregisterObserver(this); if (childCount > 0) { notifyItemRangeRemoved(childPosition, childCount); } return true; } return false; } ItemGroup();  ItemGroup(Context context, AttributeSet attrs); }
ItemGroup extends AbstractItemHierarchy implements ItemInflater.ItemParent,
        ItemHierarchy.Observer { public boolean removeChild(ItemHierarchy child) { final int childIndex = identityIndexOf(mChildren, child); final int childPosition = getChildPosition(childIndex); mDirty = true; if (childIndex != -1) { final int childCount = child.getCount(); mChildren.remove(childIndex); child.unregisterObserver(this); if (childCount > 0) { notifyItemRangeRemoved(childPosition, childCount); } return true; } return false; } ItemGroup();  ItemGroup(Context context, AttributeSet attrs); @Override void addChild(ItemHierarchy child); boolean removeChild(ItemHierarchy child); void clear(); @Override int getCount(); @Override IItem getItemAt(int position); @Override void onChanged(ItemHierarchy hierarchy); @Override void onItemRangeChanged(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override void onItemRangeInserted(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override void onItemRangeMoved(ItemHierarchy itemHierarchy, int fromPosition, int toPosition,
            int itemCount); @Override void onItemRangeRemoved(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override ItemHierarchy findItemById(int id); }
ItemGroup extends AbstractItemHierarchy implements ItemInflater.ItemParent,
        ItemHierarchy.Observer { public boolean removeChild(ItemHierarchy child) { final int childIndex = identityIndexOf(mChildren, child); final int childPosition = getChildPosition(childIndex); mDirty = true; if (childIndex != -1) { final int childCount = child.getCount(); mChildren.remove(childIndex); child.unregisterObserver(this); if (childCount > 0) { notifyItemRangeRemoved(childPosition, childCount); } return true; } return false; } ItemGroup();  ItemGroup(Context context, AttributeSet attrs); @Override void addChild(ItemHierarchy child); boolean removeChild(ItemHierarchy child); void clear(); @Override int getCount(); @Override IItem getItemAt(int position); @Override void onChanged(ItemHierarchy hierarchy); @Override void onItemRangeChanged(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override void onItemRangeInserted(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override void onItemRangeMoved(ItemHierarchy itemHierarchy, int fromPosition, int toPosition,
            int itemCount); @Override void onItemRangeRemoved(ItemHierarchy itemHierarchy, int positionStart, int itemCount); @Override ItemHierarchy findItemById(int id);  }