android.support.v4.widget.SwipeRefreshLayout.setRefreshing()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中android.support.v4.widget.SwipeRefreshLayout.setRefreshing()方法的一些代码示例,展示了SwipeRefreshLayout.setRefreshing()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SwipeRefreshLayout.setRefreshing()方法的具体详情如下:
包路径:android.support.v4.widget.SwipeRefreshLayout
类名称:SwipeRefreshLayout
方法名:setRefreshing

SwipeRefreshLayout.setRefreshing介绍

[英]Notify the widget that refresh state has changed. Do not call this when refresh is triggered by a swipe gesture.
[中]通知小部件刷新状态已更改。当刷卡手势触发刷新时,不要调用此选项。

代码示例

代码示例来源:origin: aa112901/remusic

@Override
  protected void onPostExecute(Void aVoid) {
    if (mContext == null)
      return;
    mAdapter.notifyDataSetChanged();
    swipeRefresh.setRefreshing(false);
  }
}.execute();

代码示例来源:origin: k9mail/k-9

void progress(final boolean progress) {
  fragmentListener.enableActionBarProgress(progress);
  if (swipeRefreshLayout != null && !progress) {
    swipeRefreshLayout.setRefreshing(false);
  }
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
public void finishTask() {
  mIsRefreshing = false;
  mSwipeRefreshLayout.setRefreshing(false);
  mAdapter.notifyDataSetChanged();
}

代码示例来源:origin: rengwuxian/RxJavaSamples

@Override
  public void accept(@NonNull List<Item> items) throws Exception {
    swipeRefreshLayout.setRefreshing(false);
    adapter.setItems(items);
  }
}, new Consumer<Throwable>() {

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
protected void finishTask() {
  mSwipeRefreshLayout.setRefreshing(false);
  mAdapter.notifyDataSetChanged();
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
protected void finishTask() {
  mIsRefreshing = false;
  mSwipeRefreshLayout.setRefreshing(false);
  mAdapter.notifyDataSetChanged();
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
protected void initRefreshLayout() {
  mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
  mSwipeRefreshLayout.post(() -> {
    mSwipeRefreshLayout.setRefreshing(true);
    loadData();
  });
  mSwipeRefreshLayout.setOnRefreshListener(() -> mSwipeRefreshLayout.setRefreshing(false));
}

代码示例来源:origin: rengwuxian/RxJavaSamples

@Override
  public void accept(@NonNull Throwable throwable) throws Exception {
    throwable.printStackTrace();
    swipeRefreshLayout.setRefreshing(false);
    Toast.makeText(getActivity(), R.string.loading_failed, Toast.LENGTH_SHORT).show();
  }
});

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
  public void finishTask() {
    mSwipeRefreshLayout.setRefreshing(false);
    mLiveAppIndexAdapter.notifyDataSetChanged();
    mRecyclerView.scrollToPosition(0);
  }
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
protected void finishTask() {
  mSwipeRefreshLayout.setRefreshing(false);
  mIsRefreshing = false;
  hideEmptyView();
  initRecyclerView();
}

代码示例来源:origin: rengwuxian/RxJavaSamples

@Override
  public void accept(@NonNull List<ZhuangbiImage> images) throws Exception {
    swipeRefreshLayout.setRefreshing(false);
    adapter.setImages(images);
  }
}, new Consumer<Throwable>() {

代码示例来源:origin: pockethub/PocketHub

/**
 * Called when the data has loaded.
 *
 * @param newItems The items added to the list.
 */
protected void onDataLoaded(List<Item> newItems) {
  if (!isAdded()) {
    return;
  }
  isLoading = false;
  swipeLayout.setRefreshing(false);
  items.addAll(newItems);
  mainSection.update(items);
  showList();
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
public void initRefreshLayout() {
  mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
  mSwipeRefreshLayout.setOnRefreshListener(this::loadData);
  mSwipeRefreshLayout.post(() -> {
    mSwipeRefreshLayout.setRefreshing(true);
    loadData();
  });
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
protected void initRefreshLayout() {
  mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
  mSwipeRefreshLayout.setOnRefreshListener(this::loadData);
  mSwipeRefreshLayout.post(() -> {
    mSwipeRefreshLayout.setRefreshing(true);
    loadData();
  });
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

public void initEmptyView() {
  topLayout.setVisibility(View.GONE);
  mSwipeRefreshLayout.setRefreshing(false);
  mCustomEmptyView.setVisibility(View.VISIBLE);
  mRecyclerView.setVisibility(View.GONE);
  mCustomEmptyView.setEmptyImage(R.drawable.img_tips_error_load_error);
  mCustomEmptyView.setEmptyText("加载失败~(≧▽≦)~啦啦啦.");
  SnackbarUtil.showMessage(mRecyclerView, "数据加载失败,请重新加载或者检查网络是否链接");
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

private void initEmptyView() {
  mSwipeRefreshLayout.setRefreshing(false);
  mCustomEmptyView.setVisibility(View.VISIBLE);
  mRecyclerView.setVisibility(View.GONE);
  mCustomEmptyView.setEmptyImage(R.drawable.img_tips_error_load_error);
  mCustomEmptyView.setEmptyText("加载失败~(≧▽≦)~啦啦啦.");
  SnackbarUtil.showMessage(mRecyclerView, "数据加载失败,请重新加载或者检查网络是否链接");
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
  protected void finishTask() {
    hideEmptyView();
    mSwipeRefreshLayout.setRefreshing(false);
    mLiveAppIndexAdapter.notifyDataSetChanged();
    mRecyclerView.scrollToPosition(0);
  }
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

public void initEmptyView() {
  mSwipeRefreshLayout.setRefreshing(false);
  mCustomEmptyView.setVisibility(View.VISIBLE);
  mRecyclerView.setVisibility(View.GONE);
  mCustomEmptyView.setEmptyImage(R.drawable.img_tips_error_load_error);
  mCustomEmptyView.setEmptyText("加载失败~(≧▽≦)~啦啦啦.");
  SnackbarUtil.showMessage(mRecyclerView, "数据加载失败,请重新加载或者检查网络是否链接");
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

public void initEmptyView() {
  mSwipeRefreshLayout.setRefreshing(false);
  mCustomEmptyView.setVisibility(View.VISIBLE);
  mRecyclerView.setVisibility(View.GONE);
  mCustomEmptyView.setEmptyImage(R.drawable.img_tips_error_load_error);
  mCustomEmptyView.setEmptyText("加载失败~(≧▽≦)~啦啦啦.");
  SnackbarUtil.showMessage(mRecyclerView, "数据加载失败,请重新加载或者检查网络是否链接");
}

代码示例来源:origin: pockethub/PocketHub

protected void onDataLoadError(Throwable throwable) {
  if (!isAdded()) {
    return;
  }
  isLoading = false;
  swipeLayout.setRefreshing(false);
  if (throwable != null) {
    showError(throwable, getErrorMessage());
    showList();
  }
}

相关文章