summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/res/drawable/volume_dialog_background.xml3
-rw-r--r--packages/SystemUI/res/layout/volume_ringer_drawer.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/binder/VolumeDialogRingerViewBinder.kt33
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/util/RingerDrawerConstraintsUtils.kt11
4 files changed, 38 insertions, 10 deletions
diff --git a/packages/SystemUI/res/drawable/volume_dialog_background.xml b/packages/SystemUI/res/drawable/volume_dialog_background.xml
index b527506e28f5..cd0e2c076cef 100644
--- a/packages/SystemUI/res/drawable/volume_dialog_background.xml
+++ b/packages/SystemUI/res/drawable/volume_dialog_background.xml
@@ -17,7 +17,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
- <corners android:bottomLeftRadius="@dimen/volume_dialog_background_corner_radius"
- android:bottomRightRadius="@dimen/volume_dialog_background_corner_radius"/>
+ <corners android:radius="@dimen/volume_dialog_background_corner_radius"/>
<solid android:color="@androidprv:color/materialColorSurface" />
</shape>
diff --git a/packages/SystemUI/res/layout/volume_ringer_drawer.xml b/packages/SystemUI/res/layout/volume_ringer_drawer.xml
index 983603a95833..8f51dbca2774 100644
--- a/packages/SystemUI/res/layout/volume_ringer_drawer.xml
+++ b/packages/SystemUI/res/layout/volume_ringer_drawer.xml
@@ -29,6 +29,7 @@
android:id="@+id/ringer_buttons_background"
android:layout_width="@dimen/volume_dialog_width"
android:layout_height="0dp"
+ android:visibility="gone"
android:layout_marginTop="@dimen/volume_dialog_background_vertical_margin"
android:layout_marginBottom="@dimen/volume_dialog_background_vertical_margin"
android:background="@drawable/volume_dialog_ringer_background" />
diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/binder/VolumeDialogRingerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/binder/VolumeDialogRingerViewBinder.kt
index 58b8f6254d9d..e8d19dd5e0e4 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/binder/VolumeDialogRingerViewBinder.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/binder/VolumeDialogRingerViewBinder.kt
@@ -83,6 +83,18 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
view.context.resources.getDimensionPixelSize(
R.dimen.volume_dialog_background_corner_radius
)
+ val bottomDefaultRadius = volumeDialogBgFullRadius.toFloat()
+ val bottomCornerRadii =
+ floatArrayOf(
+ 0F,
+ 0F,
+ 0F,
+ 0F,
+ bottomDefaultRadius,
+ bottomDefaultRadius,
+ bottomDefaultRadius,
+ bottomDefaultRadius,
+ )
var backgroundAnimationProgress: Float by
Delegates.observable(0F) { _, _, progress ->
ringerBackgroundView.applyCorners(
@@ -115,6 +127,8 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
drawerContainer.visibility = View.VISIBLE
when (uiModel.drawerState) {
is RingerDrawerState.Initial -> {
+ (volumeDialogBackgroundView.background as GradientDrawable)
+ .cornerRadii = bottomCornerRadii
drawerContainer.animateAndBindDrawerButtons(
viewModel,
uiModel,
@@ -123,6 +137,7 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
)
ringerDrawerTransitionListener.setProgressChangeEnabled(true)
drawerContainer.closeDrawer(
+ ringerBackgroundView,
uiModel.currentButtonIndex,
ringerState.orientation,
)
@@ -165,6 +180,7 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
)
}
drawerContainer.closeDrawer(
+ ringerBackgroundView,
uiModel.currentButtonIndex,
ringerState.orientation,
)
@@ -187,7 +203,11 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
} else {
ringerDrawerTransitionListener.setProgressChangeEnabled(true)
}
- updateOpenState(drawerContainer, ringerState.orientation)
+ updateOpenState(
+ drawerContainer,
+ ringerState.orientation,
+ ringerBackgroundView,
+ )
drawerContainer.transitionToState(
R.id.volume_dialog_ringer_drawer_open
)
@@ -204,9 +224,6 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
volumeDialogBackgroundView.setBackgroundResource(
R.drawable.volume_dialog_background
)
- ringerBackgroundView.setBackgroundResource(
- R.drawable.volume_dialog_ringer_background
- )
}
}
}
@@ -351,9 +368,13 @@ constructor(private val viewModel: VolumeDialogRingerDrawerViewModel) {
}
}
- private fun MotionLayout.closeDrawer(selectedIndex: Int, orientation: Int) {
+ private fun MotionLayout.closeDrawer(
+ ringerBackground: View,
+ selectedIndex: Int,
+ orientation: Int,
+ ) {
setTransition(R.id.close_to_open_transition)
- updateCloseState(this, selectedIndex, orientation)
+ updateCloseState(this, selectedIndex, orientation, ringerBackground)
transitionToState(R.id.volume_dialog_ringer_drawer_close)
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/util/RingerDrawerConstraintsUtils.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/util/RingerDrawerConstraintsUtils.kt
index c1e003727750..fb9884cf4341 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/util/RingerDrawerConstraintsUtils.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/ringer/ui/util/RingerDrawerConstraintsUtils.kt
@@ -25,14 +25,21 @@ import androidx.constraintlayout.widget.ConstraintSet
import com.android.systemui.res.R
import com.android.systemui.util.children
-fun updateOpenState(ringerDrawer: MotionLayout, orientation: Int) {
+fun updateOpenState(ringerDrawer: MotionLayout, orientation: Int, ringerBackground: View) {
val openSet = ringerDrawer.cloneConstraintSet(R.id.volume_dialog_ringer_drawer_open)
+ openSet.setVisibility(ringerBackground.id, View.VISIBLE)
openSet.adjustOpenConstraintsForDrawer(ringerDrawer, orientation)
ringerDrawer.updateState(R.id.volume_dialog_ringer_drawer_open, openSet)
}
-fun updateCloseState(ringerDrawer: MotionLayout, selectedIndex: Int, orientation: Int) {
+fun updateCloseState(
+ ringerDrawer: MotionLayout,
+ selectedIndex: Int,
+ orientation: Int,
+ ringerBackground: View,
+) {
val closeSet = ringerDrawer.cloneConstraintSet(R.id.volume_dialog_ringer_drawer_close)
+ closeSet.setVisibility(ringerBackground.id, View.VISIBLE)
closeSet.adjustClosedConstraintsForDrawer(ringerDrawer, selectedIndex, orientation)
ringerDrawer.updateState(R.id.volume_dialog_ringer_drawer_close, closeSet)
}