<div dir="ltr">LGTM<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 25, 2014 at 4:20 PM, Thomas Guillem <span dir="ltr"><<a href="mailto:thomas@gllm.fr" target="_blank">thomas@gllm.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">After Honeycomb only.<br>
---<br>
 .../vlc/gui/video/VideoPlayerActivity.java         | 38 ++++++++++++++++++----<br>
 1 file changed, 31 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
index faf4d10..cf11ef6 100644<br>
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java<br>
@@ -103,6 +103,7 @@ import android.view.SurfaceHolder.Callback;<br>
 import android.view.SurfaceView;<br>
 import android.view.View;<br>
 import android.view.View.OnClickListener;<br>
+import android.view.View.OnLayoutChangeListener;<br>
 import android.view.View.OnSystemUiVisibilityChangeListener;<br>
 import android.view.ViewGroup;<br>
 import android.view.ViewGroup.LayoutParams;<br>
@@ -264,6 +265,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
     private boolean mHasMenu = false;<br>
     private boolean mIsNavMenu = false;<br>
<br>
+    private OnLayoutChangeListener mOnLayoutChangeListener;<br>
+<br>
     @Override<br>
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN)<br>
     protected void onCreate(Bundle savedInstanceState) {<br>
@@ -302,7 +305,6 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
                         public void onSystemUiVisibilityChange(int visibility) {<br>
                             if (visibility == mUiVisibility)<br>
                                 return;<br>
-                            setSurfaceLayout(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);<br>
                             if (visibility == View.SYSTEM_UI_FLAG_VISIBLE && !mShowing && !isFinishing()) {<br>
                                 showOverlay();<br>
                             }<br>
@@ -528,6 +530,32 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
         AudioServiceController.getInstance().unbindAudioService(this);<br>
     }<br>
<br>
+    @Override<br>
+    public void onConfigurationChanged(Configuration newConfig) {<br>
+        if (!LibVlcUtil.isHoneycombOrLater())<br>
+            setSurfaceLayout(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);<br>
+        super.onConfigurationChanged(newConfig);<br>
+    }<br>
+<br>
+    @Override<br>
+    protected void onStart() {<br>
+        if (LibVlcUtil.isHoneycombOrLater()) {<br>
+            if (mOnLayoutChangeListener == null) {<br>
+                mOnLayoutChangeListener = new View.OnLayoutChangeListener() {<br>
+                    @Override<br>
+                    public void onLayoutChange(View v, int left, int top, int right,<br>
+                            int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {<br>
+                        if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom)<br>
+                            setSurfaceLayout(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);<br>
+                    }<br>
+                };<br>
+            }<br>
+            mSurfaceFrame.addOnLayoutChangeListener(mOnLayoutChangeListener);<br>
+        }<br>
+        setSurfaceLayout(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);<br>
+        super.onStart();<br>
+    }<br>
+<br>
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)<br>
     @Override<br>
     protected void onStop() {<br>
@@ -540,6 +568,8 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
             mPresentation = null;<br>
         }<br>
         restoreBrightness();<br>
+        if (LibVlcUtil.isHoneycombOrLater() && mOnLayoutChangeListener != null)<br>
+            mSurfaceFrame.removeOnLayoutChangeListener(mOnLayoutChangeListener);<br>
     }<br>
<br>
     @TargetApi(android.os.Build.VERSION_CODES.FROYO)<br>
@@ -853,12 +883,6 @@ public class VideoPlayerActivity extends ActionBarActivity implements IVideoPlay<br>
     }<br>
<br>
     @Override<br>
-    public void onConfigurationChanged(Configuration newConfig) {<br>
-        setSurfaceLayout(mVideoWidth, mVideoHeight, mVideoVisibleWidth, mVideoVisibleHeight, mSarNum, mSarDen);<br>
-        super.onConfigurationChanged(newConfig);<br>
-    }<br>
-<br>
-    @Override<br>
     public void setSurfaceLayout(int width, int height, int visible_width, int visible_height, int sar_num, int sar_den) {<br>
         if (width * height == 0)<br>
             return;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.1<br>
<br>
_______________________________________________<br>
Android mailing list<br>
<a href="mailto:Android@videolan.org">Android@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/android" target="_blank">https://mailman.videolan.org/listinfo/android</a><br>
</font></span></blockquote></div><br></div>