Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hi! Can anyone help with code? #3

Open
iRYO400 opened this issue Mar 5, 2016 · 1 comment
Open

Hi! Can anyone help with code? #3

iRYO400 opened this issue Mar 5, 2016 · 1 comment

Comments

@iRYO400
Copy link

iRYO400 commented Mar 5, 2016

Can you help me with implementing it to the ViewPager's Adapter.
Here is code how I implemented basic CheckBox. RecyclerView with Multi items

@Override
    public void onBindViewHolder(final ViewHolder viewHolder, final int position) {
        final int pos = position;

        viewHolder.chkSelected.setOnCheckedChangeListener(null);
        viewHolder.chkSelected.setChecked(genreList.get(position).isSelected());
        viewHolder.chkSelected.setTag(genreList.get(position));
        viewHolder.chkSelected.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CheckBox cb = (CheckBox) v;
                Genres gr = (Genres) cb.getTag();
                tinyDB = new TinyDB(v.getContext());

                if (cb.isChecked()) {
                    gr.setSelected(cb.isChecked());
                    genreList.get(pos).setSelected(cb.isChecked());
                    cgIntegerList.add(pos);
                } else {
                    cgIntegerList.remove(Integer.valueOf(pos));
                }
            }
        });

    }

Btw, nice CB! It looks awesome!

@lguipeng
Copy link
Owner

lguipeng commented Jan 2, 2017

viewHolder.chkSelected is AnimCheckBox ? why are you setOnClickListener for viewHolder.chkSelected

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

No branches or pull requests

3 participants
@lguipeng @iRYO400 and others