Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Add an option to not set click listener on the header by default #59

Open
Peterragheb opened this issue Nov 15, 2019 · 1 comment
Open

Comments

@Peterragheb
Copy link

I wanted to keep track of the expanded item position.
Using the default expansion listener didn't work.
So I had to write my own onClickListener which was not possible because you set it by default in the header class.
I had to create my custom header to remove the clickListener and add my own clicklistener in the recyclerview adapter.
Can you also please make it that when calling .expand() or .collapse() with false as the parameter to reset the indicator without animation too.

        if (isExpanded)
            holder.binding.expansionLayout.expand(false);
        else
            holder.binding.expansionLayout.collapse(false);
        expansionsCollection.add(holder.binding.expansionLayout);
        holder.binding.ehHeader.setActivated(isExpanded);
        holder.binding.ehHeader.setHeaderRotationCollapsed(0);
        holder.binding.ehHeader.setHeaderRotationExpanded(180);
        holder.binding.ehHeader.setOnClickListener(v -> {
            if (isEnabled){
                mExpandedPosition = isExpanded ? -1: position;
                holder.binding.expansionLayout.toggle(true);
            }
        });
@mattcrwi
Copy link

I also was looking for a way to set a custom click handler on the header. I ended up setting it in .doOnAttach because the default is set in onAttach and mine would be set after.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants