INNER CODE UNIT · Kotlin

lastPageIndex

tommybuonomo/dotsindicator · viewpagerdotsindicator/src/main/kotlin/com/tbuonomo/viewpagerdotsindicator/OnPageChangeListenerHelper.kt:11

        val lastPageIndex = (pageCount - 1).toFloat()
        if (offset == lastPageIndex) {
            offset = lastPageIndex - .0001f
        }
        val leftPosition = offset.toInt()
        val rightPosition = leftPosition + 1

        if (rightPosition > lastPageIndex || leftPosition < 0) {
            return
        }

        onPageScrolled(leftPosition, rightPosition, offset % 1)

        if (lastLeftPosition != -1) {
            if (leftPosition > lastLeftPosition) {
                (lastLeftPosition until leftPosition).forEach {
                    resetPosition(it)
                }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…