[Android] Filter fastscroll for swipe refresh
Geoffrey Métais
git at videolan.org
Mon Mar 2 10:49:50 CET 2015
vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 2 10:49:19 2015 +0100| [81e2a201c47a755897e546c14cb245f16b5d1970] | committer: Geoffrey Métais
Filter fastscroll for swipe refresh
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=81e2a201c47a755897e546c14cb245f16b5d1970
---
.../org/videolan/vlc/gui/audio/AudioBrowserFragment.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
index f919190..d847c6d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -182,12 +182,17 @@ public class AudioBrowserFragment extends BrowserFragment implements SwipeRefres
AbsListView.OnScrollListener mScrollListener = new AbsListView.OnScrollListener(){
@Override
- public void onScrollStateChanged(AbsListView view, int scrollState) {}
+ public void onScrollStateChanged(AbsListView view, int scrollState) {
+ boolean enabled = scrollState == SCROLL_STATE_IDLE;
+ if (enabled) {
+ enabled = view.getFirstVisiblePosition() == 0;
+ enabled &= view.getChildAt(0).getTop() == 0;
+ }
+ mSwipeRefreshLayout.setEnabled(enabled);
+ }
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
- int totalItemCount) {
- mSwipeRefreshLayout.setEnabled(firstVisibleItem == 0);
- }
+ int totalItemCount) {}
};
@Override
More information about the Android
mailing list