diff options
15 files changed, 161 insertions, 30 deletions
diff --git a/packages/Keyguard/res/layout/keyguard_status_view.xml b/packages/Keyguard/res/layout/keyguard_status_view.xml index 0d943ed..f79819f 100644 --- a/packages/Keyguard/res/layout/keyguard_status_view.xml +++ b/packages/Keyguard/res/layout/keyguard_status_view.xml @@ -28,8 +28,6 @@ androidprv:layout_maxWidth="@dimen/keyguard_security_width" androidprv:layout_maxHeight="@dimen/keyguard_security_height" android:gravity="center_horizontal|top" - android:layout_marginTop="48dp" - android:layout_marginBottom="32dp" android:contentDescription="@string/keyguard_accessibility_status"> <LinearLayout android:layout_width="match_parent" diff --git a/packages/Keyguard/res/values-sw600dp-land/dimens.xml b/packages/Keyguard/res/values-sw600dp-land/dimens.xml index 5507e5f..5615ff7 100644 --- a/packages/Keyguard/res/values-sw600dp-land/dimens.xml +++ b/packages/Keyguard/res/values-sw600dp-land/dimens.xml @@ -23,4 +23,8 @@ <!-- Size of margin on the right of keyguard's status view --> <dimen name="kg_status_line_font_right_margin">16dp</dimen> + + <!-- Overload default clock widget parameters --> + <dimen name="widget_big_font_size">88dp</dimen> + <dimen name="bottom_text_spacing_digital">-24dp</dimen> </resources>
\ No newline at end of file diff --git a/packages/Keyguard/res/values-sw600dp/dimens.xml b/packages/Keyguard/res/values-sw600dp/dimens.xml index 25e86e1..a5e93dc 100644 --- a/packages/Keyguard/res/values-sw600dp/dimens.xml +++ b/packages/Keyguard/res/values-sw600dp/dimens.xml @@ -63,8 +63,9 @@ <dimen name="keyguard_muliuser_selector_margin">12dp</dimen> <!-- Overload default clock widget parameters --> - <dimen name="widget_label_font_size">16dp</dimen> - <dimen name="widget_big_font_size">141dp</dimen> + <dimen name="widget_big_font_size">96dp</dimen> + <dimen name="widget_label_font_size">16sp</dimen> + <dimen name="bottom_text_spacing_digital">-24dp</dimen> <!-- EmergencyCarrierArea overlap - amount to overlap the emergency button and carrier text. Should be 0 on devices with plenty of room (e.g. tablets) --> diff --git a/packages/Keyguard/res/values-sw720dp/dimens.xml b/packages/Keyguard/res/values-sw720dp/dimens.xml index 30b979c..c487072 100644 --- a/packages/Keyguard/res/values-sw720dp/dimens.xml +++ b/packages/Keyguard/res/values-sw720dp/dimens.xml @@ -61,7 +61,4 @@ <!-- Height of the sliding KeyguardSecurityContainer (includes 2x keyguard_security_view_margin) --> <dimen name="keyguard_security_height">420dp</dimen> - <!-- Default clock parameters --> - <dimen name="widget_label_font_size">19dp</dimen> - </resources> diff --git a/packages/Keyguard/res/values/dimens.xml b/packages/Keyguard/res/values/dimens.xml index c05f834..6224aed 100644 --- a/packages/Keyguard/res/values/dimens.xml +++ b/packages/Keyguard/res/values/dimens.xml @@ -155,10 +155,10 @@ <dimen name="eca_overlap">-10dip</dimen> <!-- Default clock parameters --> - <dimen name="bottom_text_spacing_digital">-8dp</dimen> + <dimen name="bottom_text_spacing_digital">-18dp</dimen> <dimen name="label_font_size">14dp</dimen> - <dimen name="widget_label_font_size">14dp</dimen> - <dimen name="widget_big_font_size">60dp</dimen> + <dimen name="widget_label_font_size">14sp</dimen> + <dimen name="widget_big_font_size">68dp</dimen> <dimen name="big_font_size">120dp</dimen> </resources> diff --git a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml index 30eedee..8348e9b 100644 --- a/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml +++ b/packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml @@ -18,7 +18,7 @@ <com.android.systemui.statusbar.NotificationOverflowContainer xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="40dp" + android:layout_height="@dimen/notification_summary_height" android:focusable="true" android:clickable="true" > diff --git a/packages/SystemUI/res/values-sw600dp-land/values-land-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp-land/dimens.xml index e440de1..b510fef 100644 --- a/packages/SystemUI/res/values-sw600dp-land/values-land-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp-land/dimens.xml @@ -18,4 +18,7 @@ <resources> <!-- Recent Applications parameters --> <dimen name="status_bar_recents_app_label_width">190dip</dimen> + + <fraction name="keyguard_clock_y_fraction_max">37%</fraction> + <fraction name="keyguard_clock_y_fraction_min">14%</fraction> </resources> diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index 7372181..22815f3 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -48,4 +48,15 @@ <!-- Width of the zen mode interstitial dialog. --> <dimen name="zen_mode_dialog_width">384dp</dimen> + + <!-- The fraction of the screen height where the clock on the Keyguard has its center. The + max value is used when no notifications are displaying, and the min value is when the + highest possible number of notifications are showing. --> + <fraction name="keyguard_clock_y_fraction_max">34%</fraction> + <fraction name="keyguard_clock_y_fraction_min">25%</fraction> + + <!-- The margin between the clock and the notifications on Keyguard. See + keyguard_clock_height_fraction_* for the difference between min and max.--> + <dimen name="keyguard_clock_notifications_margin_min">32dp</dimen> + <dimen name="keyguard_clock_notifications_margin_max">32dp</dimen> </resources> diff --git a/packages/SystemUI/res/values-sw720dp-land/dimens.xml b/packages/SystemUI/res/values-sw720dp-land/dimens.xml new file mode 100644 index 0000000..2532dd6 --- /dev/null +++ b/packages/SystemUI/res/values-sw720dp-land/dimens.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2014 The Android Open Source Project + ~ + ~ Licensed under the Apache License, Version 2.0 (the "License"); + ~ you may not use this file except in compliance with the License. + ~ You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License + --> +<resources> + <!-- The fraction of the screen height where the clock on the Keyguard has its center. The + min value is used when no notifications are displaying, and the max value is when the + highest possible number of notifications are showing. --> + <fraction name="keyguard_clock_y_fraction_max">35%</fraction> + <fraction name="keyguard_clock_y_fraction_min">20%</fraction> +</resources> diff --git a/packages/SystemUI/res/values-sw720dp/config.xml b/packages/SystemUI/res/values-sw720dp/config.xml index 7cf711a..d8bb8d7d 100644 --- a/packages/SystemUI/res/values-sw720dp/config.xml +++ b/packages/SystemUI/res/values-sw720dp/config.xml @@ -35,5 +35,9 @@ <!-- Transposes the search bar layout in landscape --> <bool name="recents_transpose_search_layout_with_orientation">false</bool> + + <!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow + card. --> + <integer name="keyguard_max_notification_count">5</integer> </resources> diff --git a/packages/SystemUI/res/values-sw720dp/dimens.xml b/packages/SystemUI/res/values-sw720dp/dimens.xml index a1c5b66..7695b12 100644 --- a/packages/SystemUI/res/values-sw720dp/dimens.xml +++ b/packages/SystemUI/res/values-sw720dp/dimens.xml @@ -65,5 +65,11 @@ <!-- Where to place the app icon over the thumbnail --> <dimen name="status_bar_recents_app_icon_left_margin">0dp</dimen> <dimen name="status_bar_recents_app_icon_top_margin">8dp</dimen> + + <!-- The fraction of the screen height where the clock on the Keyguard has its center. The + max value is used when no notifications are displaying, and the min value is when the + highest possible number of notifications are showing. --> + <fraction name="keyguard_clock_y_fraction_max">35%</fraction> + <fraction name="keyguard_clock_y_fraction_min">25%</fraction> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index d403bf3..cd8ddc3 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -82,6 +82,9 @@ <!-- Height of a medium notification in the status bar --> <dimen name="notification_mid_height">128dp</dimen> + <!-- Height of a the summary ("more card") notification on keyguard. --> + <dimen name="notification_summary_height">40dp</dimen> + <!-- size at which Notification icons will be drawn in the status bar --> <dimen name="status_bar_icon_drawing_size">18dip</dimen> @@ -289,4 +292,16 @@ <!-- Minimum distance the user has to drag down to go to the full shade. --> <dimen name="keyguard_drag_down_min_distance">100dp</dimen> + + <!-- The fraction of the screen height where the clock on the Keyguard has its center. The + max value is used when no notifications are displaying, and the min value is when the + highest possible number of notifications are showing. --> + <fraction name="keyguard_clock_y_fraction_max">29.5%</fraction> + <fraction name="keyguard_clock_y_fraction_min">18%</fraction> + + <!-- The margin between the clock and the notifications on Keyguard. See + keyguard_clock_height_fraction_* for the difference between min and max.--> + <dimen name="keyguard_clock_notifications_margin_min">22dp</dimen> + <dimen name="keyguard_clock_notifications_margin_max">28dp</dimen> + </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java index cd985f5..047983b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java @@ -26,8 +26,6 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; -import android.view.animation.AnimationUtils; -import android.view.animation.Interpolator; import android.widget.LinearLayout; import com.android.systemui.R; @@ -40,8 +38,6 @@ import com.android.systemui.statusbar.stack.NotificationStackScrollLayout; public class NotificationPanelView extends PanelView implements ExpandableView.OnHeightChangedListener, ObservableScrollView.Listener, View.OnClickListener { - public static final boolean DEBUG_GESTURES = true; - private static final int EXPANSION_ANIMATION_LENGTH = 375; PhoneStatusBar mStatusBar; private StatusBarHeaderView mHeader; @@ -80,6 +76,17 @@ public class NotificationPanelView extends PanelView implements private FlingAnimationUtils mFlingAnimationUtils; private int mStatusBarMinHeight; + private int mClockNotificationsMarginMin; + private int mClockNotificationsMarginMax; + private float mClockYFractionMin; + private float mClockYFractionMax; + + /** + * The number (fractional) of notifications the "more" card counts when calculating how many + * notifications are currently visible for the y positioning of the clock. + */ + private float mMoreCardNotificationAmount; + public NotificationPanelView(Context context, AttributeSet attrs) { super(context, attrs); } @@ -113,9 +120,25 @@ public class NotificationPanelView extends PanelView implements mNotificationStackScroller = (NotificationStackScrollLayout) findViewById(R.id.notification_stack_scroller); mNotificationStackScroller.setOnHeightChangedListener(this); + } + + @Override + protected void loadDimens() { + super.loadDimens(); mNotificationTopPadding = getResources().getDimensionPixelSize( R.dimen.notifications_top_padding); mMinStackHeight = getResources().getDimensionPixelSize(R.dimen.collapsed_stack_height); + mClockNotificationsMarginMin = getResources().getDimensionPixelSize( + R.dimen.keyguard_clock_notifications_margin_min); + mClockNotificationsMarginMax = getResources().getDimensionPixelSize( + R.dimen.keyguard_clock_notifications_margin_max); + mClockYFractionMin = + getResources().getFraction(R.fraction.keyguard_clock_y_fraction_min, 1, 1); + mClockYFractionMax = + getResources().getFraction(R.fraction.keyguard_clock_y_fraction_max, 1, 1); + mMoreCardNotificationAmount = + (float) getResources().getDimensionPixelSize(R.dimen.notification_summary_height) / + getResources().getDimensionPixelSize(R.dimen.notification_min_height); mFlingAnimationUtils = new FlingAnimationUtils(getContext()); mStatusBarMinHeight = getResources().getDimensionPixelSize( com.android.internal.R.dimen.status_bar_height); @@ -124,15 +147,8 @@ public class NotificationPanelView extends PanelView implements @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); - int keyguardBottomMargin = - ((MarginLayoutParams) mKeyguardStatusView.getLayoutParams()).bottomMargin; if (!mQsExpanded) { - mStackScrollerIntrinsicPadding = mStatusBar.getBarState() == StatusBarState.KEYGUARD - ? mKeyguardStatusView.getBottom() + keyguardBottomMargin - : mHeader.getBottom() + mNotificationTopPadding; - mNotificationStackScroller.setTopPadding(mStackScrollerIntrinsicPadding, - mAnimateNextTopPaddingChange); - mAnimateNextTopPaddingChange = false; + positionClockAndNotifications(); } // Calculate quick setting heights. @@ -143,6 +159,44 @@ public class NotificationPanelView extends PanelView implements } } + /** + * Positions the clock and notifications dynamically depending on how many notifications are + * showing. + */ + private void positionClockAndNotifications() { + if (mStatusBar.getBarState() != StatusBarState.KEYGUARD) { + mStackScrollerIntrinsicPadding = mHeader.getBottom() + mNotificationTopPadding; + } else { + int notificationCount = mNotificationStackScroller.getNotGoneChildCount(); + int y = getClockY(notificationCount); + int padding = getClockNotificationsPadding(notificationCount); + mKeyguardStatusView.setY(y - mKeyguardStatusView.getHeight()/2); + mStackScrollerIntrinsicPadding = + (int) (mKeyguardStatusView.getY() + mKeyguardStatusView.getHeight() + padding); + } + mNotificationStackScroller.setTopPadding(mStackScrollerIntrinsicPadding, + mAnimateNextTopPaddingChange); + mAnimateNextTopPaddingChange = false; + } + + private int getClockNotificationsPadding(int notificationCount) { + float t = notificationCount + / (mStatusBar.getMaxKeyguardNotifications() + mMoreCardNotificationAmount); + t = Math.min(t, 1.0f); + return (int) (t * mClockNotificationsMarginMin + (1 - t) * mClockNotificationsMarginMax); + } + + private float getClockYFraction(int notificationCount) { + float t = notificationCount + / (mStatusBar.getMaxKeyguardNotifications() + mMoreCardNotificationAmount); + t = Math.min(t, 1.0f); + return (1 - t) * mClockYFractionMax + t * mClockYFractionMin; + } + + private int getClockY(int notificationCount) { + return (int) (getClockYFraction(notificationCount) * getHeight()); + } + public void animateToFullShade() { mAnimateNextTopPaddingChange = true; mNotificationStackScroller.goToFullShade(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index dde2ebb..517f763 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -322,7 +322,7 @@ public class PanelView extends FrameLayout { setOnHierarchyChangeListener(mHierarchyListener); } - private void loadDimens() { + protected void loadDimens() { final Resources res = getContext().getResources(); mSelfExpandVelocityPx = res.getDimension(R.dimen.self_expand_velocity); @@ -583,8 +583,14 @@ public class PanelView extends FrameLayout { @Override protected void onFinishInflate() { super.onFinishInflate(); + loadDimens(); + } + @Override + protected void onConfigurationChanged(Configuration newConfig) { + super.onConfigurationChanged(newConfig); loadDimens(); + mMaxPanelHeight = -1; } public void fling(float vel, boolean always) { @@ -697,12 +703,6 @@ public class PanelView extends FrameLayout { mExpandedFraction = Math.min(1f, (fh == 0) ? 0 : h / fh); } - @Override - protected void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - mMaxPanelHeight = -1; - } - protected void onHeightUpdated(float expandedHeight) { requestLayout(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index f125c9a..cb0a696 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -961,6 +961,21 @@ public class NotificationStackScrollLayout extends ViewGroup return null; } + /** + * @return the number of children which have visibility unequal to GONE + */ + public int getNotGoneChildCount() { + int childCount = getChildCount(); + int count = 0; + for (int i = 0; i < childCount; i++) { + View child = getChildAt(i); + if (child.getVisibility() != View.GONE) { + count++; + } + } + return count; + } + private int getMaxExpandHeight(View view) { if (view instanceof ExpandableNotificationRow) { ExpandableNotificationRow row = (ExpandableNotificationRow) view; |