當前位置: 首頁>>代碼示例>>Java>>正文


Java SwipeRefreshLayout.OnRefreshListener方法代碼示例

本文整理匯總了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);
            }
        }
    });
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:SwipeRefreshHelper.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:UltimateRecyclerView.java

示例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();
}
 
開發者ID:rome753,項目名稱:OneRecyclerView,代碼行數:27,代碼來源:OneRecyclerView.java

示例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();
        }
    };
}
 
開發者ID:Q115,項目名稱:Goalie_Android,代碼行數:22,代碼來源:BaseRefresherFragment.java

示例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();
        }
    };
}
 
開發者ID:TheKhaeng,項目名稱:nongbeer-mvp-android-demo,代碼行數:11,代碼來源:HistoryFragment.java

示例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);
        }
    };
}
 
開發者ID:soramitsu,項目名稱:iroha-demo-android,代碼行數:9,代碼來源:WalletPresenter.java

示例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);
    }
}
 
開發者ID:LApptelier,項目名稱:SmartRecyclerView,代碼行數:12,代碼來源:SmartRecyclerView.java

示例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);
            }
        }
    };
}
 
開發者ID:wulkanowy,項目名稱:wulkanowy,代碼行數:15,代碼來源:AbstractFragment.java

示例9: onRefreshListener

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
protected SwipeRefreshLayout.OnRefreshListener onRefreshListener() {
    return null;
}
 
開發者ID:harrylefit,項目名稱:eazycore,代碼行數:4,代碼來源:BaseMainWithDataFragment.java

示例10: setOnRefreshListener

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
  this.onRefreshListener = onRefreshListener;
  applyRefreshListener();
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:5,代碼來源:ContactSelectionListFragment.java

示例11: setRefreshListener

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
public void setRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
        if (onRefreshListener != null) {
                mSwipeRefreshLayout.setOnRefreshListener(onRefreshListener);
        }
}
 
開發者ID:HelloChenJinJun,項目名稱:TestChat,代碼行數:6,代碼來源:MultiFuncRecyclerView.java

示例12: onSwipeToRefresh

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
private SwipeRefreshLayout.OnRefreshListener onSwipeToRefresh() {
    return () -> {
        viewModel.getHeroes(true);
        hideRefreshing();
    };
}
 
開發者ID:akexorcist,項目名稱:Repository-ArchComponents,代碼行數:7,代碼來源:HeroActivity.java

示例13: setOnRefreshListener

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
public void setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener onRefreshListener) {
  this.swipeRefresh.setOnRefreshListener(onRefreshListener);
}
 
開發者ID:CableIM,項目名稱:Cable-Android,代碼行數:4,代碼來源:ContactSelectionListFragment.java

示例14: TimelineReceiver

import android.support.v4.widget.SwipeRefreshLayout; //導入方法依賴的package包/類
public TimelineReceiver(AdapterItemRemover adapter,
                        SwipeRefreshLayout.OnRefreshListener refreshListener) {
    super();
    this.adapter = adapter;
    this.refreshListener = refreshListener;
}
 
開發者ID:Vavassor,項目名稱:Tusky,代碼行數:7,代碼來源:TimelineReceiver.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:SwipeRefreshListFragment.java


注:本文中的android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。