本文整理了Java中android.support.v4.widget.SwipeRefreshLayout.setOnRefreshListener()
方法的一些代码示例,展示了SwipeRefreshLayout.setOnRefreshListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SwipeRefreshLayout.setOnRefreshListener()
方法的具体详情如下:
包路径:android.support.v4.widget.SwipeRefreshLayout
类名称:SwipeRefreshLayout
方法名:setOnRefreshListener
[英]Set the listener to be notified when a refresh is triggered via the swipe gesture.
[中]将监听器设置为在通过滑动手势触发刷新时收到通知。
代码示例来源:origin: cymcsg/UltimateAndroid
/**
* Set the listener when refresh is triggered and enable the SwipeRefreshLayout
*
* @param listener
*/
public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
mSwipeRefreshLayout.setEnabled(true);
mSwipeRefreshLayout.setOnRefreshListener(listener);
}
代码示例来源:origin: Rukey7/MvpApp
/**
* 初始化
* @param refreshLayout
* @param listener
*/
public static void init(SwipeRefreshLayout refreshLayout, SwipeRefreshLayout.OnRefreshListener listener) {
refreshLayout.setColorSchemeResources(android.R.color.holo_blue_bright,
android.R.color.holo_green_light,
android.R.color.holo_orange_light,
android.R.color.holo_red_light);
refreshLayout.setOnRefreshListener(listener);
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setOnRefreshListener(OnRefreshListener listener) {
this.listener = listener;
Shadow.directlyOn(realObject, SwipeRefreshLayout.class).setOnRefreshListener(listener);
}
代码示例来源: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: iMeiji/Toutiao
@Override
protected void initView(View view) {
recyclerView = view.findViewById(R.id.recycler_view);
recyclerView.setHasFixedSize(true);
swipeRefreshLayout = view.findViewById(R.id.refresh_layout);
swipeRefreshLayout.setColorSchemeColors(SettingUtil.getInstance().getColor());
swipeRefreshLayout.setOnRefreshListener(this);
}
代码示例来源:origin: smuyyh/BookReader
@Override
public void configViews() {
refreshLayout.setOnRefreshListener(new RefreshListener());
mRecyclerView.setHasFixedSize(true);
linearLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(linearLayoutManager);
mRecyclerView.addItemDecoration(new SupportDividerItemDecoration(mContext, LinearLayoutManager.VERTICAL));
mAdapter = new BooksByTagAdapter(mContext, mList, this);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(new RefreshListener());
mPresenter.attachView(this);
mPresenter.getBooksByTag(tag, current + "", (current + 10) + "");
}
代码示例来源: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: pockethub/PocketHub
@Override
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
swipeLayout.setOnRefreshListener(this);
swipeLayout.setColorSchemeResources(
R.color.pager_title_background_top_start,
R.color.pager_title_background_end,
R.color.text_link,
R.color.pager_title_background_end);
configureList(getRecyclerView());
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
public void initRefreshLayout() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefreshLayout.post(() -> {
mIsRefreshing = true;
mSwipeRefreshLayout.setRefreshing(true);
loadData();
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
mIsRefreshing = true;
topicCenters.clear();
loadData();
});
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
protected void initRefreshLayout() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefreshLayout.post(() -> {
mSwipeRefreshLayout.setRefreshing(true);
mIsRefreshing = true;
loadData();
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
mIsRefreshing = true;
originalRanks.clear();
loadData();
});
}
代码示例来源:origin: nanchen2251/RxJava2Examples
@Override
protected void init() {
fillData();
OperatorsAdapter adapter = new OperatorsAdapter(data) {
@Override
public void onItemClick(int position) {
itemClick(position);
}
};
adapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
mRefreshLayout.setColorSchemeColors(Color.RED, Color.BLUE, Color.GREEN);
mRefreshLayout.setOnRefreshListener(this);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL));
mRecyclerView.setAdapter(adapter);
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
public void initRefreshLayout() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefreshLayout.post(() -> {
mSwipeRefreshLayout.setRefreshing(true);
loadData();
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
pageNum = 1;
mIsRefreshing = true;
activityCenters.clear();
mEndlessRecyclerOnScrollListener.refresh();
loadData();
});
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
public void initRefreshLayout() {
mRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mRecyclerView.post(() -> {
mRefreshLayout.setRefreshing(true);
mIsRefreshing = true;
loadData();
});
mRefreshLayout.setOnRefreshListener(() -> {
clearData();
loadData();
});
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
protected void initRefreshLayout() {
mRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mRecyclerView.post(() -> {
mRefreshLayout.setRefreshing(true);
mIsRefreshing = true;
loadData();
});
mRefreshLayout.setOnRefreshListener(() -> {
clearData();
loadData();
});
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
protected void initRefreshLayout() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefreshLayout.post(() -> {
mSwipeRefreshLayout.setRefreshing(true);
mIsRefreshing = true;
loadData();
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
clearData();
loadData();
});
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
protected void initRefreshLayout() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefreshLayout.post(() -> {
mSwipeRefreshLayout.setRefreshing(true);
mIsRefreshing = true;
loadData();
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
clearData();
loadData();
});
}
代码示例来源:origin: HotBitmapGG/bilibili-android-client
@Override
protected void initRefreshLayout() {
mSwipeRefreshLayout.setColorSchemeResources(R.color.colorPrimary);
mSwipeRefreshLayout.post(() -> {
mSwipeRefreshLayout.setRefreshing(true);
mIsRefreshing = true;
loadData();
});
mSwipeRefreshLayout.setOnRefreshListener(() -> {
clearData();
loadData();
});
}
代码示例来源:origin: robolectric/robolectric
@Test
public void getOnRefreshListener_shouldReturnTheListener() {
final OnRefreshListener listener = mock(OnRefreshListener.class);
final SwipeRefreshLayout layout = new SwipeRefreshLayout(RuntimeEnvironment.application);
layout.setOnRefreshListener(listener);
assertThat(shadowOf(layout).getOnRefreshListener()).isSameAs(listener);
}
}
代码示例来源:origin: yanzhenjie/NoHttp
public NormalView(Activity activity, Contract.NormalPresenter presenter) {
super(activity, presenter);
mRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
getPresenter().refresh();
}
});
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
int color = ContextCompat.getColor(getContext(), R.color.line_color);
int size = DisplayUtils.dip2px(1);
mRecyclerView.addItemDecoration(new DefaultItemDecoration(color, 0, size));
mRecyclerView.useDefaultLoadMore();
mRecyclerView.setLoadMoreListener(new SwipeMenuRecyclerView.LoadMoreListener() {
@Override
public void onLoadMore() {
getPresenter().loadMore();
}
});
mAdapter = new MainAdapter(getContext());
mRecyclerView.setAdapter(mAdapter);
}
内容来源于网络,如有侵权,请联系作者删除!