diff options
Diffstat (limited to 'InCallUI/src/com/android/incallui/VideoCallFragment.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/VideoCallFragment.java | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java index 11b5bc65f..1d711a882 100644 --- a/InCallUI/src/com/android/incallui/VideoCallFragment.java +++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java @@ -19,6 +19,7 @@ package com.android.incallui; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; +import android.graphics.Matrix; import android.graphics.Point; import android.graphics.SurfaceTexture; import android.os.Bundle; @@ -88,11 +89,6 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, private View mVideoViews; /** - * {@code True} when the entering the activity again after a restart due to orientation change. - */ - private boolean mIsActivityRestart; - - /** * {@code True} when the layout of the activity has been completed. */ private boolean mIsLayoutComplete = false; @@ -385,12 +381,20 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, Log.e(this, "onClick: Presenter is null."); } } + + /** + * Returns the dimensions of the surface. + * + * @return The dimensions of the surface. + */ + public Point getSurfaceDimensions() { + return new Point(mWidth, mHeight); + } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mIsActivityRestart = sVideoSurfacesInUse; } /** @@ -675,12 +679,6 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, } } - @Override - public boolean isActivityRestart() { - Log.d(this, "isActivityRestart " + mIsActivityRestart); - return mIsActivityRestart; - } - /** * @return {@code True} if the display video surface has been created. */ @@ -741,12 +739,12 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, params.height = height; preview.setLayoutParams(params); - int rotation = InCallPresenter.toRotationAngle(getCurrentRotation()); - int rotationAngle = 360 - rotation; - preview.setRotation(rotationAngle); - Log.d(this, "setPreviewSize: rotation=" + rotation + - " rotationAngle=" + rotationAngle); - + // The width and height are interchanged outside of this method based on the current + // orientation, so we can transform using "width", which will be either the width or + // the height. + Matrix transform = new Matrix(); + transform.setScale(-1, 1, width/2, 0); + preview.setTransform(transform); } } @@ -853,6 +851,19 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, } /** + * Determines the size of the preview surface. + * + * @return {@link Point} specifying the width and height of the preview surface. + */ + @Override + public Point getPreviewSize() { + if (sPreviewSurface == null) { + return null; + } + return sPreviewSurface.getSurfaceDimensions(); + } + + /** * Inflates the {@link ViewStub} containing the incoming and outgoing surfaces, if necessary, * and creates {@link VideoCallSurface} instances to track the surfaces. */ |