本文整理匯總了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);
}