1 /*
2 * Copyright (C) 2024 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.qs.panels.ui.compose.toolbar
18
19 import androidx.compose.foundation.shape.CornerSize
20 import androidx.compose.foundation.shape.RoundedCornerShape
21 import androidx.compose.material.icons.Icons
22 import androidx.compose.material.icons.filled.Edit
23 import androidx.compose.material3.Icon
24 import androidx.compose.material3.IconButton
25 import androidx.compose.material3.LocalContentColor
26 import androidx.compose.material3.MaterialTheme
27 import androidx.compose.runtime.Composable
28 import androidx.compose.runtime.CompositionLocalProvider
29 import androidx.compose.ui.Modifier
30 import androidx.compose.ui.res.stringResource
31 import androidx.compose.ui.unit.dp
32 import com.android.systemui.qs.panels.ui.viewmodel.toolbar.EditModeButtonViewModel
33 import com.android.systemui.qs.ui.compose.borderOnFocus
34 import com.android.systemui.res.R
35
36 @Composable
EditModeButtonnull37 fun EditModeButton(viewModel: EditModeButtonViewModel, modifier: Modifier = Modifier) {
38 CompositionLocalProvider(
39 value = LocalContentColor provides MaterialTheme.colorScheme.onSurface
40 ) {
41 IconButton(
42 onClick = viewModel::onButtonClick,
43 shape = RoundedCornerShape(CornerSize(28.dp)),
44 modifier =
45 modifier.borderOnFocus(
46 color = MaterialTheme.colorScheme.secondary,
47 cornerSize = CornerSize(24.dp),
48 ),
49 ) {
50 Icon(
51 imageVector = Icons.Default.Edit,
52 contentDescription = stringResource(id = R.string.accessibility_quick_settings_edit),
53 )
54 }
55 }
56 }
57