Conversation
c9f26a2 to
0b4bf66
Compare
| internal class IntroStep( | ||
| private val goToLearnMore: () -> Unit | ||
| ) : Step<IntroBinding>(IntroBinding::inflate) { | ||
| ) : ComposeStep() { |
There was a problem hiding this comment.
The first ComposeStep!
| @Composable | ||
| internal fun IntroStepContent(goToLearnMore: () -> Unit) { | ||
| Button(onClick = goToLearnMore) { | ||
| Text("Go to learn more") | ||
| } | ||
| } |
There was a problem hiding this comment.
On second thought, this probably belongs inside the Step. That way, it can access the data inside the Step, which we can fake for the previews.
class MyStep : ComposeStep() {
val myDataFlow = StateFlow<MyData>()
@Composable
override fun Compose() {
val myData = myDataFlow.collectAsState()
// Use myData here
}
}| public class SimpleComposeStep(public val Content: @Composable SimpleComposeStep.() -> Unit) : ComposeStep() { | ||
|
|
||
| @Composable | ||
| override fun Compose() { | ||
| this.Content() | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
This could be useful for static content, but that doesn't happen often.
| // See https://issuetracker.google.com/issues/176079157#comment11 | ||
| implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10" |
There was a problem hiding this comment.
Figuring this out took literally TWO AND A HALF MONTHS. Everything else worked from the start.
There was a problem hiding this comment.
That's pretty annoying.
|
|
||
| dependencies { | ||
| implementation "com.android.tools.build:gradle:4.1.1" | ||
| implementation 'com.android.tools.build:gradle:7.0.0-beta05' |
There was a problem hiding this comment.
nit: Since AS arctic fox has been released, we can bump this to the stable version. Same with compose 🥳
| } | ||
|
|
||
| compileOptions { | ||
| setSourceCompatibility(JavaVersion.VERSION_1_8) |
There was a problem hiding this comment.
Might need to bump this to Java 11 for compatibility with arctic fox.
| } | ||
|
|
||
| @Preview(device = Devices.PIXEL_3, name = "Intro step") | ||
| @Composable |
There was a problem hiding this comment.
We should probably encourage the pattern on annotating the compose function with the preview annotation so that you can look at how the entire step view will look like and if we want to look at other smaller functions we can do that too. Creating a separate method just for the preview might create misdirection when reading the code.
| }) | ||
| } | ||
|
|
||
| public class ComposeStepWrapper( |
There was a problem hiding this comment.
nit: the naming of the classes is a bit confusing. But I can't think of better names. Something we might want to revisit later.
This is the gist of my idea for supporting compose. Still a ways to go. :)
Done:
NavigatorandJourneyNot done:
minSdkLevellow for non-compose packages