本文整理汇总了Java中in.srain.cube.views.ptr.PtrDefaultHandler类的典型用法代码示例。如果您正苦于以下问题:Java PtrDefaultHandler类的具体用法?Java PtrDefaultHandler怎么用?Java PtrDefaultHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PtrDefaultHandler类属于in.srain.cube.views.ptr包,在下文中一共展示了PtrDefaultHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initRefresh
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
private void initRefresh() {
mPtrClassicFrameLayout.disableWhenHorizontalMove(true);
mPtrClassicFrameLayout.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(final PtrFrameLayout frame) {
frame.postDelayed(new Runnable() {
@Override
public void run() {
frame.refreshComplete();
}
}, DELAY_MILLS);
}
});
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mRecyclerView.setAdapter(new MyFocusAdapter(getContext(), MyFocusData.getSampleData()));
}
示例2: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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);
}
});
}
示例3: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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);
}
示例4: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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);
}
示例5: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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);
}
示例6: onCreate
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ptrFrameLayout = (PtrFrameLayout) findViewById(R.id.main_ptr);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.main_recycler_view);
//noinspection ConstantConditions
recyclerView.setLayoutManager(new LinearLayoutManager(this));
List<HeaderDisplay> displayList = createHeaderDisplayList();
recyclerView.setAdapter(new HeaderAdapter(displayList));
//emulate data request
ptrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
ptrFrameLayout.postDelayed(mCompleteRefresh, 3000);
}
});
}
示例7: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void initView(View rootView) {
mPtrFrameLayout = (PtrFrameLayout) rootView.findViewById(R.id.ptr_frame_ultra);
PtrClassicDefaultHeader header = new PtrClassicDefaultHeader(getContext());
mPtrFrameLayout.addPtrUIHandler(header);
mPtrFrameLayout.setHeaderView(header);
mPtrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
frame.postDelayed(new Runnable() {
@Override
public void run() {
mPtrFrameLayout.refreshComplete();
}
}, 2000);
}
});
}
示例8: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void initView(View rootView) {
mPtrFrameLayout = (PtrFrameLayout) rootView.findViewById(R.id.ptr_frame_ultra);
ListView listView = (ListView) rootView.findViewById(R.id.lv_ultra);
mArrayAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1, getData());
listView.setAdapter(mArrayAdapter);
PtrClassicDefaultHeader header = new PtrClassicDefaultHeader(getContext());
mPtrFrameLayout.addPtrUIHandler(header);
mPtrFrameLayout.setHeaderView(header);
mPtrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
frame.postDelayed(new Runnable() {
@Override
public void run() {
mPtrFrameLayout.refreshComplete();
}
}, 2000);
}
});
}
示例9: onCreate
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tmall);
// findView
mPullUpTmly = (TmallRefreshLayout) findViewById(R.id.tmly_pull_up);
// 设置刷新监听
mPullUpTmly.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
// 刷新操作
if (mHandler != null)
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
// 刷新完毕
if (mPullUpTmly != null)
mPullUpTmly.refreshComplete();
}
}, 1500);
}
});
}
示例10: onCreate
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_jd);
// findView
mPullUpJdly = (JdRefreshLayout) findViewById(R.id.jdly_pull_up);
// 设置刷新监听
mPullUpJdly.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
// 刷新操作
if (mHandler != null)
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
// 刷新完毕
if (mPullUpJdly != null)
mPullUpJdly.refreshComplete();
}
}, 1500);
}
});
}
示例11: onCreateView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.currency_list_fragment, container, false);
ButterKnife.inject(this, view);
new DbListLoader().execute();
mPullToRefresh.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout ptrFrameLayout) {
fetchNewSupportedCurrencies();
}
});
mListView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
mListView.setOnItemClickListener(this);
return view;
}
示例12: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
private void initView() {
initData();
linearLayoutManager = new LinearLayoutManager(this);
recyclerViewAdapter = new RecyclerViewAdapter();
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.setAdapter(recyclerViewAdapter);
ptrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
ptrFrame.refreshComplete();
}
});
recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener() {
@Override
public void onLoadMore() {
recyclerViewAdapter.setLoadMore(true);
new Timer().schedule(new TimerTask() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
initData();
recyclerViewAdapter.setLoadMore(false);
}
});
}
}, 1000);
}
});
}
示例13: onCreate
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo_header_load_more);
mPtrFrame = findViewById(R.id.arad_content);
mRecycleView = findViewById(R.id.recycle_view);
items.add(new DemoHeader(mPresenter.getTopImageList()));
items.addAll(mPresenter.getList());
mAdapter = new MultiTypeAdapter(items);
mAdapter.register(DemoHeader.class, new HeaderViewBinder());
mAdapter.register(News.class, new NewsViewBinder());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
mRecycleView.setLayoutManager(linearLayoutManager);
mRecycleView.setAdapter(new LoadMoreAdapterWrapper(this, mAdapter, mPresenter));
mPresenter.loadDataFirst();
mRecycleView.addOnScrollListener(new EndlessRecyclerOnScrollListener(linearLayoutManager, mPresenter) {
@Override
public void onLoadMore() {
mPresenter.loadDataNext();
}
});
mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
mPresenter.loadDataFirst();
}
});
}
示例14: onCreate
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo_load_more);
//初始化view
mPtrFrame = findViewById(R.id.arad_content);
mRecycleView = findViewById(R.id.recycle_view);
//定义recycle view 样式
mAdapter = new MultiTypeAdapter(mPresenter.getList());
mAdapter.register(News.class, new NewsViewBinder());
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
mRecycleView.setLayoutManager(linearLayoutManager);
mRecycleView.setAdapter(new LoadMoreAdapterWrapper(this, mAdapter, mPresenter));
//上拉监听
mRecycleView.addOnScrollListener(new EndlessRecyclerOnScrollListener(linearLayoutManager, mPresenter) {
@Override
public void onLoadMore() {
mPresenter.loadDataNext();
}
});
//下拉刷新监听
mPtrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
mPresenter.loadDataFirst();
}
});
mPresenter.loadDataFirst();
}
示例15: initView
import in.srain.cube.views.ptr.PtrDefaultHandler; //导入依赖的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);
}
});
}