From ac9b15ad1aef2161b502b7925e721447f4a62c7c Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Tue, 23 Nov 2010 11:55:06 +0100 Subject: [PATCH] Little capture preview in portrait mode. Adapted workaround. --- res/layout/videocall.xml | 12 ++++++----- src/org/linphone/VideoCallActivity.java | 27 ++++++++++++------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/res/layout/videocall.xml b/res/layout/videocall.xml index 7205f881f..df869cb3a 100644 --- a/res/layout/videocall.xml +++ b/res/layout/videocall.xml @@ -1,8 +1,10 @@ - + android:id="@+id/video_frame" android:orientation="vertical" + android:layout_height="fill_parent" android:layout_width="fill_parent"> - - - + + + \ No newline at end of file diff --git a/src/org/linphone/VideoCallActivity.java b/src/org/linphone/VideoCallActivity.java index 5325fc106..2aae9e032 100644 --- a/src/org/linphone/VideoCallActivity.java +++ b/src/org/linphone/VideoCallActivity.java @@ -40,14 +40,15 @@ public class VideoCallActivity extends Activity { super.onCreate(savedInstanceState); setContentView(R.layout.videocall); - mVideoView = (SurfaceView) findViewById(R.id.video_surface); + mVideoView = (SurfaceView) findViewById(R.id.video_surface); LinphoneService.instance().getLinphoneCore().setVideoWindow((Object) mVideoView); mVideoCaptureView = (SurfaceView) findViewById(R.id.video_capture_surface); final int rotation = getWindowManager().getDefaultDisplay().getRotation(); AndroidCameraRecord.setOrientationCode(rotation); - hack(rotation); + + if (!firstLaunch) workaroundCapturePreviewHiddenOnSubsequentRotations(); AndroidCameraRecord.setSurfaceView(mVideoCaptureView, mHandler); firstLaunch = false; @@ -55,19 +56,17 @@ public class VideoCallActivity extends Activity { - private void hack(int rotation) { - if (rotation != 0 && !firstLaunch) { - View view = findViewById(R.id.video_frame); - if (view == null) { - Log.e("Linphone", "Android BUG: video frame not found; mix with landscape???"); - return; - } - - FrameLayout frame = (FrameLayout) view; - frame.removeAllViews(); - frame.addView(mVideoCaptureView); - frame.addView(mVideoView); + private void workaroundCapturePreviewHiddenOnSubsequentRotations() { + View view = findViewById(R.id.video_frame); + if (view == null) { + Log.e("Linphone", "Android BUG: video frame not found; mix with landscape???"); + return; } + + FrameLayout frame = (FrameLayout) view; + frame.removeAllViews(); + frame.addView(mVideoCaptureView); + frame.addView(mVideoView); } }