summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java37
2 files changed, 41 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
index c31f4ad5c3f1..4b2b1688bde6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationContentInflater.java
@@ -998,6 +998,10 @@ public class NotificationContentInflater implements NotificationRowContentBinder
entry.setPromotedNotificationContentModel(result.mPromotedContent);
}
+ if (PromotedNotificationUiForceExpanded.isEnabled()) {
+ row.setPromotedOngoing(entry.isOngoingPromoted());
+ }
+
boolean setRepliesAndActions = true;
if ((reInflateFlags & FLAG_CONTENT_VIEW_CONTRACTED) != 0) {
if (result.inflatedContentView != null) {
@@ -1130,9 +1134,6 @@ public class NotificationContentInflater implements NotificationRowContentBinder
entry.setHeadsUpStatusBarText(result.headsUpStatusBarText);
entry.setHeadsUpStatusBarTextPublic(result.headsUpStatusBarTextPublic);
- if (PromotedNotificationUiForceExpanded.isEnabled()) {
- row.setPromotedOngoing(entry.isOngoingPromoted());
- }
Trace.endAsyncSection(APPLY_TRACE_METHOD, System.identityHashCode(row));
if (endListener != null) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
index 3ccf5063cd68..b9aa57145c7c 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationTemplateViewWrapper.java
@@ -33,6 +33,7 @@ import android.graphics.drawable.Icon;
import android.service.notification.StatusBarNotification;
import android.util.ArraySet;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ProgressBar;
@@ -42,6 +43,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.ContrastColorUtil;
import com.android.internal.widget.NotificationActionListLayout;
import com.android.systemui.Dependency;
+import com.android.systemui.Flags;
import com.android.systemui.UiOffloadThread;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.CrossFadeHelper;
@@ -51,6 +53,7 @@ import com.android.systemui.statusbar.notification.ImageTransformState;
import com.android.systemui.statusbar.notification.TransformState;
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow;
import com.android.systemui.statusbar.notification.row.HybridNotificationView;
+import com.android.systemui.util.DimensionKt;
import java.util.function.Consumer;
@@ -186,9 +189,43 @@ public class NotificationTemplateViewWrapper extends NotificationHeaderViewWrapp
mActions = mView.findViewById(com.android.internal.R.id.actions);
mRemoteInputHistory = mView.findViewById(
com.android.internal.R.id.notification_material_reply_container);
+
+ adjustTitleAndRightIconForPromotedOngoing();
updatePendingIntentCancellations();
}
+ private void adjustTitleAndRightIconForPromotedOngoing() {
+ if (Flags.uiRichOngoingForceExpanded() && mRow.isPromotedOngoing() && mRightIcon != null) {
+ final int horizontalMargin;
+ if (notificationsRedesignTemplates()) {
+ horizontalMargin = mView.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.notification_2025_margin);
+ } else {
+ horizontalMargin = (int) DimensionKt.dpToPx(16, mView.getContext());
+ }
+
+ // position right icon to the right available space from expander.
+ final ViewGroup.MarginLayoutParams rightIconLP =
+ (ViewGroup.MarginLayoutParams) mRightIcon.getLayoutParams();
+ rightIconLP.setMarginEnd(horizontalMargin);
+ mRightIcon.setLayoutParams(rightIconLP);
+
+ // align top line view to start of the right icon.
+ final int iconSize = mView.getResources().getDimensionPixelSize(
+ com.android.internal.R.dimen.notification_right_icon_size);
+ final int marginEnd = 2 * horizontalMargin + iconSize;
+ mNotificationTopLine.setHeaderTextMarginEnd(marginEnd);
+
+ // title has too much margin on the right, so we need to reduce it
+ if (mTitle != null) {
+ final ViewGroup.MarginLayoutParams titleLP =
+ (ViewGroup.MarginLayoutParams) mTitle.getLayoutParams();
+ titleLP.setMarginEnd(marginEnd);
+ mTitle.setLayoutParams(titleLP);
+ }
+ }
+ }
+
@Nullable
protected final Icon getLargeIcon(Notification n) {
Icon modernLargeIcon = n.getLargeIcon();