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

Commit 2e6d732a authored by android-build-team Robot's avatar android-build-team Robot Committed by android-build-merger
Browse files

Merge "Revert "Update 'dnd is hiding notifications' view"" into pi-dev am: aeaefe91

am: 57d00607

Change-Id: I7821e55c3b1495b65b4467ab8511a643c862919f
parents 290879a5 57d00607
Loading
Loading
Loading
Loading
+0 −34
Original line number Diff line number Diff line
<!--
    Copyright 2018, 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.
-->

<!-- Extends Framelayout -->
<com.android.systemui.statusbar.DndSuppressingNotificationsView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/hidden_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone">
    <TextView
        android:id="@+id/hidden_notifications"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="64dp"
        android:paddingTop="28dp"
        android:gravity="top|center_horizontal"
        android:textColor="?attr/wallpaperTextColor"
        android:textSize="16sp"
        android:text="@string/dnd_suppressing_shade_text"/>
</com.android.systemui.statusbar.DndSuppressingNotificationsView>
+1 −1
Original line number Diff line number Diff line
@@ -1064,7 +1064,7 @@
    <string name="manage_notifications_text">Manage notifications</string>

    <!-- The text to show in the notifications shade when dnd is suppressing notifications. [CHAR LIMIT=100] -->
    <string name="dnd_suppressing_shade_text">Notifications hidden by Do Not Disturb</string>
    <string name="dnd_suppressing_shade_text">Do Not Disturb is hiding notifications</string>

    <!-- Media projection permission dialog action text. [CHAR LIMIT=60] -->
    <string name="media_projection_action_text">Start now</string>
+0 −91
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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
 */

package com.android.systemui.statusbar;

import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.IntegerRes;
import android.annotation.StringRes;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.drawable.Icon;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.systemui.R;
import com.android.systemui.statusbar.stack.ExpandableViewState;
import com.android.systemui.statusbar.stack.StackScrollState;

public class DndSuppressingNotificationsView extends StackScrollerDecorView {

    private TextView mText;
    private @StringRes int mTextId = R.string.dnd_suppressing_shade_text;

    public DndSuppressingNotificationsView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        mText.setText(mTextId);
    }

    @Override
    protected View findContentView() {
        return findViewById(R.id.hidden_container);
    }

    @Override
    protected View findSecondaryView() {
        return null;
    }

    public void setColor(@ColorInt int color) {
        mText.setTextColor(color);
    }

    public void setOnContentClickListener(OnClickListener listener) {
        mText.setOnClickListener(listener);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mText = findViewById(R.id.hidden_notifications);
    }

    @Override
    public ExpandableViewState createNewViewState(StackScrollState stackScrollState) {
        return new DndSuppressingViewState();
    }

    public class DndSuppressingViewState extends ExpandableViewState {
        @Override
        public void applyToView(View view) {
            super.applyToView(view);
            if (view instanceof DndSuppressingNotificationsView) {
                DndSuppressingNotificationsView dndView = (DndSuppressingNotificationsView) view;
                boolean visible = this.clipTopAmount <= mText.getPaddingTop() * 0.6f;
                dndView.performVisibilityAnimation(visible && !dndView.willBeGone());
            }
        }
    }
}
+3 −8
Original line number Diff line number Diff line
@@ -199,7 +199,6 @@ public class NotificationPanelView extends PanelView implements
    private ValueAnimator mQsSizeChangeAnimator;

    private boolean mShowEmptyShadeView;
    private boolean mShowDndView;

    private boolean mQsScrimEnabled = true;
    private boolean mLastAnnouncementWasQuickSettings;
@@ -1600,8 +1599,8 @@ public class NotificationPanelView extends PanelView implements
        // When only empty shade view is visible in QS collapsed state, simulate that we would have
        // it in expanded QS state as well so we don't run into troubles when fading the view in/out
        // and expanding/collapsing the whole panel from/to quick settings.
        if ((mNotificationStackScroller.getNotGoneChildCount() == 0
                && mShowEmptyShadeView) || mShowDndView) {
        if (mNotificationStackScroller.getNotGoneChildCount() == 0
                && mShowEmptyShadeView) {
            notificationHeight = mNotificationStackScroller.getEmptyShadeViewHeight();
        }
        int maxQsHeight = mQsMaxExpansionHeight;
@@ -2244,17 +2243,13 @@ public class NotificationPanelView extends PanelView implements
        return mDozing;
    }

    public void showDndView(boolean dndViewVisible) {
        mShowDndView = dndViewVisible;
        mNotificationStackScroller.updateDndView(mShowDndView && !mQsExpanded);
    }

    public void showEmptyShadeView(boolean emptyShadeViewVisible) {
        mShowEmptyShadeView = emptyShadeViewVisible;
        updateEmptyShadeView();
    }

    private void updateEmptyShadeView() {

        // Hide "No notifications" in QS.
        mNotificationStackScroller.updateEmptyShadeView(mShowEmptyShadeView && !mQsExpanded);
    }
+5 −34
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import static android.app.StatusBarManager.WINDOW_STATE_HIDDEN;
import static android.app.StatusBarManager.WINDOW_STATE_SHOWING;
import static android.app.StatusBarManager.windowStateToString;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN_OR_SPLIT_SCREEN_SECONDARY;
import static android.provider.Settings.Global.ZEN_MODE_OFF;

import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_ASLEEP;
import static com.android.systemui.keyguard.WakefulnessLifecycle.WAKEFULNESS_AWAKE;
@@ -169,7 +168,6 @@ import com.android.systemui.keyguard.KeyguardViewMediator;
import com.android.systemui.keyguard.ScreenLifecycle;
import com.android.systemui.keyguard.WakefulnessLifecycle;
import com.android.systemui.plugins.ActivityStarter;
import com.android.systemui.plugins.VolumeDialogController;
import com.android.systemui.plugins.qs.QS;
import com.android.systemui.plugins.statusbar.NotificationSwipeActionHelper.SnoozeOption;
import com.android.systemui.qs.QSFragment;
@@ -190,7 +188,6 @@ import com.android.systemui.statusbar.AppOpsListener;
import com.android.systemui.statusbar.BackDropView;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.CrossFadeHelper;
import com.android.systemui.statusbar.DndSuppressingNotificationsView;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.EmptyShadeView;
import com.android.systemui.statusbar.ExpandableNotificationRow;
@@ -416,7 +413,7 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected NotificationViewHierarchyManager mViewHierarchyManager;
    protected AppOpsListener mAppOpsListener;
    protected KeyguardViewMediator mKeyguardViewMediator;
    protected ZenModeController mZenController;
    private ZenModeController mZenController;

    /**
     * Helper that is responsible for showing the right toast when a disallowed activity operation
@@ -881,7 +878,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        mVisualStabilityManager.setVisibilityLocationProvider(mStackScroller);

        inflateEmptyShadeView();
        inflateDndView();
        inflateFooterView();

        mBackdrop = mStatusBarWindow.findViewById(R.id.backdrop);
@@ -1149,7 +1145,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected void reevaluateStyles() {
        inflateFooterView();
        updateFooter();
        inflateDndView();
        inflateEmptyShadeView();
        updateEmptyShadeView();
    }
@@ -1171,19 +1166,6 @@ public class StatusBar extends SystemUI implements DemoMode,
        mStackScroller.setEmptyShadeView(mEmptyShadeView);
    }

    private void inflateDndView() {
        if (mStackScroller == null) {
            return;
        }
        mDndView = (DndSuppressingNotificationsView) LayoutInflater.from(mContext).inflate(
                R.layout.status_bar_dnd_suppressing_notifications, mStackScroller, false);
        mDndView.setOnContentClickListener(v -> {
            Intent intent = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS);
            startActivity(intent, true, true, Intent.FLAG_ACTIVITY_SINGLE_TOP);
        });
        mStackScroller.setDndView(mDndView);
    }

    private void inflateFooterView() {
        if (mStackScroller == null) {
            return;
@@ -1477,11 +1459,9 @@ public class StatusBar extends SystemUI implements DemoMode,
    @VisibleForTesting
    protected void updateFooter() {
        boolean showFooterView = mState != StatusBarState.KEYGUARD
                && !areNotificationsHidden()
                && mEntryManager.getNotificationData().getActiveNotifications().size() != 0
                && !mRemoteInputManager.getController().isRemoteInputActive();
        boolean showDismissView = mClearAllEnabled && mState != StatusBarState.KEYGUARD
                && !areNotificationsHidden()
                && hasActiveClearableNotifications();

        mStackScroller.updateFooterView(showFooterView, showDismissView);
@@ -1504,13 +1484,10 @@ public class StatusBar extends SystemUI implements DemoMode,
        return false;
    }

    @VisibleForTesting
    protected void updateEmptyShadeView() {
        boolean showDndView = mState != StatusBarState.KEYGUARD && areNotificationsHidden();
        boolean showEmptyShadeView = !showDndView
                && mState != StatusBarState.KEYGUARD
                && mEntryManager.getNotificationData().getActiveNotifications().size() == 0;
        mNotificationPanel.showDndView(showDndView);
    private void updateEmptyShadeView() {
        boolean showEmptyShadeView =
                mState != StatusBarState.KEYGUARD &&
                        mEntryManager.getNotificationData().getActiveNotifications().size() == 0;
        mNotificationPanel.showEmptyShadeView(showEmptyShadeView);
    }

@@ -5017,7 +4994,6 @@ public class StatusBar extends SystemUI implements DemoMode,
    protected NotificationShelf mNotificationShelf;
    protected FooterView mFooterView;
    protected EmptyShadeView mEmptyShadeView;
    protected DndSuppressingNotificationsView mDndView;

    protected AssistManager mAssistManager;

@@ -5502,11 +5478,6 @@ public class StatusBar extends SystemUI implements DemoMode,
                    mStackScroller.getChildCount() - offsetFromEnd++);
        }

        if (mDndView != null) {
            mStackScroller.changeViewPosition(mDndView,
                    mStackScroller.getChildCount() - offsetFromEnd++);
        }

        mStackScroller.changeViewPosition(mEmptyShadeView,
                mStackScroller.getChildCount() - offsetFromEnd++);

Loading