コード例 #1
0
  @Override
  public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    Log.d("EventsFragment", "Cursor loaded " + data.getCount());

    if (getLoaderManager().getLoader(URL_LOADER).equals(loader)) {
      if (data.getCount() == 0) {
        emptyView.setVisibility(View.VISIBLE);
        recyclerView.setVisibility(View.GONE);
        emptyView.setText(R.string.no_events);
      } else {
        emptyView.setVisibility(View.GONE);
        recyclerView.setVisibility(View.VISIBLE);
        mAdapter.swapCursor(data);
      }
    }

    swipeContainer.setRefreshing(false);
  }
コード例 #2
0
 @Override
 public void onLoaderReset(Loader<Cursor> loader) {
   mAdapter.swapCursor(null);
 }