use of in.srain.cube.views.ptr.PtrClassicFrameLayout in project android-Ultra-Pull-To-Refresh by liaohuqiu.
the class WithTextViewInFrameLayoutFragment method createView.
@Override
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHeaderTitle(R.string.ptr_demo_block_frame_layout);
final View contentView = inflater.inflate(R.layout.fragment_classic_header_with_viewgroup, container, false);
final PtrClassicFrameLayout ptrFrame = (PtrClassicFrameLayout) contentView.findViewById(R.id.fragment_rotate_header_with_view_group_frame);
ptrFrame.setPtrHandler(new PtrHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
frame.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrame.refreshComplete();
}
}, 1800);
}
@Override
public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
return true;
}
});
ptrFrame.setLastUpdateTimeRelateObject(this);
// the following are default settings
ptrFrame.setResistance(1.7f);
ptrFrame.setRatioOfHeaderHeightToRefresh(1.2f);
ptrFrame.setDurationToClose(200);
ptrFrame.setDurationToCloseHeader(1000);
// default is false
ptrFrame.setPullToRefresh(false);
// default is true
ptrFrame.setKeepHeaderWhenRefresh(true);
// scroll then refresh
// comment in base fragment
ptrFrame.postDelayed(new Runnable() {
@Override
public void run() {
// ptrFrame.autoRefresh();
}
}, 150);
setupViews(ptrFrame);
return contentView;
}
use of in.srain.cube.views.ptr.PtrClassicFrameLayout in project android-Ultra-Pull-To-Refresh by liaohuqiu.
the class EvenOnlyATextView method createView.
public View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHeaderTitle(R.string.ptr_demo_block_only_text_view);
final View contentView = inflater.inflate(R.layout.fragment_classic_header_with_textview, container, false);
final PtrClassicFrameLayout ptrFrame = (PtrClassicFrameLayout) contentView.findViewById(R.id.fragment_rotate_header_with_text_view_frame);
ptrFrame.setLastUpdateTimeRelateObject(this);
ptrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
frame.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrame.refreshComplete();
}
}, 1500);
}
@Override
public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
return true;
}
});
return contentView;
}
use of in.srain.cube.views.ptr.PtrClassicFrameLayout in project MVCHelper by LuckyJayce.
the class UltraActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ultra);
/*
* 配置PtrClassicFrameLayout的刷新样式
*/
PtrClassicFrameLayout mPtrFrameLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
final MaterialHeader header = new MaterialHeader(this);
header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
header.setPadding(0, dipToPix(this, 15), 0, dipToPix(this, 10));
header.setPtrFrameLayout(mPtrFrameLayout);
mPtrFrameLayout.setLoadingMinTime(800);
mPtrFrameLayout.setDurationToCloseHeader(800);
mPtrFrameLayout.setHeaderView(header);
mPtrFrameLayout.addPtrUIHandler(header);
mvcHelper = new MVCUltraHelper<List<Book>>(mPtrFrameLayout);
// 设置数据源
mvcHelper.setDataSource(new BooksDataSource());
// 设置适配器
mvcHelper.setAdapter(new BooksAdapter(this));
// 加载数据
mvcHelper.refresh();
}
use of in.srain.cube.views.ptr.PtrClassicFrameLayout in project MVCHelper by LuckyJayce.
the class UltraRecyclerViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ultrarecyclerview);
PtrClassicFrameLayout mPtrFrameLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
mvcHelper = new MVCUltraHelper<>(mPtrFrameLayout);
// 设置数据源
mvcHelper.setDataSource(new BooksDataSource());
// 设置适配器
mvcHelper.setAdapter(new ReBooksAdapter(this));
// 加载数据
mvcHelper.refresh();
}
use of in.srain.cube.views.ptr.PtrClassicFrameLayout in project MVCHelper by LuckyJayce.
the class ListTaskActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_ultrarecyclerview);
PtrClassicFrameLayout mPtrFrameLayout = (PtrClassicFrameLayout) findViewById(R.id.rotate_header_list_view_frame);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
taskHelper = new TaskHelper<>(new MemoryCacheStore(200));
// 注册全局的task执行回调
taskHelper.registerCallBack(new ICallback<MovieAmount>() {
@Override
public void onPreExecute(Object task) {
Log.d("pppp", "task:" + task);
}
@Override
public void onProgress(Object task, int percent, long current, long total, Object extraData) {
}
@Override
public void onPostExecute(Object task, Code code, Exception exception, MovieAmount movieAmount) {
Log.d("pppp", "task:" + task + " code:" + code);
}
});
mvcHelper = new MVCUltraHelper<>(mPtrFrameLayout);
// 设置数据源
mvcHelper.setDataSource(new MoviesDataSource());
// 设置适配器
mvcHelper.setAdapter(new MoviesAdapter(taskHelper));
// 加载数据
mvcHelper.refresh();
}
Aggregations