From 77ace2ef69c54acdbbff62cc34e8487fc3c2f165 Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Thu, 11 Oct 2012 14:26:21 -0700 Subject: [PATCH] Revert "Fixed group and child view caching in SimpleExpandableListAdapter." This reverts commit b49e4d63d1976b673b4763bc012d152833609688. This produced problems with app compatibility. The boolean array introduced in this patch is never resized and can cause applications expecting different behavior to crash with index out of bounds exceptions. This looks like a good path but it will need to be revisted later. Bug 7221618 --- .../widget/SimpleExpandableListAdapter.java | 52 ---------------------- 1 file changed, 52 deletions(-) diff --git a/core/java/android/widget/SimpleExpandableListAdapter.java b/core/java/android/widget/SimpleExpandableListAdapter.java index f514374c4559..015c169f74b5 100644 --- a/core/java/android/widget/SimpleExpandableListAdapter.java +++ b/core/java/android/widget/SimpleExpandableListAdapter.java @@ -38,8 +38,6 @@ import java.util.Map; */ public class SimpleExpandableListAdapter extends BaseExpandableListAdapter { private List> mGroupData; - // Keeps track of if a group is currently expanded or not - private boolean[] mIsGroupExpanded; private int mExpandedGroupLayout; private int mCollapsedGroupLayout; private String[] mGroupFrom; @@ -198,8 +196,6 @@ public class SimpleExpandableListAdapter extends BaseExpandableListAdapter { int childLayout, int lastChildLayout, String[] childFrom, int[] childTo) { mGroupData = groupData; - // Initially all groups are not expanded - mIsGroupExpanded = new boolean[groupData.size()]; mExpandedGroupLayout = expandedGroupLayout; mCollapsedGroupLayout = collapsedGroupLayout; mGroupFrom = groupFrom; @@ -302,52 +298,4 @@ public class SimpleExpandableListAdapter extends BaseExpandableListAdapter { return true; } - /** - * {@inheritDoc} - * @return 1 for the last child in a group, 0 for the other children. - */ - @Override - public int getChildType(int groupPosition, int childPosition) { - final int childrenInGroup = getChildrenCount(groupPosition); - return childPosition == childrenInGroup - 1 ? 1 : 0; - } - - /** - * {@inheritDoc} - * @return 2, one type for the last child in a group, one for the other children. - */ - @Override - public int getChildTypeCount() { - return 2; - } - - /** - * {@inheritDoc} - * @return 1 for an expanded group view, 0 for a collapsed one. - */ - @Override - public int getGroupType(int groupPosition) { - return mIsGroupExpanded[groupPosition] ? 1 : 0; - } - - /** - * {@inheritDoc} - * @return 2, one for a collapsed group view, one for an expanded one. - */ - @Override - public int getGroupTypeCount() { - return 2; - } - - /** {@inheritDoc} */ - @Override - public void onGroupCollapsed(int groupPosition) { - mIsGroupExpanded[groupPosition] = false; - } - - /** {@inheritDoc} */ - @Override - public void onGroupExpanded(int groupPosition) { - mIsGroupExpanded[groupPosition] = true; - } } -- 2.11.0