本文整理汇总了Java中com.scwang.smartrefresh.layout.SmartRefreshLayout.setOnRefreshListener方法的典型用法代码示例。如果您正苦于以下问题:Java SmartRefreshLayout.setOnRefreshListener方法的具体用法?Java SmartRefreshLayout.setOnRefreshListener怎么用?Java SmartRefreshLayout.setOnRefreshListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.scwang.smartrefresh.layout.SmartRefreshLayout
的用法示例。
在下文中一共展示了SmartRefreshLayout.setOnRefreshListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import com.scwang.smartrefresh.layout.SmartRefreshLayout; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
final SmartRefreshLayout mSmartRefreshLayout= (SmartRefreshLayout) this.mSmartRefreshWebLayout.getLayout();
final WebView mWebView=this.mSmartRefreshWebLayout.getWeb();
mSmartRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
mAgentWeb.getLoader().reload();
mSmartRefreshLayout.postDelayed(new Runnable() {
@Override
public void run() {
mSmartRefreshLayout.finishRefresh();
}
},2000);
}
});
mSmartRefreshLayout.autoRefresh();
}
示例2: initViews
import com.scwang.smartrefresh.layout.SmartRefreshLayout; //导入方法依赖的package包/类
@Override
protected void initViews() {
mRefreshLayout = (SmartRefreshLayout) findViewById(R.id.id_refresh_layout);
mRecyclerView = (RecyclerView) findViewById(R.id.id_recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
mRefreshLayout.setOnRefreshListener(this);
mRefreshLayout.setOnLoadmoreListener(this);
mRefreshLayout.autoRefresh(0);
}
示例3: onCreateView
import com.scwang.smartrefresh.layout.SmartRefreshLayout; //导入方法依赖的package包/类
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_hot_topic, container, false);
// http://sapandiwakar.in/pull-to-refresh-for-android-recyclerview-or-any-other-vertically-scrolling-view/
// pull to refresh for android recyclerview
mRefreshLayout = (SmartRefreshLayout) rootView;
mRefreshLayout.setEnableLoadmore(false);
mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override public void onRefresh(RefreshLayout refreshLayout) {
RefreshGuidanceFromWWW();
}
});
// http://blog.csdn.net/lmj623565791/article/details/45059587
// 你想要控制Item间的间隔(可绘制),请通过ItemDecoration
// 你想要控制Item增删的动画,请通过ItemAnimator
// 你想要控制点击、长按事件,请自己写
// item被按下的时候的highlight,这个是通过guidance item的backgroun属性来实现的 (android:background="@drawable/recyclerview_item_bg")
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.guidance_recycler_view);
// Set the adapter
if (mRecyclerView != null) {
mRecyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), LinearLayoutManager.VERTICAL, 0));
Context context = rootView.getContext();
mRecyclerView.setLayoutManager(new WrapContentLinearLayoutManager(context));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.setAdapter(new HotTopicRecyclerViewAdapter(TopicListContent.HOT_TOPICS, mListener));
}
getActivity().setTitle(SMTHApplication.App_Title_Prefix + "首页导读");
if (TopicListContent.HOT_TOPICS.size() == 0) {
RefreshGuidance();
}
return rootView;
}