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

Commit 83bc7833 authored by Selim Cinek's avatar Selim Cinek
Browse files

Changed the appearance of notification bundles

Children now show up as one line notifications even
if the summary is not expanded. The childrenContainer
shows a summary if there are some which don't fit
in there currently.

Bug: 24866646
Change-Id: I0cfae9342722c9f8941f51704618190cfe4e76b4
parent 8d6440db
Loading
Loading
Loading
Loading
+39 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2015 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
  -->

<com.android.systemui.statusbar.notification.HybridNotificationView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="@dimen/notification_max_height">
    <TextView
        android:id="@+id/notification_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:singleLine="true"
        android:textAppearance="@*android:style/TextAppearance.Material.Notification.Title"
        android:paddingEnd="4dp"
    />
    <TextView
        android:id="@+id/notification_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:textAppearance="@*android:style/TextAppearance.Material.Notification"
        android:singleLine="true"
        />
</com.android.systemui.statusbar.notification.HybridNotificationView>
+12 −0
Original line number Diff line number Diff line
@@ -36,6 +36,18 @@
    <!-- The font size for the clock -->
    <dimen name="status_bar_clock_size">14sp</dimen>

    <!-- The margin on the start of the content view -->
    <dimen name="notification_content_margin_start">16dp</dimen>

    <!-- The maximum size of the title when in single line mode -->
    <dimen name="notification_maximum_title_length">150sp</dimen>

    <!-- The margin on the end of the content view -->
    <dimen name="notification_content_margin_end">8dp</dimen>

    <!-- Height of a single line notification in the status bar -->
    <dimen name="notification_single_line_height">32sp</dimen>

    <!-- Height of a small notification in the status bar -->
    <dimen name="notification_min_height">64dp</dimen>

+3 −0
Original line number Diff line number Diff line
@@ -1026,6 +1026,9 @@
    <!-- VolumeUI restoration notification: text -->
    <string name="volumeui_notification_text">Touch to restore the original.</string>

    <!-- Describes the way 2 names are concatenated. An example would be ", " to produce "Peter Muller, Paul Curry". Please also include a space here if it's appropriate in the language and if it's a RTL language include it on the left. [CHAR LIMIT=3] -->
    <string name="group_summary_concadenation">, </string>

    <!-- Toast shown when user unlocks screen and managed profile activity is in the foreground -->
    <string name="managed_profile_foreground_toast">You\'re using your work profile</string>

+12 −10
Original line number Diff line number Diff line
@@ -1929,27 +1929,29 @@ public abstract class BaseStatusBar extends SystemUI implements
        for (int i = 0; i < N; i++) {
            NotificationData.Entry entry = activeNotifications.get(i);
            if (onKeyguard) {
                entry.row.setExpansionDisabled(true);
                entry.row.setOnKeyguard(true);
            } else {
                entry.row.setExpansionDisabled(false);
                if (!entry.row.isUserLocked()) {
                entry.row.setOnKeyguard(false);
                boolean top = (i == 0);
                entry.row.setSystemExpanded(top);
            }
            }
            boolean isInvisibleChild = !mGroupManager.isVisible(entry.notification);
            boolean childNotification = mGroupManager.isChildInGroupWithSummary(entry.notification);
            boolean childWithVisibleSummary = childNotification
                    && mGroupManager.getGroupSummary(entry.notification).getVisibility()
                    == View.VISIBLE;
            boolean showOnKeyguard = shouldShowOnKeyguard(entry.notification);
            if ((isLockscreenPublicMode() && !mShowLockscreenNotifications) ||
                    (onKeyguard && (visibleNotifications >= maxKeyguardNotifications
                            || !showOnKeyguard || isInvisibleChild))) {
                            && !childWithVisibleSummary
                            || !showOnKeyguard))) {
                entry.row.setVisibility(View.GONE);
                if (onKeyguard && showOnKeyguard && !isInvisibleChild) {
                if (onKeyguard && showOnKeyguard && !childNotification) {
                    mKeyguardIconOverflowContainer.getIconsView().addNotification(entry);
                }
            } else {
                boolean wasGone = entry.row.getVisibility() == View.GONE;
                entry.row.setVisibility(View.VISIBLE);
                if (!isInvisibleChild) {
                if (!childNotification) {
                    if (wasGone) {
                        // notify the scroller of a child addition
                        mStackScroller.generateAddAnimation(entry.row, true /* fromMoreCard */);
+39 −23
Original line number Diff line number Diff line
@@ -70,9 +70,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    private boolean mIsSystemExpanded;

    /**
     * Whether the notification expansion is disabled. This is the case on Keyguard.
     * Whether the notification is on the keyguard and the expansion is disabled.
     */
    private boolean mExpansionDisabled;
    private boolean mOnKeyguard;

    private NotificationContentView mPublicLayout;
    private NotificationContentView mPrivateLayout;
@@ -162,6 +162,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    private void setStatusBarNotification(StatusBarNotification statusBarNotification) {
        mStatusBarNotification = statusBarNotification;
        mPrivateLayout.setStatusBarNotification(statusBarNotification);
        updateVetoButton();
        onChildrenCountChanged();
    }
@@ -185,6 +186,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    public void setGroupManager(NotificationGroupManager groupManager) {
        mGroupManager = groupManager;
        mPrivateLayout.setGroupManager(groupManager);
    }

    public void addChildNotification(ExpandableNotificationRow row) {
@@ -225,6 +227,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    public void setIsChildInGroup(boolean isChildInGroup, ExpandableNotificationRow parent) {
        mChildInGroup = BaseStatusBar.ENABLE_CHILD_NOTIFICATIONS && isChildInGroup;
        mShowNoBackground = mChildInGroup && hasSameBgColor(parent);
        mPrivateLayout.setIsChildInGroup(mShowNoBackground);
        updateBackground();
    }

@@ -265,34 +268,34 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    }

    public void getChildrenStates(StackScrollState resultState) {
        if (mChildrenExpanded) {
        if (mIsSummaryWithChildren) {
            StackViewState parentState = resultState.getViewStateForView(this);
            mChildrenContainer.getState(resultState, parentState);
        }
    }

    public void applyChildrenState(StackScrollState state) {
        if (mChildrenExpanded) {
        if (mIsSummaryWithChildren) {
            mChildrenContainer.applyState(state);
        }
    }

    public void prepareExpansionChanged(StackScrollState state) {
        if (mChildrenExpanded) {
        if (mIsSummaryWithChildren) {
            mChildrenContainer.prepareExpansionChanged(state);
        }
    }

    public void startChildAnimation(StackScrollState finalState,
            StackStateAnimator stateAnimator, boolean withDelays, long delay, long duration) {
        if (mChildrenExpanded) {
        if (mIsSummaryWithChildren) {
            mChildrenContainer.startAnimationToState(finalState, stateAnimator, withDelays, delay,
                    duration);
        }
    }

    public ExpandableNotificationRow getViewAtPosition(float y) {
        if (!mChildrenExpanded) {
        if (!mIsSummaryWithChildren || !mChildrenExpanded) {
            return this;
        } else {
            ExpandableNotificationRow view = mChildrenContainer.getViewAtPosition(y);
@@ -416,7 +419,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
        mSensitive = false;
        mShowingPublicInitialized = false;
        mIsSystemExpanded = false;
        mExpansionDisabled = false;
        mOnKeyguard = false;
        mPublicLayout.reset(mIsHeadsUp);
        mPrivateLayout.reset(mIsHeadsUp);
        resetHeight();
@@ -580,16 +583,19 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            mIsSystemExpanded = expand;
            notifyHeightChanged(false /* needsAnimation */);
            logExpansionEvent(false, wasExpanded);
            if (mChildrenContainer != null) {
                mChildrenContainer.updateGroupOverflow();
            }
        }
    }

    /**
     * @param expansionDisabled whether to prevent notification expansion
     * @param onKeyguard whether to prevent notification expansion
     */
    public void setExpansionDisabled(boolean expansionDisabled) {
        if (expansionDisabled != mExpansionDisabled) {
    public void setOnKeyguard(boolean onKeyguard) {
        if (onKeyguard != mOnKeyguard) {
            final boolean wasExpanded = isExpanded();
            mExpansionDisabled = expansionDisabled;
            mOnKeyguard = onKeyguard;
            logExpansionEvent(false, wasExpanded);
            if (wasExpanded != isExpanded()) {
                notifyHeightChanged(false  /* needsAnimation */);
@@ -622,23 +628,22 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
            return getActualHeight();
        }
        boolean inExpansionState = isExpanded();
        int maxContentHeight;
        if (mSensitive && mHideSensitiveForIntrinsicHeight) {
            return mRowMinHeight;
        } else if (mIsSummaryWithChildren && !mOnKeyguard) {
            return mChildrenContainer.getIntrinsicHeight()
                    + mNotificationHeader.getHeight();
        } else if (mIsHeadsUp) {
            if (inExpansionState) {
                maxContentHeight = Math.max(mMaxExpandHeight, mHeadsUpHeight);
                return Math.max(mMaxExpandHeight, mHeadsUpHeight);
            } else {
                maxContentHeight = Math.max(mRowMinHeight, mHeadsUpHeight);
                return Math.max(mRowMinHeight, mHeadsUpHeight);
            }
        } else if ((!inExpansionState && !mChildrenExpanded)) {
            maxContentHeight = mRowMinHeight;
        } else if (mChildrenExpanded) {
            maxContentHeight = mChildrenContainer.getIntrinsicHeight();
        } else if (!inExpansionState || (mChildInGroup && !isGroupExpanded())) {
            return getMinHeight();
        } else {
            maxContentHeight = getMaxExpandHeight();
            return getMaxExpandHeight();
        }
        return maxContentHeight;
    }

    private boolean isGroupExpanded() {
@@ -670,8 +675,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
     *
     * @return whether the view state is currently expanded.
     */
    private boolean isExpanded() {
        return !mExpansionDisabled
    public boolean isExpanded() {
        return !mOnKeyguard
                && (!hasUserChangedExpansion() && (isSystemExpanded() || isSystemChildExpanded())
                || isUserExpanded());
    }
@@ -778,6 +783,9 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    public void setChildrenExpanded(boolean expanded, boolean animate) {
        mChildrenExpanded = expanded;
        if (mChildrenContainer != null) {
            mChildrenContainer.setChildrenExpanded(expanded);
        }
    }

    public void updateNotificationHeader() {
@@ -844,12 +852,20 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    @Override
    public int getMaxContentHeight() {
        if (mIsSummaryWithChildren && !mShowingPublic) {
            return mChildrenContainer.getMaxContentHeight()
                    + mNotificationHeader.getHeight();
        }
        NotificationContentView showingLayout = getShowingLayout();
        return showingLayout.getMaxHeight();
    }

    @Override
    public int getMinHeight() {
        if (mIsSummaryWithChildren && !mOnKeyguard) {
            return mChildrenContainer.getMinHeight()
                    + mNotificationHeader.getHeight();
        }
        NotificationContentView showingLayout = getShowingLayout();
        return showingLayout.getMinHeight();
    }
Loading