本文整理汇总了Java中in.srain.cube.views.ptr.PtrClassicFrameLayout.setPtrHandler方法的典型用法代码示例。如果您正苦于以下问题:Java PtrClassicFrameLayout.setPtrHandler方法的具体用法?Java PtrClassicFrameLayout.setPtrHandler怎么用?Java PtrClassicFrameLayout.setPtrHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类in.srain.cube.views.ptr.PtrClassicFrameLayout
的用法示例。
在下文中一共展示了PtrClassicFrameLayout.setPtrHandler方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {
tvAbout=(TextView)v.findViewById(R.id.tv_about);
tvAbout.setMovementMethod(LinkMovementMethod.getInstance());
tvAbout.setText(Html.fromHtml((getResources().getString((R.string.app_about)))));
ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
ptr.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ptr.refreshComplete();
}
}, 2000);
}
});
}
示例2: initView
import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {
ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
rvMain = (RecyclerView) v.findViewById(R.id.rv_main);
rvMain.setLayoutManager(new LinearLayoutManager(getActivity()));
ptr.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
getData();
ptr.refreshComplete();
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ptr.autoRefresh();
}
}, 100);
}
示例3: initView
import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {
gvMain = (GridView) v.findViewById(R.id.gv_main);
ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
ptr.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
getData();
ptr.refreshComplete();
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ptr.autoRefresh();
}
}, 100);
}
示例4: initView
import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {
lvMain = (ListView) v.findViewById(R.id.lv_main);
ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
ptr.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
getData();
ptr.refreshComplete();
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ptr.autoRefresh();
}
}, 100);
}
示例5: initView
import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
private void initView(View v) {
ptr = (PtrClassicFrameLayout) v.findViewById(R.id.ptr_main);
ptr.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ptr.refreshComplete();
}
}, 2000);
}
});
}
示例6: onCreate
import in.srain.cube.views.ptr.PtrClassicFrameLayout; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo_classic_ptr);
mPtrFrame = (PtrClassicFrameLayout) findViewById(R.id.ptr_frame);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycle_view);
//TODO TEST DATA
Items allList = new Items();
for (int i = 0; i < 20; i++) {
News news = new News();
news.setImgPath("http://ds.cdncache.org/avatar-50/532/164695.jpg");
news.setTitle("新闻标题" + i);
news.setDesc("新闻描述" + i);
allList.add(news);
}
mAdapter = new MultiTypeAdapter(allList);
mAdapter.register(News.class, new NewsViewBinder());
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(mAdapter);
mPtrFrame.postDelayed(new Runnable() {
@Override
public void run() {
mPtrFrame.autoRefresh();
}
}, 1000);
mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
ToastUtils.showShort("刷新了");
Observable.timer(1, TimeUnit.SECONDS)
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<Long>() {
@Override
public void accept(Long aLong) {
mPtrFrame.refreshComplete();
}
});
}
});
}