Merge "Add rotary dismiss button to HUNs" into rvc-qpr-dev am: 2d871098d4
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Car/Notification/+/12654725
Change-Id: I1edce13e48630af7232552b2e8604fd0f34263a2
diff --git a/res/layout/basic_headsup_notification_template.xml b/res/layout/basic_headsup_notification_template.xml
index 4d7f847..f2c2fa5 100644
--- a/res/layout/basic_headsup_notification_template.xml
+++ b/res/layout/basic_headsup_notification_template.xml
@@ -56,12 +56,24 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
+
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/basic_notification_template.xml b/res/layout/basic_notification_template.xml
index 5dfcef6..2398bc0 100644
--- a/res/layout/basic_notification_template.xml
+++ b/res/layout/basic_notification_template.xml
@@ -58,17 +58,23 @@
app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/basic_notification_template_inner.xml b/res/layout/basic_notification_template_inner.xml
index 0147755..b2e7110 100644
--- a/res/layout/basic_notification_template_inner.xml
+++ b/res/layout/basic_notification_template_inner.xml
@@ -40,15 +40,21 @@
android:layout_marginBottom="@dimen/card_body_margin_bottom"
app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
diff --git a/res/layout/call_headsup_notification_template.xml b/res/layout/call_headsup_notification_template.xml
index e8173a2..c9ec748 100644
--- a/res/layout/call_headsup_notification_template.xml
+++ b/res/layout/call_headsup_notification_template.xml
@@ -58,14 +58,24 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"
- app:categoryCall="true"/>
+ android:layout_below="@id/notification_body">
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:categoryCall="true"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/call_notification_template.xml b/res/layout/call_notification_template.xml
index dcb3a68..0d7945a 100644
--- a/res/layout/call_notification_template.xml
+++ b/res/layout/call_notification_template.xml
@@ -59,18 +59,24 @@
app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"
- app:categoryCall="true"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ app:categoryCall="true"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/car_emergency_headsup_notification_template.xml b/res/layout/car_emergency_headsup_notification_template.xml
index b2bca53..725f110 100644
--- a/res/layout/car_emergency_headsup_notification_template.xml
+++ b/res/layout/car_emergency_headsup_notification_template.xml
@@ -66,12 +66,23 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
diff --git a/res/layout/car_emergency_notification_template.xml b/res/layout/car_emergency_notification_template.xml
index 2f89f4e..37da6cc 100644
--- a/res/layout/car_emergency_notification_template.xml
+++ b/res/layout/car_emergency_notification_template.xml
@@ -61,17 +61,23 @@
app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
diff --git a/res/layout/car_information_headsup_notification_template.xml b/res/layout/car_information_headsup_notification_template.xml
index 8098bb4..d588864 100644
--- a/res/layout/car_information_headsup_notification_template.xml
+++ b/res/layout/car_information_headsup_notification_template.xml
@@ -68,12 +68,23 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
diff --git a/res/layout/car_information_notification_template.xml b/res/layout/car_information_notification_template.xml
index b842af3..b1dd7ae 100644
--- a/res/layout/car_information_notification_template.xml
+++ b/res/layout/car_information_notification_template.xml
@@ -67,17 +67,23 @@
app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
diff --git a/res/layout/car_information_notification_template_inner.xml b/res/layout/car_information_notification_template_inner.xml
index f8eacc2..144bb23 100644
--- a/res/layout/car_information_notification_template_inner.xml
+++ b/res/layout/car_information_notification_template_inner.xml
@@ -49,17 +49,25 @@
android:layout_marginBottom="@dimen/card_body_margin_bottom"
app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/notification_body"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
+
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/car_notification_actions_view.xml b/res/layout/car_notification_actions_view.xml
index 435e5d1..e2b4c5b 100644
--- a/res/layout/car_notification_actions_view.xml
+++ b/res/layout/car_notification_actions_view.xml
@@ -23,7 +23,6 @@
android:layout_height="@dimen/action_button_height"
android:layout_centerVertical="true"
android:layout_marginBottom="@dimen/action_button_spacing_bottom"
- android:layout_marginStart="@dimen/card_start_margin"
android:layout_marginTop="@dimen/action_button_spacing_top"
android:minWidth="@dimen/action_button_min_width"
android:paddingBottom="@dimen/action_button_padding_bottom"
diff --git a/res/layout/car_warning_headsup_notification_template.xml b/res/layout/car_warning_headsup_notification_template.xml
index 8098bb4..d588864 100644
--- a/res/layout/car_warning_headsup_notification_template.xml
+++ b/res/layout/car_warning_headsup_notification_template.xml
@@ -68,12 +68,23 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
diff --git a/res/layout/car_warning_notification_template.xml b/res/layout/car_warning_notification_template.xml
index f74b129..9a00939 100644
--- a/res/layout/car_warning_notification_template.xml
+++ b/res/layout/car_warning_notification_template.xml
@@ -62,17 +62,23 @@
app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</FrameLayout>
</androidx.cardview.widget.CardView>
diff --git a/res/layout/dismiss_button.xml b/res/layout/dismiss_button.xml
index 3941619..d47bc01 100644
--- a/res/layout/dismiss_button.xml
+++ b/res/layout/dismiss_button.xml
@@ -23,7 +23,7 @@
android:id="@+id/dismiss_button"
android:layout_width="@dimen/dismiss_button_diameter"
android:layout_height="@dimen/dismiss_button_diameter"
- android:layout_marginEnd="@dimen/dismiss_button_end_margin"
+ android:layout_marginRight="@dimen/dismiss_button_right_margin"
android:layout_marginBottom="@dimen/card_min_bottom_padding"
android:background="@drawable/dismiss_button_background"
android:scaleType="center"
diff --git a/res/layout/group_notification_template.xml b/res/layout/group_notification_template.xml
index 18a0650..4cfadad 100644
--- a/res/layout/group_notification_template.xml
+++ b/res/layout/group_notification_template.xml
@@ -76,21 +76,33 @@
android:layout_below="@id/notification_list"
android:background="@color/notification_list_divider_color"/>
- <TextView
- android:id="@+id/expansion_footer"
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="@dimen/notification_card_footer_height"
+ android:layout_height="wrap_content"
android:layout_below="@id/footer_divider"
- android:layout_toLeftOf="@id/dismiss_button"
- android:layout_marginEnd="@dimen/card_end_margin"
- android:layout_marginStart="@dimen/card_start_margin"
- android:gravity="center_vertical"
- style="@style/NotificationBodyContentText"/>
+ android:orientation="horizontal"
+ android:layoutDirection="ltr">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <TextView
+ android:id="@+id/expansion_footer"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/notification_card_footer_height"
+ android:layout_weight="1"
+ android:layout_marginEnd="@dimen/card_end_margin"
+ android:layout_marginStart="@dimen/card_start_margin"
+ android:gravity="center_vertical"
+ android:textDirection="locale"
+ android:textAlignment="gravity"
+ style="@style/NotificationBodyContentText"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"/>
+
+ </LinearLayout>
+
</RelativeLayout>
<!-- This view intercepts all clicks on the card in the collapsed state -->
diff --git a/res/layout/inbox_headsup_notification_template.xml b/res/layout/inbox_headsup_notification_template.xml
index 6c5ed7f..6f58bef 100644
--- a/res/layout/inbox_headsup_notification_template.xml
+++ b/res/layout/inbox_headsup_notification_template.xml
@@ -59,12 +59,23 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="false"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/inbox_notification_template.xml b/res/layout/inbox_notification_template.xml
index 8ce834a..65bcaf7 100644
--- a/res/layout/inbox_notification_template.xml
+++ b/res/layout/inbox_notification_template.xml
@@ -58,17 +58,23 @@
app:maxLines="@integer/config_notificationPanelMaxBodyLines"
app:showBigIcon="true"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
diff --git a/res/layout/inbox_notification_template_inner.xml b/res/layout/inbox_notification_template_inner.xml
index 105a199..ae42428 100644
--- a/res/layout/inbox_notification_template_inner.xml
+++ b/res/layout/inbox_notification_template_inner.xml
@@ -40,15 +40,21 @@
android:layout_marginBottom="@dimen/card_body_margin_bottom"
app:maxLines="@integer/config_notificationPanelMaxBodyLines"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/message_headsup_notification_template.xml b/res/layout/message_headsup_notification_template.xml
index 3f3c541..abe2f6f 100644
--- a/res/layout/message_headsup_notification_template.xml
+++ b/res/layout/message_headsup_notification_template.xml
@@ -62,19 +62,30 @@
android:id="@+id/message_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_above="@id/notification_actions"
+ android:layout_above="@id/notification_actions_wrapper"
android:layout_alignParentEnd="true"
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_marginEnd="@dimen/card_end_margin"
style="@style/NotificationBodyContentText"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:id="@+id/notification_actions_wrapper"
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/message_notification_template.xml b/res/layout/message_notification_template.xml
index 567dc6d..24ccd77 100644
--- a/res/layout/message_notification_template.xml
+++ b/res/layout/message_notification_template.xml
@@ -100,18 +100,23 @@
android:layout_marginEnd="@dimen/card_end_margin"
android:layout_marginStart="@dimen/body_big_icon_margin"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/message_content"/>
+ android:layout_below="@id/message_content">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/message_notification_template_inner.xml b/res/layout/message_notification_template_inner.xml
index d648524..0575509 100644
--- a/res/layout/message_notification_template_inner.xml
+++ b/res/layout/message_notification_template_inner.xml
@@ -98,16 +98,21 @@
android:layout_marginBottom="@dimen/card_body_margin_bottom"
android:layout_marginEnd="@dimen/card_end_margin"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/message_content"/>
+ android:layout_below="@id/message_content">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
\ No newline at end of file
diff --git a/res/layout/navigation_headsup_notification_template.xml b/res/layout/navigation_headsup_notification_template.xml
index 4a06c68..4268905 100644
--- a/res/layout/navigation_headsup_notification_template.xml
+++ b/res/layout/navigation_headsup_notification_template.xml
@@ -56,12 +56,23 @@
app:maxLines="@integer/config_headsUpNotificationMaxBodyLines"
app:showBigIcon="true"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/notification_body"/>
+ android:layout_below="@id/notification_body">
+
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/progress_notification_template.xml b/res/layout/progress_notification_template.xml
index 091ad42..e63ffca 100644
--- a/res/layout/progress_notification_template.xml
+++ b/res/layout/progress_notification_template.xml
@@ -69,17 +69,23 @@
android:layout_marginBottom="@dimen/card_body_margin_bottom"
style="?android:attr/progressBarStyleHorizontal"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/progress_bar"/>
+ android:layout_below="@id/progress_bar">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</FrameLayout>
diff --git a/res/layout/progress_notification_template_inner.xml b/res/layout/progress_notification_template_inner.xml
index 4e94518..bf6e9f1 100644
--- a/res/layout/progress_notification_template_inner.xml
+++ b/res/layout/progress_notification_template_inner.xml
@@ -51,16 +51,21 @@
android:layout_marginBottom="@dimen/card_body_margin_bottom"
style="?android:attr/progressBarStyleHorizontal"/>
- <com.android.car.notification.template.CarNotificationActionsView
- android:id="@+id/notification_actions"
- style="@style/NotificationActionViewLayout"
- android:layout_width="wrap_content"
+ <FrameLayout
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/progress_bar"/>
+ android:layout_below="@id/progress_bar">
- <include
- layout="@layout/dismiss_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"/>
+ <com.android.car.notification.template.CarNotificationActionsView
+ android:id="@+id/notification_actions"
+ style="@style/NotificationActionViewLayout"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+ <include
+ layout="@layout/dismiss_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"/>
+
+ </FrameLayout>
</RelativeLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index f7a6161..8887249 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -49,6 +49,7 @@
<dimen name="time_stamp_text_size_in_group">@*android:dimen/car_body3_size</dimen>
<!-- Action View -->
+ <dimen name="action_view_left_margin">@*android:dimen/car_padding_3</dimen>
<dimen name="action_button_radius">28dp</dimen>
<dimen name="action_button_min_width">@*android:dimen/car_button_min_width</dimen>
<dimen name="action_button_height">@*android:dimen/car_button_height</dimen>
@@ -78,7 +79,7 @@
<!-- Dismiss button -->
<dimen name="dismiss_button_diameter">@*android:dimen/car_button_height</dimen>
- <dimen name="dismiss_button_end_margin">27dp</dimen>
+ <dimen name="dismiss_button_right_margin">32dp</dimen>
<!-- Clear all button -->
<dimen name="clear_all_button_margin">@*android:dimen/car_padding_3</dimen>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index aa08cac..c4d7474 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -52,8 +52,9 @@
</style>
<style name="NotificationActionViewLayout">
- <item name="android:layout_alignParentLeft">true</item>
+ <item name="android:layout_gravity">left</item>
<item name="android:minHeight">@dimen/card_min_bottom_padding</item>
+ <item name="android:layout_marginLeft">@dimen/action_view_left_margin</item>
</style>
<style name="NotificationActionButtonBase" parent="@android:Widget.DeviceDefault.Button.Borderless.Colored">
@@ -76,8 +77,7 @@
<style name="NotificationActionButton3" parent="NotificationActionButtonBase"/>
<style name="DismissButtonLayout">
- <item name="android:layout_alignParentRight">true</item>
- <item name="android:layout_alignParentBottom">true</item>
+ <item name="android:layout_gravity">bottom|right</item>
</style>
<style name="ClearAllButtonHeader" parent="@android:Widget.DeviceDefault.Button.Borderless.Colored">
diff --git a/src/com/android/car/notification/CarHeadsUpNotificationManager.java b/src/com/android/car/notification/CarHeadsUpNotificationManager.java
index d29db7f..d454087 100644
--- a/src/com/android/car/notification/CarHeadsUpNotificationManager.java
+++ b/src/com/android/car/notification/CarHeadsUpNotificationManager.java
@@ -310,6 +310,8 @@
mClickHandlerFactory));
}
+ currentNotification.getViewHolder().setHideDismissButton(!shouldDismissOnSwipe(alertEntry));
+
if (mShouldRestrictMessagePreview && notificationTypeItem.getNotificationType()
== NotificationViewType.MESSAGE) {
((MessageNotificationViewHolder) currentNotification.getViewHolder())
@@ -347,6 +349,13 @@
View cardView = currentNotification.getNotificationView().findViewById(R.id.card_view);
cardView.setOnTouchListener(new HeadsUpNotificationOnTouchListener(cardView,
shouldDismissOnSwipe(alertEntry), () -> resetView(alertEntry)));
+
+ // Add dismiss button listener
+ View dismissButton = currentNotification.getNotificationView().findViewById(
+ R.id.dismiss_button);
+ if (dismissButton != null) {
+ dismissButton.setOnClickListener(v -> dismissHUN(alertEntry));
+ }
}
}
diff --git a/src/com/android/car/notification/template/CarNotificationBaseViewHolder.java b/src/com/android/car/notification/template/CarNotificationBaseViewHolder.java
index 8014d0d..a846c59 100644
--- a/src/com/android/car/notification/template/CarNotificationBaseViewHolder.java
+++ b/src/com/android/car/notification/template/CarNotificationBaseViewHolder.java
@@ -152,7 +152,7 @@
} else if (mCardView != null) {
mCardView.setOnClickListener(mClickHandlerFactory.getClickHandler(alertEntry));
}
- updateDismissButton(alertEntry);
+ updateDismissButton(alertEntry, isHeadsUp);
bindCardView(mCardView, isInGroup);
bindHeader(mHeaderView, isInGroup);
@@ -310,7 +310,7 @@
}
/**
- * Returns true if the notification contained in this view holder can be swiped away.
+ * Returns true if the panel notification contained in this view holder can be swiped away.
*/
public boolean isDismissible() {
if (mAlertEntry == null) {
@@ -321,17 +321,22 @@
& (Notification.FLAG_FOREGROUND_SERVICE | Notification.FLAG_ONGOING_EVENT)) == 0;
}
- void updateDismissButton(AlertEntry alertEntry) {
+ void updateDismissButton(AlertEntry alertEntry, boolean isHeadsUp) {
if (mDismissButton == null) {
return;
}
- if (!isDismissible() || mHideDismissButton) {
+ // isDismissible only applies to panel notifications, not HUNs
+ if ((!isHeadsUp && !isDismissible()) || mHideDismissButton) {
hideDismissButton();
return;
}
mDismissButton.setImageAlpha(0);
mDismissButton.setVisibility(View.VISIBLE);
- mDismissButton.setOnClickListener(getDismissHandler(alertEntry));
+ if (!isHeadsUp) {
+ // Only set the click listener here for panel notifications - HUNs already have one
+ // provided from the CarHeadsUpNotificationManager
+ mDismissButton.setOnClickListener(getDismissHandler(alertEntry));
+ }
itemView.getViewTreeObserver().addOnGlobalFocusChangeListener(mFocusChangeListener);
}
diff --git a/src/com/android/car/notification/template/GroupNotificationViewHolder.java b/src/com/android/car/notification/template/GroupNotificationViewHolder.java
index ffcf7b1..ead4ff5 100644
--- a/src/com/android/car/notification/template/GroupNotificationViewHolder.java
+++ b/src/com/android/car/notification/template/GroupNotificationViewHolder.java
@@ -198,7 +198,7 @@
unshownCount <= 0
? mContext.getString(R.string.show_more)
: mContext.getString(R.string.show_count_more, unshownCount));
- updateDismissButton(getAlertEntry());
+ updateDismissButton(getAlertEntry(), /* isHeadsUp= */ false);
}
private void updateOnClickListener(