summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2015-05-21 17:34:08 -0700
committerEtan Cohen <etancohen@google.com>2015-05-21 17:34:08 -0700
commitbbb338a3edd047ecf6f739f9ac2979c172b5aa30 (patch)
treebe7906d4ed0937db59b975f2c0d032cf322c150f
parent3aed08dd6c0f41a0839c72f37873e496094adb05 (diff)
parente6cc9b4bdc56a682283a94dd9e5375007c73a082 (diff)
Merge commit 'b219fca' into merge
-rw-r--r--InCallUI/res/layout-land/call_card_fragment.xml28
-rw-r--r--InCallUI/res/layout-land/video_call_views.xml35
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java8
-rw-r--r--InCallUI/src/com/android/incallui/InCallActivity.java5
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java2
5 files changed, 25 insertions, 53 deletions
diff --git a/InCallUI/res/layout-land/call_card_fragment.xml b/InCallUI/res/layout-land/call_card_fragment.xml
index c02af1b03..2c4cbfca0 100644
--- a/InCallUI/res/layout-land/call_card_fragment.xml
+++ b/InCallUI/res/layout-land/call_card_fragment.xml
@@ -22,12 +22,28 @@
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" >
+ <fragment android:name="com.android.incallui.VideoCallFragment"
+ android:layout_alignParentStart="true"
+ android:layout_gravity="start|center_vertical"
+ android:id="@+id/videoCallFragment"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_alignParentBottom="true" />
+
+ <!-- Secondary "Call info" block, for the background ("on hold") call. -->
+ <include layout="@layout/secondary_call_info"
+ android:id="@+id/secondary_call_info"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true" />
+
<LinearLayout
android:id="@+id/primary_call_info_container"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="match_parent"
+ android:layout_above="@id/secondary_call_info"
android:orientation="vertical"
android:elevation="@dimen/primary_call_elevation"
android:background="@drawable/rounded_call_card_background"
@@ -49,11 +65,6 @@
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="@dimen/call_buttons_bottom_margin" />
- <!-- Secondary "Call info" block, for the background ("on hold") call. -->
- <include layout="@layout/secondary_call_info"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom" />
</FrameLayout>
@@ -104,13 +115,6 @@
</FrameLayout>
- <fragment android:name="com.android.incallui.VideoCallFragment"
- android:layout_alignParentStart="true"
- android:layout_gravity="start|center_vertical"
- android:id="@+id/videoCallFragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
<!-- Placeholder for the dialpad which is replaced with the dialpad fragment when shown. -->
<FrameLayout
android:id="@+id/answer_and_dialpad_container"
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 468b36baa..01efae141 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -582,18 +582,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 d1bebe738..99a7a1e73 100644
--- a/InCallUI/src/com/android/incallui/InCallActivity.java
+++ b/InCallUI/src/com/android/incallui/InCallActivity.java
@@ -209,7 +209,7 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
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.
@@ -223,6 +223,9 @@ public class InCallActivity extends Activity implements FragmentDisplayManager {
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 6763fbe8c..3e1bc82e4 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -241,6 +241,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
InCallVideoCallCallbackNotifier.getInstance().addSessionModificationListener(this);
mCurrentVideoState = VideoProfile.STATE_AUDIO_ONLY;
mCurrentCallState = Call.State.INVALID;
+ mDeviceOrientation = ui.getCurrentRotation();
}
/**
@@ -684,6 +685,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));