Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Commit 0d6ecc5

Browse files
kunall17niftynei
authored andcommitted
Only allow 1 stream to be expanded
1 parent 0c0d7ce commit 0d6ecc5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

app/src/main/java/com/zulip/android/activities/ZulipActivity.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,12 +660,19 @@ public boolean onChildClick(ExpandableListView parent, View v, int groupPosition
660660
}
661661
});
662662
streamsDrawer.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
663+
int previousClick = -1;
664+
663665
@Override
664-
public boolean onGroupClick(ExpandableListView expandableListView, View view, int i, long l) {
666+
public boolean onGroupClick(ExpandableListView expandableListView, View view, int position, long l) {
665667
String streamName = ((TextView) view.findViewById(R.id.name)).getText().toString();
666668
doNarrow(new NarrowFilterStream(streamName, null));
667669
drawerLayout.openDrawer(GravityCompat.START);
668-
return false; //false is necessary to expand/collapse the group
670+
if (previousClick != -1 && expandableListView.getCount() > previousClick) {
671+
expandableListView.collapseGroup(previousClick);
672+
}
673+
expandableListView.expandGroup(position);
674+
previousClick = position;
675+
return true;
669676
}
670677
});
671678
streamsDrawerAdapter.setViewBinder(new SimpleCursorTreeAdapter.ViewBinder() {

0 commit comments

Comments
 (0)