1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.volume.panel.component.bottombar.ui
18 
19 import androidx.compose.foundation.layout.Arrangement
20 import androidx.compose.foundation.layout.Row
21 import androidx.compose.foundation.layout.fillMaxWidth
22 import androidx.compose.foundation.layout.heightIn
23 import androidx.compose.material3.Button
24 import androidx.compose.material3.ButtonDefaults
25 import androidx.compose.material3.MaterialTheme
26 import androidx.compose.material3.OutlinedButton
27 import androidx.compose.material3.Text
28 import androidx.compose.runtime.Composable
29 import androidx.compose.ui.Alignment
30 import androidx.compose.ui.Modifier
31 import androidx.compose.ui.res.stringResource
32 import androidx.compose.ui.unit.dp
33 import com.android.systemui.res.R
34 import com.android.systemui.volume.panel.component.bottombar.ui.viewmodel.BottomBarViewModel
35 import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope
36 import com.android.systemui.volume.panel.ui.composable.ComposeVolumePanelUiComponent
37 import com.android.systemui.volume.panel.ui.composable.VolumePanelComposeScope
38 import javax.inject.Inject
39 
40 @VolumePanelScope
41 class BottomBarComponent
42 @Inject
43 constructor(
44     private val viewModel: BottomBarViewModel,
45 ) : ComposeVolumePanelUiComponent {
46 
47     @Composable
Contentnull48     override fun VolumePanelComposeScope.Content(modifier: Modifier) {
49         Row(
50             modifier = modifier.heightIn(min = if (isLargeScreen) 54.dp else 48.dp).fillMaxWidth(),
51             horizontalArrangement = Arrangement.SpaceBetween,
52             verticalAlignment = Alignment.CenterVertically,
53         ) {
54             OutlinedButton(
55                 onClick = viewModel::onSettingsClicked,
56                 colors =
57                     ButtonDefaults.outlinedButtonColors(
58                         contentColor = MaterialTheme.colorScheme.onSurface,
59                     ),
60             ) {
61                 Text(text = stringResource(R.string.volume_panel_dialog_settings_button))
62             }
63             Button(onClick = viewModel::onDoneClicked) {
64                 Text(stringResource(R.string.inline_done_button))
65             }
66         }
67     }
68 }
69