summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--InCallUI/res/layout/call_card.xml3
-rw-r--r--InCallUI/res/layout/primary_call_info.xml171
-rw-r--r--InCallUI/res/values/dimens.xml2
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java39
4 files changed, 119 insertions, 96 deletions
diff --git a/InCallUI/res/layout/call_card.xml b/InCallUI/res/layout/call_card.xml
index cfcd98073..cf7a49009 100644
--- a/InCallUI/res/layout/call_card.xml
+++ b/InCallUI/res/layout/call_card.xml
@@ -48,7 +48,8 @@
android:orientation="vertical"
android:translationZ="@dimen/primary_call_translation_z"
android:background="@color/incall_call_banner_background_color"
- >
+ android:clipChildren="false"
+ android:clipToPadding="false" >
<include layout="@layout/primary_call_info" />
diff --git a/InCallUI/res/layout/primary_call_info.xml b/InCallUI/res/layout/primary_call_info.xml
index 048164bd6..ea1d69f69 100644
--- a/InCallUI/res/layout/primary_call_info.xml
+++ b/InCallUI/res/layout/primary_call_info.xml
@@ -16,115 +16,108 @@
~ limitations under the License
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <LinearLayout
+<!-- "Call Banner" for primary call, the foregound or ringing call.Di
+ The "call banner" is a block of info about a single call,
+ including the contact name, phone number, call time counter,
+ and other status info. This info is shown as a "banner"
+ overlaid across the top of contact photo. -->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/primary_call_banner"
+ style="@style/PrimaryCallInfoPrimaryCallBanner"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:minHeight="@dimen/call_banner_height"
+ android:paddingStart="@dimen/call_banner_side_padding"
+ android:paddingEnd="@dimen/call_banner_side_padding"
+ android:paddingTop="@dimen/call_banner_primary_call_top_padding"
+ android:paddingBottom="@dimen/call_banner_top_bottom_padding"
+ android:clipChildren="false"
+ android:clipToPadding="false" >
+
+ <!-- Name (or the phone number, if we don't have a name to display). -->
+ <LinearLayout android:id="@+id/stateAndName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:layout_centerInParent="true"
+ android:animateLayoutChanges="true"
+ android:clipChildren="false"
+ android:clipToPadding="false" >
+
+ <TextView android:id="@+id/callStateLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical">
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/call_status_text_size"
+ android:singleLine="true"
+ android:gravity="start"
+ android:ellipsize="end" />
- <!-- "Call Banner" for primary call, the foregound or ringing call.Di
- The "call banner" is a block of info about a single call,
- including the contact name, phone number, call time counter,
- and other status info. This info is shown as a "banner"
- overlaid across the top of contact photo. -->
- <RelativeLayout android:id="@+id/primary_call_banner"
- style="@style/PrimaryCallInfoPrimaryCallBanner"
+ <TextView android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:minHeight="@dimen/call_banner_height"
- android:paddingStart="@dimen/call_banner_side_padding"
- android:paddingEnd="@dimen/call_banner_side_padding"
- android:paddingTop="@dimen/call_banner_primary_call_top_padding"
- android:paddingBottom="@dimen/call_banner_top_bottom_padding" >
+ android:fontFamily="sans-serif-light"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textSize="@dimen/call_name_text_size"
+ android:singleLine="true" />
- <!-- Name (or the phone number, if we don't have a name to display). -->
- <LinearLayout android:id="@+id/stateAndName"
- android:layout_width="match_parent"
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:clipChildren="false"
+ android:clipToPadding="false" >
+
+ <!-- Label (like "Mobile" or "Work", if present) and phone number, side by side -->
+ <LinearLayout android:id="@+id/labelAndNumber"
+ android:layout_below="@id/stateAndName"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:layout_centerInParent="true"
- android:animateLayoutChanges="true">
+ android:layout_weight="1"
+ android:orientation="horizontal">
- <TextView android:id="@+id/callStateLabel"
- android:layout_width="match_parent"
+ <TextView android:id="@+id/phoneNumber"
+ android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textSize="@dimen/call_status_text_size"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/incall_call_banner_secondary_text_color"
+ android:textSize="@dimen/call_label_text_size"
android:singleLine="true"
- android:gravity="start"
- android:ellipsize="end" />
-
- <TextView android:id="@+id/name"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:fontFamily="sans-serif-light"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textSize="@dimen/call_name_text_size"
- android:singleLine="true" />
+ android:textDirection="ltr" />
- <LinearLayout
+ <TextView android:id="@+id/label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal">
-
- <!-- Label (like "Mobile" or "Work", if present) and phone number, side by side -->
- <LinearLayout android:id="@+id/labelAndNumber"
- android:layout_below="@id/stateAndName"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:orientation="horizontal">
-
- <TextView android:id="@+id/phoneNumber"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/incall_call_banner_secondary_text_color"
- android:textSize="@dimen/call_label_text_size"
- android:singleLine="true"
- android:textDirection="ltr" />
-
- <TextView android:id="@+id/label"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/incall_call_banner_secondary_text_color"
- android:textSize="@dimen/call_label_text_size"
- android:singleLine="true"
- android:layout_marginStart="6dp" />
-
- </LinearLayout>
-
- <!-- Elapsed time indication for a call in progress. -->
- <TextView android:id="@+id/elapsedTime"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerVertical="true"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/incall_call_banner_secondary_text_color"
- android:singleLine="true"
- android:visibility="gone" />
-
- </LinearLayout>
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/incall_call_banner_secondary_text_color"
+ android:textSize="@dimen/call_label_text_size"
+ android:singleLine="true"
+ android:layout_marginStart="6dp" />
</LinearLayout>
- <!-- Call type indication: a special label and/or branding
- for certain kinds of calls (like "Internet call" for a SIP call.) -->
- <TextView android:id="@+id/callTypeLabel"
- android:layout_below="@id/labelAndNumber"
+ <!-- Elapsed time indication for a call in progress. -->
+ <TextView android:id="@+id/elapsedTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:layout_centerVertical="true"
android:textAppearance="?android:attr/textAppearanceSmall"
- android:textColor="@color/incall_call_banner_text_color"
- android:maxLines="1"
- android:ellipsize="end" />
+ android:textColor="@color/incall_call_banner_secondary_text_color"
+ android:singleLine="true"
+ android:visibility="gone" />
- </RelativeLayout> <!-- End of call_banner -->
+ </LinearLayout>
</LinearLayout>
-</FrameLayout>
+ <!-- Call type indication: a special label and/or branding
+ for certain kinds of calls (like "Internet call" for a SIP call.) -->
+ <TextView android:id="@+id/callTypeLabel"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:textColor="@color/incall_call_banner_text_color"
+ android:maxLines="1"
+ android:ellipsize="end" />
+
+</RelativeLayout> <!-- End of call_banner --> \ No newline at end of file
diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml
index af608a6cf..c7b02bb0b 100644
--- a/InCallUI/res/values/dimens.xml
+++ b/InCallUI/res/values/dimens.xml
@@ -100,4 +100,6 @@
<dimen name="translucent_shadow_height">2dp</dimen>
<dimen name="end_call_button_margin_bottom">8dp</dimen>
+
+ <dimen name="call_card_anim_translate_y_offset">50dp</dimen>
</resources>
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 60575c89d..1276f4403 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -37,6 +37,8 @@ import android.view.ViewStub;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.accessibility.AccessibilityEvent;
+import android.view.animation.Interpolator;
+import android.view.animation.PathInterpolator;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
@@ -52,7 +54,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
implements CallCardPresenter.CallCardUi {
private static final int REVEAL_ANIMATION_DURATION = 800;
- private static final int SHRINK_ANIMATION_DURATION = 400;
+ private static final int SHRINK_ANIMATION_DURATION = 1000;
// Primary caller info
private TextView mPhoneNumber;
@@ -60,6 +62,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private TextView mPrimaryName;
private TextView mCallStateLabel;
private TextView mCallTypeLabel;
+ private View mCallNumberAndLabel;
private ImageView mPhoto;
private TextView mElapsedTime;
@@ -78,9 +81,13 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
private View mEndCallButton;
private ImageButton mHandoffButton;
+ private final Interpolator mAnimationInterpolator = new PathInterpolator(0.4f, 0, 0.2f, 1);
+
// Cached DisplayMetrics density.
private float mDensity;
+ private float mTranslationOffset;
+
@Override
CallCardPresenter.CallCardUi getUi() {
return this;
@@ -112,6 +119,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
super.onCreateView(inflater, container, savedInstanceState);
mDensity = getResources().getDisplayMetrics().density;
+ mTranslationOffset =
+ getResources().getDimensionPixelSize(R.dimen.call_card_anim_translate_y_offset);
return inflater.inflate(R.layout.call_card, container, false);
}
@@ -126,6 +135,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mSecondaryCallInfo = (ViewStub) view.findViewById(R.id.secondary_call_info);
mPhoto = (ImageView) view.findViewById(R.id.photo);
mCallStateLabel = (TextView) view.findViewById(R.id.callStateLabel);
+ mCallNumberAndLabel = view.findViewById(R.id.labelAndNumber);
mCallTypeLabel = (TextView) view.findViewById(R.id.callTypeLabel);
mElapsedTime = (TextView) view.findViewById(R.id.elapsedTime);
mPrimaryCallCardContainer = view.findViewById(R.id.primary_call_info_container);
@@ -568,8 +578,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
// Prepare the state of views before the circular reveal animation
mPrimaryCallCardContainer.setBottom(parent.getHeight());
mEndCallButton.setTranslationY(200);
- mPrimaryCallInfo.setAlpha(0);
mCallButtonsContainer.setAlpha(0);
+ mCallStateLabel.setAlpha(0);
+ mPrimaryName.setAlpha(0);
+ mCallTypeLabel.setAlpha(0);
+ mCallNumberAndLabel.setAlpha(0);
final Animator revealAnimator = getRevealAnimator();
final Animator shrinkAnimator =
@@ -593,6 +606,11 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
});
}
+ /**
+ * Animator that performs the upwards shrinking animation of the blue call card scrim.
+ * At the start of the animation, each child view is moved downwards by a pre-specified amount
+ * and then translated upwards together with the scrim.
+ */
private Animator getShrinkAnimator(int startHeight, int endHeight) {
final Animator shrinkAnimator =
ObjectAnimator.ofInt(mPrimaryCallCardContainer, "bottom",
@@ -601,14 +619,17 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
shrinkAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
+ assignTranslateAnimation(mCallStateLabel, 1);
+ assignTranslateAnimation(mPrimaryName, 2);
+ assignTranslateAnimation(mCallTypeLabel, 3);
+ assignTranslateAnimation(mCallNumberAndLabel, 4);
+ assignTranslateAnimation(mCallButtonsContainer, 5);
+
mEndCallButton.animate().translationY(0)
.setDuration(SHRINK_ANIMATION_DURATION);
- mPrimaryCallInfo.animate().alpha(1).withLayer()
- .setDuration(SHRINK_ANIMATION_DURATION);
- mCallButtonsContainer.animate().alpha(1).withLayer()
- .setDuration(SHRINK_ANIMATION_DURATION);
}
});
+ shrinkAnimator.setInterpolator(mAnimationInterpolator);
return shrinkAnimator;
}
@@ -625,6 +646,12 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
return valueAnimator;
}
+ private void assignTranslateAnimation(View view, int offset) {
+ view.setTranslationY(mTranslationOffset * offset);
+ view.animate().translationY(0).alpha(1).withLayer()
+ .setDuration(SHRINK_ANIMATION_DURATION).setInterpolator(mAnimationInterpolator);
+ }
+
private final class LayoutIgnoringListener implements View.OnLayoutChangeListener {
@Override
public void onLayoutChange(View v,