tommybuonomo / dotsindicator

Three material Dots Indicators for view pagers in Android !
Apache License 2.0
3.44k stars 353 forks source link

Dotsindicator not refreshed when viewpager2 change size #109

Closed bruzzers closed 2 years ago

bruzzers commented 3 years ago

Hi, we have a problem with the library when we have a view pager 2 that changes his size.

At start we have 3 items and everything is good. After that i delete the central item and i slide programmatically my view pager to the first item, but the indicator doesn't refresh. It shows two dots correctly, but when i am in the first item of the pager it doesn't show any dot selected and when i move to the Second and last item the indicator shows the first dot as selected.

The only way to return to normal situation is go back to another activity and open again the one that contains the DotsIndicator.

We have also tried with tab layout and we see that it works, so we think is a Library problem. Can you send us some instruction or make a new release for avoid this?

Thank you so much.

Matteo

xellent1 commented 3 years ago

i have the same issue. @bruzzers

xellent1 commented 3 years ago

@bruzzers you have to use 3.0.3 version. it helped me

bruzzers commented 3 years ago

Thank you, i have tried this version but i have another bug that is solved with latest release

NareshMyTeam11 commented 3 years ago

Any solution??

sanjogshrestha commented 3 years ago

With the latest version, I still have the same issue reflected in my end. Any recommended help is always welcomed.

igorka48 commented 3 years ago

This issue occurs in case of using only method onChanged from AdapterDataObserver. You also need to trigger on onItemRangeChanged, onItemRangeInserted, onItemRangeMoved methods.

I'm using workaround in my code. But it can be easily fixed on library code.

NunciosChums commented 3 years ago

my solution just temporary. Kotlin + coroutine + ListAdapter

viewModel.myList.observe(viewLifecycleOwner, {
  myListAdapter.submitList(it)

  lifecycleScope.launch {
    delay(300)
    myListAdapter.notifyDataSetChanged()
  }
})
tommybuonomo commented 2 years ago

Duplicate of #139

tommybuonomo commented 2 years ago

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