Loading packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml 0 → 100644 +51 −0 Original line number Diff line number Diff line <!-- ~ 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 --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <com.android.systemui.statusbar.LatestItemView android:id="@+id/container" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginTop="@dimen/notification_divider_height" android:focusable="true" android:clickable="true" android:background="@*android:drawable/notification_quantum_bg_dim" > <TextView android:id="@+id/more_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="center_horizontal" android:textColor="@color/keyguard_overflow_content_color" android:textAllCaps="true" android:textAppearance="?android:attr/textAppearanceMedium" /> <com.android.systemui.statusbar.NotificationOverflowIconsView android:id="@+id/overflow_icons_view" android:layout_gravity="end|center_vertical" android:gravity="end" android:paddingLeft="8dp" android:paddingRight="8dp" android:layout_width="120dp" android:layout_height="wrap_content" /> </com.android.systemui.statusbar.LatestItemView> </FrameLayout> packages/SystemUI/res/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,7 @@ <!-- Tint color for active Quick Settings icons. --> <color name="ic_qs_on">#ffffffff</color> <!-- Tint color for the content on the notification overflow card. --> <color name="keyguard_overflow_content_color">#ff666666</color> </resources> packages/SystemUI/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -114,5 +114,9 @@ <integer name="recents_filter_animate_new_views_min_duration">125</integer> <!-- The min animation duration for animating views that are newly visible. --> <integer name="recents_animate_task_bar_enter_duration">200</integer> <!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow card. --> <integer name="keyguard_max_notification_count">4</integer> </resources> packages/SystemUI/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -534,4 +534,9 @@ </plurals> <!-- Zen mode: Summary notification content text. [CHAR LIMIT=NONE] --> <string name="zen_mode_notification_text">Touch to show</string> <!-- Text for overflow card on Keyguard when there is not enough space for all notifications on Keyguard. [CHAR LIMIT=12] --> <plurals name="keyguard_more_overflow_text"> <item quantity="other">%d more</item> </plurals> </resources> packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +32 −1 Original line number Diff line number Diff line Loading @@ -168,6 +168,8 @@ public abstract class BaseStatusBar extends SystemUI implements protected int mZenMode; protected boolean mOnKeyguard; protected View mKeyguardIconOverflowContainer; protected NotificationOverflowIconsView mOverflowIconsView; public boolean isDeviceProvisioned() { return mDeviceProvisioned; Loading Loading @@ -1050,12 +1052,20 @@ public abstract class BaseStatusBar extends SystemUI implements addNotificationViews(createNotificationViews(key, notification)); } /** * @return The number of notifications we show on Keyguard. */ protected abstract int getMaxKeyguardNotifications(); /** * Updates expanded, dimmed and locked states of notification rows. */ protected void updateRowStates() { int maxKeyguardNotifications = getMaxKeyguardNotifications(); mOverflowIconsView.removeAllViews(); int n = mNotificationData.size(); for (int i = 0; i < n; i++) { int visibleNotifications = 0; for (int i = n-1; i >= 0; i--) { NotificationData.Entry entry = mNotificationData.get(i); if (mOnKeyguard) { entry.row.setExpanded(false); Loading @@ -1067,7 +1077,28 @@ public abstract class BaseStatusBar extends SystemUI implements } entry.row.setDimmed(mOnKeyguard); entry.row.setLocked(mOnKeyguard); boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification); if (mOnKeyguard && (visibleNotifications >= maxKeyguardNotifications || !showOnKeyguard)) { entry.row.setVisibility(View.GONE); if (showOnKeyguard) { mOverflowIconsView.addNotification(entry); } } else { entry.row.setVisibility(View.VISIBLE); visibleNotifications++; } } if (mOnKeyguard && mOverflowIconsView.getChildCount() > 0) { mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE); } else { mKeyguardIconOverflowContainer.setVisibility(View.GONE); } } private boolean shouldShowOnKeyguard(StatusBarNotification sbn) { return sbn.getNotification().priority >= Notification.PRIORITY_LOW; } protected void setZenMode(int mode) { Loading Loading
packages/SystemUI/res/layout/status_bar_notification_keyguard_overflow.xml 0 → 100644 +51 −0 Original line number Diff line number Diff line <!-- ~ 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 --> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <com.android.systemui.statusbar.LatestItemView android:id="@+id/container" android:layout_width="match_parent" android:layout_height="40dp" android:layout_marginTop="@dimen/notification_divider_height" android:focusable="true" android:clickable="true" android:background="@*android:drawable/notification_quantum_bg_dim" > <TextView android:id="@+id/more_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:gravity="center_horizontal" android:textColor="@color/keyguard_overflow_content_color" android:textAllCaps="true" android:textAppearance="?android:attr/textAppearanceMedium" /> <com.android.systemui.statusbar.NotificationOverflowIconsView android:id="@+id/overflow_icons_view" android:layout_gravity="end|center_vertical" android:gravity="end" android:paddingLeft="8dp" android:paddingRight="8dp" android:layout_width="120dp" android:layout_height="wrap_content" /> </com.android.systemui.statusbar.LatestItemView> </FrameLayout>
packages/SystemUI/res/values/colors.xml +3 −0 Original line number Diff line number Diff line Loading @@ -45,4 +45,7 @@ <!-- Tint color for active Quick Settings icons. --> <color name="ic_qs_on">#ffffffff</color> <!-- Tint color for the content on the notification overflow card. --> <color name="keyguard_overflow_content_color">#ff666666</color> </resources>
packages/SystemUI/res/values/config.xml +4 −0 Original line number Diff line number Diff line Loading @@ -114,5 +114,9 @@ <integer name="recents_filter_animate_new_views_min_duration">125</integer> <!-- The min animation duration for animating views that are newly visible. --> <integer name="recents_animate_task_bar_enter_duration">200</integer> <!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow card. --> <integer name="keyguard_max_notification_count">4</integer> </resources>
packages/SystemUI/res/values/strings.xml +5 −0 Original line number Diff line number Diff line Loading @@ -534,4 +534,9 @@ </plurals> <!-- Zen mode: Summary notification content text. [CHAR LIMIT=NONE] --> <string name="zen_mode_notification_text">Touch to show</string> <!-- Text for overflow card on Keyguard when there is not enough space for all notifications on Keyguard. [CHAR LIMIT=12] --> <plurals name="keyguard_more_overflow_text"> <item quantity="other">%d more</item> </plurals> </resources>
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +32 −1 Original line number Diff line number Diff line Loading @@ -168,6 +168,8 @@ public abstract class BaseStatusBar extends SystemUI implements protected int mZenMode; protected boolean mOnKeyguard; protected View mKeyguardIconOverflowContainer; protected NotificationOverflowIconsView mOverflowIconsView; public boolean isDeviceProvisioned() { return mDeviceProvisioned; Loading Loading @@ -1050,12 +1052,20 @@ public abstract class BaseStatusBar extends SystemUI implements addNotificationViews(createNotificationViews(key, notification)); } /** * @return The number of notifications we show on Keyguard. */ protected abstract int getMaxKeyguardNotifications(); /** * Updates expanded, dimmed and locked states of notification rows. */ protected void updateRowStates() { int maxKeyguardNotifications = getMaxKeyguardNotifications(); mOverflowIconsView.removeAllViews(); int n = mNotificationData.size(); for (int i = 0; i < n; i++) { int visibleNotifications = 0; for (int i = n-1; i >= 0; i--) { NotificationData.Entry entry = mNotificationData.get(i); if (mOnKeyguard) { entry.row.setExpanded(false); Loading @@ -1067,7 +1077,28 @@ public abstract class BaseStatusBar extends SystemUI implements } entry.row.setDimmed(mOnKeyguard); entry.row.setLocked(mOnKeyguard); boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification); if (mOnKeyguard && (visibleNotifications >= maxKeyguardNotifications || !showOnKeyguard)) { entry.row.setVisibility(View.GONE); if (showOnKeyguard) { mOverflowIconsView.addNotification(entry); } } else { entry.row.setVisibility(View.VISIBLE); visibleNotifications++; } } if (mOnKeyguard && mOverflowIconsView.getChildCount() > 0) { mKeyguardIconOverflowContainer.setVisibility(View.VISIBLE); } else { mKeyguardIconOverflowContainer.setVisibility(View.GONE); } } private boolean shouldShowOnKeyguard(StatusBarNotification sbn) { return sbn.getNotification().priority >= Notification.PRIORITY_LOW; } protected void setZenMode(int mode) { Loading