[Android] PopupManager: fix window size initialisation
Thomas Guillem
git at videolan.org
Tue Dec 20 14:30:09 CET 2016
vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Dec 20 14:28:39 2016 +0100| [80c88d2fe778dc19343e1fb0917fee59f79de5a0] | committer: Thomas Guillem
PopupManager: fix window size initialisation
This is needed for OpenGL vouts
> https://code.videolan.org/videolan/vlc-android/commit/80c88d2fe778dc19343e1fb0917fee59f79de5a0
---
vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java | 2 --
vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java | 11 +++++++----
2 files changed, 7 insertions(+), 6 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 b69d283..97f530e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/PopupManager.java
@@ -179,7 +179,6 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
}
if (width == 0 || height == 0) {
- vlcVout.setWindowSize(displayW, displayH);
mRootView.setViewSize(displayW, displayH);
return;
}
@@ -205,7 +204,6 @@ public class PopupManager implements PlaybackService.Callback, GestureDetector.O
width = (int) Math.floor(dw);
height = (int) Math.floor(dh);
- vlcVout.setWindowSize(width, height);
mRootView.setViewSize(width, height);
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java b/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java
index 956b78d..50eb251 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java
+++ b/vlc-android/src/org/videolan/vlc/gui/view/PopupLayout.java
@@ -75,6 +75,7 @@ public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.
public void setVLCVOut(IVLCVout vout) {
mVLCVout = vout;
+ mVLCVout.setWindowSize(mPopupWidth, mPopupHeight);
}
/*
@@ -108,15 +109,19 @@ public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.
mLayoutParams.width = width;
mLayoutParams.height = height;
mWindowManager.updateViewLayout(this, mLayoutParams);
+ if (mVLCVout != null)
+ mVLCVout.setWindowSize(mPopupWidth, mPopupHeight);
}
@SuppressWarnings("deprecation")
private void init(Context context) {
mWindowManager = (WindowManager) context.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
+ mPopupWidth = VLCApplication.getAppResources().getDimensionPixelSize(R.dimen.video_pip_width);
+ mPopupHeight = VLCApplication.getAppResources().getDimensionPixelSize(R.dimen.video_pip_heigth);
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
- VLCApplication.getAppResources().getDimensionPixelSize(R.dimen.video_pip_width),
- VLCApplication.getAppResources().getDimensionPixelSize(R.dimen.video_pip_heigth),
+ mPopupWidth,
+ mPopupHeight,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.OPAQUE);
@@ -193,8 +198,6 @@ public class PopupLayout extends RelativeLayout implements ScaleGestureDetector.
public void onScaleEnd(ScaleGestureDetector detector) {
setViewSize(mPopupWidth, mPopupHeight);
mScaleFactor = 1.0d;
- if (mVLCVout != null)
- mVLCVout.setWindowSize(mPopupWidth, mPopupHeight);
}
private void containInScreen(int width, int height) {
More information about the Android
mailing list