Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66757217 authored by Chris Wren's avatar Chris Wren Committed by Android (Google) Code Review
Browse files

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
parent e9e37725
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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>

+1 −1
Original line number Diff line number Diff line
@@ -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>
+0 −27
Original line number Diff line number Diff line
<?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>
+8 −5
Original line number Diff line number Diff line
@@ -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>

+12 −22
Original line number Diff line number Diff line
@@ -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);
                mContext.getResources().getDimensionPixelSize(R.dimen.notification_row_min_height);
        ViewGroup.LayoutParams lp = entry.row.getLayoutParams();
            if (expand) {
        if (entry.expandable() && expand) {
            if (DEBUG) Slog.d(TAG, "setting expanded row height to WRAP_CONTENT");
            lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        } else {
            if (DEBUG) Slog.d(TAG, "setting collapsed row height to " + rowHeight);
            lp.height = rowHeight;
        }
        entry.row.setLayoutParams(lp);
        return expand;
        } else {
            return false;
        }
    }

    protected void updateExpansionStates() {
Loading