├── router ├── .gitignore ├── consumer-rules.pro ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── github │ │ └── zsoltk │ │ └── compose │ │ ├── savedinstancestate │ │ ├── Persistent.kt │ │ ├── SavedInstanceState.kt │ │ └── BundleScope.kt │ │ ├── backpress │ │ └── BackPressHandler.kt │ │ └── router │ │ ├── BackStack.kt │ │ └── Router.kt ├── proguard-rules.pro └── build.gradle ├── app-lifelike ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── material_colors.xml │ │ ├── drawable │ │ │ ├── placeholder.png │ │ │ └── ic_launcher_background.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ └── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── lifelike │ │ │ ├── entity │ │ │ ├── Photo.kt │ │ │ ├── User.kt │ │ │ └── Album.kt │ │ │ ├── composable │ │ │ ├── loggedout │ │ │ │ ├── RegFinal.kt │ │ │ │ ├── RegUserPhone.kt │ │ │ │ ├── RegUserName.kt │ │ │ │ ├── common │ │ │ │ │ └── RegFlowPanel.kt │ │ │ │ ├── RegConfirmSmsCode.kt │ │ │ │ └── Splash.kt │ │ │ ├── common │ │ │ │ └── BigButton.kt │ │ │ ├── loggedin │ │ │ │ ├── Gallery.kt │ │ │ │ ├── Profile.kt │ │ │ │ ├── FullScreenPhoto.kt │ │ │ │ ├── AlbumList.kt │ │ │ │ ├── Menu.kt │ │ │ │ ├── PhotosOfAlbum.kt │ │ │ │ └── News.kt │ │ │ ├── Root.kt │ │ │ ├── LoggedOut.kt │ │ │ └── LoggedIn.kt │ │ │ ├── DeepLink.kt │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml ├── README.md ├── proguard-rules.pro └── build.gradle ├── jitpack.yml ├── app-nested-containers ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── colors.xml │ │ │ ├── styles.xml │ │ │ └── material_colors.xml │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ ├── drawable-v24 │ │ │ └── ic_launcher_foreground.xml │ │ └── drawable │ │ │ └── ic_launcher_background.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── example │ │ └── nestedcontainers │ │ ├── DeepLink.kt │ │ ├── MainActivity.kt │ │ └── composable │ │ └── SomeChild.kt ├── README.md ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── settings.gradle ├── .gitignore ├── gradle.properties ├── .github └── workflows │ └── gradle.yml ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /router/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /router/consumer-rules.pro: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-lifelike/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 3 | -------------------------------------------------------------------------------- /app-nested-containers/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /router/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app-lifelike/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Lifelike example 3 | 4 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app-nested-containers' 2 | include ':app-lifelike' 3 | include ':router' 4 | rootProject.name = "compose-router" 5 | -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Nested containers 3 | 4 | -------------------------------------------------------------------------------- /app-lifelike/src/main/res/drawable/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/drawable/placeholder.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-lifelike/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zsoltk/compose-router/HEAD/app-nested-containers/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app-lifelike/src/main/java/com/example/lifelike/entity/Photo.kt: -------------------------------------------------------------------------------- 1 | package com.example.lifelike.entity 2 | 3 | data class Photo( 4 | val id: Int 5 | ) { 6 | val title: String = "Photo #$id" 7 | } 8 | -------------------------------------------------------------------------------- /app-lifelike/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Jul 23 10:35:09 AEST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-bin.zip 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | /.idea/caches 6 | /.idea/libraries 7 | /.idea/modules.xml 8 | /.idea/workspace.xml 9 | /.idea/navEditor.xml 10 | /.idea/assetWizardSettings.xml 11 | .DS_Store 12 | /build 13 | /captures 14 | .externalNativeBuild 15 | .cxx 16 | -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app-lifelike/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app-nested-containers/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app-lifelike/src/main/java/com/example/lifelike/entity/User.kt: -------------------------------------------------------------------------------- 1 | package com.example.lifelike.entity 2 | 3 | import androidx.compose.runtime.getValue 4 | import androidx.compose.runtime.mutableStateOf 5 | import androidx.compose.runtime.setValue 6 | 7 | 8 | class User( 9 | name: String, 10 | phone: String 11 | ){ 12 | var name by mutableStateOf(name) 13 | var phone by mutableStateOf(phone) 14 | } 15 | -------------------------------------------------------------------------------- /app-lifelike/src/main/java/com/example/lifelike/composable/loggedout/RegFinal.kt: -------------------------------------------------------------------------------- 1 | package com.example.lifelike.composable.loggedout 2 | 3 | import androidx.compose.runtime.Composable 4 | import com.example.lifelike.composable.loggedout.common.RegFlowPanel 5 | 6 | 7 | interface RegFinal { 8 | companion object { 9 | 10 | @Composable 11 | fun Content(onNext: () -> Unit) { 12 | RegFlowPanel("Welcome on board!", onNext) 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app-lifelike/src/main/java/com/example/lifelike/composable/common/BigButton.kt: -------------------------------------------------------------------------------- 1 | package com.example.lifelike.composable.common 2 | 3 | import androidx.compose.material.Button 4 | import androidx.compose.material.MaterialTheme 5 | import androidx.compose.material.Text 6 | import androidx.compose.runtime.Composable 7 | import androidx.compose.ui.graphics.Color 8 | 9 | @Composable 10 | fun BigButton(text: String, onClick: () -> Unit) { 11 | Button(onClick = onClick) { 12 | Text( 13 | text = text.toUpperCase(), 14 | style = MaterialTheme.typography.body1.copy(color = Color.White) 15 | ) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app-lifelike/src/main/java/com/example/lifelike/entity/Album.kt: -------------------------------------------------------------------------------- 1 | package com.example.lifelike.entity 2 | 3 | data class Album( 4 | val name: String, 5 | val photos: List 6 | ) 7 | 8 | val albums = listOf( 9 | Album("Trip to Budapest", MutableList(19) { i -> Photo(i) }), 10 | Album("Cats", MutableList(39) { i -> Photo(i) }), 11 | Album("Family", MutableList(162) { i -> Photo(i) }), 12 | Album("Todo", MutableList(15) { i -> Photo(i) }), 13 | Album("California road trip", MutableList(112) { i -> Photo(i) }), 14 | Album("KotlinConf", MutableList(43) { i -> Photo(i) }), 15 | Album("Summer of '19", MutableList(72) { i -> Photo(i) }) 16 | ) 17 | -------------------------------------------------------------------------------- /app-nested-containers/README.md: -------------------------------------------------------------------------------- 1 | **What your're seeing here** 2 | - There are nested containers of the same type 3 | - Every level can have its routing to a Red, Green, or Blue subtree 4 | - When you hit `Next`, that level pushes a new Routing to its own back stack, resulting in a new subtree 5 | - The previous state of that level is kept in a back stack 6 | - When you hit back on the device, the lowest level that has any screen history in its back stack will pop, and the previous subtree gets restored 7 | 8 | Not shown in this gif (should capture again), but actual code also has local state on every level (a counter), that is persisted and restored from back stack. 9 | 10 | ![](https://i.imgur.com/w3Lr2IE.gif) 11 | -------------------------------------------------------------------------------- /app-lifelike/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 15 | 16 | 10 | 11 | 15 | 16 |