Merge "Fix the height of NotificationContentView when there's no actions but bubble button" into tm-qpr-dev am: f93b70108e

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

Change-Id: I9274ab5ef7f7cd9b95a775fd950dc122c5c577bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-09-15 01:36:29 +00:00
committed by Automerger Merge Worker

View File

@@ -1369,6 +1369,8 @@ public class NotificationContentView extends FrameLayout implements Notification
} }
ImageView bubbleButton = layout.findViewById(com.android.internal.R.id.bubble_button); ImageView bubbleButton = layout.findViewById(com.android.internal.R.id.bubble_button);
View actionContainer = layout.findViewById(com.android.internal.R.id.actions_container); View actionContainer = layout.findViewById(com.android.internal.R.id.actions_container);
LinearLayout actionListMarginTarget = layout.findViewById(
com.android.internal.R.id.notification_action_list_margin_target);
if (bubbleButton == null || actionContainer == null) { if (bubbleButton == null || actionContainer == null) {
return; return;
} }
@@ -1393,6 +1395,16 @@ public class NotificationContentView extends FrameLayout implements Notification
bubbleButton.setOnClickListener(mContainingNotification.getBubbleClickListener()); bubbleButton.setOnClickListener(mContainingNotification.getBubbleClickListener());
bubbleButton.setVisibility(VISIBLE); bubbleButton.setVisibility(VISIBLE);
actionContainer.setVisibility(VISIBLE); actionContainer.setVisibility(VISIBLE);
// Set notification_action_list_margin_target's bottom margin to 0 when showing bubble
if (actionListMarginTarget != null) {
ViewGroup.LayoutParams lp = actionListMarginTarget.getLayoutParams();
if (lp instanceof ViewGroup.MarginLayoutParams) {
final ViewGroup.MarginLayoutParams mlp = (ViewGroup.MarginLayoutParams) lp;
if (mlp.bottomMargin > 0) {
mlp.setMargins(mlp.leftMargin, mlp.topMargin, mlp.rightMargin, 0);
}
}
}
} else { } else {
bubbleButton.setVisibility(GONE); bubbleButton.setVisibility(GONE);
} }