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

Is it possible to use this with mutable fragment lists with view pager 2? #58

Closed
kaushalyap opened this issue Sep 16, 2019 · 7 comments
Closed
Assignees
Labels
Milestone

Comments

@kaushalyap
Copy link

kaushalyap commented Sep 16, 2019

Is it possible to use this with mutable fragment lists with view pager 2? Does number of dots automatically get updated when we remove/add fragments?

@tommybuonomo
Copy link
Owner

Hi @kaushalyap , as long as you have a ViewPager2, you can

@kaushalyap
Copy link
Author

I thought it auto update # dots when # fragments changes, currently I set the viewpager again when # fragments changes

ex:

binding.btnNext.setOnClickListener {
            viewPagerAdapter.removeFragment(2)
            binding.dotsIndicator.setViewPager2(binding.vpHabitSteps)
} 

Can you guys make this automatic? (# dots adjust to # fragments)

@tommybuonomo
Copy link
Owner

What's inside your removeFragment () method ? Maybe you forgot to call notifyDataSetChanged inside right ?
The refresh is automatic, you don't have to set the ViewPager again if you notify your adapter that the items changed

@kaushalyap
Copy link
Author

kaushalyap commented Sep 27, 2019

@tommybuonomo

I have following

 fun removeFragment(position: Int) {
        fragmentList.removeAt(position)
        notifyItemRemoved(position)
 }

It does work(automatically update # dots) with notifyDataSetChanged, But does not work with notifyItemRemoved(position) why does it does not work with notifyItemRemoved(position)?

@kaushalyap
Copy link
Author

paging @tommybuonomo

@vkotovv
Copy link

vkotovv commented Dec 25, 2019

Related issue - #73

@tommybuonomo tommybuonomo added this to the 4.3 milestone Apr 30, 2022
@tommybuonomo tommybuonomo added bug and removed question labels Apr 30, 2022
@tommybuonomo tommybuonomo self-assigned this Apr 30, 2022
@tommybuonomo
Copy link
Owner

Hello, thanks for your contribution !
This issue is now fixed in the new version 4.3
Thanks 🔥

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

No branches or pull requests

3 participants