summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-05-26 15:00:30 -0700
committerTyler Gunn <tgunn@google.com>2015-12-06 22:05:08 -0800
commit3490c8125aaf1aaf5e4d9cc3713386db6723d613 (patch)
tree37e183787ad5505f38d631ddb23224581d3c2a7b /InCallUI
parent7e1a342c0711016fd83801116fa4f60d6c2ddb0a (diff)
Correct positioning of incoming video view.
There were a few things going on: 1. There is a case where we could try to position the incoming video view before the call card has been fully laid out and its height is known. 2. When querying the height of the video surface, the getHeight() method does not always return the value that was just set on it. Using the layout params solves this problem. 3. Cleaned up some other comments and debug statements. Bug: 21444300 Change-Id: I9b59b132d6d4c7559497c6499b164598e7a75c7f
Diffstat (limited to 'InCallUI')
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java11
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallFragment.java13
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java4
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