summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui
diff options
context:
space:
mode:
authorYorke Lee <yorkelee@google.com>2015-03-31 09:55:54 -0700
committerYorke Lee <yorkelee@google.com>2015-04-13 15:35:12 -0700
commit53485a55bfbccc8fe822739f553fc467dc0b1119 (patch)
tree88c87e5c5d978c544685cc5d9b2a9d9b511a016f /InCallUI/src/com/android/incallui
parent4b06b9c7e532c48a47e53c98014376a0897f09c1 (diff)
Video calling landscape changes to match specs
* Call card has 4dp corners, and is 90% visible * Margins for call card * Call buttons are center aligned with end call button * Remote surface is always center aligned, tapping call card slides it in and out * Status bar is black Bug: 19668216 Change-Id: Ifea27faa5f8ff32f6be13e777ca70aa4d0c7727e
Diffstat (limited to 'InCallUI/src/com/android/incallui')
-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
3 files changed, 26 insertions, 53 deletions
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);
}