Loading packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java +14 −15 Original line number Diff line number Diff line Loading @@ -164,16 +164,17 @@ public class BrightnessDialog extends Activity { container.setVisibility(View.VISIBLE); ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) container.getLayoutParams(); int horizontalMargin = getResources().getDimensionPixelSize(R.dimen.notification_side_paddings); lp.leftMargin = horizontalMargin; lp.rightMargin = horizontalMargin; int verticalMargin = getResources().getDimensionPixelSize( R.dimen.notification_guts_option_vertical_padding); lp.topMargin = verticalMargin; // Remove the margin. Have the container take all the space. Instead, insert padding. // This allows for the background to be visible around the slider. int margin = 0; lp.topMargin = margin; lp.bottomMargin = margin; lp.leftMargin = margin; lp.rightMargin = margin; int padding = getResources().getDimensionPixelSize( R.dimen.rounded_slider_background_padding ); container.setPadding(padding, padding, padding, padding); // If in multi-window or freeform, increase the top margin so the brightness dialog // doesn't get cut off. final int windowingMode = configuration.windowConfiguration.getWindowingMode(); Loading @@ -182,17 +183,15 @@ public class BrightnessDialog extends Activity { lp.topMargin += 50; } lp.bottomMargin = verticalMargin; int orientation = configuration.orientation; int windowWidth = getWindowAvailableWidth(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { boolean shouldBeFullWidth = getIntent() .getBooleanExtra(EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH, false); lp.width = (shouldBeFullWidth ? windowWidth : windowWidth / 2) - horizontalMargin * 2; lp.width = (shouldBeFullWidth ? windowWidth : windowWidth / 2) - margin * 2; } else if (orientation == Configuration.ORIENTATION_PORTRAIT) { lp.width = windowWidth - horizontalMargin * 2; lp.width = windowWidth - margin * 2; } container.setLayoutParams(lp); Loading @@ -202,7 +201,7 @@ public class BrightnessDialog extends Activity { // Exclude this view (and its horizontal margins) from triggering gestures. // This prevents back gesture from being triggered by dragging close to the // edge of the slider (0% or 100%). bounds.set(-horizontalMargin, 0, right - left + horizontalMargin, bottom - top); bounds.set(-margin, 0, right - left + margin, bottom - top); v.setSystemGestureExclusionRects(List.of(bounds)); }); } Loading packages/SystemUI/src/com/android/systemui/settings/brightness/ComposeDialogComposableProvider.kt +3 −1 Original line number Diff line number Diff line Loading @@ -17,10 +17,12 @@ package com.android.systemui.settings.brightness import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.unit.dp import com.android.compose.theme.PlatformTheme import com.android.systemui.brightness.ui.compose.BrightnessSliderContainer import com.android.systemui.brightness.ui.viewmodel.BrightnessSliderViewModel Loading @@ -44,7 +46,7 @@ private fun BrightnessSliderForDialog( rememberViewModel(traceName = "BrightnessDialog.viewModel") { brightnessSliderViewModelFactory.create(false) } BrightnessSliderContainer(viewModel = viewModel, Modifier.fillMaxWidth()) BrightnessSliderContainer(viewModel = viewModel, Modifier.fillMaxWidth().padding(8.dp)) } class ComposableProvider( Loading packages/SystemUI/tests/src/com/android/systemui/settings/brightness/BrightnessDialogTest.kt +1 −4 Original line number Diff line number Diff line Loading @@ -134,10 +134,7 @@ class BrightnessDialogTest(val flags: FlagsParameterization) : SysuiTestCase() { val frame = activityRule.activity.requireViewById<View>(viewId) val lp = frame.layoutParams as ViewGroup.MarginLayoutParams val horizontalMargin = activityRule.activity.resources.getDimensionPixelSize( R.dimen.notification_side_paddings ) val horizontalMargin = 0 assertThat(lp.leftMargin).isEqualTo(horizontalMargin) assertThat(lp.rightMargin).isEqualTo(horizontalMargin) Loading Loading
packages/SystemUI/src/com/android/systemui/settings/brightness/BrightnessDialog.java +14 −15 Original line number Diff line number Diff line Loading @@ -164,16 +164,17 @@ public class BrightnessDialog extends Activity { container.setVisibility(View.VISIBLE); ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) container.getLayoutParams(); int horizontalMargin = getResources().getDimensionPixelSize(R.dimen.notification_side_paddings); lp.leftMargin = horizontalMargin; lp.rightMargin = horizontalMargin; int verticalMargin = getResources().getDimensionPixelSize( R.dimen.notification_guts_option_vertical_padding); lp.topMargin = verticalMargin; // Remove the margin. Have the container take all the space. Instead, insert padding. // This allows for the background to be visible around the slider. int margin = 0; lp.topMargin = margin; lp.bottomMargin = margin; lp.leftMargin = margin; lp.rightMargin = margin; int padding = getResources().getDimensionPixelSize( R.dimen.rounded_slider_background_padding ); container.setPadding(padding, padding, padding, padding); // If in multi-window or freeform, increase the top margin so the brightness dialog // doesn't get cut off. final int windowingMode = configuration.windowConfiguration.getWindowingMode(); Loading @@ -182,17 +183,15 @@ public class BrightnessDialog extends Activity { lp.topMargin += 50; } lp.bottomMargin = verticalMargin; int orientation = configuration.orientation; int windowWidth = getWindowAvailableWidth(); if (orientation == Configuration.ORIENTATION_LANDSCAPE) { boolean shouldBeFullWidth = getIntent() .getBooleanExtra(EXTRA_BRIGHTNESS_DIALOG_IS_FULL_WIDTH, false); lp.width = (shouldBeFullWidth ? windowWidth : windowWidth / 2) - horizontalMargin * 2; lp.width = (shouldBeFullWidth ? windowWidth : windowWidth / 2) - margin * 2; } else if (orientation == Configuration.ORIENTATION_PORTRAIT) { lp.width = windowWidth - horizontalMargin * 2; lp.width = windowWidth - margin * 2; } container.setLayoutParams(lp); Loading @@ -202,7 +201,7 @@ public class BrightnessDialog extends Activity { // Exclude this view (and its horizontal margins) from triggering gestures. // This prevents back gesture from being triggered by dragging close to the // edge of the slider (0% or 100%). bounds.set(-horizontalMargin, 0, right - left + horizontalMargin, bottom - top); bounds.set(-margin, 0, right - left + margin, bottom - top); v.setSystemGestureExclusionRects(List.of(bounds)); }); } Loading
packages/SystemUI/src/com/android/systemui/settings/brightness/ComposeDialogComposableProvider.kt +3 −1 Original line number Diff line number Diff line Loading @@ -17,10 +17,12 @@ package com.android.systemui.settings.brightness import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.unit.dp import com.android.compose.theme.PlatformTheme import com.android.systemui.brightness.ui.compose.BrightnessSliderContainer import com.android.systemui.brightness.ui.viewmodel.BrightnessSliderViewModel Loading @@ -44,7 +46,7 @@ private fun BrightnessSliderForDialog( rememberViewModel(traceName = "BrightnessDialog.viewModel") { brightnessSliderViewModelFactory.create(false) } BrightnessSliderContainer(viewModel = viewModel, Modifier.fillMaxWidth()) BrightnessSliderContainer(viewModel = viewModel, Modifier.fillMaxWidth().padding(8.dp)) } class ComposableProvider( Loading
packages/SystemUI/tests/src/com/android/systemui/settings/brightness/BrightnessDialogTest.kt +1 −4 Original line number Diff line number Diff line Loading @@ -134,10 +134,7 @@ class BrightnessDialogTest(val flags: FlagsParameterization) : SysuiTestCase() { val frame = activityRule.activity.requireViewById<View>(viewId) val lp = frame.layoutParams as ViewGroup.MarginLayoutParams val horizontalMargin = activityRule.activity.resources.getDimensionPixelSize( R.dimen.notification_side_paddings ) val horizontalMargin = 0 assertThat(lp.leftMargin).isEqualTo(horizontalMargin) assertThat(lp.rightMargin).isEqualTo(horizontalMargin) Loading