Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9414b041 authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "expandGroup can now animate"

parents e526cfb4 63f46e71
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -24013,6 +24013,7 @@ package android.widget {
    ctor public ExpandableListView(android.content.Context, android.util.AttributeSet, int);
    method public boolean collapseGroup(int);
    method public boolean expandGroup(int);
    method public boolean expandGroup(int, boolean);
    method public android.widget.ExpandableListAdapter getExpandableListAdapter();
    method public long getExpandableListPosition(int);
    method public int getFlatListPosition(long);
+25 −2
Original line number Diff line number Diff line
@@ -599,12 +599,35 @@ public class ExpandableListView extends ListView {
     *         was already expanded, this will return false)
     */
    public boolean expandGroup(int groupPos) {
        boolean retValue = mConnector.expandGroup(groupPos);
       return expandGroup(groupPos, false);
    }

    /**
     * Expand a group in the grouped list view
     *
     * @param groupPos the group to be expanded
     * @param animate true if the expanding group should be animated in
     * @return True if the group was expanded, false otherwise (if the group
     *         was already expanded, this will return false)
     */
    public boolean expandGroup(int groupPos, boolean animate) {
        PositionMetadata pm = mConnector.getFlattenedPos(ExpandableListPosition.obtain(
                ExpandableListPosition.GROUP, groupPos, -1, -1));
        boolean retValue = mConnector.expandGroup(pm);

        if (mOnGroupExpandListener != null) {
            mOnGroupExpandListener.onGroupExpand(groupPos);
        }

        if (animate) {
            final int groupFlatPos = pm.position.flatListPos;

            final int shiftedGroupPosition = groupFlatPos + getHeaderViewsCount();
            smoothScrollToPosition(shiftedGroupPosition + mAdapter.getChildrenCount(groupPos),
                    shiftedGroupPosition);
        }
        pm.recycle();

        return retValue;
    }