luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

How to close a session in Expandable Session #135

Closed Punamasawa closed 5 years ago

Punamasawa commented 6 years ago

How to close a session in Expandable Session

douglasalipio commented 5 years ago

It makes the session closed sectionAdapter.notifyDataSetChanged();

headerHolder.rootView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    expanded = !expanded;
                    headerHolder.imgArrow.setImageResource(
                            expanded ? R.drawable.ic_keyboard_arrow_up_black_18dp : R.drawable.ic_keyboard_arrow_down_black_18dp
                    );
                    sectionAdapter.notifyDataSetChanged(); // close the session
                }
            });
luizgrp commented 5 years ago

you can also find the solution in example 4