Skip to content

Commit 6e06191

Browse files
dsandlerAndroid (Google) Code Review
authored andcommitted
Merge "Prop the tablet notification panel open a bit." into jb-mr1-dev
2 parents 95841ac + e680f54 commit 6e06191

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;
@@ -143,6 +144,7 @@ public class PhoneStatusBar extends BaseStatusBar {
143144
int mIconSize = -1;
144145
int mIconHPadding = -1;
145146
Display mDisplay;
147+
Point mCurrentDisplaySize = new Point();
146148

147149
IDreamManager mDreamManager;
148150

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

@@ -1644,12 +1645,17 @@ protected int getExpandedViewMaxHeight() {
16441645

16451646
@Override
16461647
public void updateExpandedViewPos(int thingy) {
1647-
// TODO
16481648
if (DEBUG) Slog.v(TAG, "updateExpandedViewPos");
1649+
1650+
// on larger devices, the notification panel is propped open a bit
1651+
mNotificationPanel.setMinimumHeight(
1652+
(int)(mNotificationPanelMinHeightFrac * mCurrentDisplaySize.y));
1653+
16491654
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) mNotificationPanel.getLayoutParams();
16501655
lp.gravity = mNotificationPanelGravity;
16511656
lp.leftMargin = mNotificationPanelMarginPx;
16521657
mNotificationPanel.setLayoutParams(lp);
1658+
16531659
lp = (FrameLayout.LayoutParams) mSettingsPanel.getLayoutParams();
16541660
lp.gravity = mSettingsPanelGravity;
16551661
lp.rightMargin = mNotificationPanelMarginPx;
@@ -1781,6 +1787,8 @@ else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
17811787
if (DEBUG) {
17821788
Slog.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration());
17831789
}
1790+
mDisplay.getSize(mCurrentDisplaySize);
1791+
17841792
updateResources();
17851793
repositionNavigationBar();
17861794
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
@@ -1889,27 +1897,16 @@ protected void loadDimens() {
18891897
if (mSettingsPanelGravity <= 0) {
18901898
mSettingsPanelGravity = Gravity.RIGHT | Gravity.TOP;
18911899
}
1892-
getNinePatchPadding(res.getDrawable(R.drawable.notification_panel_bg), mNotificationPanelBackgroundPadding);
1893-
final int notificationPanelDecorationHeight =
1894-
res.getDimensionPixelSize(R.dimen.notification_panel_padding_top)
1895-
+ res.getDimensionPixelSize(R.dimen.notification_panel_header_height)
1896-
+ mNotificationPanelBackgroundPadding.top
1897-
+ mNotificationPanelBackgroundPadding.bottom;
1898-
mNotificationPanelMinHeight =
1899-
notificationPanelDecorationHeight
1900-
+ res.getDimensionPixelSize(R.dimen.close_handle_underlap);
19011900

19021901
mCarrierLabelHeight = res.getDimensionPixelSize(R.dimen.carrier_label_height);
19031902
mNotificationHeaderHeight = res.getDimensionPixelSize(R.dimen.notification_panel_header_height);
19041903

1905-
if (false) Slog.v(TAG, "updateResources");
1906-
}
1907-
1908-
private static void getNinePatchPadding(Drawable d, Rect outPadding) {
1909-
if (d instanceof NinePatchDrawable) {
1910-
NinePatchDrawable ninePatch = (NinePatchDrawable) d;
1911-
ninePatch.getPadding(outPadding);
1904+
mNotificationPanelMinHeightFrac = res.getFraction(R.dimen.notification_panel_min_height_frac, 1, 1);
1905+
if (mNotificationPanelMinHeightFrac < 0f || mNotificationPanelMinHeightFrac > 1f) {
1906+
mNotificationPanelMinHeightFrac = 0f;
19121907
}
1908+
1909+
if (false) Slog.v(TAG, "updateResources");
19131910
}
19141911

19151912
//

0 commit comments

Comments
 (0)