Skip to content

Commit e680f54

Browse files
committed
Prop the tablet notification panel open a bit.
It will now occupy at least 40% of the screen, vertically. Bug: 7069227 Change-Id: I540388f6988bee591aee5b7aee1e4d25d08fad96
1 parent 13701b5 commit e680f54

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

packages/SystemUI/res/values-sw600dp/dimens.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@
4444
<!-- On tablet-sized devices, we allocate the rightmost third(ish) of the draggable status bar
4545
to quick settings. -->
4646
<item type="dimen" name="settings_panel_dragzone_fraction">35%</item>
47+
48+
<!-- Minimum fraction of the screen that should be taken up by the notification panel. -->
49+
<item type="dimen" name="notification_panel_min_height_frac">40%</item>
4750
</resources>

packages/SystemUI/res/values/dimens.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,4 +189,7 @@
189189
<!-- The padding between each tile within the QuickSettings layout -->
190190
<dimen name="quick_settings_cell_gap">4dp</dimen>
191191

192+
<!-- Minimum fraction of the screen that should be taken up by the notification panel.
193+
Not used at this screen size. -->
194+
<item type="dimen" name="notification_panel_min_height_frac">0%</item>
192195
</resources>

packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import android.graphics.Canvas;
3434
import android.graphics.ColorFilter;
3535
import android.graphics.PixelFormat;
36+
import android.graphics.Point;
3637
import android.graphics.PorterDuff;
3738
import android.graphics.Rect;
3839
import android.graphics.drawable.Drawable;
@@ -142,6 +143,7 @@ public class PhoneStatusBar extends BaseStatusBar {
142143
int mIconSize = -1;
143144
int mIconHPadding = -1;
144145
Display mDisplay;
146+
Point mCurrentDisplaySize = new Point();
145147

146148
IDreamManager mDreamManager;
147149

@@ -168,10 +170,9 @@ public class PhoneStatusBar extends BaseStatusBar {
168170
PanelView mNotificationPanel; // the sliding/resizing panel within the notification window
169171
ScrollView mScrollView;
170172
View mExpandedContents;
171-
final Rect mNotificationPanelBackgroundPadding = new Rect();
172173
int mNotificationPanelGravity;
173174
int mNotificationPanelMarginBottomPx, mNotificationPanelMarginPx;
174-
int mNotificationPanelMinHeight;
175+
float mNotificationPanelMinHeightFrac;
175176
boolean mNotificationPanelIsFullScreenWidth;
176177
TextView mNotificationPanelDebugText;
177178

@@ -1640,12 +1641,17 @@ protected int getExpandedViewMaxHeight() {
16401641

16411642
@Override
16421643
public void updateExpandedViewPos(int thingy) {
1643-
// TODO
16441644
if (DEBUG) Slog.v(TAG, "updateExpandedViewPos");
1645+
1646+
// on larger devices, the notification panel is propped open a bit
1647+
mNotificationPanel.setMinimumHeight(
1648+
(int)(mNotificationPanelMinHeightFrac * mCurrentDisplaySize.y));
1649+
16451650
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams();
16461651
lp.gravity = mNotificationPanelGravity;
16471652
lp.leftMargin = mNotificationPanelMarginPx;
16481653
mNotificationPanel.setLayoutParams(lp);
1654+
16491655
lp = (FrameLayout.LayoutParams) mSettingsPanel.getLayoutParams();
16501656
lp.gravity = mSettingsPanelGravity;
16511657
lp.rightMargin = mNotificationPanelMarginPx;
@@ -1777,6 +1783,8 @@ else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
17771783
if (DEBUG) {
17781784
Slog.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration());
17791785
}
1786+
mDisplay.getSize(mCurrentDisplaySize);
1787+
17801788
updateResources();
17811789
repositionNavigationBar();
17821790
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
@@ -1885,27 +1893,16 @@ protected void loadDimens() {
18851893
if (mSettingsPanelGravity <= 0) {
18861894
mSettingsPanelGravity = Gravity.RIGHT | Gravity.TOP;
18871895
}
1888-
getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding);
1889-
final int notificationPanelDecorationHeight =
1890-
res.getDimensionPixelSize(R.dimen.notification_panel_padding_top)
1891-
+ res.getDimensionPixelSize(R.dimen.notification_panel_header_height)
1892-
+ mNotificationPanelBackgroundPadding.top
1893-
+ mNotificationPanelBackgroundPadding.bottom;
1894-
mNotificationPanelMinHeight =
1895-
notificationPanelDecorationHeight
1896-
+ res.getDimensionPixelSize(R.dimen.close_handle_underlap);
18971896

18981897
mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height);
18991898
mNotificationHeaderHeight = res.getDimensionPixelSize(R.dimen.notification_panel_header_height);
19001899

1901-
if (false) Slog.v(TAG, "updateResources");
1902-
}
1903-
1904-
private static void getNinePatchPadding(Drawable d, Rect outPadding) {
1905-
if (d instanceof NinePatchDrawable) {
1906-
NinePatchDrawable ninePatch = (NinePatchDrawable) d;
1907-
ninePatch.getPadding(outPadding);
1900+
mNotificationPanelMinHeightFrac = res.getFraction(R.dimen.notification_panel_min_height_frac, 1, 1);
1901+
if (mNotificationPanelMinHeightFrac < 0f || mNotificationPanelMinHeightFrac > 1f) {
1902+
mNotificationPanelMinHeightFrac = 0f;
19081903
}
1904+
1905+
if (false) Slog.v(TAG, "updateResources");
19091906
}
19101907

19111908
//

0 commit comments

Comments
 (0)