summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--InCallUI/res/drawable-land/rounded_call_card_background.xml23
-rw-r--r--InCallUI/res/layout-land/call_card_fragment.xml19
-rw-r--r--InCallUI/res/values-land/colors.xml21
-rw-r--r--InCallUI/res/values-land/dimens.xml5
-rw-r--r--InCallUI/res/values/colors.xml2
-rw-r--r--InCallUI/res/values/dimens.xml5
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java26
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java11
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallFragment.java42
9 files changed, 92 insertions, 62 deletions
diff --git a/InCallUI/res/drawable-land/rounded_call_card_background.xml b/InCallUI/res/drawable-land/rounded_call_card_background.xml
new file mode 100644
index 000000000..f41ecda79
--- /dev/null
+++ b/InCallUI/res/drawable-land/rounded_call_card_background.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="@color/incall_call_banner_background_color" />
+ <corners
+ android:radius="4dp" />
+</shape> \ No newline at end of file
diff --git a/InCallUI/res/layout-land/call_card_fragment.xml b/InCallUI/res/layout-land/call_card_fragment.xml
index fb880e311..edce7b233 100644
--- a/InCallUI/res/layout-land/call_card_fragment.xml
+++ b/InCallUI/res/layout-land/call_card_fragment.xml
@@ -28,22 +28,25 @@
android:layout_height="match_parent"
android:orientation="vertical"
android:elevation="@dimen/primary_call_elevation"
- android:background="@color/incall_call_banner_background_color"
+ android:background="@drawable/rounded_call_card_background"
android:paddingTop="@dimen/call_banner_primary_call_container_top_padding"
android:clipChildren="false"
- android:clipToPadding="false" >
+ android:clipToPadding="false"
+ android:alpha="0.9"
+ android:layout_margin="10dp">
<include layout="@layout/primary_call_info" />
- <fragment android:name="com.android.incallui.CallButtonFragment"
- android:id="@+id/callButtonFragment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
<FrameLayout
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="match_parent" >
+ <fragment android:name="com.android.incallui.CallButtonFragment"
+ android:id="@+id/callButtonFragment"
+ android:layout_width="wrap_content"
+ 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"
diff --git a/InCallUI/res/values-land/colors.xml b/InCallUI/res/values-land/colors.xml
new file mode 100644
index 000000000..77eea2e68
--- /dev/null
+++ b/InCallUI/res/values-land/colors.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2015 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
+ -->
+
+<resources>
+ <!-- Background color for status bar. For portrait this will be ignored. -->
+ <color name="statusbar_background_color">#000000</color>
+</resources>
diff --git a/InCallUI/res/values-land/dimens.xml b/InCallUI/res/values-land/dimens.xml
index d992ccdea..59a5a9a87 100644
--- a/InCallUI/res/values-land/dimens.xml
+++ b/InCallUI/res/values-land/dimens.xml
@@ -16,6 +16,11 @@
-->
<resources>
+ <!-- Whether or not the landscape mode layout is currently being used -->
+ <bool name="is_layout_landscape">true</bool>
<!-- Height and width of the in-call buttons. -->
<dimen name="in_call_button_dimension">40dp</dimen>
+ <!-- Margin underneath the call buttons. This is used only in landscape mode and is sized
+ so that the call buttons are center aligned with the end call button. -->
+ <dimen name="call_buttons_bottom_margin">30dp</dimen>
</resources>
diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml
index afc557bc1..cac382deb 100644
--- a/InCallUI/res/values/colors.xml
+++ b/InCallUI/res/values/colors.xml
@@ -59,6 +59,8 @@
<!-- Background color of action bars -->
<color name="actionbar_background_color">@color/dialer_theme_color</color>
+ <!-- Background color for status bar. For portrait this will be ignored. -->
+ <color name="statusbar_background_color">@color/dialer_theme_color</color>
<color name="translucent_shadow">#33999999</color>
diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml
index 43307e8db..0739234f2 100644
--- a/InCallUI/res/values/dimens.xml
+++ b/InCallUI/res/values/dimens.xml
@@ -16,6 +16,9 @@
-->
<resources>
+ <!-- Whether or not the landscape mode layout is currently being used -->
+ <bool name="is_layout_landscape">false</bool>
+
<!-- Dimensions for CallCard elements (the normal in-call UI) -->
<!-- Height of the "call banner" overlay on top of the upper part of the call info area.
@@ -67,7 +70,7 @@
<dimen name="dialpad_digits_adjustable_height">50dp</dimen>
<dimen name="dialpad_key_numbers_size">36dp</dimen>
- <dimen name="floating_action_bar_vertical_offset">-24dp</dimen>
+ <dimen name="floating_action_button_vertical_offset">-24dp</dimen>
<dimen name="call_button_margin_vertical">8dp</dimen>
<dimen name="call_button_margin_horizontal">6dp</dimen>
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 13accf5fb..88ab73a60 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -27,6 +27,7 @@ import android.content.res.Configuration;
import android.graphics.Point;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.telecom.DisconnectCause;
import android.telecom.VideoProfile;
@@ -138,7 +139,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mShrinkAnimationDuration = getResources().getInteger(R.integer.shrink_animation_duration);
mVideoAnimationDuration = getResources().getInteger(R.integer.video_animation_duration);
mFloatingActionButtonVerticalOffset = getResources().getDimensionPixelOffset(
- R.dimen.floating_action_bar_vertical_offset);
+ R.dimen.floating_action_button_vertical_offset);
mFabNormalDiameter = getResources().getDimensionPixelOffset(
R.dimen.end_call_floating_action_button_diameter);
mFabSmallDiameter = getResources().getDimensionPixelOffset(
@@ -288,17 +289,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
float videoViewTranslation = 0f;
// Translate the call card to its pre-animation state.
- if (mIsLandscape) {
- float translationX = mPrimaryCallCardContainer.getWidth();
- translationX *= isLayoutRtl ? 1 : -1;
-
- mPrimaryCallCardContainer.setTranslationX(visible ? translationX : 0);
-
- if (visible) {
- videoViewTranslation = videoView.getWidth() / 2 - spaceBesideCallCard / 2;
- videoViewTranslation *= isLayoutRtl ? -1 : 1;
- }
- } else {
+ if (!mIsLandscape){
mPrimaryCallCardContainer.setTranslationY(visible ?
-mPrimaryCallCardContainer.getHeight() : 0);
@@ -842,7 +833,13 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
return;
}
- mPrimaryCallCardContainer.setBackgroundColor(themeColors.mPrimaryColor);
+ if (getResources().getBoolean(R.bool.is_layout_landscape)) {
+ final GradientDrawable drawable =
+ (GradientDrawable) mPrimaryCallCardContainer.getBackground();
+ drawable.setColor(themeColors.mPrimaryColor);
+ } else {
+ mPrimaryCallCardContainer.setBackgroundColor(themeColors.mPrimaryColor);
+ }
mCallButtonsContainer.setBackgroundColor(themeColors.mPrimaryColor);
mCurrentThemeColors = themeColors;
@@ -940,8 +937,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mAnimatorSet.cancel();
}
- mIsLandscape = getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE;
+ mIsLandscape = getResources().getBoolean(R.bool.is_layout_landscape);
final ViewGroup parent = ((ViewGroup) mPrimaryCallCardContainer.getParent());
final ViewTreeObserver observer = parent.getViewTreeObserver();
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 74c85db8a..078dd49ce 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -20,6 +20,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.res.Resources;
import android.graphics.Point;
import android.net.Uri;
import android.os.Bundle;
@@ -178,7 +179,7 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
/**
* When configuration changes Android kills the current activity and starts a new one.
- * The flag is used to check if full clean up is necessary (activity is stopped and new
+ * The flag is used to check if full clean up is necessary (activity is stopped and new
* activity won't be started), or if a new activity will be started right after the current one
* is destroyed, and therefore no need in release all resources.
*/
@@ -1449,7 +1450,13 @@ public class InCallPresenter implements CallList.Listener, InCallPhoneListener {
return;
}
- mInCallActivity.getWindow().setStatusBarColor(mThemeColors.mSecondaryColor);
+ final Resources resources = mInCallActivity.getResources();
+ if (resources.getBoolean(R.bool.is_layout_landscape)) {
+ mInCallActivity.getWindow().setStatusBarColor(
+ resources.getColor(R.color.statusbar_background_color));
+ } else {
+ mInCallActivity.getWindow().setStatusBarColor(mThemeColors.mSecondaryColor);
+ }
}
/**
diff --git a/InCallUI/src/com/android/incallui/VideoCallFragment.java b/InCallUI/src/com/android/incallui/VideoCallFragment.java
index a2511f23d..11b5bc65f 100644
--- a/InCallUI/src/com/android/incallui/VideoCallFragment.java
+++ b/InCallUI/src/com/android/incallui/VideoCallFragment.java
@@ -402,21 +402,12 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
- mIsLandscape = getResources().getConfiguration().orientation
- == Configuration.ORIENTATION_LANDSCAPE;
+ mIsLandscape = getResources().getBoolean(R.bool.is_layout_landscape);
Log.d(this, "onActivityCreated: IsLandscape=" + mIsLandscape);
getPresenter().init(getActivity());
}
- /**
- * Handles creation of the fragment view.
- *
- * @param inflater The inflater.
- * @param container The view group containing the fragment.
- * @param savedInstanceState The saved instance state.
- * @return
- */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@@ -451,36 +442,15 @@ public class VideoCallFragment extends BaseFragment<VideoCallPresenter,
}
/**
- * Centers the display view vertically for portrait orientation, and horizontally for
- * lanscape orientations. The view is centered within the available space not occupied by
- * the call card.
+ * Centers the display view vertically for portrait orientations. The view is centered within
+ * the available space not occupied by the call card. This is a no-op for landscape mode.
*
* @param displayVideo The video view to center.
*/
private void centerDisplayView(View displayVideo) {
- // 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
- // so we need to translate it in the +X direction.
- // 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();
-
- 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 = params.width / 2
- - spaceBesideCallCard / 2;
- if (isLayoutRtl) {
- displayVideo.setTranslationX(-videoViewTranslation);
- } else {
- displayVideo.setTranslationX(videoViewTranslation);
- }
- } else {
- float videoViewTranslation = params.height / 2
+ if (!mIsLandscape) {
+ float spaceBesideCallCard = InCallPresenter.getInstance().getSpaceBesideCallCard();
+ float videoViewTranslation = displayVideo.getHeight() / 2
- spaceBesideCallCard / 2;
displayVideo.setTranslationY(videoViewTranslation);
}