From 1a6d4388875a7be3eeeacf60b2712894667b4635 Mon Sep 17 00:00:00 2001 From: Patryk Michalik Date: Fri, 4 Jun 2021 18:33:30 +0200 Subject: [PATCH] `ServiceWarningDialog`: Tweak layout, add Cancel button --- .../gestures/handlers/SleepGestureHandler.kt | 54 +++++++++++-------- lawnchair/src/app/lawnchair/ui/theme/Shape.kt | 2 +- lawnchair/src/app/lawnchair/ui/theme/Type.kt | 2 +- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/lawnchair/src/app/lawnchair/gestures/handlers/SleepGestureHandler.kt b/lawnchair/src/app/lawnchair/gestures/handlers/SleepGestureHandler.kt index 1e01a1beb2..a779ba36c6 100644 --- a/lawnchair/src/app/lawnchair/gestures/handlers/SleepGestureHandler.kt +++ b/lawnchair/src/app/lawnchair/gestures/handlers/SleepGestureHandler.kt @@ -25,14 +25,10 @@ import android.content.Context import android.content.Intent import android.os.Build import android.provider.Settings -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.material.* import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource @@ -137,25 +133,41 @@ fun ServiceWarningDialog( .padding(16.dp) .fillMaxWidth() ) { - CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) { - Text( - text = stringResource(id = title), - style = MaterialTheme.typography.h6 - ) - } Text( - modifier = Modifier.padding(top = 8.dp, bottom = 16.dp), - text = stringResource(id = description), - style = MaterialTheme.typography.body2 + text = stringResource(id = title), + style = MaterialTheme.typography.h6, + color = MaterialTheme.colors.onSurface ) - Button( - modifier = Modifier.align(Alignment.End), - onClick = { - context.startActivity(settingsIntent) - scope.launch { sheetState.hide() } - } + Text( + modifier = Modifier.padding(top = 16.dp), + text = stringResource(id = description), + style = MaterialTheme.typography.body2, + color = MaterialTheme.colors.onSurface + ) + Row( + horizontalArrangement = Arrangement.End, + modifier = Modifier + .padding(top = 20.dp) + .fillMaxWidth() ) { - Text(text = stringResource(id = R.string.dt2s_warning_open_settings)) + OutlinedButton( + shape = MaterialTheme.shapes.small, + onClick = { + scope.launch { sheetState.hide() } + } + ) { + Text(text = stringResource(id = R.string.cancel)) + } + Spacer(modifier = Modifier.requiredWidth(16.dp)) + Button( + shape = MaterialTheme.shapes.small, + onClick = { + context.startActivity(settingsIntent) + scope.launch { sheetState.hide() } + } + ) { + Text(text = stringResource(id = R.string.dt2s_warning_open_settings)) + } } } } diff --git a/lawnchair/src/app/lawnchair/ui/theme/Shape.kt b/lawnchair/src/app/lawnchair/ui/theme/Shape.kt index 55ad613902..196e7f67b0 100644 --- a/lawnchair/src/app/lawnchair/ui/theme/Shape.kt +++ b/lawnchair/src/app/lawnchair/ui/theme/Shape.kt @@ -21,7 +21,7 @@ import androidx.compose.material.Shapes import androidx.compose.ui.unit.dp val Shapes = Shapes( - small = RoundedCornerShape(4.dp), + small = RoundedCornerShape(8.dp), medium = RoundedCornerShape(8.dp), large = RoundedCornerShape(12.dp) ) \ No newline at end of file diff --git a/lawnchair/src/app/lawnchair/ui/theme/Type.kt b/lawnchair/src/app/lawnchair/ui/theme/Type.kt index bf72c2af9d..1b76ce03c3 100644 --- a/lawnchair/src/app/lawnchair/ui/theme/Type.kt +++ b/lawnchair/src/app/lawnchair/ui/theme/Type.kt @@ -86,7 +86,7 @@ val Typography = Typography( button = TextStyle( fontWeight = FontWeight.SemiBold, fontSize = 14.sp, - letterSpacing = 1.25.sp + letterSpacing = 0.25.sp ), caption = TextStyle( fontWeight = FontWeight.Bold,