Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable pulltorefresh functionality for first time?

I'm using chrisbanes's Android-PullToRefresh in my app.

I need to disable pulltorefresh functionality for first time fragment launch - when list is empty and items are downloading in background. In this case (list is empty) user can swipe down and progressbar with "Release to refresh" will shown.

After loading all items I want to enable pulltorefresh functionality..

How?

like image 745
vsvydenko Avatar asked Nov 26 '13 11:11

vsvydenko


People also ask

How do I stop Android from pulling to refresh?

About Pull-to-refresh on Chrome for Android Of course, you may turn this feature off for all the tabs by visiting chrome://flags/#disable-pull-to-refresh-effect on your chrome browser, and then set it to Disable. Update: Some of our reader friends reminded me that the flag I mentioned above is removed from Chrome 75+.

How do I disable Swiperefreshlayout?

To disable the gesture and progress animation, call setEnabled(false) on the view. This layout should be made the parent of the view that will be refreshed as a result of the gesture and can only support one direct child.


2 Answers

I had same problem.

According to source, if view is disabled, it'll not eat touch event.

https://github.com/chrisbanes/ActionBar-PullToRefresh/blob/master/library/src/uk/co/senab/actionbarpulltorefresh/library/PullToRefreshLayout.java#L137

simply, you can do

mPullToRefreshLayout.setEnabled(false);
like image 192
ceram1 Avatar answered Sep 28 '22 16:09

ceram1


By default you disable pull to refresh and enable in asyncTask of post execute when to fill adapter of list.

like image 42
Harshit Rathi Avatar answered Sep 28 '22 14:09

Harshit Rathi