Fix the Compose footer actions paddings
This CL fixes the paddings of the footer actions when using the Compose
implementation. See the end of http://b/299104543#comment12 for details.
Bug: 299104543
Test: Manual, observed that the visual background of the footer actions
are the same in the View and Compose implementation, both on phone and
tablets
Change-Id: I444398f04d49920642a2ac44dafabd829f39afc4
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt b/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt
index 13acde2..4822200 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/qs/footer/ui/compose/FooterActions.kt
@@ -137,6 +137,7 @@
)
}
+ val horizontalPadding = dimensionResource(R.dimen.qs_content_horizontal_padding)
Row(
modifier
.fillMaxWidth()
@@ -150,6 +151,8 @@
.padding(
top = dimensionResource(R.dimen.qs_footer_actions_top_padding),
bottom = dimensionResource(R.dimen.qs_footer_actions_bottom_padding),
+ start = horizontalPadding,
+ end = horizontalPadding,
)
.layout { measurable, constraints ->
// All buttons have a 4dp padding to increase their touch size. To be consistent
diff --git a/packages/SystemUI/res/values/ids.xml b/packages/SystemUI/res/values/ids.xml
index 579358f..d8c8080 100644
--- a/packages/SystemUI/res/values/ids.xml
+++ b/packages/SystemUI/res/values/ids.xml
@@ -233,4 +233,7 @@
removed later.
-->
<item type="id" name="tag_smartspace_view" />
+
+ <!-- Tag set on the Compose implementation of the QS footer actions. -->
+ <item type="id" name="tag_compose_qs_footer_actions" />
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
index d2eac45..37e750b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSContainerImpl.java
@@ -235,11 +235,15 @@
quickStatusBarHeaderController.setContentMargins(mContentHorizontalPadding,
mContentHorizontalPadding);
} else {
- view.setPaddingRelative(
- mContentHorizontalPadding,
- view.getPaddingTop(),
- mContentHorizontalPadding,
- view.getPaddingBottom());
+ // Set the horizontal paddings unless the view is the Compose implementation of the
+ // footer actions.
+ if (view.getTag(R.id.tag_compose_qs_footer_actions) == null) {
+ view.setPaddingRelative(
+ mContentHorizontalPadding,
+ view.getPaddingTop(),
+ mContentHorizontalPadding,
+ view.getPaddingBottom());
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
index bea5528..596d024 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSFragment.java
@@ -303,6 +303,11 @@
// to all views except for qs_footer_actions, so we set it to the Compose view.
composeView.setId(R.id.qs_footer_actions);
+ // Set this tag so that QSContainerImpl does not add horizontal paddings to this Compose
+ // implementation of the footer actions. They will be set in Compose instead so that the
+ // background fills the full screen width.
+ composeView.setTag(R.id.tag_compose_qs_footer_actions, true);
+
// Set the same elevation as the View implementation, otherwise the footer actions will be
// drawn below the scroll view with QS grid and clicks won't get through on small devices
// where there isn't enough vertical space to show all the tiles and the footer actions.