Added back the recently alerted indicator to conversations

Previously this was dropped, it's now reintroduced.

Fixes: 150905003
Test: atest SystemUITests
Change-Id: Ia152bc4117fa9c656b3d477ef8e50708e1056148
This commit is contained in:
Selim Cinek
2020-03-31 17:54:19 -07:00
parent 4237e8277a
commit a2b1d3753b
7 changed files with 47 additions and 15 deletions

View File

@@ -61,7 +61,6 @@ public class NotificationHeaderView extends ViewGroup {
private CachingIconView mIcon;
private View mProfileBadge;
private View mAppOps;
private View mAudiblyAlertedIcon;
private boolean mExpanded;
private boolean mShowExpandButtonAtEnd;
private boolean mShowWorkBadgeAtEnd;
@@ -119,7 +118,6 @@ public class NotificationHeaderView extends ViewGroup {
mIcon = findViewById(com.android.internal.R.id.icon);
mProfileBadge = findViewById(com.android.internal.R.id.profile_badge);
mAppOps = findViewById(com.android.internal.R.id.app_ops);
mAudiblyAlertedIcon = findViewById(com.android.internal.R.id.alerted_icon);
}
@Override
@@ -318,11 +316,6 @@ public class NotificationHeaderView extends ViewGroup {
updateExpandButton();
}
/** Updates icon visibility based on the noisiness of the notification. */
public void setRecentlyAudiblyAlerted(boolean audiblyAlerted) {
mAudiblyAlertedIcon.setVisibility(audiblyAlerted ? View.VISIBLE : View.GONE);
}
private void updateExpandButton() {
int drawableId;
int contentDescriptionId;

View File

@@ -166,6 +166,18 @@
android:visibility="gone"
/>
<ImageView
android:id="@+id/alerted_icon"
android:layout_width="@dimen/notification_alerted_size"
android:layout_height="@dimen/notification_alerted_size"
android:layout_gravity="center"
android:layout_marginStart="4dp"
android:paddingTop="2dp"
android:scaleType="fitCenter"
android:visibility="gone"
android:contentDescription="@string/notification_alerted_content_description"
android:src="@drawable/ic_notifications_alerted"/>
<ImageView
android:id="@+id/profile_badge"
android:layout_width="@dimen/notification_badge_size"

View File

@@ -1697,8 +1697,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
private final Runnable mExpireRecentlyAlertedFlag = () -> applyAudiblyAlertedRecently(false);
private void applyAudiblyAlertedRecently(boolean audiblyAlertedRecently) {
if (mIsSummaryWithChildren && mChildrenContainer.getHeaderView() != null) {
mChildrenContainer.getHeaderView().setRecentlyAudiblyAlerted(audiblyAlertedRecently);
if (mIsSummaryWithChildren) {
mChildrenContainer.setRecentlyAudiblyAlerted(audiblyAlertedRecently);
}
mPrivateLayout.setRecentlyAudiblyAlerted(audiblyAlertedRecently);
mPublicLayout.setRecentlyAudiblyAlerted(audiblyAlertedRecently);

View File

@@ -1481,14 +1481,14 @@ public class NotificationContentView extends FrameLayout {
/** Sets whether the notification being displayed audibly alerted the user. */
public void setRecentlyAudiblyAlerted(boolean audiblyAlerted) {
if (mContractedChild != null && mContractedWrapper.getNotificationHeader() != null) {
mContractedWrapper.getNotificationHeader().setRecentlyAudiblyAlerted(audiblyAlerted);
if (mContractedChild != null) {
mContractedWrapper.setRecentlyAudiblyAlerted(audiblyAlerted);
}
if (mExpandedChild != null && mExpandedWrapper.getNotificationHeader() != null) {
mExpandedWrapper.getNotificationHeader().setRecentlyAudiblyAlerted(audiblyAlerted);
if (mExpandedChild != null) {
mExpandedWrapper.setRecentlyAudiblyAlerted(audiblyAlerted);
}
if (mHeadsUpChild != null && mHeadsUpWrapper.getNotificationHeader() != null) {
mHeadsUpWrapper.getNotificationHeader().setRecentlyAudiblyAlerted(audiblyAlerted);
if (mHeadsUpChild != null) {
mHeadsUpWrapper.setRecentlyAudiblyAlerted(audiblyAlerted);
}
}

View File

@@ -66,6 +66,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
private View mMicIcon;
private View mOverlayIcon;
private View mAppOps;
private View mAudiblyAlertedIcon;
private boolean mIsLowPriority;
private boolean mTransformLowPriorityTitle;
@@ -117,6 +118,7 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
mMicIcon = mView.findViewById(com.android.internal.R.id.mic);
mOverlayIcon = mView.findViewById(com.android.internal.R.id.overlay);
mAppOps = mView.findViewById(com.android.internal.R.id.app_ops);
mAudiblyAlertedIcon = mView.findViewById(com.android.internal.R.id.alerted_icon);
if (mNotificationHeader != null) {
mNotificationHeader.setShowExpandButtonAtEnd(mShowExpandButtonAtEnd);
mColor = mNotificationHeader.getOriginalIconColor();
@@ -230,6 +232,9 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
if (mOverlayIcon != null) {
mTransformationHelper.addViewTransformingToSimilar(mOverlayIcon);
}
if (mAudiblyAlertedIcon != null) {
mTransformationHelper.addViewTransformingToSimilar(mAudiblyAlertedIcon);
}
}
@Override
@@ -240,6 +245,13 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper {
}
}
@Override
public void setRecentlyAudiblyAlerted(boolean audiblyAlerted) {
if (mAudiblyAlertedIcon != null) {
mAudiblyAlertedIcon.setVisibility(audiblyAlerted ? View.VISIBLE : View.GONE);
}
}
@Override
public NotificationHeaderView getNotificationHeader() {
return mNotificationHeader;

View File

@@ -371,4 +371,10 @@ public abstract class NotificationViewWrapper implements TransformableView {
public int getExtraMeasureHeight() {
return 0;
}
/**
* Set the view to have recently visibly alerted.
*/
public void setRecentlyAudiblyAlerted(boolean audiblyAlerted) {
}
}

View File

@@ -1280,4 +1280,13 @@ public class NotificationChildrenContainer extends ViewGroup {
mNotificationHeaderWrapperLowPriority.showAppOpsIcons(appOps);
}
}
public void setRecentlyAudiblyAlerted(boolean audiblyAlertedRecently) {
if (mNotificationHeaderWrapper != null) {
mNotificationHeaderWrapper.setRecentlyAudiblyAlerted(audiblyAlertedRecently);
}
if (mNotificationHeaderWrapperLowPriority != null) {
mNotificationHeaderWrapperLowPriority.setRecentlyAudiblyAlerted(audiblyAlertedRecently);
}
}
}