title: How to show progress bar when my list reaches the bottom recyclerview?
body: <p>I have created stmth like buggy paging library and when I reach the bottom of list I would like to show progress bar before my data will be downloaded. I think that <code>notifyItemInserted()</code> will help me bu I don't understand where I have to insert this item. I think that I have to use <code>notifyItemChanged</code> also for hiding all data fields and show progress bar at my list item. So, here is my own loading additional data when I reach the end of list:</p>
  
  <pre><code> jobLst.addOnScrollListener(object : RecyclerView.OnScrollListener() {
              override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
                  if (dy &gt; 0) {
                      val visibleItemCount = mLayoutManager.childCount
                      val totalItemCount = mLayoutManager.itemCount
                      val pastVisibleItems = mLayoutManager.findFirstVisibleItemPosition()
                      if (loading) {
                          if (visibleItemCount + pastVisibleItems &gt;= totalItemCount &amp;&amp; !recyclerView.canScrollVertically(1)) {
                   // here I would like to show loader
  
  getJobList(Integer.parseInt(Uri.parse(nextUrl).getQueryParameter("offset")), type, sp.getString("access_token", ""), filterData, true) 
                          }
                      }
                  }
              }
          })
  </code></pre>
  
  <p>and I think that I will have to change my item layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginStart="15dp"
      android:layout_marginTop="4dp"
      android:layout_marginEnd="15dp"
      android:background="@drawable/message_list_item_bg"
      android:orientation="vertical"&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginStart="10dp"
          android:layout_marginTop="5dp"
          android:layout_marginEnd="10dp"
          android:orientation="horizontal"&gt;
  
          &lt;TextView
              android:id="@+id/tv_job_title"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_weight="3.5"
              android:ellipsize="end"
              android:fontFamily="@font/opensans_semibold"
              android:singleLine="true"
              android:textColor="#333333"
              app:autoSizeMaxTextSize="20sp"
              app:autoSizeMinTextSize="8sp"
              app:autoSizeStepGranularity="2sp"
              app:autoSizeTextType="uniform" /&gt;
  
          &lt;TextView
              android:id="@+id/tv_date"
              android:layout_width="wrap_content"
              android:layout_height="match_parent"
              android:layout_weight="0.5"
              android:fontFamily="@font/opensans_semibold"
              android:gravity="end"
              android:textSize="12sp" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;TextView
          android:id="@+id/tv_address"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginStart="10dp"
          android:layout_marginTop="5dp"
          android:layout_marginEnd="10dp"
          android:ellipsize="end"
          android:fontFamily="@font/opensans_regular"
          android:gravity="center_vertical"
          android:singleLine="true"
          android:textColor="#999999"
          app:autoSizeMaxTextSize="20sp"
          app:autoSizeMinTextSize="8sp"
          app:autoSizeStepGranularity="2sp"
          app:autoSizeTextType="uniform" /&gt;
  
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginStart="10dp"
          android:layout_marginTop="5dp"
          android:layout_marginEnd="10dp"
          android:orientation="horizontal"
          tools:ignore="UseCompoundDrawables"&gt;
  
          &lt;TextView
              android:id="@+id/tv_company"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              android:layout_marginEnd="30dp"
              android:layout_weight="3.5"
              android:ellipsize="end"
              android:fontFamily="@font/opensans_regular"
              android:gravity="center_vertical"
              android:singleLine="true"
              android:textColor="#666666"
              app:autoSizeMaxTextSize="20sp"
              app:autoSizeMinTextSize="8sp"
              app:autoSizeStepGranularity="2sp"
              app:autoSizeTextType="uniform" /&gt;
  
  
          &lt;ImageView
              android:id="@+id/add_to_notepad"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:background="@drawable/add_to_notepad"
              android:gravity="end" /&gt;
  
  
          &lt;ProgressBar
              android:id="@+id/progressBar"
              android:layout_width="24dp"
              android:layout_height="24dp"
              android:gravity="end"
              android:visibility="gone" /&gt;
      &lt;/LinearLayout&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>current progressbar is already used and can't be used for this purpose. So, I will need to add and then remove one item with another view type before and after loading some new data.My main layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@color/white"
      tools:context=".jobAGENT.JobsList"&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_marginTop="75dp"
          android:gravity="center_horizontal"
          android:text="@string/no_jobs"
          android:textSize="32sp"
          android:textStyle="italic"
          android:visibility="gone" /&gt;
  
      &lt;android.support.v4.widget.SwipeRefreshLayout
          android:id="@+id/refresh_t"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_marginStart="5dp"
          android:layout_marginTop="10dp"
          android:layout_marginBottom="5dp"
          android:background="@color/white"&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/job_list_t"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_marginStart="10dp"
              android:layout_marginTop="10dp"
              android:layout_marginEnd="10dp"
              android:layout_marginBottom="10dp" /&gt;
  
  
      &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  
  
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>So, what you can advice me? </p>