diff options
author | Suresh Koleti <skolet@codeaurora.org> | 2014-11-24 22:56:58 +0530 |
---|---|---|
committer | Arne Coucheron <arco68@gmail.com> | 2014-12-13 01:45:54 +0100 |
commit | 0d4516c62121b077698d8553edbcf145ddcf5d93 (patch) | |
tree | 47fb99bb6e110e8a6825e4dddcb23776e2435c30 | |
parent | 19df5cd071e0be7d7620514c4a775cc37d95e61d (diff) | |
download | packages_apps_InCallUI-0d4516c62121b077698d8553edbcf145ddcf5d93.tar.gz packages_apps_InCallUI-0d4516c62121b077698d8553edbcf145ddcf5d93.tar.bz2 packages_apps_InCallUI-0d4516c62121b077698d8553edbcf145ddcf5d93.zip |
Set display size as per current TextureView size
- Using TextureView height and width to calculate the display size.
- When ever there is change in display make sure that center the display.
Change-Id: I34a19fd466ce03703953c78b2da1b2b14c17cb09
CRs-Fixed: 751961
-rw-r--r-- | src/com/android/incallui/VideoCallFragment.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/com/android/incallui/VideoCallFragment.java b/src/com/android/incallui/VideoCallFragment.java index a618a37e..99cb47e3 100644 --- a/src/com/android/incallui/VideoCallFragment.java +++ b/src/com/android/incallui/VideoCallFragment.java @@ -454,7 +454,6 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, * @param displayVideo The video view to center. */ private void centerDisplayView(View displayVideo) { - Log.d(this, "centerDisplayView: IsLandscape=" + mIsLandscape); // In a lansdcape layout we need to ensure we horizontally center the view based on whether // the layout is left-to-right or right-to-left. // In a left-to-right locale, the space for the video view is to the right of the call card @@ -463,9 +462,13 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, // so we need to translate it in the -X direction. final boolean isLayoutRtl = InCallPresenter.isRtl(); + ViewGroup.LayoutParams params = displayVideo.getLayoutParams(); float spaceBesideCallCard = InCallPresenter.getInstance().getSpaceBesideCallCard(); + Log.d(this, "centerDisplayView: IsLandscape= " + mIsLandscape + " Layout width: " + + params.width + " height: " + params.height + " spaceBesideCallCard: " + + spaceBesideCallCard); if (mIsLandscape) { - float videoViewTranslation = displayVideo.getWidth() / 2 + float videoViewTranslation = params.width / 2 - spaceBesideCallCard / 2; if (isLayoutRtl) { displayVideo.setTranslationX(-videoViewTranslation); @@ -473,7 +476,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, displayVideo.setTranslationX(videoViewTranslation); } } else { - float videoViewTranslation = displayVideo.getHeight() / 2 + float videoViewTranslation = params.height / 2 - spaceBesideCallCard / 2; displayVideo.setTranslationY(videoViewTranslation); } @@ -900,8 +903,7 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter, // It is only after layout is complete that the dimensions of the Call Card has been // established, which is a prerequisite to centering the view. // Incoming video calls will center the view - if (mIsLayoutComplete && ((mIsLandscape && textureView.getTranslationX() == 0) || ( - !mIsLandscape && textureView.getTranslationY() == 0))) { + if (mIsLayoutComplete) { centerDisplayView(textureView); } } |