Coder Social home page Coder Social logo

Comments (8)

florent37 avatar florent37 commented on May 18, 2024 1

pseudo code :

 public final static class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.RecyclerHolder> {

        private final List<Object> list = new ArrayList<>();

        private final ExpansionLayoutCollection expansionsCollection = new ExpansionLayoutCollection();

        public RecyclerAdapter(){
        	expansionsCollection.openOnlyOne(true);
        }

        @Override
        public RecyclerHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            return RecyclerHolder.buildFor(parent);
        }

        @Override
        public void onBindViewHolder(RecyclerHolder holder, int position) {
            holder.bind(list.get(position));

            expansionsCollection.add(holder.getExpansionLayout());
        }

        @Override
        public int getItemCount() {
            return list.size();
        }

        public void setItems(List<Object> items) {
            this.list.addAll(items);
            notifyDataSetChanged();
        }

        public final static class RecyclerHolder extends RecyclerView.ViewHolder {

            private static final int LAYOUT = R.layout.recycler_cell;

            @BindView(R.id.expansion)
            ExpansionLayout expansionLayout;

            public static RecyclerHolder buildFor(ViewGroup viewGroup){
                   return new RecyclerHolder(LayoutInflater.from(viewGroup.getContext()).inflate(LAYOUT, viewGroup, false));
             }

            public RecyclerHolder(View itemView) {
                super(itemView);
                ButterKnife.bind(this, itemView);
            }

            public void bind(Object object){

            }

            public ExpansionLayout getExpansionLayout(){
            	return expansionLayout;
            }
        }
    }

from expansionpanel.

florent37 avatar florent37 commented on May 18, 2024 1

I updated my sample

from expansionpanel.

florent37 avatar florent37 commented on May 18, 2024

you can do it with the ExpansionLayoutCollection ? didn't try
save the ExpansionLayoutCollection object into your recycler and add in it the ExpansionLayouts from viewholder

from expansionpanel.

tellfa avatar tellfa commented on May 18, 2024

can you send to me code?
i download your project and test on it. can you edit your code for this feature know?
please, because i really need your library with this feature know
pleaseee

from expansionpanel.

tellfa avatar tellfa commented on May 18, 2024

hey my friend i wait for your answer , because now need this feature in project

from expansionpanel.

florent37 avatar florent37 commented on May 18, 2024

haven't tested

from expansionpanel.

florent37 avatar florent37 commented on May 18, 2024

If it does not work, you can make a pull request to fix it ;)

from expansionpanel.

tellfa avatar tellfa commented on May 18, 2024

wow! it's woooooooooork 💋 💋 ❤️ thanks my friend for your great libraries ❤️

from expansionpanel.

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.