diff options
author | Jorim Jaggi <jjaggi@google.com> | 2014-07-28 12:14:48 +0200 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2014-07-28 15:35:09 +0200 |
commit | 87d84d4d9533814e92bc7b1b0f91347a4982c1d0 (patch) | |
tree | c150893bc8b42f408ed19bfbbe34af12fc8590e5 /packages/SystemUI | |
parent | c7dea6ee9b06369b0c0c3773dc2e40409ce86a8e (diff) | |
download | frameworks_base-87d84d4d9533814e92bc7b1b0f91347a4982c1d0.zip frameworks_base-87d84d4d9533814e92bc7b1b0f91347a4982c1d0.tar.gz frameworks_base-87d84d4d9533814e92bc7b1b0f91347a4982c1d0.tar.bz2 |
Make user avatar bigger on lockscreen when it is tappable
Also fix some other paddings there.
Change-Id: I6c54b070cde96e7fd21ff3533ee6a4b58547028c
Diffstat (limited to 'packages/SystemUI')
4 files changed, 72 insertions, 9 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_expanded_header.xml b/packages/SystemUI/res/layout/status_bar_expanded_header.xml index 5b54eb3..0eec094 100644 --- a/packages/SystemUI/res/layout/status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/status_bar_expanded_header.xml @@ -68,7 +68,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginStart="8dp" + android:layout_marginStart="@dimen/header_battery_margin_keyguard" android:paddingEnd="@dimen/battery_level_padding_end" android:textColor="#ffffff" android:textSize="12sp"/> @@ -142,7 +142,7 @@ android:id="@+id/keyguard_carrier_text" android:layout_width="match_parent" android:layout_height="@dimen/status_bar_header_height_keyguard" - android:layout_marginLeft="16dp" + android:layout_marginStart="@dimen/keyguard_carrier_text_margin" android:layout_toStartOf="@id/system_icons_super_container" android:gravity="center_vertical" android:ellipsize="marquee" diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index a5e3924..953a3ab 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -62,4 +62,22 @@ keyguard_clock_height_fraction_* for the difference between min and max.--> <dimen name="keyguard_clock_notifications_margin_min">44dp</dimen> <dimen name="keyguard_clock_notifications_margin_max">44dp</dimen> + + <!-- Height of the status bar header bar when on Keyguard --> + <dimen name="status_bar_header_height_keyguard">60dp</dimen> + + <!-- The width of user avatar when on Keyguard --> + <dimen name="multi_user_switch_width_keyguard">48dp</dimen> + + <!-- The width of user avatar when on Keyguard --> + <dimen name="multi_user_avatar_keyguard_size">30dp</dimen> + + <!-- end margin for multi user switch in collapsed quick settings --> + <dimen name="multi_user_switch_keyguard_margin">6dp</dimen> + + <!-- Margin on the left side of the carrier text on Keyguard --> + <dimen name="keyguard_carrier_text_margin">24dp</dimen> + + <!-- end margin for system icons if multi user switch is hidden --> + <dimen name="system_icons_switcher_hidden_expanded_margin">20dp</dimen> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index f9805ba..bd10623 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -362,9 +362,15 @@ <!-- The width of the multi user switch in expanded QS header. --> <dimen name="multi_user_switch_width_expanded">48dp</dimen> + <!-- The width of user avatar when on Keyguard --> + <dimen name="multi_user_switch_width_keyguard">34dp</dimen> + <!-- The width of user avatar when collapsed --> <dimen name="multi_user_avatar_collapsed_size">22dp</dimen> + <!-- The width of user avatar when on Keyguard --> + <dimen name="multi_user_avatar_keyguard_size">22dp</dimen> + <!-- The font size of the time when collapsed in QS --> <dimen name="qs_time_collapsed_size">14sp</dimen> @@ -380,4 +386,13 @@ <!-- Largest size an avatar might need to be drawn in the user picker, status bar, or quick settings header --> <dimen name="max_avatar_size">48dp</dimen> + + <!-- Margin on the left side of the carrier text on Keyguard --> + <dimen name="keyguard_carrier_text_margin">16dp</dimen> + + <!-- Margin on the left side of the battery % in the header. --> + <dimen name="header_battery_margin_expanded">8dp</dimen> + + <!-- Margin on the left side of the battery % when on Keyguard. --> + <dimen name="header_battery_margin_keyguard">6dp</dimen> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java index aaef60e..7b40d72 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarHeaderView.java @@ -95,7 +95,10 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private int mClockMarginBottomCollapsed; private int mMultiUserSwitchWidthCollapsed; private int mMultiUserSwitchWidthExpanded; + private int mMultiUserSwitchWidthKeyguard; private int mBatteryPaddingEnd; + private int mBatteryMarginExpanded; + private int mBatteryMarginKeyguard; /** * In collapsed QS, the clock and avatar are scaled down a bit post-layout to allow for a nice @@ -103,6 +106,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL */ private float mClockCollapsedScaleFactor; private float mAvatarCollapsedScaleFactor; + private float mAvatarKeyguardScaleFactor; private ActivityStarter mActivityStarter; private BatteryController mBatteryController; @@ -194,14 +198,23 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_collapsed); mMultiUserSwitchWidthExpanded = getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_expanded); + mMultiUserSwitchWidthKeyguard = + getResources().getDimensionPixelSize(R.dimen.multi_user_switch_width_keyguard); mAvatarCollapsedScaleFactor = getResources().getDimensionPixelSize(R.dimen.multi_user_avatar_collapsed_size) / (float) mMultiUserAvatar.getLayoutParams().width; + mAvatarKeyguardScaleFactor = + getResources().getDimensionPixelSize(R.dimen.multi_user_avatar_keyguard_size) + / (float) mMultiUserAvatar.getLayoutParams().width; mClockCollapsedScaleFactor = (float) getResources().getDimensionPixelSize(R.dimen.qs_time_collapsed_size) / (float) getResources().getDimensionPixelSize(R.dimen.qs_time_expanded_size); mBatteryPaddingEnd = getResources().getDimensionPixelSize(R.dimen.battery_level_padding_end); + mBatteryMarginExpanded = + getResources().getDimensionPixelSize(R.dimen.header_battery_margin_expanded); + mBatteryMarginKeyguard = + getResources().getDimensionPixelSize(R.dimen.header_battery_margin_keyguard); } public void setActivityStarter(ActivityStarter activityStarter) { @@ -253,6 +266,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateAvatarScale(); updateClockLp(); updateBatteryLevelPaddingEnd(); + updateBatteryLevelLp(); mStatusIconClipper.update(); } } @@ -354,12 +368,15 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL } private void updateAvatarScale() { - if (!mExpanded || mOverscrolled) { - mMultiUserSwitch.setScaleX(mAvatarCollapsedScaleFactor); - mMultiUserSwitch.setScaleY(mAvatarCollapsedScaleFactor); - } else { + if (mExpanded && !mOverscrolled) { mMultiUserSwitch.setScaleX(1f); mMultiUserSwitch.setScaleY(1f); + } else if (mKeyguardShowing) { + mMultiUserSwitch.setScaleX(mAvatarKeyguardScaleFactor); + mMultiUserSwitch.setScaleY(mAvatarKeyguardScaleFactor); + } else { + mMultiUserSwitch.setScaleX(mAvatarCollapsedScaleFactor); + mMultiUserSwitch.setScaleY(mAvatarCollapsedScaleFactor); } } @@ -453,16 +470,17 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL private void updateMultiUserSwitch() { int marginEnd; + int width; if (mExpanded && !mOverscrolled) { marginEnd = mMultiUserExpandedMargin; + width = mMultiUserSwitchWidthExpanded; } else if (mKeyguardShowing) { marginEnd = mMultiUserKeyguardMargin; + width = mMultiUserSwitchWidthKeyguard; } else { marginEnd = mMultiUserCollapsedMargin; + width = mMultiUserSwitchWidthCollapsed; } - int width = mExpanded && !mOverscrolled - ? mMultiUserSwitchWidthExpanded - : mMultiUserSwitchWidthCollapsed; MarginLayoutParams lp = (MarginLayoutParams) mMultiUserSwitch.getLayoutParams(); if (marginEnd != lp.getMarginEnd() || lp.width != width) { lp.setMarginEnd(marginEnd); @@ -471,6 +489,17 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL } } + private void updateBatteryLevelLp() { + int marginStart = mExpanded && !mOverscrolled + ? mBatteryMarginExpanded + : mBatteryMarginKeyguard; + MarginLayoutParams lp = (MarginLayoutParams) mBatteryLevel.getLayoutParams(); + if (marginStart != lp.getMarginStart()) { + lp.setMarginStart(marginStart); + mBatteryLevel.setLayoutParams(lp); + } + } + public void setExpansion(float t) { float height = mCollapsedHeight + t * (mExpandedHeight - mCollapsedHeight); if (height < mCollapsedHeight) { @@ -517,6 +546,7 @@ public class StatusBarHeaderView extends RelativeLayout implements View.OnClickL updateMultiUserSwitch(); updateClickTargets(); updateBatteryLevelPaddingEnd(); + updateAvatarScale(); mStatusIconClipper.update(); } |