Skip to content

Commit

Permalink
encapsulate and protect
Browse files Browse the repository at this point in the history
  • Loading branch information
mtotschnig committed May 17, 2020
1 parent 9294ffb commit 6a3fcbc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,24 @@
*/
class ExpandableStickyListHeadersAdapter extends BaseAdapter implements StickyListHeadersAdapter {

protected final StickyListHeadersAdapter mInnerAdapter;
DualHashMap<View,Long> mViewToItemIdMap = new DualHashMap<View, Long>();
DistinctMultiHashMap<Integer,View> mHeaderIdToViewMap = new DistinctMultiHashMap<Integer, View>();
List<Long> mCollapseHeaderIds = new ArrayList<>();
final StickyListHeadersAdapter mInnerAdapter;
private DualHashMap<View,Long> mViewToItemIdMap = new DualHashMap<>();
private DistinctMultiHashMap<Integer,View> mHeaderIdToViewMap = new DistinctMultiHashMap<>();

private List<Long> mCollapseHeaderIds = new ArrayList<>();

ExpandableStickyListHeadersAdapter(StickyListHeadersAdapter innerAdapter){
this.mInnerAdapter = innerAdapter;
}

public List<Long> getCollapseHeaderIds() {
return mCollapseHeaderIds;
}

public void setCollapseHeaderIds(List<Long> collapseHeaderIds) {
this.mCollapseHeaderIds = new ArrayList<>(collapseHeaderIds);
}

@Override
public View getHeaderView(int position, View convertView, ViewGroup parent) {
return mInnerAdapter.getHeaderView(position,convertView,parent);
Expand Down Expand Up @@ -110,7 +119,7 @@ public boolean isHeaderCollapsed(long headerId){

public void expand(long headerId) {
if(isHeaderCollapsed(headerId)){
mCollapseHeaderIds.remove((Object) headerId);
mCollapseHeaderIds.remove(headerId);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public boolean isHeaderCollapsed(long headerId){
}

public List<Long> getCollapsedHeaderIds() {
return mExpandableStickyListHeadersAdapter.mCollapseHeaderIds;
return mExpandableStickyListHeadersAdapter.getCollapseHeaderIds();
}

public void setCollapsedHeaderIds(List<Long> collapsedHeaderIds ) {
mExpandableStickyListHeadersAdapter.mCollapseHeaderIds = collapsedHeaderIds;
mExpandableStickyListHeadersAdapter.setCollapseHeaderIds(collapsedHeaderIds);
}

public void setAnimExecutor(IAnimationExecutor animExecutor) {
Expand Down

0 comments on commit 6a3fcbc

Please sign in to comment.