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
This commit is contained in:
Chris Wren
2012-05-14 10:05:42 -04:00
committed by Android (Google) Code Review
parent e9e3772534
commit 66757217a6
6 changed files with 25 additions and 59 deletions

View File

@@ -48,7 +48,7 @@
android:id="@+id/latestItems"
android:layout_width="match_parent"
android:layout_height="wrap_content"
systemui:rowHeight="@dimen/notification_height"
systemui:rowHeight="@dimen/notification_row_min_height"
/>
</ScrollView>
@@ -68,4 +68,4 @@
</com.android.systemui.statusbar.phone.CloseDragHandle>
</FrameLayout><!-- end of sliding panel -->
</FrameLayout><!-- end of sliding panel -->

View File

@@ -77,7 +77,7 @@
android:clickable="true"
android:focusable="true"
android:descendantFocusability="afterDescendants"
systemui:rowHeight="@dimen/notification_height"
systemui:rowHeight="@dimen/notification_row_min_height"
/>
</ScrollView>
</LinearLayout>

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
* Copyright (c) 2011, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- thickness (height) of each notification row, including any separators or padding -->
<!-- note: this is the same value as in values/dimens.xml; the value is overridden in
values-hdpi/dimens.xml and so we need to re-assert the general value here -->
<dimen name="notification_height">68dp</dimen>
<!-- thickness (height) of dividers between each notification row -->
<!-- same as in values/dimens.xml; see note at notification_height -->
<dimen name="notification_divider_height">2dp</dimen>
</resources>

View File

@@ -49,18 +49,21 @@
reducing false presses on navbar buttons; approx 2mm -->
<dimen name="navigation_bar_deadzone_size">12dp</dimen>
<!-- thickness (height) of each 1U notification row plus glow, padding, etc -->
<dimen name="notification_height">72dp</dimen>
<!-- Height of notification icons in the status bar -->
<dimen name="status_bar_icon_size">@*android:dimen/status_bar_icon_size</dimen>
<!-- Height of a small notification in the status bar plus glow, padding, etc -->
<dimen name="notification_min_height">72dp</dimen>
<!-- Height of a small notification in the status bar -->
<dimen name="notification_min_height">64dp</dimen>
<!-- Height of a large notification in the status bar -->
<dimen name="notification_max_height">256dp</dimen>
<!-- Height of a small notification in the status bar plus glow, padding, etc -->
<dimen name="notification_row_min_height">72dp</dimen>
<!-- Height of a large notification in the status bar plus glow, padding, etc -->
<dimen name="notification_row_max_height">260dp</dimen>
<!-- size at which Notification icons will be drawn in the status bar -->
<dimen name="status_bar_icon_drawing_size">18dip</dimen>

View File

@@ -478,7 +478,7 @@ public abstract class BaseStatusBar extends SystemUI implements
protected boolean inflateViews(NotificationData.Entry entry, ViewGroup parent) {
int rowHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_height);
mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int minHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight =
@@ -498,7 +498,6 @@ public abstract class BaseStatusBar extends SystemUI implements
// for blaming (see SwipeHelper.setLongPressListener)
row.setTag(sbn.pkg);
ViewGroup.LayoutParams lp = row.getLayoutParams();
workAroundBadLayerDrawableOpacity(row);
View vetoButton = updateNotificationVetoButton(row, sbn);
vetoButton.setContentDescription(mContext.getString(
@@ -510,13 +509,6 @@ public abstract class BaseStatusBar extends SystemUI implements
ViewGroup content = (ViewGroup)row.findViewById(R.id.content);
ViewGroup adaptive = (ViewGroup)row.findViewById(R.id.adaptive);
// Ensure that R.id.content is properly set to 64dp high if 1U
lp = content.getLayoutParams();
if (large == null) {
lp.height = minHeight;
}
content.setLayoutParams(lp);
content.setDescendantFocusability(ViewGroup.FOCUS_BLOCK_DESCENDANTS);
PendingIntent contentIntent = sbn.notification.contentIntent;
@@ -557,7 +549,7 @@ public abstract class BaseStatusBar extends SystemUI implements
SizeAdaptiveLayout.LayoutParams params =
new SizeAdaptiveLayout.LayoutParams(expandedLarge.getLayoutParams());
params.minHeight = minHeight+1;
params.maxHeight = SizeAdaptiveLayout.LayoutParams.UNBOUNDED;
params.maxHeight = maxHeight;
adaptive.addView(expandedLarge, params);
}
row.setDrawingCacheEnabled(true);
@@ -724,20 +716,18 @@ public abstract class BaseStatusBar extends SystemUI implements
}
protected boolean expandView(NotificationData.Entry entry, boolean expand) {
if (entry.expandable()) {
int rowHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_height);
ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
if (expand) {
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
} else {
lp.height = rowHeight;
}
entry.row.setLayoutParams(lp);
return expand;
int rowHeight =
mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
if (entry.expandable() && expand) {
if (DEBUG) Slog.d(TAG, "setting expanded row height to WRAP_CONTENT");
lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
} else {
return false;
if (DEBUG) Slog.d(TAG, "setting collapsed row height to " + rowHeight);
lp.height = rowHeight;
}
entry.row.setLayoutParams(lp);
return expand;
}
protected void updateExpansionStates() {

View File

@@ -101,8 +101,8 @@ public class NotificationRowLayout
float densityScale = getResources().getDisplayMetrics().density;
float pagingTouchSlop = ViewConfiguration.get(mContext).getScaledPagingTouchSlop();
mSwipeHelper = new SwipeHelper(SwipeHelper.X, this, densityScale, pagingTouchSlop);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_max_height);
int minHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
int maxHeight = getResources().getDimensionPixelSize(R.dimen.notification_row_max_height);
mExpandHelper = new ExpandHelper(mContext, this, minHeight, maxHeight);
}