[Android] Simplify pull-to-refresh activation

Geoffrey Métais git at videolan.org
Thu Nov 2 11:09:00 CET 2017


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Oct 31 14:18:46 2017 +0100| [07f32fcc69d878e2aff7ab21c015f8b7c9bce350] | committer: Geoffrey Métais

Simplify pull-to-refresh activation

> https://code.videolan.org/videolan/vlc-android/commit/07f32fcc69d878e2aff7ab21c015f8b7c9bce350
---

 .../src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java   | 7 +------
 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java       | 7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
index 798f8981a..d35d90ff7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioAlbumsSongsFragment.java
@@ -318,12 +318,7 @@ public class AudioAlbumsSongsFragment extends BaseAudioBrowser implements SwipeR
     private View.OnTouchListener mSwipeFilter = new View.OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent event) {
-            mSwipeRefreshLayout.setEnabled(false);
-            switch (event.getAction()) {
-                case MotionEvent.ACTION_UP:
-                    mSwipeRefreshLayout.setEnabled(true);
-                    break;
-            }
+            mSwipeRefreshLayout.setEnabled(event.getAction() == MotionEvent.ACTION_UP);
             return false;
         }
     };
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 9acd2bebd..02e7e0a01 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -677,12 +677,7 @@ public class AudioBrowserFragment extends BaseAudioBrowser implements SwipeRefre
     private View.OnTouchListener mSwipeFilter = new View.OnTouchListener() {
         @Override
         public boolean onTouch(View v, MotionEvent event) {
-            mSwipeRefreshLayout.setEnabled(false);
-            switch (event.getAction()) {
-                case MotionEvent.ACTION_UP:
-                    mSwipeRefreshLayout.setEnabled(true);
-                    break;
-            }
+            mSwipeRefreshLayout.setEnabled(event.getAction() == MotionEvent.ACTION_UP);
             return false;
         }
     };



More information about the Android mailing list