romandanylyk / PageIndicatorView

An page indicator for Android ViewPager
4.63k stars 564 forks source link

Bug in setCount(int count) #74

Open sikrinick opened 6 years ago

sikrinick commented 6 years ago

I have 2 fragments per screen in FragmentPagerAdapter. Currently, I am having 4 fragments at all, 2 per screen and one swipe move only to next fragment, making it look like 3 screens. Therefore, I need to have 3 indicator dots. Obviously, I have to do setCount(int count), as library by default will use number of fragments in adapter. Although, it is impossible to have 3 of them due to check in setCount(int count).

public void setCount(int count) {
        if (this.count != count) {
...

In initCountAttribute, there is next code:

        if (count != COUNT_NOT_SET) {
            isCountSet = true;
        } else {
            count = DEFAULT_CIRCLES_COUNT;
        }

Where, int DEFAULT_CIRCLES_COUNT = 3. In summary, this doesn't allow to set number of indicator dots as 3, and therefore, to forbid library to automatically set number of indicator dots, based on ViewPager, if number of fragments in ViewPager is different.

jemshit commented 6 years ago

maybe app:piv_dynamicCount="false" in xml so pagerindicator does not use size of viewpager adapter