diff options
author | Tyler Gunn <tgunn@google.com> | 2015-05-19 09:06:20 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2015-12-06 22:04:31 -0800 |
commit | 015ec97c0ecc23063fa3efd3cd11639b399422ac (patch) | |
tree | a651c1b759cac175042302cf0e9d28aa3f1f86ac /InCallUI | |
parent | a860052619d1c3d13a33629e97a8e05509fa0e1b (diff) |
Fix presentation of "held" banner in landscape mode, plus more!
1. Removed landscape video_call_views.xml file; it was identical to
the portrait version but missing some recent changes. This corrected
an issue I observed with the preview surface not rotating properly.
2. Changed layout of landscape call_card_fragment so that the secondary
call info box is a banner along the bottom of the screen and the call card
adjusts to fit above it. The trick is to put that view before the
primary call card in the relative layout and mark the primary call card to
"layout_above" the secondary call info.
3. Fixed issue observed when transitioning from portrait to landscape
where the secondary call card OnPreDrawListener would keep firing.
Changed the way the OnPreDrawListener is removed per Yorke.
4. Corrected issue where the preview surface would not change to a
landscape orientation when the device is rotated. Ensured when starting
up the VideoCallPresenter to adjust the orientation of the surface.
Bug: 21076775
Change-Id: Ia86215814602523882cc47d19a2cf2ab08eec5ea
Diffstat (limited to 'InCallUI')
4 files changed, 9 insertions, 41 deletions
diff --git a/InCallUI/res/layout-land/video_call_views.xml b/InCallUI/res/layout-land/video_call_views.xml deleted file mode 100644 index 8961ea4bf..000000000 --- a/InCallUI/res/layout-land/video_call_views.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> - -<!-- - ~ Copyright (C) 2014 The Android Open Source Project - ~ - ~ Licensed under the Apache License, Version 2.0 (the "License"); - ~ you may not use this file except in compliance with the License. - ~ You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License - --> - -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" > - - <TextureView - android:id="@+id/incomingVideo" - android:layout_gravity="center" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - <!-- The width and height are replaced at runtime based on the selected camera. --> - <TextureView - android:id="@+id/previewVideo" - android:layout_gravity="bottom|right" - android:layout_margin="@dimen/video_preview_margin" - android:layout_width="70dp" - android:layout_height="120dp" /> -</FrameLayout> diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index e7d4f4836..705a1da02 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -648,18 +648,16 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mSecondaryCallInfo.setVisibility(View.VISIBLE); } + updateFabPositionForSecondaryCallInfo(); // We need to translate the secondary caller info, but we need to know its position after // the layout has occurred so use a {@code ViewTreeObserver}. final ViewTreeObserver observer = getView().getViewTreeObserver(); + observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { // We don't want to continue getting called. - if (observer.isAlive()) { - observer.removeOnPreDrawListener(this); - } - - updateFabPositionForSecondaryCallInfo(); + getView().getViewTreeObserver().removeOnPreDrawListener(this); // Get the height of the secondary call info now, and then re-hide the view prior // to doing the actual animation. diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index cbcf50c41..a807a12ea 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -227,7 +227,7 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD return; } - int newRotation = Surface.ROTATION_0; + int newRotation; // We only shift if we're within 22.5 (23) degrees of the target // orientation. This avoids flopping back and forth when holding // the device at 45 degrees or so. @@ -241,6 +241,9 @@ public class InCallActivity extends TransactionSafeActivity implements FragmentD newRotation = Surface.ROTATION_180; } else if (orientation >= 247 && orientation <= 293) { newRotation = Surface.ROTATION_90; + } else { + // Device is between orientations, so leave orientation the same. + return; } // Orientation is the current device orientation in degrees. Ultimately we want diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index a8812a672..eb9b62005 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -247,6 +247,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi InCallVideoCallCallbackNotifier.getInstance().addSessionModificationListener(this); mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY; mCurrentCallState = Call.State.INVALID; + mDeviceOrientation = ui.getCurrentRotation(); } /** @@ -699,6 +700,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi final int rotation = ui.getCurrentRotation(); if (rotation != VideoCallFragment.ORIENTATION_UNKNOWN) { videoCall.setDeviceOrientation(InCallPresenter.toRotationAngle(rotation)); + onDeviceOrientationChanged(rotation); } enableCamera(videoCall, isCameraRequired(newVideoState)); |