diff options
3 files changed, 22 insertions, 19 deletions
diff --git a/packages/SystemUI/res/values-sw600dp/dimens.xml b/packages/SystemUI/res/values-sw600dp/dimens.xml index a687571..df6ed19 100644 --- a/packages/SystemUI/res/values-sw600dp/dimens.xml +++ b/packages/SystemUI/res/values-sw600dp/dimens.xml @@ -44,4 +44,7 @@ <!-- On tablet-sized devices, we allocate the rightmost third(ish) of the draggable status bar to quick settings. --> <item type="dimen" name="settings_panel_dragzone_fraction">35%</item> + + <!-- Minimum fraction of the screen that should be taken up by the notification panel. --> + <item type="dimen" name="notification_panel_min_height_frac">40%</item> </resources> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 46c3903..84549af 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -189,4 +189,7 @@ <!-- The padding between each tile within the QuickSettings layout --> <dimen name="quick_settings_cell_gap">4dp</dimen> + <!-- Minimum fraction of the screen that should be taken up by the notification panel. + Not used at this screen size. --> + <item type="dimen" name="notification_panel_min_height_frac">0%</item> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index d72632f..dc24a88 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -33,6 +33,7 @@ import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.PixelFormat; +import android.graphics.Point; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; @@ -142,6 +143,7 @@ public class PhoneStatusBar extends BaseStatusBar { int mIconSize = -1; int mIconHPadding = -1; Display mDisplay; + Point mCurrentDisplaySize = new Point(); IDreamManager mDreamManager; @@ -168,10 +170,9 @@ public class PhoneStatusBar extends BaseStatusBar { PanelView mNotificationPanel; // the sliding/resizing panel within the notification window ScrollView mScrollView; View mExpandedContents; - final Rect mNotificationPanelBackgroundPadding = new Rect(); int mNotificationPanelGravity; int mNotificationPanelMarginBottomPx, mNotificationPanelMarginPx; - int mNotificationPanelMinHeight; + float mNotificationPanelMinHeightFrac; boolean mNotificationPanelIsFullScreenWidth; TextView mNotificationPanelDebugText; @@ -1640,12 +1641,17 @@ public class PhoneStatusBar extends BaseStatusBar { @Override public void updateExpandedViewPos(int thingy) { - // TODO if (DEBUG) Slog.v(TAG, "updateExpandedViewPos"); + + // on larger devices, the notification panel is propped open a bit + mNotificationPanel.setMinimumHeight( + (int)(mNotificationPanelMinHeightFrac * mCurrentDisplaySize.y)); + FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams(); lp.gravity = mNotificationPanelGravity; lp.leftMargin = mNotificationPanelMarginPx; mNotificationPanel.setLayoutParams(lp); + lp = (FrameLayout.LayoutParams) mSettingsPanel.getLayoutParams(); lp.gravity = mSettingsPanelGravity; lp.rightMargin = mNotificationPanelMarginPx; @@ -1777,6 +1783,8 @@ public class PhoneStatusBar extends BaseStatusBar { if (DEBUG) { Slog.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration()); } + mDisplay.getSize(mCurrentDisplaySize); + updateResources(); repositionNavigationBar(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); @@ -1885,27 +1893,16 @@ public class PhoneStatusBar extends BaseStatusBar { if (mSettingsPanelGravity <= 0) { mSettingsPanelGravity = Gravity.RIGHT | Gravity.TOP; } - getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding); - final int notificationPanelDecorationHeight = - res.getDimensionPixelSize(R.dimen.notification_panel_padding_top) - + res.getDimensionPixelSize(R.dimen.notification_panel_header_height) - + mNotificationPanelBackgroundPadding.top - + mNotificationPanelBackgroundPadding.bottom; - mNotificationPanelMinHeight = - notificationPanelDecorationHeight - + res.getDimensionPixelSize(R.dimen.close_handle_underlap); mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height); mNotificationHeaderHeight = res.getDimensionPixelSize(R.dimen.notification_panel_header_height); - if (false) Slog.v(TAG, "updateResources"); - } - - private static void getNinePatchPadding(Drawable d, Rect outPadding) { - if (d instanceof NinePatchDrawable) { - NinePatchDrawable ninePatch = (NinePatchDrawable) d; - ninePatch.getPadding(outPadding); + mNotificationPanelMinHeightFrac = res.getFraction(R.dimen.notification_panel_min_height_frac, 1, 1); + if (mNotificationPanelMinHeightFrac < 0f || mNotificationPanelMinHeightFrac > 1f) { + mNotificationPanelMinHeightFrac = 0f; } + + if (false) Slog.v(TAG, "updateResources"); } // |