Fixed version update.

This commit is contained in:
Amine 2018-09-25 20:56:25 +02:00
parent 377c5518f7
commit 2be872e61e

View File

@ -114,7 +114,7 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
private lateinit var appColors: AppColors private lateinit var appColors: AppColors
private var offset: Int = 0 private var offset: Int = 0
private var firstVisible: Int = 0 private var firstVisible: Int = 0
private var recyclerViewScrollListener: RecyclerView.OnScrollListener? = null private lateinit var recyclerViewScrollListener: RecyclerView.OnScrollListener
private lateinit var settings: SharedPreferences private lateinit var settings: SharedPreferences
private var recyclerAdapter: RecyclerView.Adapter<*>? = null private var recyclerAdapter: RecyclerView.Adapter<*>? = null
@ -209,8 +209,8 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
) { ) {
override fun getSwipeDirs( override fun getSwipeDirs(
recyclerView: RecyclerView?, recyclerView: RecyclerView,
viewHolder: RecyclerView.ViewHolder? viewHolder: RecyclerView.ViewHolder
): Int = ): Int =
if (elementsShown != UNREAD_SHOWN) { if (elementsShown != UNREAD_SHOWN) {
0 0
@ -805,22 +805,20 @@ class HomeActivity : AppCompatActivity(), SearchView.OnQueryTextListener {
} }
private fun handleInfiniteScroll() { private fun handleInfiniteScroll() {
if (recyclerViewScrollListener == null) { recyclerViewScrollListener = object : RecyclerView.OnScrollListener() {
recyclerViewScrollListener = object : RecyclerView.OnScrollListener() { override fun onScrolled(localRecycler: RecyclerView, dx: Int, dy: Int) {
override fun onScrolled(localRecycler: RecyclerView?, dx: Int, dy: Int) { if (localRecycler != null && dy > 0) {
if (localRecycler != null && dy > 0) { val manager = recyclerView.layoutManager
val manager = recyclerView.layoutManager val lastVisibleItem: Int = when (manager) {
val lastVisibleItem: Int = when (manager) { is StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions(
is StaggeredGridLayoutManager -> manager.findLastCompletelyVisibleItemPositions( null
null ).last()
).last() is GridLayoutManager -> manager.findLastCompletelyVisibleItemPosition()
is GridLayoutManager -> manager.findLastCompletelyVisibleItemPosition() else -> 0
else -> 0 }
}
if (lastVisibleItem == (items.size - 1) && items.size < maxItemNumber()) { if (lastVisibleItem == (items.size - 1) && items.size < maxItemNumber()) {
getElementsAccordingToTab(appendResults = true) getElementsAccordingToTab(appendResults = true)
}
} }
} }
} }