From 5485ff6141ccebad2c171a9a51ffdbcb72703bd7 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 27 May 2011 19:15:01 +0900 Subject: Reduce the number of notification icons on narrow screens. For devices with minimum width between 600 and 720 dp, show only 3 icons (and then, only in portrait). All other configurations will show 5. Bug: 4501374 Change-Id: I88168560fc2876c26cd3eb57f2db0b0cfe8b4fdd --- .../SystemUI/res/values-sw600dp-port/config.xml | 25 ++++++++++++++++++++++ .../SystemUI/res/values-sw600dp-port/dimens.xml | 4 ++-- .../SystemUI/res/values-sw720dp-port/dimens.xml | 22 +++++++++++++++++++ packages/SystemUI/res/values-sw720dp/config.xml | 25 ++++++++++++++++++++++ packages/SystemUI/res/values/config.xml | 4 ++++ .../systemui/statusbar/tablet/TabletStatusBar.java | 15 +++++++++---- 6 files changed, 89 insertions(+), 6 deletions(-) create mode 100644 packages/SystemUI/res/values-sw600dp-port/config.xml create mode 100644 packages/SystemUI/res/values-sw720dp-port/dimens.xml create mode 100644 packages/SystemUI/res/values-sw720dp/config.xml diff --git a/packages/SystemUI/res/values-sw600dp-port/config.xml b/packages/SystemUI/res/values-sw600dp-port/config.xml new file mode 100644 index 0000000..ab7661a --- /dev/null +++ b/packages/SystemUI/res/values-sw600dp-port/config.xml @@ -0,0 +1,25 @@ + + + + + + 3 + + diff --git a/packages/SystemUI/res/values-sw600dp-port/dimens.xml b/packages/SystemUI/res/values-sw600dp-port/dimens.xml index 78dd8c4..b8a6cfe 100644 --- a/packages/SystemUI/res/values-sw600dp-port/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp-port/dimens.xml @@ -1,6 +1,6 @@ - 2dp + 0dp diff --git a/packages/SystemUI/res/values-sw720dp-port/dimens.xml b/packages/SystemUI/res/values-sw720dp-port/dimens.xml new file mode 100644 index 0000000..74b266d --- /dev/null +++ b/packages/SystemUI/res/values-sw720dp-port/dimens.xml @@ -0,0 +1,22 @@ + + + + + 2dp + + diff --git a/packages/SystemUI/res/values-sw720dp/config.xml b/packages/SystemUI/res/values-sw720dp/config.xml new file mode 100644 index 0000000..56b8e54 --- /dev/null +++ b/packages/SystemUI/res/values-sw720dp/config.xml @@ -0,0 +1,25 @@ + + + + + + 5 + + diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml index bb59794..372aa39 100644 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -36,5 +36,9 @@ true + + 5 + diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index 172aaa1..c85a8cc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -80,9 +80,6 @@ public class TabletStatusBar extends StatusBar implements public static final boolean DEBUG = false; public static final String TAG = "TabletStatusBar"; - public static final int MAX_NOTIFICATION_ICONS = 5; - // IME switcher icon is big and occupy width of two icons - public static final int MAX_NOTIFICATION_ICONS_IME_BUTTON_VISIBLE = MAX_NOTIFICATION_ICONS - 1; public static final int MSG_OPEN_NOTIFICATION_PANEL = 1000; public static final int MSG_CLOSE_NOTIFICATION_PANEL = 1001; @@ -104,6 +101,7 @@ public class TabletStatusBar extends StatusBar implements int mNaturalBarHeight = -1; int mIconSize = -1; int mIconHPadding = -1; + private int mMaxNotificationIcons = 5; H mHandler = new H(); @@ -343,6 +341,13 @@ public class TabletStatusBar extends StatusBar implements mIconSize = newIconSize; reloadAllNotificationIcons(); // reload the tray } + + final int numIcons = res.getInteger(R.integer.config_maxNotificationIcons); + if (numIcons != mMaxNotificationIcons) { + mMaxNotificationIcons = numIcons; + if (DEBUG) Slog.d(TAG, "max notification icons: " + mMaxNotificationIcons); + reloadAllNotificationIcons(); + } } protected View makeStatusBarView() { @@ -1429,9 +1434,11 @@ public class TabletStatusBar extends StatusBar implements // When IME button is visible, the number of notification icons should be decremented // to fit the upper limit. + // IME switcher icon is big and occupy width of one icon + final int maxNotificationIconsImeButtonVisible = mMaxNotificationIcons - 1; final int maxNotificationIconsCount = (mInputMethodSwitchButton.getVisibility() != View.GONE) ? - MAX_NOTIFICATION_ICONS_IME_BUTTON_VISIBLE : MAX_NOTIFICATION_ICONS; + maxNotificationIconsImeButtonVisible : mMaxNotificationIcons; for (int i=0; i< maxNotificationIconsCount; i++) { if (i>=N) break; toShow.add(mNotificationData.get(N-i-1).icon); -- cgit v1.1