Closed vovakatz closed 7 years ago
Hi @vovakatz! Just released an update which I believe might fix this. Let me know if you are still having issues!
@mandybess hello, I have the same problem, I use the library 'com.thoughtbot:expandablerecyclerview:1.3' and com.thoughtbot:expandablecheckrecyclerview:1.4 and and the same bug, The methods I use are:
mAdapter.setOnGroupExpandCollapseListener(new GroupExpandCollapseListener() { @Override public void onGroupExpanded(ExpandableGroup group) {
if (expandedGroup != null && !expandedGroup.equals(group) && mAdapter.isGroupExpanded(expandedGroup)){
mAdapter.toggleGroup(expandedGroup);
}
expandedGroup = group;
}
@Override
public void onGroupCollapsed(ExpandableGroup group) {
}
});
and I use a different one but the same problem, that @vovakatz
this is the other metod, i use and the same problem:
@Override public void onGroupExpanded(int positionStart, int itemCount) { if (itemCount > 0) { int groupIndex = expandableList.getUnflattenedPosition(positionStart).groupPos; notifyItemRangeInserted(positionStart, itemCount);
for (ExpandableGroup grp : mGroups) {
if (!grp.equals(mGroups.get(groupIndex))) {
Log.e("if ", String.valueOf(mGroups.get(groupIndex)));
if (this.isGroupExpanded(grp)) {
Log.e("notificacion ", String.valueOf(grp));
this.toggleGroup(grp);
this.notifyDataSetChanged();
}
}
}
}
please cand you healpme?
I needed an expandable recyclerview which allows only one group to be expanded at the time. I added the follwoing code to GenreAdapter in your sample project:
`private ExpandableGroup expandedGroup; setOnGroupExpandCollapseListener(new GroupExpandCollapseListener() { @Override public void onGroupExpanded(ExpandableGroup group) { if (expandedGroup != null){ toggleGroup(expandedGroup); } expandedGroup = group; }
It works fine when the previously expanded group is visible on the screen. If the group is off the screen, it will not collapse when calling toggleGroup on it. Unless I am doing something wrong?
Looks like there is an infinite loop: