[Android] SlidingPane: fix the pane positioning if a pane moving function was called before the first layout

Adrien Maglo git at videolan.org
Wed Jan 15 09:39:43 CET 2014


vlc-ports/android | branch: master | Adrien Maglo <magsoft at videolan.org> | Wed Jan 15 09:39:37 2014 +0100| [baecf17bdf4f54bbc9bedf8a31e87243e396f45a] | committer: Adrien Maglo

SlidingPane: fix the pane positioning if a pane moving function was called before the first layout

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

 .../org/videolan/vlc/widget/SlidingPaneLayout.java |   27 +++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
index a682376..5cf4240 100644
--- a/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
+++ b/vlc-android/src/org/videolan/vlc/widget/SlidingPaneLayout.java
@@ -541,21 +541,36 @@ public class SlidingPaneLayout extends ViewGroup {
     }
 
     private boolean closePane(View pane, int initialVelocity) {
-        if (mFirstLayout || smoothSlideTo(0.f, initialVelocity))
+        if (mFirstLayout) {
+            mState = STATE_CLOSED;
             return true;
-        return false;
+        }
+        else if (smoothSlideTo(0.f, initialVelocity))
+            return true;
+        else
+            return false;
     }
 
     private boolean openPaneEntirely(View pane, int initialVelocity) {
-        if (mFirstLayout || smoothSlideTo(1.f, initialVelocity))
+        if (mFirstLayout) {
+            mState = STATE_OPENED_ENTIRELY;
             return true;
-        return false;
+        }
+        else if (smoothSlideTo(1.f, initialVelocity))
+            return true;
+        else
+            return false;
     }
 
     private boolean openPane(View pane, int initialVelocity) {
-        if (mFirstLayout || smoothSlideTo(1 - (float)mOverhangSize / mSlideRange, initialVelocity))
+        if (mFirstLayout) {
+            mState = STATE_OPENED;
             return true;
-        return false;
+        }
+        else if (smoothSlideTo(1 - (float)mOverhangSize / mSlideRange, initialVelocity))
+            return true;
+        else
+            return false;
     }
 
     /**



More information about the Android mailing list