title: Recyclerview addOnScrollListener issue
body: <p>Here's my function that detect end off <code>RecyclerView</code> that will be use in pagination later.</p>
  
  <pre><code>private fun setOnScrollListener(categoryRecyclerView: RecyclerView, categoryPresenter: EntertainmentPresenter){
      categoryRecyclerView.addOnScrollListener(object: RecyclerView.OnScrollListener(){
  
          override fun onScrolled(recyclerView: RecyclerView?, dx: Int, dy: Int) {
              super.onScrolled(recyclerView, dx, dy)
              val totalItemCount:Int = categoryLayoutManager.itemCount
              val firstVisibleItemPosition:Int = categoryLayoutManager.findFirstVisibleItemPosition()
              val visibleItemCount:Int
              val lastVisibleItemPosition: Int = categoryLayoutManager.findLastVisibleItemPosition()
  
              visibleItemCount = lastVisibleItemPosition - firstVisibleItemPosition
  
              Log.e("q", lastVisibleItemPosition.toString())
              Log.e("q", dy.toString())
  
              if (loading) {
                  if (totalItemCount &gt; previousTotal) {
                      loading = false
                      previousTotal = totalItemCount
                  }
              }
  
              if (!loading &amp;&amp; totalItemCount - visibleItemCount  &lt;= firstVisibleItemPosition) {
                   Log.e("q", lastVisibleItemPosition.toString())
                  loading = true
              }
          }
      })
  }
  </code></pre>
  
  <p>I used it before on <code>RecyclerView</code> that has linear <code>LayoutManger</code> and every thing was great.</p>
  
  <p>But when I used it with <code>RecyclerView</code> that has <code>GridLayoutManager</code>, things got weird.</p>
  
  <ol>
  <li>It implemented only once and doesn't work when i scroll.</li>
  <li>Last visible item position return <code>totalItemCount-1</code>.</li>
  </ol>
  
  <p>Last thing: this I call this function in <code>onCreate</code> and I tried it with <code>RecyclerView</code> that has <code>linear layout manager</code> and everything was great</p>
  
  <p>Here's my logcat,</p>
  
  <pre><code>2018-10-06 06:10:15.919 11033-11033/com.example.karem.moviesdatabase E/q: 0  
  2018-10-06 06:10:15.919 11033-11033/com.example.karem.moviesdatabase E/q: 18
  </code></pre>
  
  <p>It only called once and nothing happen when I scroll.</p>