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

Commit feb411dd authored by Anthony Chen's avatar Anthony Chen Committed by Android (Google) Code Review
Browse files

Merge "Allow notification shelf to be toggled off."

parents 5285628d 9e05d46e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -341,4 +341,8 @@
    <!-- Whether or not the button to clear all notifications will be shown. -->
    <bool name="config_enableNotificationsClearAll">true</bool>

    <!-- Whether or not to show the notification shelf that houses the icons of notifications that
     have been scrolled off-screen. -->
    <bool name="config_showNotificationShelf">true</bool>

</resources>
+32 −14
Original line number Diff line number Diff line
@@ -18,12 +18,13 @@ package com.android.systemui.statusbar;

import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.SystemProperties;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;

import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.ViewInvertHelper;
@@ -71,6 +72,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    private int mRelativeOffset;
    private boolean mInteractive;
    private boolean mAnimationsEnabled = true;
    private boolean mShowNotificationShelf;

    public NotificationShelf(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -99,21 +101,24 @@ public class NotificationShelf extends ActivatableNotificationView implements
    }

    private void initDimens() {
        mIconAppearTopPadding = getResources().getDimensionPixelSize(
                R.dimen.notification_icon_appear_padding);
        mStatusBarHeight = getResources().getDimensionPixelOffset(R.dimen.status_bar_height);
        mStatusBarPaddingStart = getResources().getDimensionPixelOffset(
                R.dimen.status_bar_padding_start);
        mPaddingBetweenElements = getResources().getDimensionPixelSize(
                R.dimen.notification_divider_height);
        Resources res = getResources();
        mIconAppearTopPadding = res.getDimensionPixelSize(R.dimen.notification_icon_appear_padding);
        mStatusBarHeight = res.getDimensionPixelOffset(R.dimen.status_bar_height);
        mStatusBarPaddingStart = res.getDimensionPixelOffset(R.dimen.status_bar_padding_start);
        mPaddingBetweenElements = res.getDimensionPixelSize(R.dimen.notification_divider_height);

        ViewGroup.LayoutParams layoutParams = getLayoutParams();
        layoutParams.height = getResources().getDimensionPixelOffset(
                R.dimen.notification_shelf_height);
        layoutParams.height = res.getDimensionPixelOffset(R.dimen.notification_shelf_height);
        setLayoutParams(layoutParams);
        int padding = getResources().getDimensionPixelOffset(R.dimen.shelf_icon_container_padding);

        int padding = res.getDimensionPixelOffset(R.dimen.shelf_icon_container_padding);
        mShelfIcons.setPadding(padding, 0, padding, 0);
        mScrollFastThreshold = getResources().getDimensionPixelOffset(
                R.dimen.scroll_fast_threshold);
        mScrollFastThreshold = res.getDimensionPixelOffset(R.dimen.scroll_fast_threshold);
        mShowNotificationShelf = res.getBoolean(R.bool.config_showNotificationShelf);

        if (!mShowNotificationShelf) {
            setVisibility(GONE);
        }
    }

    @Override
@@ -148,7 +153,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
    public void updateState(StackScrollState resultState,
            AmbientState ambientState) {
        View lastView = ambientState.getLastVisibleBackgroundChild();
        if (lastView != null) {
        if (mShowNotificationShelf && lastView != null) {
            float maxShelfEnd = ambientState.getInnerHeight() + ambientState.getTopPadding()
                    + ambientState.getStackTranslation();
            ExpandableViewState lastViewState = resultState.getViewStateForView(lastView);
@@ -186,6 +191,11 @@ public class NotificationShelf extends ActivatableNotificationView implements
     * the icons from the notification area into the shelf.
     */
    public void updateAppearance() {
        // If the shelf should not be shown, then there is no need to update anything.
        if (!mShowNotificationShelf) {
            return;
        }

        mShelfIcons.resetViewStates();
        float shelfStart = getTranslationY();
        float numViewsInShelf = 0.0f;
@@ -630,6 +640,10 @@ public class NotificationShelf extends ActivatableNotificationView implements

        @Override
        public void applyToView(View view) {
            if (!mShowNotificationShelf) {
                return;
            }

            super.applyToView(view);
            setMaxShelfEnd(maxShelfEnd);
            setOpenedAmount(openedAmount);
@@ -640,6 +654,10 @@ public class NotificationShelf extends ActivatableNotificationView implements

        @Override
        public void animateTo(View child, AnimationProperties properties) {
            if (!mShowNotificationShelf) {
                return;
            }

            super.animateTo(child, properties);
            setMaxShelfEnd(maxShelfEnd);
            setOpenedAmount(openedAmount);
+4 −4
Original line number Diff line number Diff line
@@ -41,12 +41,10 @@ import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
import android.widget.FrameLayout;
import android.widget.TextView;

import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.keyguard.KeyguardStatusView;
import com.android.systemui.DejankUtils;
import com.android.systemui.EventLogTags;
import com.android.systemui.Interpolators;
import com.android.systemui.R;
import com.android.systemui.classifier.FalsingManager;
@@ -59,6 +57,7 @@ import com.android.systemui.statusbar.FlingAnimationUtils;
import com.android.systemui.statusbar.GestureRecorder;
import com.android.systemui.statusbar.KeyguardAffordanceView;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -422,8 +421,9 @@ public class NotificationPanelView extends PanelView implements
                mKeyguardStatusView.getHeight());
        int notificationPadding = Math.max(1, getResources().getDimensionPixelSize(
                R.dimen.notification_divider_height));
        float shelfSize = mNotificationStackScroller.getNotificationShelf().getIntrinsicHeight()
                + notificationPadding;
        NotificationShelf shelf = mNotificationStackScroller.getNotificationShelf();
        float shelfSize = shelf.getVisibility() == GONE ? 0
                : shelf.getIntrinsicHeight() + notificationPadding;
        float availableSpace = mNotificationStackScroller.getHeight() - minPadding - shelfSize
                - mIndicationBottomPadding;
        int count = 0;
+10 −8
Original line number Diff line number Diff line
@@ -821,7 +821,8 @@ public class NotificationStackScrollLayout extends ViewGroup
            } else {
                appearPosition = 0;
            }
            if (getNotGoneChildCount() >= minNotificationsForShelf) {
            if (getNotGoneChildCount() >= minNotificationsForShelf
                    && mShelf.getVisibility() != GONE) {
                appearPosition += mShelf.getIntrinsicHeight();
            }
        } else {
@@ -2209,10 +2210,11 @@ public class NotificationStackScrollLayout extends ViewGroup
                top = (int) firstView.getTranslationY();
            }
        }
        ActivatableNotificationView lastView = mShelf.hasItemsInStableShelf()
        ActivatableNotificationView lastView =
                mShelf.hasItemsInStableShelf() && mShelf.getVisibility() != GONE
                        ? mShelf
                        : mLastVisibleBackgroundChild;
        int bottom = 0;
        int bottom;
        if (lastView != null) {
            int finalTranslationY;
            if (lastView == mShelf) {
@@ -2362,7 +2364,7 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    public int getLayoutMinHeight() {
        return mShelf.getIntrinsicHeight();
        return mShelf.getVisibility() == GONE ? 0 : mShelf.getIntrinsicHeight();
    }

    public int getFirstChildIntrinsicHeight() {
@@ -2387,7 +2389,7 @@ public class NotificationStackScrollLayout extends ViewGroup
        final int firstChildMinHeight = firstChild != null ? firstChild.getCollapsedHeight()
                : mCollapsedSize;
        int shelfHeight = 0;
        if (mLastVisibleBackgroundChild != null) {
        if (mLastVisibleBackgroundChild != null && mShelf.getVisibility() != GONE) {
            shelfHeight = mShelf.getIntrinsicHeight();
        }
        return mIntrinsicPadding + firstChildMinHeight + shelfHeight;
@@ -3401,7 +3403,7 @@ public class NotificationStackScrollLayout extends ViewGroup
                    endPosition += row.getNotificationParent().getTranslationY();
                }
                int layoutEnd = mMaxLayoutHeight + (int) mStackTranslation;
                if (row != mLastVisibleBackgroundChild) {
                if (row != mLastVisibleBackgroundChild && mShelf.getVisibility() != GONE) {
                    layoutEnd -= mShelf.getIntrinsicHeight() + mPaddingBetweenElements;
                }
                if (endPosition > layoutEnd) {