diff options
Diffstat (limited to 'InCallUI')
3 files changed, 16 insertions, 12 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 46f8a7ead..e06d8d0eb 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -410,9 +410,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mPrimaryCallCardContainer.setTranslationY(visible ? -mPrimaryCallCardContainer.getHeight() : 0); - if (visible) { - videoViewTranslation = videoView.getHeight() / 2 - spaceBesideCallCard / 2; - } + ViewGroup.LayoutParams p = videoView.getLayoutParams(); + videoViewTranslation = p.height / 2 - spaceBesideCallCard / 2; } // Perform animation of video view. @@ -421,12 +420,10 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr .setDuration(mVideoAnimationDuration); if (mIsLandscape) { videoViewAnimator - .translationX(videoViewTranslation) - .start(); + .translationX(visible ? videoViewTranslation : 0); } else { videoViewAnimator - .translationY(videoViewTranslation) - .start(); + .translationY(visible ? videoViewTranslation : 0); } videoViewAnimator.start(); diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java index 7c83f6e7e..2c063034a 100644 --- a/InCallUI/src/com/android/incallui/VideoCallFragment.java +++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java @@ -459,9 +459,16 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, */ private void centerDisplayView(View displayVideo) { if (!mIsLandscape) { + ViewGroup.LayoutParams p = displayVideo.getLayoutParams(); + int height = p.height; + float spaceBesideCallCard = InCallPresenter.getInstance().getSpaceBesideCallCard(); - float videoViewTranslation = displayVideo.getHeight() / 2 - - spaceBesideCallCard / 2; + // If space beside call card is zeo, layout hasn't happened yet so there is no point + // in attempting to center the view. + if (Math.abs(spaceBesideCallCard - 0.0f) < 0.0001) { + return; + } + float videoViewTranslation = height / 2 - spaceBesideCallCard / 2; displayVideo.setTranslationY(videoViewTranslation); } } @@ -756,7 +763,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, */ @Override public void setDisplayVideoSize(int width, int height) { - Log.d(this, "setDisplayVideoSize: width=" + width + " height=" + height); + Log.v(this, "setDisplayVideoSize: width=" + width + " height=" + height); if (sDisplaySurface != null) { TextureView displayVideo = sDisplaySurface.getTextureView(); if (displayVideo == null) { diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index 8e88afc13..3df0b8123 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -1073,7 +1073,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi * @param height peer height */ private void setDisplayVideoSize(int width, int height) { - Log.d(this, "setDisplayVideoSize:Received peer width=" + width + " peer height=" + height); + Log.v(this, "setDisplayVideoSize: Received peer width=" + width + " height=" + height); VideoCallUi ui = getUi(); if (ui == null) { return; @@ -1081,7 +1081,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi // Get current display size Point size = ui.getScreenSize(); - Log.d("VideoCallPresenter", "setDisplayVideoSize: windowmgr width=" + size.x + Log.v(this, "setDisplayVideoSize: windowmgr width=" + size.x + " windowmgr height=" + size.y); if (size.y * width > size.x * height) { // current display height is too much. Correct it |