Git Product home page Git Product logo

Comments (14)

mandybess avatar mandybess commented on August 20, 2024 4

Hiya! Here is one solution:

    private ExpandableGroup expandedGroup;
    
    adapter.setOnGroupExpandCollapseListener(new GroupExpandCollapseListener() {
      @Override
      public void onGroupExpanded(ExpandableGroup group) {
        if (expandedGroup != null) {
          adapter.toggleGroup(expandedGroup);
        }
        expandedGroup = group;
      }

      @Override
      public void onGroupCollapsed(ExpandableGroup group) {

      }
    });

from expandable-recycler-view.

yelamansa avatar yelamansa commented on August 20, 2024

@ashwini-pandarkat1993 Did you get a solution?

from expandable-recycler-view.

yelamansa avatar yelamansa commented on August 20, 2024

from expandable-recycler-view.

JayattamaPrusty avatar JayattamaPrusty commented on August 20, 2024

what should be written in adapter.toggleGroup(expandedGroup).
As only integer value can be invoked into toggleGroup(int flatPos).
how to get the position of an expanded group.

from expandable-recycler-view.

mandybess avatar mandybess commented on August 20, 2024

@JayattamaPrusty there is also a method to pass an ExpandableGroup into toggleGroup()

https://github.com/thoughtbot/expandable-recycler-view/blob/master/expandablerecyclerview/src/main/java/com/thoughtbot/expandablerecyclerview/ExpandableRecyclerViewAdapter.java#L185

from expandable-recycler-view.

JayattamaPrusty avatar JayattamaPrusty commented on August 20, 2024

@mandybess its not working for me.here i m facing a problem that when i expand one group,if i try to expand another group,its not expanding.after collapsing first group also no other groups not working.

from expandable-recycler-view.

JayattamaPrusty avatar JayattamaPrusty commented on August 20, 2024

how to add onclicklistener on child item?

from expandable-recycler-view.

rahulyadav7001 avatar rahulyadav7001 commented on August 20, 2024

Hi @mandybess,
This code is working for me,but after adding this code in setOnGroupExpandCollapseListener method I'm getting crass after clicking two three time of any items.
Please help me.

from expandable-recycler-view.

 avatar commented on August 20, 2024

@rahulyadav7001 change line to: if (expandedGroup != null && !expandedGroup.equals(group)) {

from expandable-recycler-view.

kukamanga avatar kukamanga commented on August 20, 2024

@rahulyadav7001 This should solve your problem:

private ExpandableGroup mLastExpandedGroup ;
@OverRide public void onGroupExpanded(ExpandableGroup group) {
if (mLastExpandedGroup != null
&& !mLastExpandedGroup.equals(group)
&& adapter.isGroupExpanded(mLastExpandedGroup)) {
adapter.toggleGroup(mLastExpandedGroup);
}
mLastExpandedGroup = group;
}

from expandable-recycler-view.

bobcripps avatar bobcripps commented on August 20, 2024

I too want to be able to close an expanded group automatically when another one is opened.
I'm probably missing something here but I've implemented the onGroupExpanded() listener in the Activity in the sample in ExpandActivity and it works but the rotation of the up down arrow is done in the GenreViewHolder hence the group is collapsed correctly but I don't know how to get the GenreViewHolder to rotate the arrow. There appears to be no way to link the ExpandableGroup to the GenreViewHolder.
adapter.setOnGroupExpandCollapseListener(new GroupExpandCollapseListener() {
@OverRide
public void onGroupExpanded(ExpandableGroup group) {

    if (expandedGroup != null
            && !expandedGroup.equals(group)
            && adapter.isGroupExpanded(expandedGroup)) {
      adapter.toggleGroup(expandedGroup);
    }
    expandedGroup = group;
  }

from expandable-recycler-view.

shwetantmohapatra avatar shwetantmohapatra commented on August 20, 2024

can some one help me with this

from expandable-recycler-view.

pavelsust avatar pavelsust commented on August 20, 2024

@mandybess its not working for me.here i m facing a problem that when i expand one group,if i try to expand another group,its not expanding.after collapsing first group also no other groups not working.

ya i am facing this issue too

from expandable-recycler-view.

RealDavid avatar RealDavid commented on August 20, 2024

Best solution.

`
private ExpandableGroup expandedGroup;

productAdapter.setOnGroupExpandCollapseListener(new GroupExpandCollapseListener() {
    @Override
    public void onGroupExpanded(ExpandableGroup group) {
        if (expandedGroup != null) {
            productAdapter.toggleGroup(expandedGroup);
        }
        expandedGroup = group;
    }

    @Override
    public void onGroupCollapsed(ExpandableGroup group) {
        expandedGroup=null;
    }
});

expandableRecyclerView.setAdapter(productAdapter);

}`

from expandable-recycler-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.