[Android] FlingViewGroup: add a function to scroll to a given position without annimation

Adrien Maglo git at videolan.org
Tue Jan 14 10:27:58 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Jan 14 10:16:20 2014 +0100| [e53c6a426221261853a935ccf1b70d19e17d631e] | committer: Adrien Maglo

FlingViewGroup: add a function to scroll to a given position without annimation

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

 vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index 173e3ca..cb79f1a 100644
--- a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
+++ b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
@@ -232,6 +232,14 @@ public class FlingViewGroup extends ViewGroup {
         }
     }
 
+    public void scrollTo(int position) {
+        mCurrentView = position;
+        scrollTo(position * getWidth(), 0);
+        if (mViewSwitchListener != null) {
+            mViewSwitchListener.onSwitched(position);
+        }
+    }
+
     public void setOnViewSwitchedListener(ViewSwitchListener l) {
         mViewSwitchListener = l;
     }



More information about the Android mailing list