Skip to content

Commit

Permalink
fix WrapperExpandableListAdapter :
Browse files Browse the repository at this point in the history
override (getChildType / getChildTypeCount) and (getGroupType /getGroupTypeCount) to make the group list and the child list could display different style layout
  • Loading branch information
walkermanx committed Dec 1, 2017
1 parent 18f63d5 commit 959c638
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,36 @@ public boolean isGroupExpanded(int groupPosition) {
final Boolean expanded = mGroupExpandedMap.get(groupPosition);
return expanded != null ? expanded : false;
}

@Override
public int getChildType(int groupPosition, int childPosition) {
if (this.mWrappedAdapter instanceof BaseExpandableListAdapter)
return ((BaseExpandableListAdapter) this.mWrappedAdapter).getChildType(groupPosition, childPosition);

return super.getChildType(groupPosition, childPosition);
}


@Override
public int getChildTypeCount() {
if (this.mWrappedAdapter instanceof BaseExpandableListAdapter)
return ((BaseExpandableListAdapter) this.mWrappedAdapter).getChildTypeCount();

return super.getChildTypeCount();
}


@Override
public int getGroupType(int groupPosition) {
if (this.mWrappedAdapter instanceof BaseExpandableListAdapter)
return ((BaseExpandableListAdapter) this.mWrappedAdapter).getGroupType(groupPosition);
return super.getGroupType(groupPosition);
}

@Override
public int getGroupTypeCount() {
if (this.mWrappedAdapter instanceof BaseExpandableListAdapter)
return ((BaseExpandableListAdapter) this.mWrappedAdapter).getGroupTypeCount();
return super.getGroupTypeCount();
}
}

0 comments on commit 959c638

Please sign in to comment.