本文整理汇总了Java中com.scwang.smartrefresh.layout.listener.OnRefreshListener类的典型用法代码示例。如果您正苦于以下问题:Java OnRefreshListener类的具体用法?Java OnRefreshListener怎么用?Java OnRefreshListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OnRefreshListener类属于com.scwang.smartrefresh.layout.listener包,在下文中一共展示了OnRefreshListener类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onViewCreated
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的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: refresh
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
private void refresh() {
swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
if(MyApp.isLogin()){
getData(PULL_REFRESH);
}else{
showToast("请先登录哦~");
mhandler.postDelayed(new Runnable() {
@Override
public void run() {
swipeRefreshLayout.finishRefresh();
}
},1000);
}
}
});
}
示例3: onCreate
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_practice_banner);
final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
final RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
mAdapter = new QuickAdapter();
recyclerView.addItemDecoration(new DividerItemDecoration(this, VERTICAL));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(mAdapter);
refreshLayout.autoRefresh();
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(final RefreshLayout refreshlayout) {
refreshlayout.getLayout().postDelayed(new Runnable() {
@Override
public void run() {
if (mAdapter.getItemCount() < 2) {
List<Movie> movies = new Gson().fromJson(JSON_MOVIES, new TypeToken<ArrayList<Movie>>() {}.getType());
mAdapter.replaceData(movies);
}
refreshlayout.finishRefresh();
}
},2000);
}
});
//添加Header
View header = LayoutInflater.from(this).inflate(R.layout.listitem_movie_header, recyclerView, false);
Banner banner = (Banner) header;
banner.setImageLoader(new GlideImageLoader());
banner.setImages(BANNER_ITEMS);
banner.start();
mAdapter.addHeaderView(banner);
//状态栏透明和间距处理
StatusBarUtil.immersive(this);
StatusBarUtil.setPaddingSmart(this, toolbar);
StatusBarUtil.setPaddingSmart(this, recyclerView);
StatusBarUtil.setMargin(this, findViewById(R.id.header));
StatusBarUtil.setPaddingSmart(this, findViewById(R.id.blurview));
}
示例4: refresh
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
private void refresh() {
swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getData(PULL_REFRESH, type);
}
});
}
示例5: refresh
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
private void refresh() {
swipeRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(RefreshLayout refreshlayout) {
getData(PULL_REFRESH);
}
});
}
示例6: onCreateView
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的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;
}
示例7: setOnRefreshListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
/**
* 单独设置刷新监听器
*/
@Override
public SmartRefreshLayout setOnRefreshListener(OnRefreshListener listener) {
this.mRefreshListener = listener;
return this;
}
示例8: onCreate
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_using_custom);
final Toolbar toolbar = (Toolbar)findViewById(R.id.toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
ListView listView = (ListView) findViewById(R.id.listview);
listView.setAdapter(mAdapter = new BaseRecyclerAdapter<Void>(simple_list_item_2) {
@Override
protected void onBindViewHolder(SmartViewHolder holder, Void model, int position) {
holder.text(android.R.id.text1, String.format(Locale.CHINA, "第%02d条数据", position));
holder.text(android.R.id.text2, String.format(Locale.CHINA, "这是测试的第%02d条数据", position));
holder.textColorId(android.R.id.text2, R.color.colorTextAssistant);
}
});
final RefreshLayout refreshLayout = (RefreshLayout) findViewById(R.id.refreshLayout);
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(final RefreshLayout refreshlayout) {
refreshlayout.getLayout().postDelayed(new Runnable() {
@Override
public void run() {
mAdapter.refresh(initData());
refreshlayout.finishRefresh();
}
}, 2000);
}
});
refreshLayout.setRefreshHeader(new ClassicsHeader(this));
refreshLayout.setHeaderHeight(60);
//触发自动刷新
if (isFirstEnter) {
isFirstEnter = false;
refreshLayout.autoRefresh();
} else {
mAdapter.refresh(initData());
}
}
示例9: setOnRefreshListener
import com.scwang.smartrefresh.layout.listener.OnRefreshListener; //导入依赖的package包/类
/**
* 单独设置刷新监听器
*/
RefreshLayout setOnRefreshListener(OnRefreshListener listener);