[Android] Rescale popup only on pinch end

Geoffrey Métais git at videolan.org
Fri Apr 1 15:45:52 CEST 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr  1 15:45:21 2016 +0200| [84d6fca177c88c8cccdede3c0407b14fe510064e] | committer: Geoffrey Métais

Rescale popup only on pinch end

> https://code.videolan.org/videolan/vlc-android/commit/84d6fca177c88c8cccdede3c0407b14fe510064e
---

 .../src/org/videolan/vlc/gui/video/PopupManager.java      | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
index 47503a3..70a388b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
@@ -68,6 +68,7 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
     private GestureDetectorCompat mGestureDetector = null;
     private ScaleGestureDetector mScaleGestureDetector;
     private double mScaleFactor = 1.d;
+    private int mPopupWidth, mPopupHeight;
 
     private WindowManager windowManager;
     private RelativeLayout mRootView;
@@ -350,15 +351,10 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
         mScaleFactor *= detector.getScaleFactor();
 
         mScaleFactor = Math.max(0.1d, Math.min(mScaleFactor, 5.0d));
-        int width = (int) (mRootView.getWidth()*mScaleFactor);
-        int height = (int) (mRootView.getHeight()*mScaleFactor);
-        LayoutParams lp = mRootView.getLayoutParams();
-        lp.width *= mScaleFactor;
-        lp.height *= mScaleFactor;
-        setViewSize(width, height);
+        mPopupWidth = (int) (mRootView.getWidth()*mScaleFactor);
+        mPopupHeight = (int) (mRootView.getHeight()*mScaleFactor);
         return true;
     }
-
     @Override
     public boolean onScaleBegin(ScaleGestureDetector detector) {
         mHandler.sendEmptyMessage(HIDE_BUTTONS);
@@ -367,8 +363,11 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
 
     @Override
     public void onScaleEnd(ScaleGestureDetector detector) {
+        WindowManager.LayoutParams lp = (WindowManager.LayoutParams) mRootView.getLayoutParams();
+        lp.width *= mScaleFactor;
+        lp.height *= mScaleFactor;
+        setViewSize(mPopupWidth, mPopupHeight);
         mScaleFactor = 1.0d;
-        windowManager.updateViewLayout(mRootView, mRootView.getLayoutParams());
     }
 
     private void showNotification() {



More information about the Android mailing list