Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,30 @@ 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
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
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
Expand Down Expand Up @@ -113,7 +114,7 @@ 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) {
Providers(AmbientContentAlpha provides ContentAlpha.high) {
Text(
text = stringResource(id = R.string.app_tagline),
style = MaterialTheme.typography.subtitle1,
Expand Down Expand Up @@ -148,7 +149,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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -77,7 +78,7 @@ fun Question(
shape = MaterialTheme.shapes.small
)
) {
ProvideEmphasis(emphasis = AmbientEmphasisLevels.current.high) {
Providers(AmbientContentAlpha provides ContentAlpha.high) {
Text(
text = stringResource(id = question.questionText),
style = MaterialTheme.typography.subtitle1,
Expand All @@ -87,7 +88,7 @@ fun Question(
}
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion Jetsurvey/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ subprojects {
freeCompilerArgs += '-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi'
freeCompilerArgs += '-Xopt-in=kotlinx.coroutines.FlowPreview'
freeCompilerArgs += '-Xopt-in=kotlin.Experimental'

freeCompilerArgs += [
'-P',
'plugin:androidx.compose.compiler.plugins.kotlin:intrinsicRemember=true'
]
// Set JVM target to 1.8
jvmTarget = "1.8"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down