Loading more on swipe.

This commit is contained in:
Amine 2017-11-01 19:46:13 +01:00
parent cea258bc21
commit 57177cc910

View File

@ -207,6 +207,18 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
else else
tabNewBadge.hide() tabNewBadge.hide()
val manager = recyclerView.layoutManager
val lastVisibleItem: Int = when (manager) {
is StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions(null).last()
is GridLayoutManager -> manager.findLastCompletelyVisibleItemPosition()
else -> 0
}
if (lastVisibleItem == (items.size - 1)) {
getElementsAccordingToTab(appendResults = true)
}
} catch (e: IndexOutOfBoundsException) {} } catch (e: IndexOutOfBoundsException) {}
} }