diff options
3 files changed, 133 insertions, 57 deletions
diff --git a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml index 84df0d643e58..26152cdac136 100644 --- a/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml +++ b/packages/SystemUI/res/layout/quick_status_bar_expanded_header.xml @@ -34,19 +34,31 @@ <LinearLayout android:id="@+id/expanded_group" android:layout_width="wrap_content" - android:layout_height="match_parent" + android:layout_height="48dp" android:gravity="center" android:clipChildren="false" android:clipToPadding="false" android:orientation="horizontal" android:layout_alignParentEnd="true" - android:layout_marginTop="30dp" - android:layout_marginEnd="16dp"> + android:layout_marginTop="28dp" + android:layout_marginEnd="12dp"> + + <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch" + android:layout_width="48dp" + android:layout_height="48dp" + android:layout_alignParentEnd="true" + android:background="@drawable/ripple_drawable" > + <ImageView android:id="@+id/multi_user_avatar" + android:layout_width="@dimen/multi_user_avatar_expanded_size" + android:layout_height="@dimen/multi_user_avatar_expanded_size" + android:layout_gravity="center" + android:scaleType="centerInside"/> + </com.android.systemui.statusbar.phone.MultiUserSwitch> <com.android.systemui.statusbar.AlphaOptimizedFrameLayout android:id="@+id/settings_button_container" android:layout_width="48dp" - android:layout_height="@dimen/status_bar_header_height" + android:layout_height="48dp" android:clipChildren="false" android:clipToPadding="false"> @@ -68,18 +80,6 @@ </com.android.systemui.statusbar.AlphaOptimizedFrameLayout> - <com.android.systemui.statusbar.phone.MultiUserSwitch android:id="@+id/multi_user_switch" - android:layout_width="48dp" - android:layout_height="48dp" - android:layout_alignParentEnd="true" - android:background="@drawable/ripple_drawable" > - <ImageView android:id="@+id/multi_user_avatar" - android:layout_width="@dimen/multi_user_avatar_expanded_size" - android:layout_height="@dimen/multi_user_avatar_expanded_size" - android:layout_gravity="center" - android:scaleType="centerInside"/> - </com.android.systemui.statusbar.phone.MultiUserSwitch> - <ImageView android:layout_width="48dp" android:layout_height="48dp" @@ -104,44 +104,62 @@ android:gravity="center_vertical" /> <LinearLayout - android:id="@+id/date_time_group" + android:id="@+id/date_time_alarm_group" android:layout_width="wrap_content" - android:layout_height="25dp" + android:layout_height="wrap_content" android:layout_alignParentStart="true" android:layout_alignParentTop="true" - android:orientation="horizontal"> - - <include layout="@layout/split_clock_view" + android:layout_marginStart="16dp" + android:gravity="start" + android:orientation="vertical"> + <LinearLayout + android:id="@+id/date_time_group" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginStart="16dp" + android:layout_height="19dp" android:layout_marginTop="4dp" - android:id="@+id/clock" /> + android:orientation="horizontal"> - <com.android.systemui.statusbar.policy.DateView - android:id="@+id/date" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginStart="6dp" - android:layout_marginTop="4dp" - android:drawableStart="@drawable/header_dot" - android:drawablePadding="6dp" - android:singleLine="true" - android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" - android:textSize="@dimen/qs_time_collapsed_size" - android:gravity="top" - systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" /> + <include layout="@layout/split_clock_view" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:id="@+id/clock" /> + + <com.android.systemui.statusbar.policy.DateView + android:id="@+id/date" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="6dp" + android:drawableStart="@drawable/header_dot" + android:drawablePadding="6dp" + android:singleLine="true" + android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Clock" + android:textSize="@dimen/qs_time_collapsed_size" + android:gravity="top" + systemui:datePattern="@string/abbrev_wday_month_day_no_year_alarm" /> + + <com.android.systemui.statusbar.AlphaOptimizedButton + android:id="@+id/alarm_status_collapsed" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:drawablePadding="6dp" + android:drawableStart="@drawable/ic_access_alarms_small" + android:textColor="#64ffffff" + android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" + android:paddingStart="6dp" + android:gravity="top" + android:background="?android:attr/selectableItemBackground" + android:visibility="gone" /> + </LinearLayout> <com.android.systemui.statusbar.AlphaOptimizedButton android:id="@+id/alarm_status" android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_marginTop="4dp" - android:drawablePadding="6dp" + android:layout_height="20dp" + android:paddingTop="3dp" + android:drawablePadding="8dp" android:drawableStart="@drawable/ic_access_alarms_small" android:textColor="#64ffffff" android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Date" - android:paddingStart="6dp" android:gravity="top" android:background="?android:attr/selectableItemBackground" android:visibility="gone" /> @@ -152,7 +170,7 @@ android:background="#0000" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="25dp" + android:layout_marginTop="28dp" android:layout_marginStart="12dp" android:layout_marginEnd="12dp" android:layout_alignParentEnd="true" diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 11c13e178625..aed5ab22be63 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -162,7 +162,10 @@ <dimen name="qs_tile_margin">16dp</dimen> <dimen name="qs_quick_tile_size">48dp</dimen> <dimen name="qs_quick_tile_padding">12dp</dimen> - <dimen name="qs_date_anim_translation">44.5dp</dimen> + <dimen name="qs_date_anim_translation">36dp</dimen> + <dimen name="qs_date_alarm_anim_translation">26dp</dimen> + <dimen name="qs_date_collapsed_text_size">14sp</dimen> + <dimen name="qs_date_text_size">16sp</dimen> <dimen name="qs_page_indicator_size">12dp</dimen> <dimen name="qs_tile_icon_size">24dp</dimen> <dimen name="qs_tile_text_size">12sp</dimen> @@ -598,9 +601,6 @@ <dimen name="fab_elevation">12dp</dimen> <dimen name="fab_press_translation_z">9dp</dimen> - <!-- TODO: Remove this --> - <dimen name="qs_header_neg_padding">-8dp</dimen> - <!-- How high we lift the divider when touching --> <dimen name="docked_stack_divider_lift_elevation">4dp</dimen> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java index 11d99ffe97dc..3bb141a3621b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java @@ -20,6 +20,7 @@ import android.app.AlarmManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; @@ -30,6 +31,7 @@ import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.android.keyguard.KeyguardStatusView; +import com.android.systemui.FontSizeUtils; import com.android.systemui.R; import com.android.systemui.qs.QSPanel; import com.android.systemui.qs.QSTile; @@ -47,7 +49,9 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements private NextAlarmController mNextAlarmController; private SettingsButton mSettingsButton; private View mSettingsContainer; + private TextView mAlarmStatus; + private TextView mAlarmStatusCollapsed; private QSPanel mQsPanel; @@ -56,19 +60,21 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements private ViewGroup mExpandedGroup; private ViewGroup mDateTimeGroup; - private View mEmergencyOnly; - private TextView mQsDetailHeaderTitle; + private ViewGroup mDateTimeAlarmGroup; + private TextView mEmergencyOnly; + private boolean mListening; private AlarmManager.AlarmClockInfo mNextAlarm; private QuickQSPanel mHeaderQsPanel; private boolean mShowEmergencyCallsOnly; - private float mDateTimeTranslation; private MultiUserSwitch mMultiUserSwitch; private ImageView mMultiUserAvatar; - private View mQsDetailHeaderBack; - private final int[] mTmpInt2 = new int[2]; + private float mDateTimeTranslation; + private float mDateTimeAlarmTranslation; + private float mExpansionFraction; + private float mDateScaleFactor; public QuickStatusBarHeader(Context context, AttributeSet attrs) { super(context, attrs); @@ -78,11 +84,12 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements protected void onFinishInflate() { super.onFinishInflate(); - mEmergencyOnly = findViewById(R.id.header_emergency_calls_only); - mDateTimeTranslation = mContext.getResources().getDimension( - R.dimen.qs_date_anim_translation); + mEmergencyOnly = (TextView) findViewById(R.id.header_emergency_calls_only); + + mDateTimeAlarmGroup = (ViewGroup) findViewById(R.id.date_time_alarm_group); + mDateTimeAlarmGroup.findViewById(R.id.empty_time_view).setVisibility(View.GONE); mDateTimeGroup = (ViewGroup) findViewById(R.id.date_time_group); - mDateTimeGroup.findViewById(R.id.empty_time_view).setVisibility(View.GONE); + mExpandedGroup = (ViewGroup) findViewById(R.id.expanded_group); mHeaderQsPanel = (QuickQSPanel) findViewById(R.id.quick_qs_panel); @@ -91,6 +98,7 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements mSettingsContainer = findViewById(R.id.settings_button_container); mSettingsButton.setOnClickListener(this); + mAlarmStatusCollapsed = (TextView) findViewById(R.id.alarm_status_collapsed); mAlarmStatus = (TextView) findViewById(R.id.alarm_status); mAlarmStatus.setOnClickListener(this); @@ -110,6 +118,29 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements getHeight())); } }); + updateResources(); + } + + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); + updateResources(); + } + + private void updateResources() { + FontSizeUtils.updateFontSize(mAlarmStatus, R.dimen.qs_date_collapsed_size); + FontSizeUtils.updateFontSize(mEmergencyOnly, R.dimen.qs_emergency_calls_only_text_size); + + mDateTimeTranslation = mContext.getResources().getDimension( + R.dimen.qs_date_anim_translation); + mDateTimeAlarmTranslation = mContext.getResources().getDimension( + R.dimen.qs_date_alarm_anim_translation); + float dateCollapsedSize = mContext.getResources().getDimension( + R.dimen.qs_date_collapsed_text_size); + float dateExpandedSize = mContext.getResources().getDimension( + R.dimen.qs_date_text_size); + mDateScaleFactor = dateExpandedSize / dateCollapsedSize - 1; + updateDateTimePosition(); } @Override @@ -140,15 +171,41 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements @Override public void setExpansion(float headerExpansionFraction) { + mExpansionFraction = headerExpansionFraction; + mExpandedGroup.setAlpha(headerExpansionFraction); mExpandedGroup.setVisibility(headerExpansionFraction > 0 ? View.VISIBLE : View.INVISIBLE); + mHeaderQsPanel.setAlpha(1 - headerExpansionFraction); mHeaderQsPanel.setVisibility(headerExpansionFraction < 1 ? View.VISIBLE : View.INVISIBLE); - mDateTimeGroup.setTranslationY(headerExpansionFraction * mDateTimeTranslation); + mAlarmStatus.setAlpha(headerExpansionFraction); + mAlarmStatusCollapsed.setAlpha(1 - headerExpansionFraction); + updateAlarmVisibilities(); + + float textScale = headerExpansionFraction * mDateScaleFactor; + mDateTimeGroup.setScaleX(1 + textScale); + mDateTimeGroup.setScaleY(1 + textScale); + mDateTimeGroup.setTranslationX(textScale * mDateTimeGroup.getWidth() / 2); + mDateTimeGroup.setTranslationY(textScale * mDateTimeGroup.getHeight() / 2); + updateDateTimePosition(); + mEmergencyOnly.setAlpha(headerExpansionFraction); } + private void updateAlarmVisibilities() { + mAlarmStatus.setVisibility(mAlarmShowing && mExpansionFraction > 0 + ? View.VISIBLE : View.INVISIBLE); + mAlarmStatusCollapsed.setVisibility(mAlarmShowing && mExpansionFraction < 1 + ? View.VISIBLE : View.INVISIBLE); + } + + private void updateDateTimePosition() { + float translation = mAlarmShowing ? mDateTimeAlarmTranslation + : mDateTimeTranslation; + mDateTimeAlarmGroup.setTranslationY(mExpansionFraction * translation); + } + public void setListening(boolean listening) { if (listening == mListening) { return; @@ -160,11 +217,12 @@ public class QuickStatusBarHeader extends BaseStatusBarHeader implements @Override public void updateEverything() { + updateDateTimePosition(); updateVisibilities(); } private void updateVisibilities() { - mAlarmStatus.setVisibility(mAlarmShowing ? View.VISIBLE : View.GONE); + updateAlarmVisibilities(); mEmergencyOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly ? View.VISIBLE : View.INVISIBLE); mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility( |