本文整理汇总了Java中android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener方法的典型用法代码示例。如果您正苦于以下问题:Java SwipeRefreshLayout.OnRefreshListener方法的具体用法?Java SwipeRefreshLayout.OnRefreshListener怎么用?Java SwipeRefreshLayout.OnRefreshListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.widget.SwipeRefreshLayout
的用法示例。
在下文中一共展示了SwipeRefreshLayout.OnRefreshListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
* 初始化,关联AppBarLayout,处理滑动冲突
* @param refreshLayout
* @param appBar
* @param listener
*/
public static void init(final SwipeRefreshLayout refreshLayout, AppBarLayout appBar, 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);
appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (verticalOffset >= 0) {
refreshLayout.setEnabled(true);
} else {
refreshLayout.setEnabled(false);
}
}
});
}
示例2: setDefaultOnRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
* Set the listener when refresh is triggered and enable the SwipeRefreshLayout
*
* @param listener SwipeRefreshLayout
*/
public void setDefaultOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
mSwipeRefreshLayout.setEnabled(true);
if (defaultSwipeToDismissColors != null && defaultSwipeToDismissColors.length > 0) {
mSwipeRefreshLayout.setColorSchemeColors(defaultSwipeToDismissColors);
} else {
mSwipeRefreshLayout.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);
}
mSwipeRefreshLayout.setOnRefreshListener(listener);
}
示例3: init
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
* 初始化方法,传入需要的接口实现类
* @param onRefreshListener 下拉刷新接口
* @param onLoadMoreListener 加载更多接口
* @param onCreateVHListeners 创建ViewHolder接口
*/
public void init(SwipeRefreshLayout.OnRefreshListener onRefreshListener, OneLoadingLayout.OnLoadMoreListener onLoadMoreListener, OnCreateVHListener<S>... onCreateVHListeners){
if(onRefreshListener != null) {
this.onRefreshListener = onRefreshListener;
}else{
swipeRefreshLayout.setEnabled(false);
}
List<OnCreateVHListener<S>> listeners = new ArrayList<>();
listeners.addAll(Arrays.asList(onCreateVHListeners));
if(onLoadMoreListener != null) {
this.onLoadMoreListener = onLoadMoreListener;
adapter = new OneAdapter<>(listeners, oneLoadingLayout);
}else{
adapter = new OneAdapter<>(listeners);
}
recyclerView.setAdapter(adapter);
onRefresh();
}
示例4: onRefresherRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
protected SwipeRefreshLayout.OnRefreshListener onRefresherRefreshListener() {
return new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
RESTSync sm = new RESTSync(UserHelper.getInstance().getOwnerProfile().username,
PreferenceHelper.getInstance().getLastSyncedTimeEpoch());
sm.setListener(new RESTSync.Listener() {
@Override
public void onSuccess() {
syncComplete(true, "");
}
@Override
public void onFailure(String errMsg) {
syncComplete(false, errMsg);
}
});
sm.execute();
}
};
}
示例5: onPullRefresh
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@NonNull
private SwipeRefreshLayout.OnRefreshListener onPullRefresh(){
return new SwipeRefreshLayout.OnRefreshListener(){
@Override
public void onRefresh(){
getPresenter().setHistoryItemGroup( null );
getPresenter().requestHistory();
}
};
}
示例6: onSwipeRefresh
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
public SwipeRefreshLayout.OnRefreshListener onSwipeRefresh() {
return new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
refreshHandler.postDelayed(transactionRunnable, 1500);
}
};
}
示例7: setRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
* Set the RecyclerView' SwipeRefreshListener
*
* @param listener the RecyclerView' SwipeRefreshListener
*/
public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
if (mSwipeLayout != null) {
mSwipeLayout.setEnabled(true);
mSwipeLayout.setOnRefreshListener(listener);
}
}
示例8: getDefaultRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
@NonNull
private SwipeRefreshLayout.OnRefreshListener getDefaultRefreshListener() {
return new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
if (NetworkUtils.isOnline(getContext())) {
new RefreshTask(AbstractFragment.this).execute();
} else {
Toast.makeText(getContext(), R.string.noInternet_text, Toast.LENGTH_SHORT).show();
swipeRefreshLayout.setRefreshing(false);
}
}
};
}
示例9: onRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
protected SwipeRefreshLayout.OnRefreshListener onRefreshListener() {
return null;
}
示例10: setOnRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
this.onRefreshListener = onRefreshListener;
applyRefreshListener();
}
示例11: setRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
if (onRefreshListener != null) {
mSwipeRefreshLayout.setOnRefreshListener(onRefreshListener);
}
}
示例12: onSwipeToRefresh
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
private SwipeRefreshLayout.OnRefreshListener onSwipeToRefresh() {
return () -> {
viewModel.getHeroes(true);
hideRefreshing();
};
}
示例13: setOnRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
this.swipeRefresh.setOnRefreshListener(onRefreshListener);
}
示例14: TimelineReceiver
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
public TimelineReceiver(AdapterItemRemover adapter,
SwipeRefreshLayout.OnRefreshListener refreshListener) {
super();
this.adapter = adapter;
this.refreshListener = refreshListener;
}
示例15: setOnRefreshListener
import android.support.v4.widget.SwipeRefreshLayout; //导入方法依赖的package包/类
/**
* Set the {@link android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener} to listen for
* initiated refreshes.
*
* @see android.support.v4.widget.SwipeRefreshLayout#setOnRefreshListener(android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener)
*/
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) {
mSwipeRefreshLayout.setOnRefreshListener(listener);
}