当前位置: 首页>>代码示例>>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;未经允许,请勿转载。