summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Julia Tuttle <juliatuttle@google.com> 2022-06-09 17:04:24 -0400
committer Julia Tuttle <juliatuttle@google.com> 2022-08-09 18:20:38 -0400
commit140fab50785ce5a2224618b83dff45871b3f48c0 (patch)
tree0132b31da674f7ff844d370dda958a071d1c5a80
parent716c5618dfab500888f04c2cc7bfcb9192370faa (diff)
Clean up QS/NSSL bottom margin calculation
The root cause of b/222594381 was a deviation between the two mostly repetitive branches of an if-else. This change factors out the not-repetitive part of those two branches into a top-level case, and then merges the rest of the cases between the two branches. It also removes the default value for stackScrollMargin, since that saves a couple lines of code but makes the resulting outputs harder to discern by eye. Also, spell out some wildcard imports to make ktlint happy. Bug: 222594381 Test: manual, on Pixel 5a Change-Id: I6a034a6fb475be363667cb64ab2b3516a8df6005
-rw-r--r--packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt48
1 files changed, 21 insertions, 27 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt b/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt
index 13a5615a8b54..2a467763951c 100644
--- a/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt
+++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationsQSContainerController.kt
@@ -6,7 +6,11 @@ import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.view.WindowInsets
import androidx.annotation.VisibleForTesting
import androidx.constraintlayout.widget.ConstraintSet
-import androidx.constraintlayout.widget.ConstraintSet.*
+import androidx.constraintlayout.widget.ConstraintSet.BOTTOM
+import androidx.constraintlayout.widget.ConstraintSet.END
+import androidx.constraintlayout.widget.ConstraintSet.PARENT_ID
+import androidx.constraintlayout.widget.ConstraintSet.START
+import androidx.constraintlayout.widget.ConstraintSet.TOP
import com.android.systemui.R
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.flags.FeatureFlags
@@ -171,33 +175,23 @@ class NotificationsQSContainerController @Inject constructor(
private fun calculateBottomSpacing(): Paddings {
val containerPadding: Int
- var stackScrollMargin = notificationsBottomMargin
- if (splitShadeEnabled) {
- if (isGestureNavigation) {
- // only default cutout padding, taskbar always hides
- containerPadding = bottomCutoutInsets
- } else if (taskbarVisible) {
- // navigation buttons + visible taskbar means we're NOT on homescreen
- containerPadding = bottomStableInsets
- } else {
- // navigation buttons + hidden taskbar means we're on homescreen
- containerPadding = 0
- // we need extra margin for notifications as navigation buttons are below them
- stackScrollMargin = bottomStableInsets + notificationsBottomMargin
- }
+ val stackScrollMargin: Int
+ if (!splitShadeEnabled && (isQSCustomizing || isQSDetailShowing)) {
+ // Clear out bottom paddings/margins so the qs customization can be full height.
+ containerPadding = 0
+ stackScrollMargin = 0
+ } else if (isGestureNavigation) {
+ // only default cutout padding, taskbar always hides
+ containerPadding = bottomCutoutInsets
+ stackScrollMargin = notificationsBottomMargin
+ } else if (taskbarVisible) {
+ // navigation buttons + visible taskbar means we're NOT on homescreen
+ containerPadding = bottomStableInsets
+ stackScrollMargin = notificationsBottomMargin
} else {
- if (isQSCustomizing || isQSDetailShowing) {
- // Clear out bottom paddings/margins so the qs customization can be full height.
- containerPadding = 0
- stackScrollMargin = 0
- } else if (isGestureNavigation) {
- containerPadding = bottomCutoutInsets
- } else if (taskbarVisible) {
- containerPadding = bottomStableInsets
- } else {
- containerPadding = 0
- stackScrollMargin = bottomStableInsets + notificationsBottomMargin
- }
+ // navigation buttons + hidden taskbar means we're on homescreen
+ containerPadding = 0
+ stackScrollMargin = bottomStableInsets + notificationsBottomMargin
}
val qsContainerPadding = if (!(isQSCustomizing || isQSDetailShowing)) {
// We also want this padding in the bottom in these cases