Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e358ab9 authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Add toggleableState to ToggleButtonComponent" into main

parents ea469730 de61cab0
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.semantics.toggleableState
import androidx.compose.ui.state.ToggleableState
import androidx.compose.ui.unit.dp
import com.android.systemui.common.ui.compose.Icon
import com.android.systemui.volume.panel.component.button.ui.viewmodel.ButtonViewModel
@@ -79,6 +81,12 @@ class ToggleButtonComponent(
                    modifier =
                        Modifier.fillMaxSize().padding(8.dp).semantics {
                            role = Role.Switch
                            toggleableState =
                                if (viewModel.isActive) {
                                    ToggleableState.On
                                } else {
                                    ToggleableState.Off
                                }
                            contentDescription = label
                        },
                    onClick = { onCheckedChange(!viewModel.isActive) },