Skip to content

Commit 6675721

Browse files
cwrenAndroid (Google) Code Review
authored andcommitted
Create separate dimensions for the notificaitons and notification rows.
Use notification heights on layouts internal to the notificaitons. Use row heights where padding needs to be protected, on row layout decisions. Clean up values-xhdpi/dimens.xml since there is no longer a values-hdpi/dimens.xml. Bug: 6475098 Bug: 6489095 Change-Id: I44750574c6e23336585a432a38c5f1ba183b6cbc
1 parent e9e3772 commit 6675721

File tree

6 files changed

+25
-59
lines changed

6 files changed

+25
-59
lines changed

packages/SystemUI/res/layout/status_bar_expanded.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
android:id="@+id/latestItems"
4949
android:layout_width="match_parent"
5050
android:layout_height="wrap_content"
51-
systemui:rowHeight="@dimen/notification_height"
51+
systemui:rowHeight="@dimen/notification_row_min_height"
5252
/>
5353
</ScrollView>
5454

@@ -68,4 +68,4 @@
6868

6969
</com.android.systemui.statusbar.phone.CloseDragHandle>
7070

71-
</FrameLayout><!-- end of sliding panel -->
71+
</FrameLayout><!-- end of sliding panel -->

packages/SystemUI/res/layout/system_bar_notification_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
android:clickable="true"
7878
android:focusable="true"
7979
android:descendantFocusability="afterDescendants"
80-
systemui:rowHeight="@dimen/notification_height"
80+
systemui:rowHeight="@dimen/notification_row_min_height"
8181
/>
8282
</ScrollView>
8383
</LinearLayout>

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

Lines changed: 0 additions & 27 deletions
This file was deleted.

packages/SystemUI/res/values/dimens.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,21 @@
4949
reducing false presses on navbar buttons; approx 2mm -->
5050
<dimen name="navigation_bar_deadzone_size">12dp</dimen>
5151

52-
<!-- thickness (height) of each 1U notification row plus glow, padding, etc -->
53-
<dimen name="notification_height">72dp</dimen>
54-
5552
<!-- Height of notification icons in the status bar -->
5653
<dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
5754

58-
<!-- Height of a small notification in the status bar plus glow, padding, etc -->
59-
<dimen name="notification_min_height">72dp</dimen>
55+
<!-- Height of a small notification in the status bar -->
56+
<dimen name="notification_min_height">64dp</dimen>
6057

6158
<!-- Height of a large notification in the status bar -->
6259
<dimen name="notification_max_height">256dp</dimen>
6360

61+
<!-- Height of a small notification in the status bar plus glow, padding, etc -->
62+
<dimen name="notification_row_min_height">72dp</dimen>
63+
64+
<!-- Height of a large notification in the status bar plus glow, padding, etc -->
65+
<dimen name="notification_row_max_height">260dp</dimen>
66+
6467
<!-- size at which Notification icons will be drawn in the status bar -->
6568
<dimen name="status_bar_icon_drawing_size">18dip</dimen>
6669

packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ protected void workAroundBadLayerDrawableOpacity(View v) {
478478

479479
protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
480480
int rowHeight =
481-
mContext.getResources().getDimensionPixelSize(R.dimen.notification_height);
481+
mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
482482
int minHeight =
483483
mContext.getResources().getDimensionPixelSize(R.dimen.notification_min_height);
484484
int maxHeight =
@@ -498,7 +498,6 @@ protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent)
498498
// for blaming (see SwipeHelper.setLongPressListener)
499499
row.setTag(sbn.pkg);
500500

501-
ViewGroup.LayoutParams lp = row.getLayoutParams();
502501
workAroundBadLayerDrawableOpacity(row);
503502
View vetoButton = updateNotificationVetoButton(row, sbn);
504503
vetoButton.setContentDescription(mContext.getString(
@@ -510,13 +509,6 @@ protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent)
510509
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
511510
ViewGroup adaptive = (ViewGroup)row.findViewById(R.id.adaptive);
512511

513-
// Ensure that R.id.content is properly set to 64dp high if 1U
514-
lp = content.getLayoutParams();
515-
if (large == null) {
516-
lp.height = minHeight;
517-
}
518-
content.setLayoutParams(lp);
519-
520512
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
521513

522514
PendingIntent contentIntent = sbn.notification.contentIntent;
@@ -557,7 +549,7 @@ protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent)
557549
SizeAdaptiveLayout.LayoutParams params =
558550
new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
559551
params.minHeight = minHeight+1;
560-
params.maxHeight = SizeAdaptiveLayout.LayoutParams.UNBOUNDED;
552+
params.maxHeight = maxHeight;
561553
adaptive.addView(expandedLarge, params);
562554
}
563555
row.setDrawingCacheEnabled(true);
@@ -724,20 +716,18 @@ protected StatusBarIconView addNotificationViews(IBinder key,
724716
}
725717

726718
protected boolean expandView(NotificationData.Entry entry, boolean expand) {
727-
if (entry.expandable()) {
728-
int rowHeight =
729-
mContext.getResources().getDimensionPixelSize(R.dimen.notification_height);
730-
ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
731-
if (expand) {
732-
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
733-
} else {
734-
lp.height = rowHeight;
735-
}
736-
entry.row.setLayoutParams(lp);
737-
return expand;
719+
int rowHeight =
720+
mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
721+
ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
722+
if (entry.expandable() && expand) {
723+
if (DEBUG) Slog.d(TAG, "setting expanded row height to WRAP_CONTENT");
724+
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
738725
} else {
739-
return false;
726+
if (DEBUG) Slog.d(TAG, "setting collapsed row height to " + rowHeight);
727+
lp.height = rowHeight;
740728
}
729+
entry.row.setLayoutParams(lp);
730+
return expand;
741731
}
742732

743733
protected void updateExpansionStates() {

packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ public void onChildViewRemoved(View parent, View child) {
101101
float densityScale = getResources().getDisplayMetrics().density;
102102
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
103103
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
104-
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
105-
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
104+
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
105+
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
106106
mExpandHelper = new ExpandHelper(mContext, this, minHeight, maxHeight);
107107
}
108108

0 commit comments

Comments
 (0)