h6ah4i / android-advancedrecyclerview

RecyclerView extension library which provides advanced features. (ex. Google's Inbox app like swiping, Play Music app like drag and drop sorting)
https://advancedrecyclerview.h6ah4i.com/
Apache License 2.0
5.32k stars 860 forks source link

Problem with collapseAll() method #494

Open StePiasentin opened 4 years ago

StePiasentin commented 4 years ago

Hi, Your library is awesome and I find it really useful, but I have a problem when collapsing items. I want to keep only one group expanded at a time, so when I click to expand a group, I collapse all the others.

Here is the method I call when i click the expand or collapse button:

private void handleOnClickGroupItemContainerView(int groupPosition) {
        if (isGroupExpanded(groupPosition)) {
            mExpandableItemManager.collapseGroup(groupPosition);
            mGroupViewHolder.mIndicator.setImageResource(R.drawable.ic_arrow_down);
            mGroupViewHolder.itemView.setPadding(0, 0, 0, 50);
        } else {
            mExpandableItemManager.collapseAll();
            mExpandableItemManager.expandGroup(groupPosition);
            mGroupViewHolder.mIndicator.setImageResource(R.drawable.ic_arrow_up);
            mGroupViewHolder.itemView.setPadding(0, 0, 0, -25);
        }
    }

The problem is that I have graphic elements (a button image and a padding) that I want to be different when expanded or collapsed in my groups, and when i perform this method only current group items change, all the other groups collapse without changing their view items. How can I notify to other groups to change their aspect based on what happens?

Thanks