[Android] FlingViewGroup: add callbacks for the touch down and up events

Adrien Maglo git at videolan.org
Tue Jan 14 18:53:49 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Jan 14 18:50:05 2014 +0100| [0f1750ea85fdc91d4551901d38cbfbc1f7db1aa8] | committer: Adrien Maglo

FlingViewGroup: add callbacks for the touch down and up events

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=0f1750ea85fdc91d4551901d38cbfbc1f7db1aa8
---

 .../src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java  |    6 ++++++
 vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java   |    9 +++++++++
 2 files changed, 15 insertions(+)

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 d5dc3fa..13885ed 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioBrowserFragment.java
@@ -311,6 +311,12 @@ public class AudioBrowserFragment extends SherlockFragment {
             mFlingViewPosition = position;
         }
 
+        @Override
+        public void onTouchDown() {}
+
+        @Override
+        public void onTouchUp() {}
+
     };
 
     /**
diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index e317c6e..b102daa 100644
--- a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
+++ b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
@@ -164,6 +164,8 @@ public class FlingViewGroup extends ViewGroup {
                 if (!mScroller.isFinished())
                     mScroller.abortAnimation();
                 mLastX = x;
+                if (mViewSwitchListener != null)
+                    mViewSwitchListener.onTouchDown();
                 break;
             case MotionEvent.ACTION_MOVE:
                 int delta = (int) (mLastX - x);
@@ -201,6 +203,9 @@ public class FlingViewGroup extends ViewGroup {
                     mVelocityTracker = null;
                 }
 
+                if (mViewSwitchListener != null)
+                    mViewSwitchListener.onTouchUp();
+
                 break;
         }
 
@@ -247,6 +252,10 @@ public class FlingViewGroup extends ViewGroup {
         void onSwitching(float progress);
 
         void onSwitched(int position);
+
+        void onTouchDown();
+
+        void onTouchUp();
     }
 
 }



More information about the Android mailing list