diff options
author | Andrew Lee <anwlee@google.com> | 2014-08-18 17:45:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-08-16 03:52:42 +0000 |
commit | d58311e2fff9a7143438ad005e5b3651c3e507a5 (patch) | |
tree | f50d1e572a743b985fb81db36e505a75304fc2b0 | |
parent | e0ec555ed70bb58208eaa12b139d155ae0b20bdd (diff) | |
parent | 45c0059f18883ebda7133d92f5828b5859d22934 (diff) |
Merge "Position/size adjustments to the floating action button." into lmp-dev
-rw-r--r-- | InCallUI/res/drawable/end_call_background.xml | 4 | ||||
-rw-r--r-- | InCallUI/res/layout-land/call_card_content.xml | 22 | ||||
-rw-r--r-- | InCallUI/res/layout/call_card_content.xml | 22 | ||||
-rw-r--r-- | InCallUI/res/values/colors.xml | 4 | ||||
-rw-r--r-- | InCallUI/res/values/dimens.xml | 7 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardFragment.java | 55 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 3 |
7 files changed, 81 insertions, 36 deletions
diff --git a/InCallUI/res/drawable/end_call_background.xml b/InCallUI/res/drawable/end_call_background.xml index b3d877b31..8f3926f47 100644 --- a/InCallUI/res/drawable/end_call_background.xml +++ b/InCallUI/res/drawable/end_call_background.xml @@ -16,6 +16,4 @@ <!-- Background drawable used to render the "end call" button. --> <ripple xmlns:android="http://schemas.android.com/apk/res/android" - android:color="@color/end_call_touch_feedback_tint"> - <item android:drawable="@drawable/fab_red" /> -</ripple> + android:color="@color/end_call_touch_feedback_tint" /> diff --git a/InCallUI/res/layout-land/call_card_content.xml b/InCallUI/res/layout-land/call_card_content.xml index 7d1db8e00..b1b527505 100644 --- a/InCallUI/res/layout-land/call_card_content.xml +++ b/InCallUI/res/layout-land/call_card_content.xml @@ -110,17 +110,21 @@ <FrameLayout android:id="@+id/floating_end_call_action_button_container" - android:layout_width="@dimen/floating_action_button_width" - android:layout_height="@dimen/floating_action_button_height" + android:layout_width="@dimen/end_call_floating_action_button_diameter" + android:layout_height="@dimen/end_call_floating_action_button_diameter" + android:background="@drawable/fab_red" + android:layout_centerHorizontal="true" android:layout_marginBottom="@dimen/end_call_button_margin_bottom" - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" > + android:layout_alignParentBottom="true" > <ImageButton android:id="@+id/floating_end_call_action_button" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@drawable/end_call_background" - android:src="@drawable/fab_ic_end_call" - android:contentDescription="@string/onscreenEndCallText" /> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/end_call_background" + android:src="@drawable/fab_ic_end_call" + android:scaleType="center" + android:contentDescription="@string/onscreenEndCallText" /> + </FrameLayout> + </RelativeLayout> diff --git a/InCallUI/res/layout/call_card_content.xml b/InCallUI/res/layout/call_card_content.xml index ec32d986d..5437ef04d 100644 --- a/InCallUI/res/layout/call_card_content.xml +++ b/InCallUI/res/layout/call_card_content.xml @@ -121,17 +121,21 @@ <FrameLayout android:id="@+id/floating_end_call_action_button_container" - android:layout_width="@dimen/floating_action_button_width" - android:layout_height="@dimen/floating_action_button_height" + android:layout_width="@dimen/end_call_floating_action_button_diameter" + android:layout_height="@dimen/end_call_floating_action_button_diameter" + android:background="@drawable/fab_red" + android:layout_centerHorizontal="true" android:layout_marginBottom="@dimen/end_call_button_margin_bottom" - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" > + android:layout_alignParentBottom="true" > <ImageButton android:id="@+id/floating_end_call_action_button" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@drawable/end_call_background" - android:src="@drawable/fab_ic_end_call" - android:contentDescription="@string/onscreenEndCallText" /> + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="@drawable/end_call_background" + android:src="@drawable/fab_ic_end_call" + android:scaleType="center" + android:contentDescription="@string/onscreenEndCallText" /> + </FrameLayout> + </RelativeLayout> diff --git a/InCallUI/res/values/colors.xml b/InCallUI/res/values/colors.xml index faf27e676..bd2642d64 100644 --- a/InCallUI/res/values/colors.xml +++ b/InCallUI/res/values/colors.xml @@ -67,6 +67,6 @@ <color name="glowpad_incoming_widget_tint">#a3a3a3</color> <color name="glowpad_incoming_widget_background_tint">#ffffff</color> - <!-- 30% opacity, accent color. --> - <color name="incall_dialpad_touch_tint">#66eeff41</color> + <!-- 20% opacity, theme color. --> + <color name="incall_dialpad_touch_tint">#330288d1</color> </resources> diff --git a/InCallUI/res/values/dimens.xml b/InCallUI/res/values/dimens.xml index f35a3f3d8..87dd66756 100644 --- a/InCallUI/res/values/dimens.xml +++ b/InCallUI/res/values/dimens.xml @@ -59,6 +59,7 @@ <dimen name="primary_call_elevation">4dp</dimen> <dimen name="secondary_call_elevation">4dp</dimen> + <dimen name="floating_action_bar_vertical_offset">-24dp</dimen> <!-- Padding at the left and right edges of the incall_touch_ui button cluster. This padding is necessary because we can't allow the @@ -102,7 +103,7 @@ <dimen name="translucent_shadow_height">2dp</dimen> <dimen name="end_call_button_margin_bottom">8dp</dimen> - <dimen name="end_call_button_hide_offset">70dp</dimen> + <dimen name="end_call_button_hide_offset">80dp</dimen> <dimen name="call_card_anim_translate_y_offset">50dp</dimen> @@ -111,4 +112,8 @@ <dimen name="video_preview_small_dimension">90dp</dimen> <dimen name="video_preview_margin">20dp</dimen> + + <dimen name="end_call_floating_action_button_diameter">72dp</dimen> + <dimen name="end_call_floating_action_button_small_diameter">56dp</dimen> + </resources> diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index be9b18dec..9e182226b 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -32,7 +32,6 @@ import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.view.Display; import android.view.LayoutInflater; -import android.view.MotionEvent; import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewGroup; @@ -56,8 +55,11 @@ import java.util.List; */ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPresenter.CallCardUi> implements CallCardPresenter.CallCardUi { + private int mRevealAnimationDuration; private int mShrinkAnimationDuration; + private int mFabNormalDiameter; + private int mFabSmallDiameter; private boolean mIsLandscape; // Primary caller info @@ -92,6 +94,8 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr private FloatingActionButtonController mFloatingActionButtonController; private View mFloatingActionButtonContainer; + private ImageButton mFloatingActionButton; + private int mFloatingActionButtonVerticalOffset; private int mFloatingActionButtonHideOffset; // Cached DisplayMetrics density. @@ -118,8 +122,14 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mRevealAnimationDuration = getResources().getInteger(R.integer.reveal_animation_duration); 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); mFloatingActionButtonHideOffset = getResources().getDimensionPixelOffset( R.dimen.end_call_button_hide_offset); + mFabNormalDiameter = getResources().getDimensionPixelOffset( + R.dimen.end_call_floating_action_button_diameter); + mFabSmallDiameter = getResources().getDimensionPixelOffset( + R.dimen.end_call_floating_action_button_small_diameter); mIsLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; } @@ -174,9 +184,9 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mFloatingActionButtonContainer = view.findViewById( R.id.floating_end_call_action_button_container); - ImageButton floatingActionButton = (ImageButton) view.findViewById( + mFloatingActionButton = (ImageButton) view.findViewById( R.id.floating_end_call_action_button); - floatingActionButton.setOnClickListener(new View.OnClickListener() { + mFloatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getPresenter().endCallClicked(); @@ -790,7 +800,14 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr @Override public void setEndCallButtonEnabled(boolean enabled) { - mFloatingActionButtonController.setVisible(enabled); + mFloatingActionButtonController.align( + mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_END + : FloatingActionButtonController.ALIGN_MIDDLE, + 0 /* offsetX */, + enabled ? mFloatingActionButtonVerticalOffset /* offsetY */ + : mFloatingActionButtonHideOffset, + true); + mFloatingActionButton.setEnabled(enabled); } /** @@ -873,6 +890,26 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr }); } + public void onDialpadShow() { + mFloatingActionButtonController.align( + mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_END + : FloatingActionButtonController.ALIGN_MIDDLE, + 0 /* offsetX */, + 0 /* offsetY */, + true); + mFloatingActionButtonController.resize(mFabSmallDiameter, true); + } + + public void onDialpadHide() { + mFloatingActionButtonController.align( + mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_END + : FloatingActionButtonController.ALIGN_MIDDLE, + 0 /* offsetX */, + mFloatingActionButtonVerticalOffset /* offsetY */, + true); + mFloatingActionButtonController.resize(mFabNormalDiameter, true); + } + /** * 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 @@ -880,8 +917,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr */ private Animator getShrinkAnimator(int startHeight, int endHeight) { final Animator shrinkAnimator = - ObjectAnimator.ofInt(mPrimaryCallCardContainer, "bottom", - startHeight, endHeight); + ObjectAnimator.ofInt(mPrimaryCallCardContainer, "bottom", startHeight, endHeight); shrinkAnimator.setDuration(mShrinkAnimationDuration); shrinkAnimator.addListener(new AnimatorListenerAdapter() { @Override @@ -892,12 +928,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr assignTranslateAnimation(mCallTypeLabel, 4); assignTranslateAnimation(mCallButtonsContainer, 5); - mFloatingActionButtonController.align( - mIsLandscape ? FloatingActionButtonController.ALIGN_QUARTER_END - : FloatingActionButtonController.ALIGN_MIDDLE, - 0 /* offsetX */, - 0 /* offsetY */, - true); + setEndCallButtonEnabled(true); } }); shrinkAnimator.setInterpolator(AnimUtils.EASE_IN); diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index a49342e0e..8930837dc 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -568,6 +568,9 @@ public class InCallActivity extends Activity { if (showDialpad) { showDialpad(true); mDialpadFragment.animateShowDialpad(); + mCallCardFragment.onDialpadShow(); + } else { + mCallCardFragment.onDialpadHide(); } mDialpadFragment.getView().startAnimation(showDialpad ? mSlideIn : mSlideOut); } |