use of in.srain.cube.views.ptr.PtrDefaultHandler 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.PtrDefaultHandler in project android-Ultra-Pull-To-Refresh by liaohuqiu.
the class HideHeader method setupViews.
@Override
protected void setupViews(final PtrClassicFrameLayout ptrFrame) {
setHeaderTitle(R.string.ptr_demo_block_hide_header);
ptrFrame.setKeepHeaderWhenRefresh(false);
final View loading = Utils.createSimpleLoadingTip(getContext());
mTitleHeaderBar.getRightViewContainer().addView(loading);
ptrFrame.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
loading.setVisibility(View.VISIBLE);
frame.postDelayed(new Runnable() {
@Override
public void run() {
loading.setVisibility(View.INVISIBLE);
ptrFrame.refreshComplete();
}
}, 1500);
}
@Override
public boolean checkCanDoRefresh(PtrFrameLayout frame, View content, View header) {
return true;
}
});
}
use of in.srain.cube.views.ptr.PtrDefaultHandler in project android-Ultra-Pull-To-Refresh by liaohuqiu.
the class WithLongPressFragment method createView.
@Override
protected View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mImageLoader = ImageLoaderFactory.create(getActivity());
View view = inflater.inflate(R.layout.fragment_with_long_press, null);
setHeaderTitle(R.string.ptr_demo_block_with_long_press);
final PtrFrameLayout ptrFrameLayout = (PtrFrameLayout) view.findViewById(R.id.with_long_press_list_view_frame);
ListView listView = (ListView) view.findViewById(R.id.with_long_press_list_view);
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getContext(), "Long Pressed: " + id, Toast.LENGTH_SHORT).show();
return true;
}
});
final ListViewDataAdapter<String> listViewDataAdapter = new ListViewDataAdapter<String>();
listViewDataAdapter.setViewHolderClass(this, ViewHolder.class);
ptrFrameLayout.setPtrHandler(new PtrDefaultHandler() {
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
ptrFrameLayout.postDelayed(new Runnable() {
@Override
public void run() {
listViewDataAdapter.getDataList().clear();
listViewDataAdapter.getDataList().addAll(Arrays.asList(Images.imageUrls));
listViewDataAdapter.notifyDataSetChanged();
ptrFrameLayout.refreshComplete();
}
}, 2000);
}
});
ptrFrameLayout.postDelayed(new Runnable() {
@Override
public void run() {
ptrFrameLayout.autoRefresh();
}
}, 100);
listView.setAdapter(listViewDataAdapter);
return view;
}
Aggregations