summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--InCallUI/res/values/ids.xml1
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java17
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallFragment.java44
3 files changed, 37 insertions, 25 deletions
diff --git a/InCallUI/res/values/ids.xml b/InCallUI/res/values/ids.xml
index c6ad2099c..accb8fb73 100644
--- a/InCallUI/res/values/ids.xml
+++ b/InCallUI/res/values/ids.xml
@@ -16,4 +16,5 @@
<resources>
<item type="id" name="fadeState" />
+ <item type="id" name="view_tag_callcard_actual_height" />
</resources>
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index e63e7a6a4..7dd36ff41 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -57,7 +57,6 @@ import java.util.List;
*/
public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPresenter.CallCardUi>
implements CallCardPresenter.CallCardUi {
-
private AnimatorSet mAnimatorSet;
private int mShrinkAnimationDuration;
private int mFabNormalDiameter;
@@ -360,7 +359,17 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
if (mIsLandscape) {
return getView().getWidth() - mPrimaryCallCardContainer.getWidth();
} else {
- return getView().getHeight() - mPrimaryCallCardContainer.getHeight();
+ final int callCardHeight;
+ // Retrieve the actual height of the call card, independent of whether or not the
+ // outgoing call animation is in progress. The animation does not run in landscape mode
+ // so this only needs to be done for portrait.
+ if (mPrimaryCallCardContainer.getTag(R.id.view_tag_callcard_actual_height) != null) {
+ callCardHeight = (int) mPrimaryCallCardContainer.getTag(
+ R.id.view_tag_callcard_actual_height);
+ } else {
+ callCardHeight = mPrimaryCallCardContainer.getHeight();
+ }
+ return getView().getHeight() - callCardHeight;
}
}
@@ -856,6 +865,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
// Prepare the state of views before the slide animation
final int originalHeight = mPrimaryCallCardContainer.getHeight();
+ mPrimaryCallCardContainer.setTag(R.id.view_tag_callcard_actual_height,
+ originalHeight);
mPrimaryCallCardContainer.setBottom(parent.getHeight());
// Set up FAB.
@@ -873,6 +884,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
+ mPrimaryCallCardContainer.setTag(R.id.view_tag_callcard_actual_height,
+ null);
setViewStatePostAnimation(listener);
}
});
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java
index 6e4abfc26..2b0ddd534 100644
--- a/InCallUI/src/com/android/incallui/VideoCallFragment.java
+++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java
@@ -347,28 +347,6 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
final View view = inflater.inflate(R.layout.video_call_fragment, container, false);
- // Attempt to center the incoming video view, if it is in the layout.
- final ViewTreeObserver observer = view.getViewTreeObserver();
- observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- // Check if the layout includes the incoming video surface -- this will only be the
- // case for a video call.
- View displayVideo = view.findViewById(R.id.incomingVideo);
- if (displayVideo != null) {
- centerDisplayView(displayVideo);
- }
-
- mIsLayoutComplete = true;
-
- // Remove the listener so we don't continually re-layout.
- ViewTreeObserver observer = view.getViewTreeObserver();
- if (observer.isAlive()) {
- observer.removeOnGlobalLayoutListener(this);
- }
- }
- });
-
return view;
}
@@ -387,7 +365,6 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
// In a right-to-left locale, the space for the video view is to the left of the call card
// so we need to translate it in the -X direction.
final boolean isLayoutRtl = InCallPresenter.isRtl();
-
float spaceBesideCallCard = InCallPresenter.getInstance().getSpaceBesideCallCard();
if (mIsLandscape) {
float videoViewTranslation = displayVideo.getWidth() / 2
@@ -576,6 +553,27 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
sPreviewSurface.recreateView((TextureView) mVideoViews.findViewById(
R.id.previewVideo));
}
+
+ // Attempt to center the incoming video view, if it is in the layout.
+ final ViewTreeObserver observer = mVideoViews.getViewTreeObserver();
+ observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ // Check if the layout includes the incoming video surface -- this will only be the
+ // case for a video call.
+ View displayVideo = mVideoViews.findViewById(R.id.incomingVideo);
+ if (displayVideo != null) {
+ centerDisplayView(displayVideo);
+ }
+ mIsLayoutComplete = true;
+
+ // Remove the listener so we don't continually re-layout.
+ ViewTreeObserver observer = mVideoViews.getViewTreeObserver();
+ if (observer.isAlive()) {
+ observer.removeOnGlobalLayoutListener(this);
+ }
+ }
+ });
}
}