Android-Pagination-with-RecyclerView icon indicating copy to clipboard operation
Android-Pagination-with-RecyclerView copied to clipboard

Issue when remove Loading would remove a list item

Open bhapps opened this issue 5 years ago • 0 comments

I had issue when remove Loading would remove a list item at index 0, my fix was to check for item type is indeed LOADING holder by checking in the if statement in the removeLoadingFooter() function using

&& getItemViewType(position) == LOADING

sorry code is in Kotlin as I am using Kotlin ..

fun removeLoadingFooter() {
        isLoadingAdded = false
        val position = loadingFooterLastPosition
        val result = getItem(position)
        if (result != null && getItemViewType(position) == LOADING) {
            CamerasModel!!.removeAt(position)
            notifyItemRemoved(position)
        }
    }

bhapps avatar Apr 04 '20 08:04 bhapps