architecture-samples icon indicating copy to clipboard operation
architecture-samples copied to clipboard

Create ScrollChildSwipeRefreshLayout

Open Poojadk1710 opened this issue 4 years ago • 0 comments

//This is incase if the scrollup doesn't work

fun scrollChild(view: ScrollChildSwipeRefreshLayout? , availfirstItem : Int, availItemCount: Int, totalItemCount:Int){

//If total item count is zero then it should reset back to initial state var firstAvailItem = firstAvailItem

if (totalItemCount < scrollUpChild){ this.currentPage = this.startingPageIndex this.scrollUpChild = totalItemCount if(totalItemCount = =0){ this.loading = true }

//If its loading check the count has changed or not and we can finish loading and update the current page no and total item count } var loading var currentPage if (loading && totalItemCount > previousTotalItemCount){ loading = false scrollUpChild = totalItemCount currentPage++ }

var reverse if(reverse){ firstAvailItem = totalItemCount - firstAvailItem } var onLoad if(!loading && totalItemCount - availItemCount <= firstAvialItem + canChildScrollUp){ ScrollChildSwipeRefreshLayout(currentPage + 1, totalItemCount) loading = true } }

Poojadk1710 avatar Aug 31 '21 07:08 Poojadk1710