@Override
  public RecyclerView.OnScrollListener getScrollListener() {
    if (scrollListener == null) {
      EndlessScrollListener endlessScrollListener = new EndlessScrollListener(layoutManager);
      endlessScrollListener.setOnLoadMoreDataListener(this);
      scrollListener = endlessScrollListener;
    }

    return scrollListener;
  }
Beispiel #2
0
  @Override
  @SuppressWarnings("unchecked")
  public void onPostExecute(Object... result) {
    isRefreshing = false;
    if (isAttached) {
      swipeRefreshLayout.setRefreshing(false);
      adapter.setLoadingData(false);
      if (result != null && result.length > 0) {

        if (adapter != null) {
          if (offset == 0) {
            cryptoCustomerCommunityInformationList.clear();
            cryptoCustomerCommunityInformationList.addAll((ArrayList) result[0]);
            adapter.changeDataSet(cryptoCustomerCommunityInformationList);
            ((EndlessScrollListener) scrollListener).notifyDataSetChanged();
          } else {
            cryptoCustomerCommunityInformationList.addAll((ArrayList) result[0]);
            adapter.notifyItemRangeInserted(
                offset, cryptoCustomerCommunityInformationList.size() - 1);
            adapter.notifyDataSetChanged();
          }
        }
      }
    }

    showOrHideEmptyView();
  }
  @Override
  public void onPostExecute(Object... result) {

    isRefreshing = false;
    if (isAttached) {
      swipeRefreshLayout.setRefreshing(false);
      adapter.setLoadingData(false);
      if (result != null && result.length > 0) {

        if (adapter != null) {
          if (offset == 0) {
            lstIntraUserInformations.clear();
            lstIntraUserInformations.addAll((ArrayList) result[0]);
            adapter.changeDataSet(lstIntraUserInformations);
            ((EndlessScrollListener) scrollListener).notifyDataSetChanged();
          } else {
            lstIntraUserInformations.addAll((ArrayList) result[0]);
            adapter.notifyItemRangeInserted(offset, lstIntraUserInformations.size() - 1);
          }

          if (lstIntraUserInformations != null) {
            if (lstIntraUserInformations.isEmpty()) {
              showEmpty(true, emptyView);
              showEmpty(false, searchEmptyView);
            } else {

              showEmpty(false, emptyView);
              showEmpty(false, searchEmptyView);
            }
          } else {

            showEmpty(false, emptyView);
            showEmpty(false, searchEmptyView);
          }
        }
      }
    }
  }