Loading packages/SystemUI/res/layout/status_bar_notification_footer.xml +11 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,17 @@ android:id="@+id/content" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/unlock_prompt_footer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" 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"/> <com.android.systemui.statusbar.notification.row.FooterViewButton style="@style/TextAppearance.NotificationSectionHeaderButton" android:id="@+id/manage_text" Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java +50 −0 Original line number Diff line number Diff line Loading @@ -16,15 +16,22 @@ package com.android.systemui.statusbar.notification.row; 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.content.res.Resources; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.IndentingPrintWriter; import android.view.View; import android.widget.TextView; import androidx.annotation.NonNull; import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; import com.android.systemui.statusbar.notification.stack.ViewState; Loading @@ -41,6 +48,11 @@ public class FooterView extends StackScrollerDecorView { private String mManageNotificationText; private String mManageNotificationHistoryText; // Footer label private TextView mSeenNotifsFooterTextView; private @StringRes int mSeenNotifsFilteredText; private int mUnlockIconSize; public FooterView(Context context, AttributeSet attrs) { super(context, attrs); } Loading Loading @@ -73,10 +85,41 @@ public class FooterView extends StackScrollerDecorView { super.onFinishInflate(); mClearAllButton = (FooterViewButton) findSecondaryView(); mManageButton = findViewById(R.id.manage_text); mSeenNotifsFooterTextView = findViewById(R.id.unlock_prompt_footer); updateResources(); updateText(); } public void setFooterLabelTextAndIcon(@StringRes int text, @DrawableRes int icon) { mSeenNotifsFilteredText = text; if (mSeenNotifsFilteredText != 0) { mSeenNotifsFooterTextView.setText(mSeenNotifsFilteredText); } else { mSeenNotifsFooterTextView.setText(null); } Drawable drawable; if (icon == 0) { drawable = null; } else { drawable = getResources().getDrawable(icon); drawable.setBounds(0, 0, mUnlockIconSize, mUnlockIconSize); } mSeenNotifsFooterTextView.setCompoundDrawablesRelative(drawable, null, null, null); updateFooterVisibilityMode(); } private void updateFooterVisibilityMode() { if (mSeenNotifsFilteredText != 0) { mManageButton.setVisibility(View.GONE); mClearAllButton.setVisibility(View.GONE); mSeenNotifsFooterTextView.setVisibility(View.VISIBLE); } else { mManageButton.setVisibility(View.VISIBLE); mClearAllButton.setVisibility(View.VISIBLE); mSeenNotifsFooterTextView.setVisibility(View.GONE); } } public void setManageButtonClickListener(OnClickListener listener) { mManageButton.setOnClickListener(listener); } Loading Loading @@ -135,12 +178,19 @@ public class FooterView extends StackScrollerDecorView { mClearAllButton.setTextColor(textColor); mManageButton.setBackground(theme.getDrawable(R.drawable.notif_footer_btn_background)); mManageButton.setTextColor(textColor); final @ColorInt int labelTextColor = Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary); mSeenNotifsFooterTextView.setTextColor(labelTextColor); mSeenNotifsFooterTextView.setCompoundDrawableTintList( ColorStateList.valueOf(labelTextColor)); } private void updateResources() { mManageNotificationText = getContext().getString(R.string.manage_notifications_text); mManageNotificationHistoryText = getContext() .getString(R.string.manage_notifications_history_text); mUnlockIconSize = getResources() .getDimensionPixelSize(R.dimen.notifications_unseen_footer_icon_size); } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +15 −4 Original line number Diff line number Diff line Loading @@ -538,6 +538,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private NotificationStackScrollLayoutController.TouchHandler mTouchHandler; private final ScreenOffAnimationController mScreenOffAnimationController; private boolean mShouldUseSplitNotificationShade; private boolean mHasFilteredOutSeenNotifications; private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener = new ExpandableView.OnHeightChangedListener() { Loading Loading @@ -684,6 +685,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateFooter(); } void setHasFilteredOutSeenNotifications(boolean hasFilteredOutSeenNotifications) { mHasFilteredOutSeenNotifications = hasFilteredOutSeenNotifications; } @VisibleForTesting @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooter() { Loading Loading @@ -4612,13 +4617,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) void updateEmptyShadeView( boolean visible, boolean areNotificationsHiddenInShade, boolean areSeenNotifsFiltered) { void updateEmptyShadeView(boolean visible, boolean areNotificationsHiddenInShade) { mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled); if (areNotificationsHiddenInShade) { updateEmptyShadeView(R.string.dnd_suppressing_shade_text, 0, 0); } else if (areSeenNotifsFiltered) { } else if (mHasFilteredOutSeenNotifications) { updateEmptyShadeView( R.string.no_unseen_notif_text, R.string.unlock_to_see_notif_text, Loading Loading @@ -4657,13 +4661,20 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooterView(boolean visible, boolean showDismissView, boolean showHistory) { if (mFooterView == null) { if (mFooterView == null || mNotificationStackSizeCalculator == null) { return; } boolean animate = mIsExpanded && mAnimationsEnabled; mFooterView.setVisible(visible, animate); mFooterView.setSecondaryVisible(showDismissView, animate); mFooterView.showHistory(showHistory); if (mHasFilteredOutSeenNotifications) { mFooterView.setFooterLabelTextAndIcon( R.string.unlock_to_see_notif_text, R.drawable.ic_friction_lock_closed); } else { mFooterView.setFooterLabelTextAndIcon(0, 0); } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +4 −5 Original line number Diff line number Diff line Loading @@ -1242,11 +1242,7 @@ public class NotificationStackScrollLayoutController { // For more details, see: b/228790482 && !isInTransitionToKeyguard(); mView.updateEmptyShadeView( shouldShow, mZenModeController.areNotificationsHiddenInShade(), mNotifPipelineFlags.getShouldFilterUnseenNotifsOnKeyguard() && mSeenNotificationsProvider.getHasFilteredOutSeenNotifications()); mView.updateEmptyShadeView(shouldShow, mZenModeController.areNotificationsHiddenInShade()); Trace.endSection(); } Loading Loading @@ -1942,6 +1938,9 @@ public class NotificationStackScrollLayoutController { @Override public void setNotifStats(@NonNull NotifStats notifStats) { mNotifStats = notifStats; mView.setHasFilteredOutSeenNotifications( mNotifPipelineFlags.getShouldFilterUnseenNotifsOnKeyguard() && mSeenNotificationsProvider.getHasFilteredOutSeenNotifications()); updateFooter(); updateShowEmptyShadeView(); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.row; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; Loading Loading @@ -98,5 +100,16 @@ public class FooterViewTest extends SysuiTestCase { mView.setSecondaryVisible(true /* visible */, true /* animate */); } @Test public void testSetFooterLabelTextAndIcon() { mView.setFooterLabelTextAndIcon( R.string.unlock_to_see_notif_text, R.drawable.ic_friction_lock_closed); assertThat(mView.findViewById(R.id.manage_text).getVisibility()).isEqualTo(View.GONE); assertThat(mView.findSecondaryView().getVisibility()).isEqualTo(View.GONE); assertThat(mView.findViewById(R.id.unlock_prompt_footer).getVisibility()) .isEqualTo(View.VISIBLE); } } Loading
packages/SystemUI/res/layout/status_bar_notification_footer.xml +11 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,17 @@ android:id="@+id/content" android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/unlock_prompt_footer" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" 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"/> <com.android.systemui.statusbar.notification.row.FooterViewButton style="@style/TextAppearance.NotificationSectionHeaderButton" android:id="@+id/manage_text" Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/FooterView.java +50 −0 Original line number Diff line number Diff line Loading @@ -16,15 +16,22 @@ package com.android.systemui.statusbar.notification.row; 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.content.res.Resources; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.IndentingPrintWriter; import android.view.View; import android.widget.TextView; import androidx.annotation.NonNull; import com.android.settingslib.Utils; import com.android.systemui.R; import com.android.systemui.statusbar.notification.stack.ExpandableViewState; import com.android.systemui.statusbar.notification.stack.ViewState; Loading @@ -41,6 +48,11 @@ public class FooterView extends StackScrollerDecorView { private String mManageNotificationText; private String mManageNotificationHistoryText; // Footer label private TextView mSeenNotifsFooterTextView; private @StringRes int mSeenNotifsFilteredText; private int mUnlockIconSize; public FooterView(Context context, AttributeSet attrs) { super(context, attrs); } Loading Loading @@ -73,10 +85,41 @@ public class FooterView extends StackScrollerDecorView { super.onFinishInflate(); mClearAllButton = (FooterViewButton) findSecondaryView(); mManageButton = findViewById(R.id.manage_text); mSeenNotifsFooterTextView = findViewById(R.id.unlock_prompt_footer); updateResources(); updateText(); } public void setFooterLabelTextAndIcon(@StringRes int text, @DrawableRes int icon) { mSeenNotifsFilteredText = text; if (mSeenNotifsFilteredText != 0) { mSeenNotifsFooterTextView.setText(mSeenNotifsFilteredText); } else { mSeenNotifsFooterTextView.setText(null); } Drawable drawable; if (icon == 0) { drawable = null; } else { drawable = getResources().getDrawable(icon); drawable.setBounds(0, 0, mUnlockIconSize, mUnlockIconSize); } mSeenNotifsFooterTextView.setCompoundDrawablesRelative(drawable, null, null, null); updateFooterVisibilityMode(); } private void updateFooterVisibilityMode() { if (mSeenNotifsFilteredText != 0) { mManageButton.setVisibility(View.GONE); mClearAllButton.setVisibility(View.GONE); mSeenNotifsFooterTextView.setVisibility(View.VISIBLE); } else { mManageButton.setVisibility(View.VISIBLE); mClearAllButton.setVisibility(View.VISIBLE); mSeenNotifsFooterTextView.setVisibility(View.GONE); } } public void setManageButtonClickListener(OnClickListener listener) { mManageButton.setOnClickListener(listener); } Loading Loading @@ -135,12 +178,19 @@ public class FooterView extends StackScrollerDecorView { mClearAllButton.setTextColor(textColor); mManageButton.setBackground(theme.getDrawable(R.drawable.notif_footer_btn_background)); mManageButton.setTextColor(textColor); final @ColorInt int labelTextColor = Utils.getColorAttrDefaultColor(mContext, android.R.attr.textColorPrimary); mSeenNotifsFooterTextView.setTextColor(labelTextColor); mSeenNotifsFooterTextView.setCompoundDrawableTintList( ColorStateList.valueOf(labelTextColor)); } private void updateResources() { mManageNotificationText = getContext().getString(R.string.manage_notifications_text); mManageNotificationHistoryText = getContext() .getString(R.string.manage_notifications_history_text); mUnlockIconSize = getResources() .getDimensionPixelSize(R.dimen.notifications_unseen_footer_icon_size); } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayout.java +15 −4 Original line number Diff line number Diff line Loading @@ -538,6 +538,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable private NotificationStackScrollLayoutController.TouchHandler mTouchHandler; private final ScreenOffAnimationController mScreenOffAnimationController; private boolean mShouldUseSplitNotificationShade; private boolean mHasFilteredOutSeenNotifications; private final ExpandableView.OnHeightChangedListener mOnChildHeightChangedListener = new ExpandableView.OnHeightChangedListener() { Loading Loading @@ -684,6 +685,10 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable updateFooter(); } void setHasFilteredOutSeenNotifications(boolean hasFilteredOutSeenNotifications) { mHasFilteredOutSeenNotifications = hasFilteredOutSeenNotifications; } @VisibleForTesting @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooter() { Loading Loading @@ -4612,13 +4617,12 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) void updateEmptyShadeView( boolean visible, boolean areNotificationsHiddenInShade, boolean areSeenNotifsFiltered) { void updateEmptyShadeView(boolean visible, boolean areNotificationsHiddenInShade) { mEmptyShadeView.setVisible(visible, mIsExpanded && mAnimationsEnabled); if (areNotificationsHiddenInShade) { updateEmptyShadeView(R.string.dnd_suppressing_shade_text, 0, 0); } else if (areSeenNotifsFiltered) { } else if (mHasFilteredOutSeenNotifications) { updateEmptyShadeView( R.string.no_unseen_notif_text, R.string.unlock_to_see_notif_text, Loading Loading @@ -4657,13 +4661,20 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) public void updateFooterView(boolean visible, boolean showDismissView, boolean showHistory) { if (mFooterView == null) { if (mFooterView == null || mNotificationStackSizeCalculator == null) { return; } boolean animate = mIsExpanded && mAnimationsEnabled; mFooterView.setVisible(visible, animate); mFooterView.setSecondaryVisible(showDismissView, animate); mFooterView.showHistory(showHistory); if (mHasFilteredOutSeenNotifications) { mFooterView.setFooterLabelTextAndIcon( R.string.unlock_to_see_notif_text, R.drawable.ic_friction_lock_closed); } else { mFooterView.setFooterLabelTextAndIcon(0, 0); } } @ShadeViewRefactor(RefactorComponent.SHADE_VIEW) Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java +4 −5 Original line number Diff line number Diff line Loading @@ -1242,11 +1242,7 @@ public class NotificationStackScrollLayoutController { // For more details, see: b/228790482 && !isInTransitionToKeyguard(); mView.updateEmptyShadeView( shouldShow, mZenModeController.areNotificationsHiddenInShade(), mNotifPipelineFlags.getShouldFilterUnseenNotifsOnKeyguard() && mSeenNotificationsProvider.getHasFilteredOutSeenNotifications()); mView.updateEmptyShadeView(shouldShow, mZenModeController.areNotificationsHiddenInShade()); Trace.endSection(); } Loading Loading @@ -1942,6 +1938,9 @@ public class NotificationStackScrollLayoutController { @Override public void setNotifStats(@NonNull NotifStats notifStats) { mNotifStats = notifStats; mView.setHasFilteredOutSeenNotifications( mNotifPipelineFlags.getShouldFilterUnseenNotifsOnKeyguard() && mSeenNotificationsProvider.getHasFilteredOutSeenNotifications()); updateFooter(); updateShowEmptyShadeView(); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/FooterViewTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package com.android.systemui.statusbar.notification.row; import static com.google.common.truth.Truth.assertThat; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; Loading Loading @@ -98,5 +100,16 @@ public class FooterViewTest extends SysuiTestCase { mView.setSecondaryVisible(true /* visible */, true /* animate */); } @Test public void testSetFooterLabelTextAndIcon() { mView.setFooterLabelTextAndIcon( R.string.unlock_to_see_notif_text, R.drawable.ic_friction_lock_closed); assertThat(mView.findViewById(R.id.manage_text).getVisibility()).isEqualTo(View.GONE); assertThat(mView.findSecondaryView().getVisibility()).isEqualTo(View.GONE); assertThat(mView.findViewById(R.id.unlock_prompt_footer).getVisibility()) .isEqualTo(View.VISIBLE); } }