diff --git a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInScreen.kt b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInScreen.kt index 1c395ad7f5..dc91ac990e 100644 --- a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInScreen.kt +++ b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInScreen.kt @@ -16,7 +16,6 @@ package com.example.compose.jetsurvey.signinsignup -import androidx.compose.foundation.Text import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -32,6 +31,7 @@ import androidx.compose.material.Scaffold import androidx.compose.material.Snackbar import androidx.compose.material.SnackbarHost import androidx.compose.material.SnackbarHostState +import androidx.compose.material.Text import androidx.compose.material.TextButton import androidx.compose.runtime.Composable import androidx.compose.runtime.remember diff --git a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInSignUp.kt b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInSignUp.kt index 6ecd41c1cd..c6044c1f9f 100644 --- a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInSignUp.kt +++ b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignInSignUp.kt @@ -16,9 +16,7 @@ package com.example.compose.jetsurvey.signinsignup -import androidx.compose.foundation.AmbientTextStyle import androidx.compose.foundation.ScrollableColumn -import androidx.compose.foundation.Text import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -29,20 +27,24 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.layout.preferredWidth import androidx.compose.foundation.layout.wrapContentSize -import androidx.compose.material.AmbientEmphasisLevels +import androidx.compose.foundation.text.KeyboardOptions +import androidx.compose.material.AmbientContentAlpha +import androidx.compose.material.AmbientTextStyle +import androidx.compose.material.ContentAlpha import androidx.compose.material.Icon import androidx.compose.material.IconButton import androidx.compose.material.MaterialTheme import androidx.compose.material.OutlinedButton import androidx.compose.material.OutlinedTextField -import androidx.compose.material.ProvideEmphasis import androidx.compose.material.Surface +import androidx.compose.material.Text import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ChevronLeft import androidx.compose.material.icons.filled.Visibility import androidx.compose.material.icons.filled.VisibilityOff import androidx.compose.runtime.Composable +import androidx.compose.runtime.Providers import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment @@ -117,7 +119,7 @@ fun Email( emailState.text = it }, label = { - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { Text( text = stringResource(id = R.string.email), style = MaterialTheme.typography.body2 @@ -133,7 +135,7 @@ fun Email( }, textStyle = MaterialTheme.typography.body2, isErrorValue = emailState.showErrors(), - imeAction = imeAction, + keyboardOptions = KeyboardOptions.Default.copy(imeAction = imeAction), onImeActionPerformed = { action, softKeyboardController -> if (action == ImeAction.Done) { softKeyboardController?.hideSoftwareKeyboard() @@ -170,7 +172,7 @@ fun Password( }, textStyle = MaterialTheme.typography.body2, label = { - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { Text( text = label, style = MaterialTheme.typography.body2 @@ -194,7 +196,7 @@ fun Password( PasswordVisualTransformation() }, isErrorValue = passwordState.showErrors(), - imeAction = imeAction, + keyboardOptions = KeyboardOptions.Default.copy(imeAction = imeAction), onImeActionPerformed = { action, softKeyboardController -> if (action == ImeAction.Done) { softKeyboardController?.hideSoftwareKeyboard() @@ -231,7 +233,7 @@ fun OrSignInAsGuest( horizontalAlignment = Alignment.CenterHorizontally ) { Surface { - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { Text( text = stringResource(id = R.string.or), style = MaterialTheme.typography.subtitle2 diff --git a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignUpScreen.kt b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignUpScreen.kt index 3b043fd158..a7094fdbff 100644 --- a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignUpScreen.kt +++ b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/SignUpScreen.kt @@ -16,17 +16,18 @@ package com.example.compose.jetsurvey.signinsignup -import androidx.compose.foundation.Text import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.preferredHeight -import androidx.compose.material.AmbientEmphasisLevels +import androidx.compose.material.AmbientContentAlpha import androidx.compose.material.Button +import androidx.compose.material.ContentAlpha import androidx.compose.material.MaterialTheme -import androidx.compose.material.ProvideEmphasis import androidx.compose.material.Scaffold +import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.Providers import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.focus.ExperimentalFocus @@ -103,7 +104,7 @@ fun SignUpContent( ) Spacer(modifier = Modifier.preferredHeight(16.dp)) - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { Text( text = stringResource(id = R.string.terms_and_conditions), style = MaterialTheme.typography.caption @@ -117,9 +118,7 @@ fun SignUpContent( enabled = emailState.isValid && passwordState.isValid && confirmPasswordState.isValid ) { - Text( - text = stringResource(id = R.string.create_account) - ) + Text(text = stringResource(id = R.string.create_account)) } } } diff --git a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/WelcomeScreen.kt b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/WelcomeScreen.kt index b1518b236a..e92ad56683 100644 --- a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/WelcomeScreen.kt +++ b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/signinsignup/WelcomeScreen.kt @@ -18,7 +18,6 @@ package com.example.compose.jetsurvey.signinsignup import androidx.compose.animation.animate import androidx.compose.foundation.Image -import androidx.compose.foundation.Text import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -26,12 +25,14 @@ import androidx.compose.foundation.layout.offsetPx import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.layout.wrapContentHeight -import androidx.compose.material.AmbientEmphasisLevels +import androidx.compose.material.AmbientContentAlpha import androidx.compose.material.Button +import androidx.compose.material.ContentAlpha import androidx.compose.material.MaterialTheme -import androidx.compose.material.ProvideEmphasis import androidx.compose.material.Surface +import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.Providers import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -39,8 +40,8 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.layout.boundsInParent -import androidx.compose.ui.onGloballyPositioned -import androidx.compose.ui.onSizeChanged +import androidx.compose.ui.layout.onGloballyPositioned +import androidx.compose.ui.layout.onSizeChanged import androidx.compose.ui.platform.DensityAmbient import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource @@ -113,14 +114,12 @@ private fun Branding(modifier: Modifier = Modifier) { modifier = modifier.wrapContentHeight(align = Alignment.CenterVertically) ) { Logo(modifier = Modifier.align(Alignment.CenterHorizontally).padding(horizontal = 76.dp)) - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.high) { - Text( - text = stringResource(id = R.string.app_tagline), - style = MaterialTheme.typography.subtitle1, - textAlign = TextAlign.Center, - modifier = Modifier.padding(top = 24.dp).fillMaxWidth() - ) - } + Text( + text = stringResource(id = R.string.app_tagline), + style = MaterialTheme.typography.subtitle1, + textAlign = TextAlign.Center, + modifier = Modifier.padding(top = 24.dp).fillMaxWidth() + ) } } @@ -148,7 +147,7 @@ private fun SignInCreateAccount( ) { val emailState = remember { EmailState() } Column(modifier = modifier, horizontalAlignment = Alignment.CenterHorizontally) { - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { Text( text = stringResource(id = R.string.sign_in_create_account), style = MaterialTheme.typography.subtitle2, diff --git a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyQuestions.kt b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyQuestions.kt index 5ed9879201..12921e5051 100644 --- a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyQuestions.kt +++ b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyQuestions.kt @@ -18,7 +18,6 @@ package com.example.compose.jetsurvey.survey import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.ScrollableColumn -import androidx.compose.foundation.Text import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -30,17 +29,19 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.selection.selectable -import androidx.compose.material.AmbientEmphasisLevels +import androidx.compose.material.AmbientContentAlpha import androidx.compose.material.Button import androidx.compose.material.Checkbox import androidx.compose.material.CheckboxConstants +import androidx.compose.material.ContentAlpha import androidx.compose.material.MaterialTheme -import androidx.compose.material.ProvideEmphasis import androidx.compose.material.RadioButton import androidx.compose.material.RadioButtonConstants import androidx.compose.material.Slider import androidx.compose.material.Surface +import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.Providers import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -77,17 +78,15 @@ fun Question( shape = MaterialTheme.shapes.small ) ) { - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.high) { - Text( - text = stringResource(id = question.questionText), - style = MaterialTheme.typography.subtitle1, - modifier = Modifier.fillMaxWidth().padding(vertical = 24.dp, horizontal = 16.dp) - ) - } + Text( + text = stringResource(id = question.questionText), + style = MaterialTheme.typography.subtitle1, + modifier = Modifier.fillMaxWidth().padding(vertical = 24.dp, horizontal = 16.dp) + ) } Spacer(modifier = Modifier.preferredHeight(24.dp)) if (question.description != null) { - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { Text( text = stringResource(id = question.description), style = MaterialTheme.typography.caption, diff --git a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyScreen.kt b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyScreen.kt index 94bc9f00b3..130421667a 100644 --- a/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyScreen.kt +++ b/Jetsurvey/app/src/main/java/com/example/compose/jetsurvey/survey/SurveyScreen.kt @@ -17,7 +17,6 @@ package com.example.compose.jetsurvey.survey import androidx.compose.foundation.ScrollableColumn -import androidx.compose.foundation.Text import androidx.compose.foundation.layout.ConstraintLayout import androidx.compose.foundation.layout.ExperimentalLayout import androidx.compose.foundation.layout.Row @@ -27,19 +26,21 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.preferredHeight import androidx.compose.foundation.layout.width -import androidx.compose.material.AmbientEmphasisLevels +import androidx.compose.material.AmbientContentAlpha import androidx.compose.material.Button +import androidx.compose.material.ContentAlpha import androidx.compose.material.Icon import androidx.compose.material.IconButton import androidx.compose.material.LinearProgressIndicator import androidx.compose.material.MaterialTheme import androidx.compose.material.OutlinedButton -import androidx.compose.material.ProvideEmphasis import androidx.compose.material.Scaffold import androidx.compose.material.Surface +import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Close import androidx.compose.runtime.Composable +import androidx.compose.runtime.Providers import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.runtime.savedinstancestate.savedInstanceState @@ -191,7 +192,7 @@ private fun SurveyTopAppBar( } ) - ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.medium) { + Providers(AmbientContentAlpha provides ContentAlpha.medium) { IconButton( onClick = onBackPressed, modifier = Modifier.padding(horizontal = 12.dp).constrainAs(button) { diff --git a/Jetsurvey/buildSrc/src/main/java/com/example/compose/jetsurvey/buildsrc/dependencies.kt b/Jetsurvey/buildSrc/src/main/java/com/example/compose/jetsurvey/buildsrc/dependencies.kt index d7ae38de39..0ddf01cdeb 100644 --- a/Jetsurvey/buildSrc/src/main/java/com/example/compose/jetsurvey/buildsrc/dependencies.kt +++ b/Jetsurvey/buildSrc/src/main/java/com/example/compose/jetsurvey/buildsrc/dependencies.kt @@ -21,7 +21,7 @@ object Versions { } object Libs { - const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha15" + const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha16" const val jdkDesugar = "com.android.tools:desugar_jdk_libs:1.0.9" const val junit = "junit:junit:4.13" @@ -40,8 +40,8 @@ object Libs { const val coreKtx = "androidx.core:core-ktx:1.5.0-alpha01" object Compose { - const val snapshot = "" - const val version = "1.0.0-alpha06" + const val snapshot = "6953474" + const val version = "1.0.0-SNAPSHOT" @get:JvmStatic val snapshotUrl: String