[Android] VideoPlayer: fix crop after rotation (Fixes #15083)

Thomas Guillem git at videolan.org
Thu Jul 23 15:55:25 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jul 23 15:51:44 2015 +0200| [e84d8efaa8c2bbcbaaba5e0c3595ea5fc02ae56d] | committer: Thomas Guillem

VideoPlayer: fix crop after rotation (Fixes #15083)

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

 .../org/videolan/vlc/gui/video/VideoPlayerActivity.java   |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index aa46516..779669a 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -661,11 +661,20 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         if (AndroidUtil.isHoneycombOrLater()) {
             if (mOnLayoutChangeListener == null) {
                 mOnLayoutChangeListener = new View.OnLayoutChangeListener() {
+                    private final Runnable mRunnable = new Runnable() {
+                        @Override
+                        public void run() {
+                            changeSurfaceLayout();
+                        }
+                    };
                     @Override
                     public void onLayoutChange(View v, int left, int top, int right,
                                                int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
-                        if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom)
-                            changeSurfaceLayout();
+                        if (left != oldLeft || top != oldTop || right != oldRight || bottom != oldBottom) {
+                            /* changeSurfaceLayout need to be called after the layout changed */
+                            mHandler.removeCallbacks(mRunnable);
+                            mHandler.post(mRunnable);
+                        }
                     }
                 };
             }



More information about the Android mailing list