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

Commit 263d7612 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add unlock to see more messaging to locked shade" into tm-qpr-dev am:...

Merge "Add unlock to see more messaging to locked shade" into tm-qpr-dev am: 0b72c627 am: 9862a01c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20609656



Change-Id: I5e8750edf196d61ea8cc406327cbd19ba2128b41
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 5399e4bd 9862a01c
Loading
Loading
Loading
Loading
+22 −5
Original line number Diff line number Diff line
@@ -21,12 +21,29 @@
        android:layout_height="wrap_content"
        android:visibility="gone"
        >
    <LinearLayout android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            >
        <TextView
                android:id="@+id/no_notifications"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="64dp"
            android:textAppearance="?android:attr/textAppearanceButton"
                android:gravity="center"
                android:textAppearance="?android:attr/textAppearanceButton"
                android:text="@string/empty_shade_text"/>
        <TextView
                android:id="@+id/no_notifications_footer"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:gravity="center"
                android:drawablePadding="8dp"
                android:visibility="gone"
                android:textAppearance="?android:attr/textAppearanceButton"
                android:text="@string/unlock_to_see_notif_text"/>
    </LinearLayout>
</com.android.systemui.statusbar.EmptyShadeView>
+2 −0
Original line number Diff line number Diff line
@@ -403,6 +403,8 @@
        (quick_qs_offset_height (60dp)  - ongoing_appops_chip_height (24dp) ) / 2 -->
    <dimen name="notifications_top_padding_split_shade">18dp</dimen>

    <dimen name="notifications_unseen_footer_icon_size">16dp</dimen>

    <!-- Height of the status bar header bar when on Keyguard -->
    <dimen name="status_bar_header_height_keyguard">40dp</dimen>

+6 −0
Original line number Diff line number Diff line
@@ -1105,6 +1105,12 @@
    <!-- Text which is shown in the notification shade when there are no notifications. [CHAR LIMIT=30] -->
    <string name="empty_shade_text">No notifications</string>

    <!-- Text which is shown in the expanded notification shade when there are currently no notifications visible that the user hasn't already seen. [CHAR LIMIT=30] -->
    <string name="no_unseen_notif_text">No new notifications</string>

    <!-- Text which is shown in the locked notification shade when there are currently no notifications, but if the user were to unlock, notifications would appear. [CHAR LIMIT=40] -->
    <string name="unlock_to_see_notif_text">Unlock to see older notifications</string>

    <!-- Disclosure at the bottom of Quick Settings that indicates that parental controls are enabled. [CHAR LIMIT=100] -->
    <string name="quick_settings_disclosure_parental_controls">This device is managed by your parent</string>

+59 −1
Original line number Diff line number Diff line
@@ -17,9 +17,12 @@
package com.android.systemui.statusbar;

import android.annotation.ColorInt;
import android.annotation.DrawableRes;
import android.annotation.StringRes;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
@@ -33,16 +36,30 @@ import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
public class EmptyShadeView extends StackScrollerDecorView {

    private TextView mEmptyText;
    private TextView mEmptyFooterText;

    private @StringRes int mText = R.string.empty_shade_text;

    private @DrawableRes int mFooterIcon = R.drawable.ic_friction_lock_closed;
    private @StringRes int mFooterText = R.string.unlock_to_see_notif_text;
    private @Visibility int mFooterVisibility = View.GONE;
    private int mSize;

    public EmptyShadeView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mSize = getResources().getDimensionPixelSize(
                R.dimen.notifications_unseen_footer_icon_size);
    }

    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        mSize = getResources().getDimensionPixelSize(
                R.dimen.notifications_unseen_footer_icon_size);
        mEmptyText.setText(mText);
        mEmptyFooterText.setVisibility(mFooterVisibility);
        setFooterText(mFooterText);
        setFooterIcon(mFooterIcon);
    }

    @Override
@@ -52,11 +69,13 @@ public class EmptyShadeView extends StackScrollerDecorView {

    @Override
    protected View findSecondaryView() {
        return null;
        return findViewById(R.id.no_notifications_footer);
    }

    public void setTextColor(@ColorInt int color) {
        mEmptyText.setTextColor(color);
        mEmptyFooterText.setTextColor(color);
        mEmptyFooterText.setCompoundDrawableTintList(ColorStateList.valueOf(color));
    }

    public void setText(@StringRes int text) {
@@ -64,14 +83,53 @@ public class EmptyShadeView extends StackScrollerDecorView {
        mEmptyText.setText(mText);
    }

    public void setFooterVisibility(@Visibility int visibility) {
        mFooterVisibility = visibility;
        setSecondaryVisible(visibility == View.VISIBLE, false);
    }

    public void setFooterText(@StringRes int text) {
        mFooterText = text;
        if (text != 0) {
            mEmptyFooterText.setText(mFooterText);
        } else {
            mEmptyFooterText.setText(null);
        }
    }

    public void setFooterIcon(@DrawableRes int icon) {
        mFooterIcon = icon;
        Drawable drawable;
        if (icon == 0) {
            drawable = null;
        } else {
            drawable = getResources().getDrawable(icon);
            drawable.setBounds(0, 0, mSize, mSize);
        }
        mEmptyFooterText.setCompoundDrawablesRelative(drawable, null, null, null);
    }

    @StringRes
    public int getTextResource() {
        return mText;
    }

    @StringRes
    public int getFooterTextResource() {
        return mFooterText;
    }

    @DrawableRes
    public int getFooterIconResource() {
        return mFooterIcon;
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        mEmptyText = (TextView) findContentView();
        mEmptyFooterText = (TextView) findSecondaryView();
        mEmptyFooterText.setCompoundDrawableTintList(mEmptyFooterText.getTextColors());
    }

    @Override
+11 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.statusbar.notification.collection.coordinator.dagger
import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.NotifFilter
import com.android.systemui.statusbar.notification.collection.notifcollection.NotifCollectionListener
import com.android.systemui.statusbar.notification.collection.provider.SectionHeaderVisibilityProvider
import com.android.systemui.statusbar.notification.collection.provider.SeenNotificationsProviderImpl
import com.android.systemui.statusbar.notification.interruption.KeyguardNotificationVisibilityProvider
import javax.inject.Inject
import kotlin.time.Duration.Companion.seconds
@@ -49,6 +50,7 @@ constructor(
    private val notifPipelineFlags: NotifPipelineFlags,
    @Application private val scope: CoroutineScope,
    private val sectionHeaderVisibilityProvider: SectionHeaderVisibilityProvider,
    private val seenNotifsProvider: SeenNotificationsProviderImpl,
    private val statusBarStateController: StatusBarStateController,
) : Coordinator {

@@ -105,6 +107,9 @@ constructor(
    @VisibleForTesting
    internal val unseenNotifFilter =
        object : NotifFilter("$TAG-unseen") {

            var hasFilteredAnyNotifs = false

            override fun shouldFilterOut(entry: NotificationEntry, now: Long): Boolean =
                when {
                    // Don't apply filter if the keyguard isn't currently showing
@@ -115,6 +120,11 @@ constructor(
                    //  - summary will be pruned if necessary, depending on if children are filtered
                    entry.parent?.summary == entry -> false
                    else -> true
                }.also { hasFiltered -> hasFilteredAnyNotifs = hasFilteredAnyNotifs || hasFiltered }

            override fun onCleanup() {
                seenNotifsProvider.hasFilteredOutSeenNotifications = hasFilteredAnyNotifs
                hasFilteredAnyNotifs = false
            }
        }

Loading