[Android] Audio browser: scroll the FlyingViewGroup when its size changes

Adrien Maglo git at videolan.org
Tue Nov 26 09:00:57 CET 2013


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Tue Nov 26 08:52:41 2013 +0100| [285706cd3b64a213b3b0a73adb6d7e613f9b70a1] | committer: Adrien Maglo

Audio browser: scroll the FlyingViewGroup when its size changes

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

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

diff --git a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
index c91d0d7..173e3ca 100644
--- a/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
+++ b/vlc-android/src/org/videolan/vlc/widget/FlingViewGroup.java
@@ -79,8 +79,6 @@ public class FlingViewGroup extends ViewGroup {
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         super.onMeasure(widthMeasureSpec, heightMeasureSpec);
 
-        final int width = MeasureSpec.getSize(widthMeasureSpec);
-
         final int widthMode = MeasureSpec.getMode(widthMeasureSpec);
 
         if (widthMode != MeasureSpec.EXACTLY ) {
@@ -91,8 +89,13 @@ public class FlingViewGroup extends ViewGroup {
         for (int i = 0; i < count; i++) {
             getChildAt(i).measure(widthMeasureSpec, heightMeasureSpec);
         }
+    }
 
-        scrollTo(mCurrentView * width, 0);
+    @Override
+    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+        super.onSizeChanged(w, h, oldw, oldh);
+        scrollTo(mCurrentView * w, 0);
+        requestLayout();
     }
 
     @Override



More information about the Android mailing list