Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 649a7b0

Browse files
author
wanjian
committed
no message
1 parent 02e3803 commit 649a7b0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎lib/src/main/java/com/wanjian/view/ExpandableAdapter.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,29 @@ int getSafeChildCount(int groupIndex) {
2121
}
2222

2323
public void collapseGroup(int groupIndex) {
24+
if (groupIndex < 0 || groupIndex >= getSafeGroupCount()) {
25+
return;
26+
}
2427
if (isExpanded(groupIndex)) {
2528
notifyChildItemRangeRemoved(groupIndex, 0, getSafeChildCount(groupIndex));
2629
isCollapsed.set(groupIndex);
2730
}
2831
}
2932

3033
public void expandGroup(int groupIndex) {
34+
if (groupIndex < 0 || groupIndex >= getSafeGroupCount()) {
35+
return;
36+
}
3137
if (isExpanded(groupIndex) == false) {
3238
isCollapsed.clear(groupIndex);
3339
notifyChildItemRangeInserted(groupIndex, 0, getSafeChildCount(groupIndex));
3440
}
3541
}
3642

3743
public boolean isExpanded(int groupIndex) {
44+
if (groupIndex < 0 || groupIndex >= getSafeGroupCount()) {
45+
return false;
46+
}
3847
return !isCollapsed.get(groupIndex);
3948
}
4049

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /