title: SwipeRefreshLayout doesn't refresh on swipe when list size is zero
body: <p>I am using SwipeRefreshLayout for my recyclerview.I am showing data in recyclerview by making an api call and i am calling that api on swipe refresh.The issue I am having is that if list size is zero than swipe refresh is not working.I want to make api call on swipe refresh even when list size is zero so that list gets updated if any new data is there.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v4.widget.SwipeRefreshLayout
          android:id="@+id/swiperefresh"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;android.support.v7.widget.RecyclerView
              android:id="@+id/datalist"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/homebackground"
              android:clipToPadding="false"
  
              android:paddingBottom="8dp"
  
              /&gt;
  
  
  
      &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  
      &lt;TextView
          android:id="@+id/tvNoData"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:text="No orders yet"
          android:textSize="20sp"
          android:visibility="gone" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>   swiperefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
              @Override
              public void onRefresh() {
                  callLoginApi();
              }
          });
   private void callLoginApi() {
  
      APICALL(in, new Callback&lt;Orssaf&gt;() {
              @Override
              public void success(Result&lt;Orssaf&gt; result) {
                  swiperefresh.setRefreshing(false);
  
                  }
              }
              @Override
              public void failure(TwitterException e) {
  
                  swiperefresh.setRefreshing(false);
              }
          });
      }
  </code></pre>
  
  <p>Adapter</p>
  
  <pre><code>public class OrderHistoryAdapter extends RecyclerView.Adapter&lt;OrderHistoryAdapter.MyViewHolder&gt; {
      private Context mContext;
      private ArrayList&lt;OrderDetailsData&gt; orders;
      public OrderHistoryAdapter(Context context, ArrayList&lt;OrderDetailsData&gt; order) {
          mContext = context;
          orders = order;
      }
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View itemView = LayoutInflater.from(parent.getContext())
                  .inflate(R.layout.item_foodvitecurrentorder, parent, false);
          return new MyViewHolder(itemView);
      }
      @Override
      public void onBindViewHolder(MyViewHolder holder, int position) {
          OrderDetailsData order = orders.get(position);
          Picasso.with(mContext).load(order.getSenderImage()).placeholder(R.drawable.profile_img).transform(new CircleTransform()).into(holder.profileimage);
          holder.itemscount.setText("dfg"));
          holder.pricecount.setText("$fsdf"));
          holder.ordertime.setText("sdgsdg");
          holder.message.setText("greg");
  
          }
      }
      @Override
      public int getItemCount() {
          return orders.size();
      }
      public class MyViewHolder extends RecyclerView.ViewHolder {
          private CircularImageView profileimage;
          private TextView status, message, itemscount, pricecount, ordertime
          public MyViewHolder(View itemView) {
              super(itemView);
              profileimage = (CircularImageView) itemView.findViewById(R.id.profileimage);
              status = (TextView) itemView.findViewById(R.id.status);
              message = (TextView) itemView.findViewById(R.id.message);
              itemscount = (TextView) itemView.findViewById(R.id.itemscount);
              pricecount = (TextView) itemView.findViewById(R.id.pricecount);
              ordertime = (TextView) itemView.findViewById(R.id.ordertime);
  
          }
      }
  }
  </code></pre>
  
  <p>UPDATED according to answer..</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;android.support.v4.widget.SwipeRefreshLayout
          android:id="@+id/swiperefresh"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
  
          &lt;android.foodviteseller.co.foodviteseller.views.RecyclerViewEmptySupport
              android:id="@+id/datalist"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/homebackground"
              android:clipToPadding="false"
  
              android:paddingBottom="8dp"
  
              /&gt;
          &lt;TextView
              android:id="@+id/emptyView"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_centerInParent="true"
              android:text="EmptyList"
              android:textSize="20sp"
              android:visibility="gone" /&gt;
  
          &lt;!--&lt;include layout="@layout/no_data_layout" /&gt;--&gt;
  
      &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  
      &lt;TextView
          android:id="@+id/tvNoData"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerInParent="true"
          android:text="No orders yet"
          android:textSize="20sp"
          android:visibility="gone" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Code</p>
  
  <pre><code>  datalist = (RecyclerViewEmptySupport) v.findViewById(R.id.datalist);
  
   private void callLoginApi() {
  
      APICALL(in, new Callback&lt;Orssaf&gt;() {
              @Override
              public void success(Result&lt;Orssaf&gt; result) {
                  swiperefresh.setRefreshing(false);
                if (orders.size() &gt; 0) {
      orderAdapter = new OrderHistoryAdapter(mContext, orders);
      datalist.setAdapter(orderAdapter);
  } else {
      emptyView.setVisibility(View.VISIBLE);
     datalist.setEmptyView(emptyView);
      tvNoData.setVisibility(View.VISIBLE);
      tvNoData.setText("No orders yet");
  }
  
                  }
              }
              @Override
              public void failure(TwitterException e) {
  
                  swiperefresh.setRefreshing(false);
              }
          });
      }
  </code></pre>