protected static void updateChildViews( Object subViews, EventBean[] newData, EventBean[] oldData) { if (subViews instanceof List) { List<View> viewList = (List<View>) subViews; ViewSupport.updateChildren(viewList, newData, oldData); } else { ((View) subViews).update(newData, oldData); } }
@Override public boolean removeView(View view) { if (!(view instanceof GroupableView)) { super.removeView(view); } boolean removed = super.removeView(view); if (!removed) { return false; } if (!hasViews()) { subViewsPerKey.clear(); return true; } GroupableView removedView = (GroupableView) view; Deque<Object> removedKeys = null; for (Map.Entry<Object, Object> entry : subViewsPerKey.entrySet()) { Object value = entry.getValue(); if (value instanceof View) { GroupableView subview = (GroupableView) value; if (compareViews(subview, removedView)) { if (removedKeys == null) { removedKeys = new ArrayDeque<Object>(); } removedKeys.add(entry.getKey()); } } else if (value instanceof List) { List<View> subviews = (List<View>) value; for (int i = 0; i < subviews.size(); i++) { GroupableView subview = (GroupableView) subviews.get(i); if (compareViews(subview, removedView)) { subviews.remove(i); if (subviews.isEmpty()) { if (removedKeys == null) { removedKeys = new ArrayDeque<Object>(); } removedKeys.add(entry.getKey()); } break; } } } } if (removedKeys != null) { for (Object key : removedKeys) { subViewsPerKey.remove(key); } } return true; }