From 0de9f1bfdc0317570e189ff0ed24191e792225d4 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 13:45:14 +0900 Subject: [PATCH 01/42] =?UTF-8?q?[Chore]:=20=EC=BB=B4=ED=8F=AC=EC=A6=88=20?= =?UTF-8?q?=EB=B2=84=EC=A0=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ec3eba56..d3cc6333 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -44,6 +44,14 @@ leakcanary = "2.12" okhttp3-logging-interceptor = "4.9.1" # Common ted-permission = "3.3.0" +# Compose +compose-ui = "1.4.3" +compose-viewmodel = "2.7.0" +compose-coil = "1.3.2" +compose-livedata = "1.5.4" +compose-navi = "2.7.0" +compose-hiltnavi = "1.1.0" +compose-bottomsheet = "1.3.1" [libraries] # Kotlin @@ -92,6 +100,17 @@ sentry = { module = "io.sentry:sentry-android", version.ref = "sentry" } # Debug leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" } okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp3-logging-interceptor" } +# Compose +compose-material = { module = "androidx.compose.material:material", version.ref = "compose-ui" } +compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-ui"} +compose-ui-tooling = {module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui"} +compose-ui-preview = {module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui"} +compose-viewmodel = {module = "androidx.lifecycle:lifecycle-viewmodel-compose",version.ref = "compose-viewmodel"} +compose-bottomsheet = {module = "com.holix.android:bottomsheetdialog-compose", version.ref = "compose-bottomsheet"} +compose-coil = {module = "io.coil-kt:coil-compose",version.ref = "compose-coil"} +compose-navi = {module = "androidx.navigation:navigation-compose",version.ref = "compose-navi"} +compose-hiltnavi = {module = "androidx.hilt:hilt-navigation-compose",version.ref="compose-hiltnavi"} +compose-livedata = {module = "androidx.compose.runtime:runtime-livedata",version.ref="compose-livedata"} [plugins] android-application = { id = "com.android.application", version.ref = "plugin-gradle" } From 3e20dbad1786a24cffc87eebc5a4dbef2693f9a9 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 13:47:36 +0900 Subject: [PATCH 02/42] =?UTF-8?q?[Style]:=20=EC=BD=94=EB=93=9C=20=EB=A6=AC?= =?UTF-8?q?=ED=8F=AC=EB=A7=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d3cc6333..e0bb22e5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -102,15 +102,15 @@ leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.re okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp3-logging-interceptor" } # Compose compose-material = { module = "androidx.compose.material:material", version.ref = "compose-ui" } -compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-ui"} -compose-ui-tooling = {module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui"} -compose-ui-preview = {module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui"} -compose-viewmodel = {module = "androidx.lifecycle:lifecycle-viewmodel-compose",version.ref = "compose-viewmodel"} -compose-bottomsheet = {module = "com.holix.android:bottomsheetdialog-compose", version.ref = "compose-bottomsheet"} -compose-coil = {module = "io.coil-kt:coil-compose",version.ref = "compose-coil"} -compose-navi = {module = "androidx.navigation:navigation-compose",version.ref = "compose-navi"} -compose-hiltnavi = {module = "androidx.hilt:hilt-navigation-compose",version.ref="compose-hiltnavi"} -compose-livedata = {module = "androidx.compose.runtime:runtime-livedata",version.ref="compose-livedata"} +compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" } +compose-ui-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui" } +compose-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "compose-viewmodel" } +compose-bottomsheet = { module = "com.holix.android:bottomsheetdialog-compose", version.ref = "compose-bottomsheet" } +compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "compose-coil" } +compose-navi = { module = "androidx.navigation:navigation-compose", version.ref = "compose-navi" } +compose-hiltnavi = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "compose-hiltnavi" } +compose-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "compose-livedata" } [plugins] android-application = { id = "com.android.application", version.ref = "plugin-gradle" } From 258d2af9defd51f17b6f37c9d01fd95938758c7c Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 14:23:31 +0900 Subject: [PATCH 03/42] =?UTF-8?q?[Chore]:=20=EC=BB=B4=ED=8F=AC=EC=A6=88=20?= =?UTF-8?q?=EB=B2=84=EC=A0=84=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 4 ++++ common/build.gradle.kts | 3 +++ gradle/libs.versions.toml | 10 +++++----- presentation/build.gradle.kts | 12 ++++++++++++ 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c03b66cd..ec2c3bc1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -52,6 +52,10 @@ android { } buildFeatures { dataBinding = true + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = libs.compose.toString() } } diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 093075b1..e5835abc 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -28,4 +28,7 @@ dependencies { implementation(libs.glide) implementation(libs.bundles.logging) + + implementation(libs.compose.navi) + implementation(libs.compose.hiltnavi) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e0bb22e5..d6c82d16 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,7 +45,7 @@ okhttp3-logging-interceptor = "4.9.1" # Common ted-permission = "3.3.0" # Compose -compose-ui = "1.4.3" +compose = "1.4.3" compose-viewmodel = "2.7.0" compose-coil = "1.3.2" compose-livedata = "1.5.4" @@ -101,10 +101,10 @@ sentry = { module = "io.sentry:sentry-android", version.ref = "sentry" } leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" } okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp3-logging-interceptor" } # Compose -compose-material = { module = "androidx.compose.material:material", version.ref = "compose-ui" } -compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" } -compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" } -compose-ui-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui" } +compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } +compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } +compose-ui-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } compose-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "compose-viewmodel" } compose-bottomsheet = { module = "com.holix.android:bottomsheetdialog-compose", version.ref = "compose-bottomsheet" } compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "compose-coil" } diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index 764e9d70..c9e963ac 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -59,6 +59,18 @@ dependencies { implementation(libs.ted.permission) implementation(libs.bundles.logging) + + implementation(libs.compose.ui) + implementation(libs.compose.material) + implementation(libs.compose.ui.preview) + implementation(libs.compose.ui.tooling) + implementation(libs.compose.ui.preview) + implementation(libs.compose.bottomsheet) + implementation(libs.compose.coil) + + implementation(libs.compose.viewmodel) + implementation(libs.compose.livedata) + } fun getLocalProperty(propertyKey: String): String { From a6299bfd120b81917f81bdc3e6eeda53bfd325c5 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 14:36:43 +0900 Subject: [PATCH 04/42] =?UTF-8?q?[Chore]:=20=EC=BB=B4=ED=8F=AC=EC=A6=88=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC?= =?UTF-8?q?=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/build.gradle.kts | 3 --- presentation/build.gradle.kts | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index e5835abc..093075b1 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -28,7 +28,4 @@ dependencies { implementation(libs.glide) implementation(libs.bundles.logging) - - implementation(libs.compose.navi) - implementation(libs.compose.hiltnavi) } diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index c9e963ac..a6f9566d 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -71,6 +71,9 @@ dependencies { implementation(libs.compose.viewmodel) implementation(libs.compose.livedata) + implementation(libs.compose.navi) + implementation(libs.compose.hiltnavi) + } fun getLocalProperty(propertyKey: String): String { From 4bec84bef675962e1731daea173114af2d77e7fb Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 15:12:07 +0900 Subject: [PATCH 05/42] =?UTF-8?q?[Chore]:=20=EC=BB=B4=ED=8F=AC=EC=A6=88=20?= =?UTF-8?q?ui=20bundle=20=EC=83=9D=EC=84=B1=EA=B3=BC=20google=20system=20?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gradle/libs.versions.toml | 5 ++++- presentation/build.gradle.kts | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d6c82d16..dd8fff03 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -28,6 +28,7 @@ androidx-room = "2.6.1" androidx-paging = "3.1.1" # Google google-material = "1.11.0" +system-contoller = "0.20.1" # Network ktor = "2.3.7" kotlinx-serialization = "1.6.1" @@ -79,6 +80,7 @@ androidx-paging-runtime = { module = "androidx.paging:paging-runtime-ktx", versi androidx-paging-common = { module = "androidx.paging:paging-common-ktx", version.ref = "androidx-paging" } # Google google-material = { module = "com.google.android.material:material", version.ref = "google-material" } +google-system-contoller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "system-contoller" } # Network ktor-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" } ktor-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } @@ -102,7 +104,7 @@ leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.re okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp3-logging-interceptor" } # Compose compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } -compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } +compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } compose-ui-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } compose-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "compose-viewmodel" } @@ -131,3 +133,4 @@ androidx-data = ["androidx-room-runtime", "androidx-room-coroutine", "androidx-p network = ["ktor-core", "ktor-okhttp", "ktor-resources", "ktor-content-negotiation", "ktor-kotlinx-serialization", "ktor-auth", "kotlinx-serialization"] logging = ["timber", "sentry"] +compose-ui = ["compose-ui-ui","compose-ui-preview","compose-ui-tooling","compose-material"] \ No newline at end of file diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index a6f9566d..ef667848 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -60,11 +60,8 @@ dependencies { implementation(libs.bundles.logging) - implementation(libs.compose.ui) - implementation(libs.compose.material) - implementation(libs.compose.ui.preview) - implementation(libs.compose.ui.tooling) - implementation(libs.compose.ui.preview) + implementation(libs.bundles.compose.ui) + implementation(libs.compose.bottomsheet) implementation(libs.compose.coil) @@ -74,6 +71,8 @@ dependencies { implementation(libs.compose.navi) implementation(libs.compose.hiltnavi) + implementation(libs.google.system.contoller) + } fun getLocalProperty(propertyKey: String): String { From ab37720a3b4d2db7469fd2a00e3299472c7a3b6f Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 15:14:42 +0900 Subject: [PATCH 06/42] =?UTF-8?q?[Feat]:=20=EC=BB=B4=ED=8F=AC=EC=A6=88=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EC=97=90=EC=84=9C=20=EC=95=A0=ED=94=8C?= =?UTF-8?q?=EB=A6=AC=EC=BC=80=EC=9D=B4=EC=85=98=20=EC=83=81=ED=83=9C?= =?UTF-8?q?=EB=A5=BC=20=EA=B4=80=EB=A6=AC=ED=95=98=EB=8A=94=20applicationS?= =?UTF-8?q?tate=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/state/ApplicationState.kt | 15 +++++++++ .../common/state/rememberApplicationState.kt | 32 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt new file mode 100644 index 00000000..b71da4db --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt @@ -0,0 +1,15 @@ +package ac.dnd.bookkeeping.android.presentation.common.state + +import androidx.compose.material.ScaffoldState +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.Stable +import androidx.navigation.NavHostController +import com.google.accompanist.systemuicontroller.SystemUiController + +@Stable +class ApplicationState( + val bottomBarState: MutableState, + val navController: NavHostController, + val systemUiController: SystemUiController, + val scaffoldState: ScaffoldState +) \ No newline at end of file diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt new file mode 100644 index 00000000..580fe0d8 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt @@ -0,0 +1,32 @@ +package ac.dnd.bookkeeping.android.presentation.common.state + +import androidx.compose.material.ScaffoldState +import androidx.compose.material.rememberScaffoldState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.MutableState +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.navigation.NavHostController +import androidx.navigation.compose.rememberNavController +import com.google.accompanist.systemuicontroller.SystemUiController +import com.google.accompanist.systemuicontroller.rememberSystemUiController + +@Composable +fun rememberApplicationState( + bottomBarState: MutableState = remember { mutableStateOf(false) }, + navController: NavHostController = rememberNavController(), + systemUiController: SystemUiController = rememberSystemUiController(), + scaffoldState: ScaffoldState = rememberScaffoldState() +) = remember( + bottomBarState, + navController, + systemUiController, + scaffoldState +) { + ApplicationState( + bottomBarState = bottomBarState, + navController = navController, + systemUiController = systemUiController, + scaffoldState = scaffoldState + ) +} \ No newline at end of file From 516eacdab736985c7929b3f82d71c3e51a0b7d36 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 15:42:11 +0900 Subject: [PATCH 07/42] =?UTF-8?q?[Feat]:=20NavHost=EC=9D=98=20=EA=B0=81=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=EC=9D=84=20=EB=8B=B4=EB=8B=B9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20ScreenRoot=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/root/MainRoot.kt | 11 +++++++++++ .../android/presentation/common/root/ScreenRoot.kt | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt new file mode 100644 index 00000000..cb76fa04 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt @@ -0,0 +1,11 @@ +package ac.dnd.bookkeeping.android.presentation.common.root + +object MainRoot { + + const val BOTTOM_FIRST = "firstScreen" + const val BOTTOM_SECOND = "secondScreen" + const val BOTTOM_THIRD = "thirdScreen" + const val BOTTOM_FOURTH = "fourthScreen" + const val BOTTOM_FIFTH = "fifthScreen" + +} \ No newline at end of file diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt new file mode 100644 index 00000000..ae666a71 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt @@ -0,0 +1,8 @@ +package ac.dnd.bookkeeping.android.presentation.common.root + +object ScreenRoot { + + const val SPLASH = "splashScreen" + const val MAIN_GRAPH = "mainGraph" + +} \ No newline at end of file From 425b73ee943c1bc933503a4b3d2316aaa970e2e7 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 15:52:07 +0900 Subject: [PATCH 08/42] =?UTF-8?q?[Feat]:=20BottomState,=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=EB=B0=94=EB=A5=BC=20=EA=B4=80=EB=A6=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=ED=81=B4=EB=9E=98=EC=8A=A4=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/state/ManageSystemUiState.kt | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt new file mode 100644 index 00000000..06cbc8bf --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt @@ -0,0 +1,27 @@ +package ac.dnd.bookkeeping.android.presentation.common.state + +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.navigation.compose.currentBackStackEntryAsState + +@Composable +fun ManageSystemUiState( + appState: ApplicationState +) { + val navBackStackEntry by appState.navController.currentBackStackEntryAsState() + + when(navBackStackEntry?.destination?.route) { + + ScreenRoot.SPLASH -> { + appState.systemUiController.isStatusBarVisible = false + appState.bottomBarState.value = false + } + + ScreenRoot.MAIN_GRAPH -> { + appState.systemUiController.isStatusBarVisible = false + appState.bottomBarState.value = true + } + } + +} \ No newline at end of file From d048da6063779283442076830d83ffd82f91ecf9 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 16:00:14 +0900 Subject: [PATCH 09/42] =?UTF-8?q?[Feat]:=20Bottom=20Item=20=ED=85=9C?= =?UTF-8?q?=ED=94=8C=EB=A6=BF=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBar/BottomBarItem.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt new file mode 100644 index 00000000..af0522b8 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt @@ -0,0 +1,18 @@ +package ac.dnd.bookkeeping.android.presentation.common.bottomBar + +import ac.dnd.bookkeeping.android.presentation.R +import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot +import androidx.annotation.DrawableRes +import androidx.annotation.StringRes + +sealed class BottomBarItem( + val route: String, + @DrawableRes val drawableResId: Int, + @StringRes val stringResId: Int +) { + + + companion object { + val BOTTOM_NAV_ITEMS = listOf() + } +} \ No newline at end of file From 464ebf5dbeb1b81880d50d8be6bc2471bf21e859 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 17:33:55 +0900 Subject: [PATCH 10/42] =?UTF-8?q?[Style]:=20=EC=BD=94=EB=93=9C=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7,=20=EB=B6=88=ED=95=84=EC=9A=94=20import=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/bottomBar/BottomBarItem.kt | 2 -- .../android/presentation/common/state/ManageSystemUiState.kt | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt index af0522b8..d638fdfb 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt @@ -1,7 +1,5 @@ package ac.dnd.bookkeeping.android.presentation.common.bottomBar -import ac.dnd.bookkeeping.android.presentation.R -import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot import androidx.annotation.DrawableRes import androidx.annotation.StringRes diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt index 06cbc8bf..4a11d875 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt @@ -11,7 +11,7 @@ fun ManageSystemUiState( ) { val navBackStackEntry by appState.navController.currentBackStackEntryAsState() - when(navBackStackEntry?.destination?.route) { + when (navBackStackEntry?.destination?.route) { ScreenRoot.SPLASH -> { appState.systemUiController.isStatusBarVisible = false @@ -24,4 +24,4 @@ fun ManageSystemUiState( } } -} \ No newline at end of file +} From cb2d5e6c7c1dc85a9b7eb4392af919876e18837d Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 18:09:52 +0900 Subject: [PATCH 11/42] =?UTF-8?q?[Feat]:=20bottomNavigation=20bottomGraph?= =?UTF-8?q?=20=ED=85=9C=ED=94=8C=EB=A6=BF=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBar/BottomGraph.kt | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt new file mode 100644 index 00000000..591e00fe --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt @@ -0,0 +1,58 @@ +package ac.dnd.bookkeeping.android.presentation.common.bottomBar + +import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.compose.runtime.Composable +import androidx.navigation.NavGraphBuilder +import androidx.navigation.compose.composable +import androidx.navigation.navigation + +fun NavGraphBuilder.bottomGraph( + appState: ApplicationState +) { + + navigation( + startDestination = MainRoot.BOTTOM_FIRST, + route = ScreenRoot.MAIN_GRAPH + ){ + + composable(MainRoot.BOTTOM_FIRST){ + FirstScreen(appState) + } + + composable(MainRoot.BOTTOM_SECOND){ + SecondScreen(appState) + } + + composable(MainRoot.BOTTOM_THIRD){ + ThirdScreen(appState) + } + + composable(MainRoot.BOTTOM_FOURTH){ + FourthScreen(appState) + } + + composable(MainRoot.BOTTOM_FIFTH){ + FifthScreen(appState) + } + + } + +} + +@Composable +fun FirstScreen(appState: ApplicationState){} + +@Composable +fun SecondScreen(appState: ApplicationState){} + +@Composable +fun ThirdScreen(appState: ApplicationState){} + +@Composable +fun FourthScreen(appState: ApplicationState){} + +@Composable +fun FifthScreen(appState: ApplicationState){} + From da77509348c451dd05ed48f10aa16144cffa4521 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 18:21:00 +0900 Subject: [PATCH 12/42] =?UTF-8?q?[Feat]:=20bottomNavigation=20ui=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=EA=B3=BC=20click=20=EC=9D=B4=EB=B2=A4?= =?UTF-8?q?=ED=8A=B8=20=EC=8B=9C=20currentRoute=20=EC=A0=84=ED=99=98=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBar/BottomBarScreen.kt | 76 +++++++++++++++++++ .../common/bottomBar/BottomGraph.kt | 27 ++++--- 2 files changed, 92 insertions(+), 11 deletions(-) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt new file mode 100644 index 00000000..87a07e94 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt @@ -0,0 +1,76 @@ +package ac.dnd.bookkeeping.android.presentation.common.bottomBar + +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.material.BottomNavigation +import androidx.compose.material.BottomNavigationItem +import androidx.compose.material.Icon +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.navigation.compose.currentBackStackEntryAsState + +@Composable +fun BottomBarScreen( + appState: ApplicationState +) { + + AnimatedVisibility( + visible = appState.bottomBarState.value, + modifier = Modifier + .fillMaxWidth() + .height(90.dp) + ) { + + BottomNavigation( + elevation = 0.dp, + backgroundColor = Color.White + ) { + val navBackStackEntry by appState.navController.currentBackStackEntryAsState() + val currentRoute = navBackStackEntry?.destination?.route + + BottomBarItem.BOTTOM_NAV_ITEMS.forEach { screen -> + + BottomNavigationItem( + selected = currentRoute == screen.route, + icon = { + Icon( + painter = painterResource(id = screen.drawableResId), + contentDescription = "bottom icon" + ) + }, + label = { + Text( + text = stringResource(id = screen.stringResId), + fontSize = 12.sp, + modifier = Modifier.padding(0.dp) + ) + }, + selectedContentColor = Color.Black, + unselectedContentColor = Color.White, + onClick = { + appState.navController.navigate(screen.route) { + popUpTo(ScreenRoot.MAIN_GRAPH) { + saveState = true + } + launchSingleTop = true + restoreState = true + } + } + ) + + } + } + + } +} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt index 591e00fe..751d89c1 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt @@ -15,25 +15,25 @@ fun NavGraphBuilder.bottomGraph( navigation( startDestination = MainRoot.BOTTOM_FIRST, route = ScreenRoot.MAIN_GRAPH - ){ + ) { - composable(MainRoot.BOTTOM_FIRST){ + composable(MainRoot.BOTTOM_FIRST) { FirstScreen(appState) } - composable(MainRoot.BOTTOM_SECOND){ + composable(MainRoot.BOTTOM_SECOND) { SecondScreen(appState) } - composable(MainRoot.BOTTOM_THIRD){ + composable(MainRoot.BOTTOM_THIRD) { ThirdScreen(appState) } - composable(MainRoot.BOTTOM_FOURTH){ + composable(MainRoot.BOTTOM_FOURTH) { FourthScreen(appState) } - composable(MainRoot.BOTTOM_FIFTH){ + composable(MainRoot.BOTTOM_FIFTH) { FifthScreen(appState) } @@ -42,17 +42,22 @@ fun NavGraphBuilder.bottomGraph( } @Composable -fun FirstScreen(appState: ApplicationState){} +fun FirstScreen(appState: ApplicationState) { +} @Composable -fun SecondScreen(appState: ApplicationState){} +fun SecondScreen(appState: ApplicationState) { +} @Composable -fun ThirdScreen(appState: ApplicationState){} +fun ThirdScreen(appState: ApplicationState) { +} @Composable -fun FourthScreen(appState: ApplicationState){} +fun FourthScreen(appState: ApplicationState) { +} @Composable -fun FifthScreen(appState: ApplicationState){} +fun FifthScreen(appState: ApplicationState) { +} From 0d6f65a19ab99dafa56bbc05e92fcb958fff8062 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 18:46:43 +0900 Subject: [PATCH 13/42] =?UTF-8?q?[Feat]:=20bottomGraph=20=EC=97=B0?= =?UTF-8?q?=EA=B2=B0=EA=B3=BC=20splash=20=EC=8A=A4=ED=81=AC=EB=A6=B0=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/navigation/MainNavGraph.kt | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt new file mode 100644 index 00000000..71636e0a --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt @@ -0,0 +1,78 @@ +package ac.dnd.bookkeeping.android.presentation.common.navigation + +import ac.dnd.bookkeeping.android.presentation.common.bottomBar.BottomBarScreen +import ac.dnd.bookkeeping.android.presentation.common.bottomBar.bottomGraph +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.padding +import androidx.compose.material.Scaffold +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.sp +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.composable +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch + +@Composable +fun MainNavGraph( + appState: ApplicationState +) { + + Scaffold( + modifier = Modifier.fillMaxSize(), + scaffoldState = appState.scaffoldState, + bottomBar = { BottomBarScreen(appState) } + ) { innerPadding -> + + BackHandler(enabled = true, onBack = {}) + NavHost( + navController = appState.navController, + startDestination = ScreenRoot.SPLASH, + modifier = Modifier.padding(innerPadding) + ) { + bottomGraph(appState) + + composable(route = ScreenRoot.SPLASH) { + SplashScreen(appState) + } + } + + } + +} + +@Composable +fun SplashScreen( + appState: ApplicationState +) { + val scope = rememberCoroutineScope() + LaunchedEffect(Unit) { + scope.launch { + delay(500L) + appState.navController.navigate(ScreenRoot.MAIN_GRAPH) + } + } + + Box( + modifier = Modifier + .fillMaxSize() + .background(color = Color.Black), + contentAlignment = Alignment.Center + ) { + Text( + text = "Splash Screen", + fontSize = 20.sp, + color = Color.White + ) + } +} From 2d8992de77de3f02ce597d5af2a9c6349dff89b4 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Wed, 17 Jan 2024 18:55:56 +0900 Subject: [PATCH 14/42] =?UTF-8?q?[Feat]:=20main=20ui=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=EA=B3=BC=20BottomView=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/main/MainActivity.kt | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt index b6a1e2dd..ae58a5c0 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt @@ -1,8 +1,18 @@ package ac.dnd.bookkeeping.android.presentation.ui.main -import androidx.activity.viewModels -import ac.dnd.bookkeeping.android.presentation.databinding.ActivityMainBinding import ac.dnd.bookkeeping.android.presentation.common.base.BaseActivity +import ac.dnd.bookkeeping.android.presentation.common.navigation.MainNavGraph +import ac.dnd.bookkeeping.android.presentation.common.state.ManageSystemUiState +import ac.dnd.bookkeeping.android.presentation.common.state.rememberApplicationState +import ac.dnd.bookkeeping.android.presentation.databinding.ActivityMainBinding +import androidx.activity.compose.setContent +import androidx.activity.viewModels +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Surface +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.tooling.preview.Preview import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint @@ -14,6 +24,27 @@ class MainActivity : BaseActivity(ActivityMainBinding::infl bind { vm = viewModel lifecycleOwner = this@MainActivity + setContent { + Surface( + modifier = Modifier.fillMaxSize(), + color = Color.White + ){ + MainUi() + } + } } } } + +@Composable +fun MainUi() { + val appState = rememberApplicationState() + ManageSystemUiState(appState = appState) + MainNavGraph(appState = appState) +} + +@Preview +@Composable +fun PreviewMainUi(){ + MainUi() +} From a5ac9213cc5663a1dd64725e4e680d93927fccc0 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 00:09:41 +0900 Subject: [PATCH 15/42] =?UTF-8?q?[Fix]:=20=EB=B9=8C=EB=93=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=EB=A1=9C=20=EB=B2=84=EC=A0=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 14 ++++++++------ gradle/libs.versions.toml | 18 ++++++++++-------- presentation/build.gradle.kts | 23 +++++++++++++++-------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ec2c3bc1..aa4f8ce3 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -28,13 +28,19 @@ android { isMinifyEnabled = true isShrinkResources = true isDebuggable = false - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } debug { isMinifyEnabled = false isShrinkResources = false isDebuggable = true - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) applicationIdSuffix = ".debug" } } @@ -52,10 +58,6 @@ android { } buildFeatures { dataBinding = true - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = libs.compose.toString() } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dd8fff03..72873155 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -46,7 +46,7 @@ okhttp3-logging-interceptor = "4.9.1" # Common ted-permission = "3.3.0" # Compose -compose = "1.4.3" +androidx-compose = "1.4.3" compose-viewmodel = "2.7.0" compose-coil = "1.3.2" compose-livedata = "1.5.4" @@ -103,15 +103,17 @@ sentry = { module = "io.sentry:sentry-android", version.ref = "sentry" } leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" } okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp3-logging-interceptor" } # Compose -compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } -compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } -compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } -compose-ui-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } +compose-material = { module = "androidx.compose.material:material", version.ref = "androidx-compose" } +compose-ui-ui = { module = "androidx.compose.ui:ui", version.ref = "androidx-compose" } +compose-ui-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "androidx-compose" } compose-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "compose-viewmodel" } -compose-bottomsheet = { module = "com.holix.android:bottomsheetdialog-compose", version.ref = "compose-bottomsheet" } -compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "compose-coil" } compose-navi = { module = "androidx.navigation:navigation-compose", version.ref = "compose-navi" } compose-hiltnavi = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "compose-hiltnavi" } + +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose" } +compose-ui-test = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "androidx-compose" } +compose-bottomsheet = { module = "com.holix.android:bottomsheetdialog-compose", version.ref = "compose-bottomsheet" } +compose-coil = { module = "io.coil-kt:coil-compose", version.ref = "compose-coil" } compose-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "compose-livedata" } [plugins] @@ -133,4 +135,4 @@ androidx-data = ["androidx-room-runtime", "androidx-room-coroutine", "androidx-p network = ["ktor-core", "ktor-okhttp", "ktor-resources", "ktor-content-negotiation", "ktor-kotlinx-serialization", "ktor-auth", "kotlinx-serialization"] logging = ["timber", "sentry"] -compose-ui = ["compose-ui-ui","compose-ui-preview","compose-ui-tooling","compose-material"] \ No newline at end of file +compose = ["compose-ui-ui", "compose-ui-preview", "compose-material", "compose-viewmodel", "compose-hiltnavi", "compose-navi"] diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index ef667848..07f164fb 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -20,10 +20,16 @@ android { buildTypes { debug { - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } release { - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } } @@ -37,6 +43,10 @@ android { buildFeatures { dataBinding = true + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.5.6" } } @@ -60,17 +70,14 @@ dependencies { implementation(libs.bundles.logging) - implementation(libs.bundles.compose.ui) + implementation(libs.bundles.compose) + debugImplementation(libs.compose.ui.tooling) + debugImplementation(libs.compose.ui.test) implementation(libs.compose.bottomsheet) implementation(libs.compose.coil) - - implementation(libs.compose.viewmodel) implementation(libs.compose.livedata) - implementation(libs.compose.navi) - implementation(libs.compose.hiltnavi) - implementation(libs.google.system.contoller) } From 13296bbbcce515203862d89bdb1b53ead1747303 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 00:26:56 +0900 Subject: [PATCH 16/42] =?UTF-8?q?[Feat]:=20Sample=20item=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- presentation/src/main/res/drawable/bottom_sample.xml | 5 +++++ presentation/src/main/res/values/strings.xml | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 presentation/src/main/res/drawable/bottom_sample.xml diff --git a/presentation/src/main/res/drawable/bottom_sample.xml b/presentation/src/main/res/drawable/bottom_sample.xml new file mode 100644 index 00000000..5a870f55 --- /dev/null +++ b/presentation/src/main/res/drawable/bottom_sample.xml @@ -0,0 +1,5 @@ + + + diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 6a6931e9..1e077817 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -1 +1,4 @@ - \ No newline at end of file + + + + From afe58a2a2f4d8e7d71f5ea0a95178d4e12ee2d90 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 00:34:18 +0900 Subject: [PATCH 17/42] =?UTF-8?q?[Feat]:=20bottom=20item=20=ED=85=9C?= =?UTF-8?q?=ED=94=8C=EB=A6=BF=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBar/BottomBarItem.kt | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt index d638fdfb..11906a37 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt @@ -1,5 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.common.bottomBar +import ac.dnd.bookkeeping.android.presentation.R +import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot import androidx.annotation.DrawableRes import androidx.annotation.StringRes @@ -8,9 +10,44 @@ sealed class BottomBarItem( @DrawableRes val drawableResId: Int, @StringRes val stringResId: Int ) { + data object BottomFirst : + BottomBarItem( + route = MainRoot.BOTTOM_FIRST, + drawableResId = R.drawable.bottom_sample, + stringResId = R.string.bottom_sample + ) + data object BottomSecond : + BottomBarItem( + route = MainRoot.BOTTOM_SECOND, + drawableResId = R.drawable.bottom_sample, + stringResId = R.string.bottom_sample + ) + + data object BottomThird : + BottomBarItem( + route = MainRoot.BOTTOM_THIRD, + drawableResId = R.drawable.bottom_sample, + stringResId = R.string.bottom_sample + ) + + data object BottomFourth : + BottomBarItem( + route = MainRoot.BOTTOM_FOURTH, + drawableResId = R.drawable.bottom_sample, + stringResId = R.string.bottom_sample + ) + + data object BottomFifth : + BottomBarItem( + route = MainRoot.BOTTOM_FIFTH, + drawableResId = R.drawable.bottom_sample, + stringResId = R.string.bottom_sample + ) companion object { - val BOTTOM_NAV_ITEMS = listOf() + val BOTTOM_NAV_ITEMS = listOf( + BottomFirst, BottomSecond, BottomThird, BottomFourth, BottomFifth + ) } -} \ No newline at end of file +} From 9f38bb8bcdc7fc037b97714685f5d5ba0c0ad78a Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 01:59:10 +0900 Subject: [PATCH 18/42] =?UTF-8?q?[Fix]:=20ConfirmButton=20Error=EB=A1=9C?= =?UTF-8?q?=20=EC=9E=84=EC=8B=9C=20=EC=A3=BC=EC=84=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/layout/fragment_home.xml | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/presentation/src/main/res/layout/fragment_home.xml b/presentation/src/main/res/layout/fragment_home.xml index 68b24064..058c218c 100644 --- a/presentation/src/main/res/layout/fragment_home.xml +++ b/presentation/src/main/res/layout/fragment_home.xml @@ -25,17 +25,17 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - + + + + + + + + + + + From 45a0e99dabaafc7b557c6a1a2d2b9ac76bf7dbe8 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 02:00:28 +0900 Subject: [PATCH 19/42] =?UTF-8?q?[Feat]:=20Compose=20ui=20Theme=20?= =?UTF-8?q?=EC=A7=80=EC=A0=95=EA=B3=BC=20=EB=B7=B0=20=ED=99=9C=EC=84=B1?= =?UTF-8?q?=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/main/MainActivity.kt | 29 +++++----- .../presentation/ui/main/theme/Color.kt | 8 +++ .../presentation/ui/main/theme/Shape.kt | 11 ++++ .../presentation/ui/main/theme/Theme.kt | 54 +++++++++++++++++++ .../presentation/ui/main/theme/Type.kt | 28 ++++++++++ 5 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Color.kt create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Shape.kt create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Theme.kt create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Type.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt index ae58a5c0..df8a8a1c 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt @@ -5,13 +5,14 @@ import ac.dnd.bookkeeping.android.presentation.common.navigation.MainNavGraph import ac.dnd.bookkeeping.android.presentation.common.state.ManageSystemUiState import ac.dnd.bookkeeping.android.presentation.common.state.rememberApplicationState import ac.dnd.bookkeeping.android.presentation.databinding.ActivityMainBinding +import ac.dnd.bookkeeping.android.presentation.ui.main.theme.BookkeepingTheme import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.MaterialTheme import androidx.compose.material.Surface import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import dagger.hilt.android.AndroidEntryPoint @@ -24,27 +25,29 @@ class MainActivity : BaseActivity(ActivityMainBinding::infl bind { vm = viewModel lifecycleOwner = this@MainActivity - setContent { - Surface( - modifier = Modifier.fillMaxSize(), - color = Color.White - ){ - MainUi() - } - } + } + setContent { + MainUi() } } } @Composable fun MainUi() { - val appState = rememberApplicationState() - ManageSystemUiState(appState = appState) - MainNavGraph(appState = appState) + BookkeepingTheme { + Surface( + modifier = Modifier.fillMaxSize(), + color = MaterialTheme.colors.background + ) { + val appState = rememberApplicationState() + ManageSystemUiState(appState = appState) + MainNavGraph(appState = appState) + } + } } @Preview @Composable -fun PreviewMainUi(){ +fun PreviewMainUi() { MainUi() } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Color.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Color.kt new file mode 100644 index 00000000..a93adb22 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Color.kt @@ -0,0 +1,8 @@ +package ac.dnd.bookkeeping.android.presentation.ui.main.theme + +import androidx.compose.ui.graphics.Color + +val Purple200 = Color(0xFFBB86FC) +val Purple500 = Color(0xFF6200EE) +val Purple700 = Color(0xFF3700B3) +val Teal200 = Color(0xFF03DAC5) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Shape.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Shape.kt new file mode 100644 index 00000000..6abbb222 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Shape.kt @@ -0,0 +1,11 @@ +package ac.dnd.bookkeeping.android.presentation.ui.main.theme + +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Shapes +import androidx.compose.ui.unit.dp + +val Shapes = Shapes( + small = RoundedCornerShape(4.dp), + medium = RoundedCornerShape(4.dp), + large = RoundedCornerShape(0.dp) +) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Theme.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Theme.kt new file mode 100644 index 00000000..2209112d --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Theme.kt @@ -0,0 +1,54 @@ +package ac.dnd.bookkeeping.android.presentation.ui.main.theme + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.material.MaterialTheme +import androidx.compose.material.darkColors +import androidx.compose.material.lightColors +import androidx.compose.runtime.Composable +import androidx.compose.runtime.SideEffect +import androidx.compose.ui.graphics.Color +import com.google.accompanist.systemuicontroller.rememberSystemUiController + +private val DarkColorPalette = darkColors( + primary = Purple200, + primaryVariant = Purple700, + secondary = Teal200 +) + + +private val LightColorPalette = lightColors( + primary = Purple500, + primaryVariant = Purple700, + secondary = Teal200 + + /* Other default colors to override + background = Color.White, + surface = Color.White, + onPrimary = Color.White, + onSecondary = Color.Black, + onBackground = Color.Black, + onSurface = Color.Black, + */ +) + +@Composable +fun BookkeepingTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit) { + val colors = if (darkTheme) { + DarkColorPalette + } else { + LightColorPalette + } + + MaterialTheme( + colors = colors, + typography = Typography, + shapes = Shapes, + content = content + ) + + val systemUiController = rememberSystemUiController() + SideEffect { + systemUiController.setSystemBarsColor(Color.White) + systemUiController.isNavigationBarVisible = false + } +} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Type.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Type.kt new file mode 100644 index 00000000..24f17e92 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/theme/Type.kt @@ -0,0 +1,28 @@ +package ac.dnd.bookkeeping.android.presentation.ui.main.theme + +import androidx.compose.material.Typography +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.text.font.FontFamily +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.sp + +// Set of Material typography styles to start with +val Typography = Typography( + body1 = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 16.sp + ) + /* Other default text styles to override + button = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.W500, + fontSize = 14.sp + ), + caption = TextStyle( + fontFamily = FontFamily.Default, + fontWeight = FontWeight.Normal, + fontSize = 12.sp + ) + */ +) From 8a9afadee9153997f6704c9ef4868081bf0f22c0 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 02:17:44 +0900 Subject: [PATCH 20/42] =?UTF-8?q?[Style]:=20=EC=BD=94=EB=93=9C=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=20=EB=B3=80=EA=B2=BD,=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=20import=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/common/bottomBar/BottomBarScreen.kt | 12 ++++++++---- .../presentation/common/bottomBar/BottomGraph.kt | 10 +++++----- .../presentation/common/navigation/MainNavGraph.kt | 2 +- .../presentation/common/state/ManageSystemUiState.kt | 7 ++++++- .../common/state/rememberApplicationState.kt | 2 +- 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt index 87a07e94..cf1c09fd 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt @@ -3,6 +3,7 @@ package ac.dnd.bookkeeping.android.presentation.common.bottomBar import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.compose.animation.AnimatedVisibility +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -22,7 +23,8 @@ import androidx.navigation.compose.currentBackStackEntryAsState @Composable fun BottomBarScreen( - appState: ApplicationState + appState: ApplicationState, + bottomBarItems: List = BottomBarItem.BOTTOM_NAV_ITEMS ) { AnimatedVisibility( @@ -34,12 +36,13 @@ fun BottomBarScreen( BottomNavigation( elevation = 0.dp, - backgroundColor = Color.White + backgroundColor = Color.White, + modifier = Modifier.fillMaxSize() ) { val navBackStackEntry by appState.navController.currentBackStackEntryAsState() val currentRoute = navBackStackEntry?.destination?.route - BottomBarItem.BOTTOM_NAV_ITEMS.forEach { screen -> + bottomBarItems.forEach { screen -> BottomNavigationItem( selected = currentRoute == screen.route, @@ -53,11 +56,12 @@ fun BottomBarScreen( Text( text = stringResource(id = screen.stringResId), fontSize = 12.sp, + color = Color.Black, modifier = Modifier.padding(0.dp) ) }, selectedContentColor = Color.Black, - unselectedContentColor = Color.White, + unselectedContentColor = Color.Gray, onClick = { appState.navController.navigate(screen.route) { popUpTo(ScreenRoot.MAIN_GRAPH) { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt index 751d89c1..ec52a991 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt @@ -17,23 +17,23 @@ fun NavGraphBuilder.bottomGraph( route = ScreenRoot.MAIN_GRAPH ) { - composable(MainRoot.BOTTOM_FIRST) { + composable(BottomBarItem.BottomFirst.route) { FirstScreen(appState) } - composable(MainRoot.BOTTOM_SECOND) { + composable(BottomBarItem.BottomSecond.route) { SecondScreen(appState) } - composable(MainRoot.BOTTOM_THIRD) { + composable(BottomBarItem.BottomThird.route) { ThirdScreen(appState) } - composable(MainRoot.BOTTOM_FOURTH) { + composable(BottomBarItem.BottomFourth.route) { FourthScreen(appState) } - composable(MainRoot.BOTTOM_FIFTH) { + composable(BottomBarItem.BottomFifth.route) { FifthScreen(appState) } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt index 71636e0a..e6d838eb 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt @@ -31,7 +31,7 @@ fun MainNavGraph( Scaffold( modifier = Modifier.fillMaxSize(), scaffoldState = appState.scaffoldState, - bottomBar = { BottomBarScreen(appState) } + bottomBar = { BottomBarScreen(appState = appState) } ) { innerPadding -> BackHandler(enabled = true, onBack = {}) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt index 4a11d875..ada7a3b0 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt @@ -1,5 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.common.state +import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -18,7 +19,11 @@ fun ManageSystemUiState( appState.bottomBarState.value = false } - ScreenRoot.MAIN_GRAPH -> { + MainRoot.BOTTOM_FIRST, + MainRoot.BOTTOM_SECOND, + MainRoot.BOTTOM_THIRD, + MainRoot.BOTTOM_FOURTH, + MainRoot.BOTTOM_FIFTH -> { appState.systemUiController.isStatusBarVisible = false appState.bottomBarState.value = true } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt index 580fe0d8..e754445e 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt @@ -29,4 +29,4 @@ fun rememberApplicationState( systemUiController = systemUiController, scaffoldState = scaffoldState ) -} \ No newline at end of file +} From cee9986577f196f7ae99735c93b7417fd9e276eb Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 02:21:33 +0900 Subject: [PATCH 21/42] =?UTF-8?q?[Refactor]:=20=EA=B0=81=20item=20?= =?UTF-8?q?=EA=B5=AC=EB=B6=84=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20Sam?= =?UTF-8?q?pleScreen=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/bottomBar/BottomGraph.kt | 52 +++++++++++-------- 1 file changed, 29 insertions(+), 23 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt index ec52a991..9e93cbe5 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt @@ -3,7 +3,15 @@ package ac.dnd.bookkeeping.android.presentation.common.bottomBar import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.sp import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.navigation @@ -18,23 +26,23 @@ fun NavGraphBuilder.bottomGraph( ) { composable(BottomBarItem.BottomFirst.route) { - FirstScreen(appState) + SampleScreen(appState,BottomBarItem.BottomFirst.route) } composable(BottomBarItem.BottomSecond.route) { - SecondScreen(appState) + SampleScreen(appState,BottomBarItem.BottomSecond.route) } composable(BottomBarItem.BottomThird.route) { - ThirdScreen(appState) + SampleScreen(appState,BottomBarItem.BottomThird.route) } composable(BottomBarItem.BottomFourth.route) { - FourthScreen(appState) + SampleScreen(appState,BottomBarItem.BottomFourth.route) } composable(BottomBarItem.BottomFifth.route) { - FifthScreen(appState) + SampleScreen(appState,BottomBarItem.BottomFifth.route) } } @@ -42,22 +50,20 @@ fun NavGraphBuilder.bottomGraph( } @Composable -fun FirstScreen(appState: ApplicationState) { -} - -@Composable -fun SecondScreen(appState: ApplicationState) { -} - -@Composable -fun ThirdScreen(appState: ApplicationState) { -} - -@Composable -fun FourthScreen(appState: ApplicationState) { -} - -@Composable -fun FifthScreen(appState: ApplicationState) { +fun SampleScreen( + appState: ApplicationState, + text: String +) { + Box( + modifier = Modifier + .fillMaxSize() + .background(color = Color.White), + contentAlignment = Alignment.Center + ) { + Text( + text = text, + fontSize = 20.sp, + color = Color.Black + ) + } } - From a6f47b9644f2e362a326a4499a86e0a23ad62e39 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 13:01:03 +0900 Subject: [PATCH 22/42] =?UTF-8?q?[Refactor]:=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=BB=A8=EB=B2=A4=EC=85=98=20=EC=A4=80=EC=88=98=ED=95=98?= =?UTF-8?q?=EC=97=AC=20=ED=8C=A8=ED=82=A4=EC=A7=80=20=EB=B6=84=EB=A6=AC,?= =?UTF-8?q?=20=ED=8C=A8=ED=82=A4=EC=A7=80=EB=AA=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/build.gradle.kts | 1 - gradle/libs.versions.toml | 6 +++--- presentation/build.gradle.kts | 1 - .../android/presentation/common/root/MainRoot.kt | 2 +- .../android/presentation/common/root/ScreenRoot.kt | 2 +- .../presentation/common/state/ApplicationState.kt | 2 +- .../bottomBar => ui/bottombar}/BottomBarItem.kt | 2 +- .../bottomBar => ui/bottombar}/BottomBarScreen.kt | 2 +- .../bottomBar => ui/bottombar}/BottomGraph.kt | 12 ++++++------ .../android/presentation/ui/main/MainActivity.kt | 2 +- .../{common => ui}/navigation/MainNavGraph.kt | 6 +++--- 11 files changed, 18 insertions(+), 20 deletions(-) rename presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/{common/bottomBar => ui/bottombar}/BottomBarItem.kt (95%) rename presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/{common/bottomBar => ui/bottombar}/BottomBarScreen.kt (97%) rename presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/{common/bottomBar => ui/bottombar}/BottomGraph.kt (80%) rename presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/{common => ui}/navigation/MainNavGraph.kt (90%) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 093075b1..8eea0490 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -23,7 +23,6 @@ android { dependencies { implementation(libs.bundles.kotlin) - implementation(libs.bundles.androidx.presentation) implementation(libs.google.material) implementation(libs.glide) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 72873155..abe8df6c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -129,10 +129,10 @@ sentry = { id = "io.sentry.android.gradle", version.ref = "plugin-sentry" } [bundles] kotlin = ["kotlin", "kotlinx-coroutines-android", "kotlinx-coroutines-core", "kotlinx-datetime"] -androidx-presentation = ["androidx-core", "androidx-appcompat", "androidx-constraintlayout", "androidx-fragment", - "androidx-viewmodel", "androidx-livedata", "androidx-navigation-fragment", "androidx-navigation-ui"] androidx-data = ["androidx-room-runtime", "androidx-room-coroutine", "androidx-paging-runtime"] +androidx-presentation = ["androidx-core", "androidx-appcompat", "androidx-constraintlayout", "androidx-fragment", + "androidx-viewmodel", "androidx-livedata", "androidx-navigation-fragment", "androidx-navigation-ui", + "compose-ui-ui", "compose-ui-preview", "compose-material", "compose-viewmodel", "compose-hiltnavi", "compose-navi"] network = ["ktor-core", "ktor-okhttp", "ktor-resources", "ktor-content-negotiation", "ktor-kotlinx-serialization", "ktor-auth", "kotlinx-serialization"] logging = ["timber", "sentry"] -compose = ["compose-ui-ui", "compose-ui-preview", "compose-material", "compose-viewmodel", "compose-hiltnavi", "compose-navi"] diff --git a/presentation/build.gradle.kts b/presentation/build.gradle.kts index 07f164fb..d0e34044 100644 --- a/presentation/build.gradle.kts +++ b/presentation/build.gradle.kts @@ -70,7 +70,6 @@ dependencies { implementation(libs.bundles.logging) - implementation(libs.bundles.compose) debugImplementation(libs.compose.ui.tooling) debugImplementation(libs.compose.ui.test) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt index cb76fa04..e2a1b5e7 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt @@ -8,4 +8,4 @@ object MainRoot { const val BOTTOM_FOURTH = "fourthScreen" const val BOTTOM_FIFTH = "fifthScreen" -} \ No newline at end of file +} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt index ae666a71..50dcf9f6 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt @@ -5,4 +5,4 @@ object ScreenRoot { const val SPLASH = "splashScreen" const val MAIN_GRAPH = "mainGraph" -} \ No newline at end of file +} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt index b71da4db..713cf2bf 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt @@ -12,4 +12,4 @@ class ApplicationState( val navController: NavHostController, val systemUiController: SystemUiController, val scaffoldState: ScaffoldState -) \ No newline at end of file +) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt similarity index 95% rename from presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt rename to presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt index 11906a37..c605c69f 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarItem.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.presentation.common.bottomBar +package ac.dnd.bookkeeping.android.presentation.ui.bottombar import ac.dnd.bookkeeping.android.presentation.R import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt similarity index 97% rename from presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt rename to presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt index cf1c09fd..2bb6a9bf 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomBarScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.presentation.common.bottomBar +package ac.dnd.bookkeeping.android.presentation.ui.bottombar import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt similarity index 80% rename from presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt rename to presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt index 9e93cbe5..c5ee1500 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/bottomBar/BottomGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt @@ -1,4 +1,4 @@ -package ac.dnd.bookkeeping.android.presentation.common.bottomBar +package ac.dnd.bookkeeping.android.presentation.ui.bottombar import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot @@ -26,23 +26,23 @@ fun NavGraphBuilder.bottomGraph( ) { composable(BottomBarItem.BottomFirst.route) { - SampleScreen(appState,BottomBarItem.BottomFirst.route) + SampleScreen(appState, BottomBarItem.BottomFirst.route) } composable(BottomBarItem.BottomSecond.route) { - SampleScreen(appState,BottomBarItem.BottomSecond.route) + SampleScreen(appState, BottomBarItem.BottomSecond.route) } composable(BottomBarItem.BottomThird.route) { - SampleScreen(appState,BottomBarItem.BottomThird.route) + SampleScreen(appState, BottomBarItem.BottomThird.route) } composable(BottomBarItem.BottomFourth.route) { - SampleScreen(appState,BottomBarItem.BottomFourth.route) + SampleScreen(appState, BottomBarItem.BottomFourth.route) } composable(BottomBarItem.BottomFifth.route) { - SampleScreen(appState,BottomBarItem.BottomFifth.route) + SampleScreen(appState, BottomBarItem.BottomFifth.route) } } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt index df8a8a1c..62017795 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.main import ac.dnd.bookkeeping.android.presentation.common.base.BaseActivity -import ac.dnd.bookkeeping.android.presentation.common.navigation.MainNavGraph +import ac.dnd.bookkeeping.android.presentation.ui.navigation.MainNavGraph import ac.dnd.bookkeeping.android.presentation.common.state.ManageSystemUiState import ac.dnd.bookkeeping.android.presentation.common.state.rememberApplicationState import ac.dnd.bookkeeping.android.presentation.databinding.ActivityMainBinding diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt similarity index 90% rename from presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt rename to presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt index e6d838eb..892ccea6 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt @@ -1,7 +1,7 @@ -package ac.dnd.bookkeeping.android.presentation.common.navigation +package ac.dnd.bookkeeping.android.presentation.ui.navigation -import ac.dnd.bookkeeping.android.presentation.common.bottomBar.BottomBarScreen -import ac.dnd.bookkeeping.android.presentation.common.bottomBar.bottomGraph +import ac.dnd.bookkeeping.android.presentation.ui.bottombar.BottomBarScreen +import ac.dnd.bookkeeping.android.presentation.ui.bottombar.bottomGraph import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.activity.compose.BackHandler From eb5c004df2270a05363f5693deabfab24e48d266 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 14:25:43 +0900 Subject: [PATCH 23/42] =?UTF-8?q?[Style]:=20=EC=BD=94=EB=93=9C=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=20=EC=88=98=EC=A0=95,=20applicationState=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EB=B3=91=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../root/{MainRoot.kt => MainRootConstant.kt} | 2 +- .../{ScreenRoot.kt => ScreenRootConstant.kt} | 2 +- .../common/state/ApplicationState.kt | 26 +++++++++++++++ .../common/state/ManageSystemUiState.kt | 16 +++++----- .../common/state/rememberApplicationState.kt | 32 ------------------- .../ui/bottombar/BottomBarItem.kt | 12 +++---- .../ui/bottombar/BottomBarScreen.kt | 4 +-- .../presentation/ui/bottombar/BottomGraph.kt | 8 ++--- .../ui/navigation/MainNavGraph.kt | 8 ++--- 9 files changed, 52 insertions(+), 58 deletions(-) rename presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/{MainRoot.kt => MainRootConstant.kt} (91%) rename presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/{ScreenRoot.kt => ScreenRootConstant.kt} (83%) delete mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRootConstant.kt similarity index 91% rename from presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt rename to presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRootConstant.kt index e2a1b5e7..762b5367 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRoot.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/MainRootConstant.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.common.root -object MainRoot { +object MainRootConstant { const val BOTTOM_FIRST = "firstScreen" const val BOTTOM_SECOND = "secondScreen" diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt similarity index 83% rename from presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt rename to presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt index 50dcf9f6..cdf1d1a2 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRoot.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.common.root -object ScreenRoot { +object ScreenRootConstant { const val SPLASH = "splashScreen" const val MAIN_GRAPH = "mainGraph" diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt index 713cf2bf..3648bf33 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ApplicationState.kt @@ -1,10 +1,16 @@ package ac.dnd.bookkeeping.android.presentation.common.state import androidx.compose.material.ScaffoldState +import androidx.compose.material.rememberScaffoldState +import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.Stable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.navigation.NavHostController +import androidx.navigation.compose.rememberNavController import com.google.accompanist.systemuicontroller.SystemUiController +import com.google.accompanist.systemuicontroller.rememberSystemUiController @Stable class ApplicationState( @@ -13,3 +19,23 @@ class ApplicationState( val systemUiController: SystemUiController, val scaffoldState: ScaffoldState ) + +@Composable +fun rememberApplicationState( + bottomBarState: MutableState = remember { mutableStateOf(false) }, + navController: NavHostController = rememberNavController(), + systemUiController: SystemUiController = rememberSystemUiController(), + scaffoldState: ScaffoldState = rememberScaffoldState() +) = remember( + bottomBarState, + navController, + systemUiController, + scaffoldState +) { + ApplicationState( + bottomBarState = bottomBarState, + navController = navController, + systemUiController = systemUiController, + scaffoldState = scaffoldState + ) +} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt index ada7a3b0..0cc35535 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.common.state -import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot -import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.root.MainRootConstant +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.navigation.compose.currentBackStackEntryAsState @@ -14,16 +14,16 @@ fun ManageSystemUiState( when (navBackStackEntry?.destination?.route) { - ScreenRoot.SPLASH -> { + ScreenRootConstant.SPLASH -> { appState.systemUiController.isStatusBarVisible = false appState.bottomBarState.value = false } - MainRoot.BOTTOM_FIRST, - MainRoot.BOTTOM_SECOND, - MainRoot.BOTTOM_THIRD, - MainRoot.BOTTOM_FOURTH, - MainRoot.BOTTOM_FIFTH -> { + MainRootConstant.BOTTOM_FIRST, + MainRootConstant.BOTTOM_SECOND, + MainRootConstant.BOTTOM_THIRD, + MainRootConstant.BOTTOM_FOURTH, + MainRootConstant.BOTTOM_FIFTH -> { appState.systemUiController.isStatusBarVisible = false appState.bottomBarState.value = true } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt deleted file mode 100644 index e754445e..00000000 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/rememberApplicationState.kt +++ /dev/null @@ -1,32 +0,0 @@ -package ac.dnd.bookkeeping.android.presentation.common.state - -import androidx.compose.material.ScaffoldState -import androidx.compose.material.rememberScaffoldState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.MutableState -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.navigation.NavHostController -import androidx.navigation.compose.rememberNavController -import com.google.accompanist.systemuicontroller.SystemUiController -import com.google.accompanist.systemuicontroller.rememberSystemUiController - -@Composable -fun rememberApplicationState( - bottomBarState: MutableState = remember { mutableStateOf(false) }, - navController: NavHostController = rememberNavController(), - systemUiController: SystemUiController = rememberSystemUiController(), - scaffoldState: ScaffoldState = rememberScaffoldState() -) = remember( - bottomBarState, - navController, - systemUiController, - scaffoldState -) { - ApplicationState( - bottomBarState = bottomBarState, - navController = navController, - systemUiController = systemUiController, - scaffoldState = scaffoldState - ) -} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt index c605c69f..fad5c777 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarItem.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.bottombar import ac.dnd.bookkeeping.android.presentation.R -import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot +import ac.dnd.bookkeeping.android.presentation.common.root.MainRootConstant import androidx.annotation.DrawableRes import androidx.annotation.StringRes @@ -12,35 +12,35 @@ sealed class BottomBarItem( ) { data object BottomFirst : BottomBarItem( - route = MainRoot.BOTTOM_FIRST, + route = MainRootConstant.BOTTOM_FIRST, drawableResId = R.drawable.bottom_sample, stringResId = R.string.bottom_sample ) data object BottomSecond : BottomBarItem( - route = MainRoot.BOTTOM_SECOND, + route = MainRootConstant.BOTTOM_SECOND, drawableResId = R.drawable.bottom_sample, stringResId = R.string.bottom_sample ) data object BottomThird : BottomBarItem( - route = MainRoot.BOTTOM_THIRD, + route = MainRootConstant.BOTTOM_THIRD, drawableResId = R.drawable.bottom_sample, stringResId = R.string.bottom_sample ) data object BottomFourth : BottomBarItem( - route = MainRoot.BOTTOM_FOURTH, + route = MainRootConstant.BOTTOM_FOURTH, drawableResId = R.drawable.bottom_sample, stringResId = R.string.bottom_sample ) data object BottomFifth : BottomBarItem( - route = MainRoot.BOTTOM_FIFTH, + route = MainRootConstant.BOTTOM_FIFTH, drawableResId = R.drawable.bottom_sample, stringResId = R.string.bottom_sample ) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt index 2bb6a9bf..d1fadff5 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.bottombar -import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.layout.fillMaxSize @@ -64,7 +64,7 @@ fun BottomBarScreen( unselectedContentColor = Color.Gray, onClick = { appState.navController.navigate(screen.route) { - popUpTo(ScreenRoot.MAIN_GRAPH) { + popUpTo(ScreenRootConstant.MAIN_GRAPH) { saveState = true } launchSingleTop = true diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt index c5ee1500..f921ff7e 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomGraph.kt @@ -1,7 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.bottombar -import ac.dnd.bookkeeping.android.presentation.common.root.MainRoot -import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.root.MainRootConstant +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -21,8 +21,8 @@ fun NavGraphBuilder.bottomGraph( ) { navigation( - startDestination = MainRoot.BOTTOM_FIRST, - route = ScreenRoot.MAIN_GRAPH + startDestination = MainRootConstant.BOTTOM_FIRST, + route = ScreenRootConstant.MAIN_GRAPH ) { composable(BottomBarItem.BottomFirst.route) { diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt index 892ccea6..a3a2d388 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt @@ -2,7 +2,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.navigation import ac.dnd.bookkeeping.android.presentation.ui.bottombar.BottomBarScreen import ac.dnd.bookkeeping.android.presentation.ui.bottombar.bottomGraph -import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRoot +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.activity.compose.BackHandler import androidx.compose.foundation.background @@ -37,12 +37,12 @@ fun MainNavGraph( BackHandler(enabled = true, onBack = {}) NavHost( navController = appState.navController, - startDestination = ScreenRoot.SPLASH, + startDestination = ScreenRootConstant.SPLASH, modifier = Modifier.padding(innerPadding) ) { bottomGraph(appState) - composable(route = ScreenRoot.SPLASH) { + composable(route = ScreenRootConstant.SPLASH) { SplashScreen(appState) } } @@ -59,7 +59,7 @@ fun SplashScreen( LaunchedEffect(Unit) { scope.launch { delay(500L) - appState.navController.navigate(ScreenRoot.MAIN_GRAPH) + appState.navController.navigate(ScreenRootConstant.MAIN_GRAPH) } } From 7e9528e6173a98c9c578833f39652181895e2d89 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Thu, 18 Jan 2024 14:40:36 +0900 Subject: [PATCH 24/42] =?UTF-8?q?[Refactor]:=20=EC=8A=A4=ED=94=8C=EB=9E=98?= =?UTF-8?q?=EC=89=AC=20=EC=8A=A4=ED=81=AC=EB=A6=B0=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/navigation/MainNavGraph.kt | 41 ++---------------- .../presentation/ui/splash/SplashScreen.kt | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt index a3a2d388..cdac19b1 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt @@ -1,27 +1,18 @@ package ac.dnd.bookkeeping.android.presentation.ui.navigation -import ac.dnd.bookkeeping.android.presentation.ui.bottombar.BottomBarScreen -import ac.dnd.bookkeeping.android.presentation.ui.bottombar.bottomGraph import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import ac.dnd.bookkeeping.android.presentation.ui.bottombar.BottomBarScreen +import ac.dnd.bookkeeping.android.presentation.ui.bottombar.bottomGraph +import ac.dnd.bookkeeping.android.presentation.ui.splash.SplashScreen import androidx.activity.compose.BackHandler -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.Scaffold -import androidx.compose.material.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.unit.sp import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable -import kotlinx.coroutines.delay -import kotlinx.coroutines.launch @Composable fun MainNavGraph( @@ -50,29 +41,3 @@ fun MainNavGraph( } } - -@Composable -fun SplashScreen( - appState: ApplicationState -) { - val scope = rememberCoroutineScope() - LaunchedEffect(Unit) { - scope.launch { - delay(500L) - appState.navController.navigate(ScreenRootConstant.MAIN_GRAPH) - } - } - - Box( - modifier = Modifier - .fillMaxSize() - .background(color = Color.Black), - contentAlignment = Alignment.Center - ) { - Text( - text = "Splash Screen", - fontSize = 20.sp, - color = Color.White - ) - } -} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt new file mode 100644 index 00000000..ad0b8023 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt @@ -0,0 +1,43 @@ +package ac.dnd.bookkeeping.android.presentation.ui.splash + +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.sp +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch + +@Composable +fun SplashScreen( + appState: ApplicationState +) { + val scope = rememberCoroutineScope() + LaunchedEffect(Unit) { + scope.launch { + delay(500L) + appState.navController.navigate(ScreenRootConstant.MAIN_GRAPH) + } + } + + Box( + modifier = Modifier + .fillMaxSize() + .background(color = Color.Black), + contentAlignment = Alignment.Center + ) { + Text( + text = "Splash Screen", + fontSize = 20.sp, + color = Color.White + ) + } +} From e46ae5c1b65eedf7715df220455e14cd4478d8d2 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 01:37:54 +0900 Subject: [PATCH 25/42] =?UTF-8?q?[Feat]:=20Navigation=20Graph=EC=9D=98=20R?= =?UTF-8?q?oot=20=EC=A7=84=EC=9E=85=EC=A0=90=EC=9D=84=20=EA=B5=AC=EB=B6=84?= =?UTF-8?q?=ED=95=98=EA=B8=B0=20=EC=9C=84=ED=95=9C=20enum=20=ED=81=B4?= =?UTF-8?q?=EB=9E=98=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/root/RootEntryPoint.kt | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/RootEntryPoint.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/RootEntryPoint.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/RootEntryPoint.kt new file mode 100644 index 00000000..19a7bdc0 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/RootEntryPoint.kt @@ -0,0 +1,6 @@ +package ac.dnd.bookkeeping.android.presentation.common.root + +enum class RootEntryPoint { + LOGIN, + MAIN +} From 72275f7ce7d3473e95b9ea4c8e2bec552fd239ad Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 01:42:45 +0900 Subject: [PATCH 26/42] =?UTF-8?q?[Feat]:=20SplashViewModel=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=EA=B3=BC=20=ED=99=94=EB=A9=B4=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/splash/SplashViewModel.kt | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt new file mode 100644 index 00000000..4b1dd096 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt @@ -0,0 +1,29 @@ +package ac.dnd.bookkeeping.android.presentation.ui.splash + +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant +import androidx.lifecycle.ViewModel +import androidx.navigation.NavHostController +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class SplashViewModel @Inject constructor( + +) : ViewModel() { + + fun navigateToMain( + navController: NavHostController + ) { + navController.navigate(ScreenRootConstant.MAIN_GRAPH) { + popUpTo(ScreenRootConstant.SPLASH) { + inclusive = true + } + } + } + + fun navigateToLogin( + navController: NavHostController + ) { + } + +} From bfe20f27ef780a842de53ef203b36d2b9aa35675 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 01:44:03 +0900 Subject: [PATCH 27/42] =?UTF-8?q?[Feat]:=20Login=20=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=EB=A5=BC=20=EB=8B=B4=EB=8B=B9=ED=95=98=EB=8A=94=20LOG?= =?UTF-8?q?IN=20ScreenRootConstant=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/root/ScreenRootConstant.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt index cdf1d1a2..bf50b105 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt @@ -3,6 +3,7 @@ package ac.dnd.bookkeeping.android.presentation.common.root object ScreenRootConstant { const val SPLASH = "splashScreen" + const val LOGIN ="loginGraph" const val MAIN_GRAPH = "mainGraph" } From 56a8a0dab328d269e086cf016796008c67be7c11 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 01:45:39 +0900 Subject: [PATCH 28/42] =?UTF-8?q?[Feat]:=20Login=20=ED=99=94=EB=A9=B4=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/root/ScreenRootConstant.kt | 2 +- .../android/presentation/ui/splash/SplashViewModel.kt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt index bf50b105..04816a8d 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt @@ -3,7 +3,7 @@ package ac.dnd.bookkeeping.android.presentation.common.root object ScreenRootConstant { const val SPLASH = "splashScreen" - const val LOGIN ="loginGraph" + const val LOGIN_GRAPH ="loginGraph" const val MAIN_GRAPH = "mainGraph" } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt index 4b1dd096..2f4e91cf 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt @@ -24,6 +24,11 @@ class SplashViewModel @Inject constructor( fun navigateToLogin( navController: NavHostController ) { + navController.navigate(ScreenRootConstant.LOGIN_GRAPH) { + popUpTo(ScreenRootConstant.SPLASH) { + inclusive = true + } + } } } From eaa17e07289ded2b9c5c431e2cd848cd94b6dc3a Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 01:46:07 +0900 Subject: [PATCH 29/42] =?UTF-8?q?[Feat]:=20SplashScreen=EC=97=90=20ViewMod?= =?UTF-8?q?el=EC=9D=84=20=EC=97=B0=EA=B2=B0=ED=95=98=EA=B3=A0=20=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=EB=B3=84=20=ED=99=94=EB=A9=B4=20=EC=9D=B4=EB=8F=99=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/ui/splash/SplashScreen.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt index ad0b8023..f250acc4 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt @@ -1,6 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.splash -import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant +import ac.dnd.bookkeeping.android.presentation.common.root.RootEntryPoint import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -13,18 +13,24 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel import kotlinx.coroutines.delay import kotlinx.coroutines.launch @Composable fun SplashScreen( - appState: ApplicationState + appState: ApplicationState, + rootEntryPoint: RootEntryPoint, + viewModel: SplashViewModel = hiltViewModel() ) { val scope = rememberCoroutineScope() LaunchedEffect(Unit) { scope.launch { delay(500L) - appState.navController.navigate(ScreenRootConstant.MAIN_GRAPH) + when (rootEntryPoint) { + RootEntryPoint.LOGIN -> viewModel.navigateToLogin(appState.navController) + RootEntryPoint.MAIN -> viewModel.navigateToMain(appState.navController) + } } } From 8bf1fa2bbbbe370cad22efc803b1fc777f1818ac Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 11:49:21 +0900 Subject: [PATCH 30/42] =?UTF-8?q?[Fix]:=20=EC=8A=A4=ED=94=8C=EB=9E=98?= =?UTF-8?q?=EC=89=AC=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/ui/navigation/MainNavGraph.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt index cdac19b1..99888bc5 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt @@ -1,5 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.navigation +import ac.dnd.bookkeeping.android.presentation.common.root.RootEntryPoint import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import ac.dnd.bookkeeping.android.presentation.ui.bottombar.BottomBarScreen @@ -34,7 +35,7 @@ fun MainNavGraph( bottomGraph(appState) composable(route = ScreenRootConstant.SPLASH) { - SplashScreen(appState) + SplashScreen(appState,RootEntryPoint.MAIN) } } From ebca65b9bfacdfa9fc9071ad621cc0e300ae6f3b Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 12:14:55 +0900 Subject: [PATCH 31/42] =?UTF-8?q?[Feat]:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=ED=99=94=EB=A9=B4=20=EC=9D=B4=EB=8F=99=20=EA=B4=80=EB=A0=A8=20?= =?UTF-8?q?LoginRootConstant=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/root/LoginRootConstant.kt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/LoginRootConstant.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/LoginRootConstant.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/LoginRootConstant.kt new file mode 100644 index 00000000..e6a9251f --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/LoginRootConstant.kt @@ -0,0 +1,8 @@ +package ac.dnd.bookkeeping.android.presentation.common.root + +object LoginRootConstant { + + const val LOGIN_MAIN = "loginMainScreen" + const val LOGIN_ONBOARD = "loginOnboardScreen" + +} From a1ad4a73d9edb97efbbdbe74348daadd72f7c2a1 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 12:21:22 +0900 Subject: [PATCH 32/42] =?UTF-8?q?[Feat]:=20Login,=20OnBoard=20Empty=20Scre?= =?UTF-8?q?en=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/login/LoginScreen.kt | 33 +++++++++++++++++++ .../presentation/ui/login/OnBoardScreen.kt | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt new file mode 100644 index 00000000..fef46ab6 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt @@ -0,0 +1,33 @@ +package ac.dnd.bookkeeping.android.presentation.ui.login + +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.sp + +@Composable +fun LoginScreen( + appState: ApplicationState, +) { + val scope = rememberCoroutineScope() + + Box( + modifier = Modifier + .fillMaxSize() + .background(color = Color.Black), + contentAlignment = Alignment.Center + ) { + Text( + text = "Login Screen", + fontSize = 20.sp, + color = Color.White + ) + } +} diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt new file mode 100644 index 00000000..c44ab347 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt @@ -0,0 +1,33 @@ +package ac.dnd.bookkeeping.android.presentation.ui.login + +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material.Text +import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.sp + +@Composable +fun OnBoardScreen( + appState: ApplicationState, +) { + val scope = rememberCoroutineScope() + + Box( + modifier = Modifier + .fillMaxSize() + .background(color = Color.Black), + contentAlignment = Alignment.Center + ) { + Text( + text = "OnBoard Screen", + fontSize = 20.sp, + color = Color.White + ) + } +} From 90e9ec959fe9a9c00d32089b4b5b8b9e8822099e Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:10:26 +0900 Subject: [PATCH 33/42] =?UTF-8?q?[Refactor]:=20=EA=B0=81=20=EA=B7=B8?= =?UTF-8?q?=EB=9E=98=ED=94=84=20=EB=B3=84=20SplashScreen=20=EB=B6=84?= =?UTF-8?q?=EA=B8=B0=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/common/root/ScreenRootConstant.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt index 04816a8d..303749d6 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt @@ -2,7 +2,8 @@ package ac.dnd.bookkeeping.android.presentation.common.root object ScreenRootConstant { - const val SPLASH = "splashScreen" + const val LOGIN_SPLASH = "loginSplashScreen" + const val MAIN_SPLASH = "mainSplashScreen" const val LOGIN_GRAPH ="loginGraph" const val MAIN_GRAPH = "mainGraph" From 2033be8c7dba23fd439096913ff6b4da012528f4 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:11:10 +0900 Subject: [PATCH 34/42] =?UTF-8?q?[Feat]:=20Login=20Navigation=20=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=EB=A5=BC=20=EC=B2=98=EB=A6=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20LoginNavGraph=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/navigation/LoginNavGraph.kt | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt new file mode 100644 index 00000000..9656c420 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt @@ -0,0 +1,41 @@ +package ac.dnd.bookkeeping.android.presentation.ui.navigation + +import ac.dnd.bookkeeping.android.presentation.common.root.LoginRootConstant +import ac.dnd.bookkeeping.android.presentation.common.root.RootEntryPoint +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant +import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import ac.dnd.bookkeeping.android.presentation.ui.login.LoginScreen +import ac.dnd.bookkeeping.android.presentation.ui.login.OnBoardScreen +import ac.dnd.bookkeeping.android.presentation.ui.splash.SplashScreen +import androidx.compose.runtime.Composable +import androidx.navigation.NavGraphBuilder +import androidx.navigation.compose.composable +import androidx.navigation.navigation + +fun NavGraphBuilder.loginNavGraph( + appState: ApplicationState +) { + + navigation( + startDestination = ScreenRootConstant.LOGIN_SPLASH, + route = ScreenRootConstant.LOGIN_GRAPH + ) { + + composable(route = ScreenRootConstant.LOGIN_SPLASH) { + SplashScreen( + appState = appState, + rootEntryPoint = RootEntryPoint.LOGIN + ) + } + + composable(LoginRootConstant.LOGIN_MAIN) { + LoginScreen(appState = appState) + } + + composable(LoginRootConstant.LOGIN_ONBOARD) { + OnBoardScreen(appState = appState) + } + + } + +} From 89477acb5ae10458d226cfee1ea1ccc1abce9207 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:11:44 +0900 Subject: [PATCH 35/42] =?UTF-8?q?[Feat]:=20LoginViewModel=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/login/LoginViewModel.kt | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt new file mode 100644 index 00000000..86c73352 --- /dev/null +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt @@ -0,0 +1,35 @@ +package ac.dnd.bookkeeping.android.presentation.ui.login + +import ac.dnd.bookkeeping.android.presentation.common.root.LoginRootConstant +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant +import androidx.lifecycle.ViewModel +import androidx.navigation.NavHostController +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject + +@HiltViewModel +class LoginViewModel @Inject constructor( + +): ViewModel() { + + fun navigateToOnBoard( + navController: NavHostController + ){ + navController.navigate(LoginRootConstant.LOGIN_ONBOARD){ + popUpTo(LoginRootConstant.LOGIN_MAIN) { + inclusive = true + } + } + } + + fun navigateToMain( + navController: NavHostController, + prevRoot: String + ){ + navController.navigate(ScreenRootConstant.MAIN_SPLASH){ + popUpTo(prevRoot){ + inclusive = true + } + } + } +} From 3d13db0cc93bf1f43328ff8e20400cb4bc4d7a65 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:12:36 +0900 Subject: [PATCH 36/42] =?UTF-8?q?[Feat]:=20Login,OnBoard=20Screen=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=83=9D=EC=84=B1=EA=B3=BC=20=EB=84=A4?= =?UTF-8?q?=EB=B9=84=EA=B2=8C=EC=9D=B4=EC=85=98=20=EC=A0=84=ED=99=98=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/login/LoginScreen.kt | 45 +++++++++++++++++-- .../presentation/ui/login/OnBoardScreen.kt | 45 +++++++++++++++++-- 2 files changed, 84 insertions(+), 6 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt index fef46ab6..14d5abc5 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt @@ -1,33 +1,72 @@ package ac.dnd.bookkeeping.android.presentation.ui.login import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import ac.dnd.bookkeeping.android.presentation.ui.main.theme.Shapes import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Surface import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel @Composable fun LoginScreen( appState: ApplicationState, + viewModel: LoginViewModel = hiltViewModel() ) { - val scope = rememberCoroutineScope() + + val nextStageState = remember{ mutableStateOf(false) } + if (nextStageState.value){ + viewModel.navigateToOnBoard(appState.navController) + nextStageState.value = false + } Box( modifier = Modifier .fillMaxSize() .background(color = Color.Black), - contentAlignment = Alignment.Center ) { Text( text = "Login Screen", fontSize = 20.sp, - color = Color.White + color = Color.White, + modifier = Modifier.align(Alignment.Center) ) + + Surface( + modifier = Modifier + .align(Alignment.BottomCenter) + .padding(30.dp) + .fillMaxWidth() + .clickable { + nextStageState.value = true + }, + shape = RoundedCornerShape(10.dp), + color = Color.White + ){ + Text( + text = "next", + fontSize = 20.sp, + color = Color.Black, + textAlign = TextAlign.Center, + modifier = Modifier.padding(5.dp) + ) + } } + } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt index c44ab347..08812e89 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt @@ -1,33 +1,72 @@ package ac.dnd.bookkeeping.android.presentation.ui.login +import ac.dnd.bookkeeping.android.presentation.common.root.LoginRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState +import ac.dnd.bookkeeping.android.presentation.ui.main.theme.Shapes import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Surface import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.hilt.navigation.compose.hiltViewModel @Composable fun OnBoardScreen( appState: ApplicationState, + viewModel: LoginViewModel = hiltViewModel() ) { - val scope = rememberCoroutineScope() + + val nextStageState = remember{ mutableStateOf(false) } + if (nextStageState.value){ + viewModel.navigateToMain(appState.navController,LoginRootConstant.LOGIN_ONBOARD) + nextStageState.value = false + } Box( modifier = Modifier .fillMaxSize() .background(color = Color.Black), - contentAlignment = Alignment.Center ) { Text( text = "OnBoard Screen", fontSize = 20.sp, - color = Color.White + color = Color.White, + modifier = Modifier.align(Alignment.Center) ) + + Surface( + modifier = Modifier + .align(Alignment.BottomCenter) + .padding(30.dp) + .fillMaxWidth() + .clickable { + nextStageState.value = true + }, + shape = RoundedCornerShape(10.dp), + color = Color.White + ){ + Text( + text = "next", + fontSize = 20.sp, + color = Color.Black, + textAlign = TextAlign.Center, + modifier = Modifier.padding(5.dp) + ) + } } } From 5f81d7a53a49b9c6dcf4d3cc68e80ff0138d5bd8 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:13:11 +0900 Subject: [PATCH 37/42] =?UTF-8?q?[Refactor]:=20Graph=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=A5=B8=20SplashScreen=20=EB=B6=84=EA=B8=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/ui/splash/SplashScreen.kt | 7 ++++--- .../presentation/ui/splash/SplashViewModel.kt | 13 ++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt index f250acc4..847518fe 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt @@ -1,6 +1,7 @@ package ac.dnd.bookkeeping.android.presentation.ui.splash import ac.dnd.bookkeeping.android.presentation.common.root.RootEntryPoint +import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -26,10 +27,10 @@ fun SplashScreen( val scope = rememberCoroutineScope() LaunchedEffect(Unit) { scope.launch { - delay(500L) + delay(1000L) when (rootEntryPoint) { - RootEntryPoint.LOGIN -> viewModel.navigateToLogin(appState.navController) - RootEntryPoint.MAIN -> viewModel.navigateToMain(appState.navController) + RootEntryPoint.LOGIN -> viewModel.navigateToLogin(appState.navController,ScreenRootConstant.LOGIN_SPLASH) + RootEntryPoint.MAIN -> viewModel.navigateToMain(appState.navController,ScreenRootConstant.MAIN_SPLASH) } } } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt index 2f4e91cf..45f8f39c 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashViewModel.kt @@ -1,5 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.ui.splash +import ac.dnd.bookkeeping.android.presentation.common.root.LoginRootConstant import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import androidx.lifecycle.ViewModel import androidx.navigation.NavHostController @@ -12,20 +13,22 @@ class SplashViewModel @Inject constructor( ) : ViewModel() { fun navigateToMain( - navController: NavHostController + navController: NavHostController, + rootEntryPoint: String ) { navController.navigate(ScreenRootConstant.MAIN_GRAPH) { - popUpTo(ScreenRootConstant.SPLASH) { + popUpTo(rootEntryPoint) { inclusive = true } } } fun navigateToLogin( - navController: NavHostController + navController: NavHostController, + rootEntryPoint: String ) { - navController.navigate(ScreenRootConstant.LOGIN_GRAPH) { - popUpTo(ScreenRootConstant.SPLASH) { + navController.navigate(LoginRootConstant.LOGIN_MAIN) { + popUpTo(rootEntryPoint) { inclusive = true } } From 0562ba00ef5065f0b739a1ea24ad345daefe714a Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:13:29 +0900 Subject: [PATCH 38/42] =?UTF-8?q?[Refactor]:=20MainGraph=20Splash=20?= =?UTF-8?q?=EB=B6=84=EA=B8=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/navigation/MainNavGraph.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt index 99888bc5..76107ec7 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt @@ -29,13 +29,16 @@ fun MainNavGraph( BackHandler(enabled = true, onBack = {}) NavHost( navController = appState.navController, - startDestination = ScreenRootConstant.SPLASH, + startDestination = ScreenRootConstant.LOGIN_GRAPH, modifier = Modifier.padding(innerPadding) ) { bottomGraph(appState) - - composable(route = ScreenRootConstant.SPLASH) { - SplashScreen(appState,RootEntryPoint.MAIN) + loginNavGraph(appState) + composable(route = ScreenRootConstant.MAIN_SPLASH) { + SplashScreen( + appState = appState, + rootEntryPoint = RootEntryPoint.MAIN + ) } } From fd5a2a6f0405a5b4cc0474763dca7ded41bab288 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:13:56 +0900 Subject: [PATCH 39/42] =?UTF-8?q?[Feat]:=20systemUiController=20Navigation?= =?UTF-8?q?Bar=20State=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/common/state/ManageSystemUiState.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt index 0cc35535..1440a135 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/state/ManageSystemUiState.kt @@ -1,5 +1,6 @@ package ac.dnd.bookkeeping.android.presentation.common.state +import ac.dnd.bookkeeping.android.presentation.common.root.LoginRootConstant import ac.dnd.bookkeeping.android.presentation.common.root.MainRootConstant import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import androidx.compose.runtime.Composable @@ -14,8 +15,9 @@ fun ManageSystemUiState( when (navBackStackEntry?.destination?.route) { - ScreenRootConstant.SPLASH -> { + ScreenRootConstant.LOGIN_SPLASH, ScreenRootConstant.MAIN_SPLASH -> { appState.systemUiController.isStatusBarVisible = false + appState.systemUiController.isNavigationBarVisible = false appState.bottomBarState.value = false } @@ -25,8 +27,15 @@ fun ManageSystemUiState( MainRootConstant.BOTTOM_FOURTH, MainRootConstant.BOTTOM_FIFTH -> { appState.systemUiController.isStatusBarVisible = false + appState.systemUiController.isNavigationBarVisible = true appState.bottomBarState.value = true } + + LoginRootConstant.LOGIN_ONBOARD, LoginRootConstant.LOGIN_MAIN -> { + appState.systemUiController.isStatusBarVisible = true + appState.systemUiController.isNavigationBarVisible = true + appState.bottomBarState.value = false + } } } From da5628f63ee9afd3a682b311682096eaa54485b6 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:18:35 +0900 Subject: [PATCH 40/42] =?UTF-8?q?[Refactor]:=20BottomBarScreen=20=EC=83=89?= =?UTF-8?q?=EC=83=81,=20=EA=B0=84=EA=B2=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../android/presentation/ui/bottombar/BottomBarScreen.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt index d1fadff5..7b0bb3ec 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/bottombar/BottomBarScreen.kt @@ -31,12 +31,12 @@ fun BottomBarScreen( visible = appState.bottomBarState.value, modifier = Modifier .fillMaxWidth() - .height(90.dp) + .height(80.dp) ) { BottomNavigation( elevation = 0.dp, - backgroundColor = Color.White, + backgroundColor = Color.LightGray, modifier = Modifier.fillMaxSize() ) { val navBackStackEntry by appState.navController.currentBackStackEntryAsState() From f2d8100016cf2d0f4e870b860320571b13a18ee2 Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:22:20 +0900 Subject: [PATCH 41/42] =?UTF-8?q?[Feat]:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8&?= =?UTF-8?q?=EC=98=A8=EB=B3=B4=EB=94=A9=20=ED=9D=90=EB=A6=84=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B0=99=EC=9D=80=20ViewModel=20=EC=9D=B8=EC=8A=A4?= =?UTF-8?q?=ED=84=B4=EC=8A=A4=20=EC=9C=A0=EC=A7=80=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/ui/navigation/LoginNavGraph.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt index 9656c420..bd75b4e9 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt @@ -5,9 +5,12 @@ import ac.dnd.bookkeeping.android.presentation.common.root.RootEntryPoint import ac.dnd.bookkeeping.android.presentation.common.root.ScreenRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState import ac.dnd.bookkeeping.android.presentation.ui.login.LoginScreen +import ac.dnd.bookkeeping.android.presentation.ui.login.LoginViewModel import ac.dnd.bookkeeping.android.presentation.ui.login.OnBoardScreen import ac.dnd.bookkeeping.android.presentation.ui.splash.SplashScreen import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavGraphBuilder import androidx.navigation.compose.composable import androidx.navigation.navigation @@ -29,11 +32,19 @@ fun NavGraphBuilder.loginNavGraph( } composable(LoginRootConstant.LOGIN_MAIN) { - LoginScreen(appState = appState) + val backStackEntry = remember(it){ + appState.navController.getBackStackEntry(ScreenRootConstant.LOGIN_GRAPH) + } + val loginViewModel: LoginViewModel = hiltViewModel(backStackEntry) + LoginScreen(appState = appState, viewModel = loginViewModel) } composable(LoginRootConstant.LOGIN_ONBOARD) { - OnBoardScreen(appState = appState) + val backStackEntry = remember(it){ + appState.navController.getBackStackEntry(ScreenRootConstant.LOGIN_GRAPH) + } + val loginViewModel: LoginViewModel = hiltViewModel(backStackEntry) + OnBoardScreen(appState = appState, viewModel = loginViewModel) } } From 3cbdd06fe10a2e04a00758149917bc1863bc576a Mon Sep 17 00:00:00 2001 From: jinuemong Date: Fri, 19 Jan 2024 13:27:16 +0900 Subject: [PATCH 42/42] =?UTF-8?q?[Chore]:=20=EC=BD=94=EB=93=9C=20=ED=8F=AC?= =?UTF-8?q?=EB=A7=B7=20=EC=88=98=EC=A0=95,=20=EC=BB=A8=EB=B2=A4=EC=85=98?= =?UTF-8?q?=20=EC=A4=80=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/common/root/ScreenRootConstant.kt | 2 +- .../android/presentation/ui/login/LoginScreen.kt | 11 +++-------- .../android/presentation/ui/login/LoginViewModel.kt | 13 +++++++------ .../android/presentation/ui/login/OnBoardScreen.kt | 12 ++++-------- .../android/presentation/ui/main/MainActivity.kt | 2 +- .../presentation/ui/navigation/LoginNavGraph.kt | 7 ++----- .../presentation/ui/navigation/MainNavGraph.kt | 4 ---- .../android/presentation/ui/splash/SplashScreen.kt | 11 +++++++++-- 8 files changed, 27 insertions(+), 35 deletions(-) diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt index 303749d6..480ed102 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/common/root/ScreenRootConstant.kt @@ -4,7 +4,7 @@ object ScreenRootConstant { const val LOGIN_SPLASH = "loginSplashScreen" const val MAIN_SPLASH = "mainSplashScreen" - const val LOGIN_GRAPH ="loginGraph" + const val LOGIN_GRAPH = "loginGraph" const val MAIN_GRAPH = "mainGraph" } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt index 14d5abc5..4c56677b 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginScreen.kt @@ -1,13 +1,11 @@ package ac.dnd.bookkeeping.android.presentation.ui.login import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState -import ac.dnd.bookkeeping.android.presentation.ui.main.theme.Shapes import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Surface @@ -15,7 +13,6 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -29,9 +26,8 @@ fun LoginScreen( appState: ApplicationState, viewModel: LoginViewModel = hiltViewModel() ) { - - val nextStageState = remember{ mutableStateOf(false) } - if (nextStageState.value){ + val nextStageState = remember { mutableStateOf(false) } + if (nextStageState.value) { viewModel.navigateToOnBoard(appState.navController) nextStageState.value = false } @@ -58,7 +54,7 @@ fun LoginScreen( }, shape = RoundedCornerShape(10.dp), color = Color.White - ){ + ) { Text( text = "next", fontSize = 20.sp, @@ -68,5 +64,4 @@ fun LoginScreen( ) } } - } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt index 86c73352..2f8c1660 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/LoginViewModel.kt @@ -10,12 +10,12 @@ import javax.inject.Inject @HiltViewModel class LoginViewModel @Inject constructor( -): ViewModel() { +) : ViewModel() { fun navigateToOnBoard( navController: NavHostController - ){ - navController.navigate(LoginRootConstant.LOGIN_ONBOARD){ + ) { + navController.navigate(LoginRootConstant.LOGIN_ONBOARD) { popUpTo(LoginRootConstant.LOGIN_MAIN) { inclusive = true } @@ -25,11 +25,12 @@ class LoginViewModel @Inject constructor( fun navigateToMain( navController: NavHostController, prevRoot: String - ){ - navController.navigate(ScreenRootConstant.MAIN_SPLASH){ - popUpTo(prevRoot){ + ) { + navController.navigate(ScreenRootConstant.MAIN_SPLASH) { + popUpTo(prevRoot) { inclusive = true } } } + } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt index 08812e89..efbf91fb 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/login/OnBoardScreen.kt @@ -2,13 +2,11 @@ package ac.dnd.bookkeeping.android.presentation.ui.login import ac.dnd.bookkeeping.android.presentation.common.root.LoginRootConstant import ac.dnd.bookkeeping.android.presentation.common.state.ApplicationState -import ac.dnd.bookkeeping.android.presentation.ui.main.theme.Shapes import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.Surface @@ -16,7 +14,6 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -30,10 +27,9 @@ fun OnBoardScreen( appState: ApplicationState, viewModel: LoginViewModel = hiltViewModel() ) { - - val nextStageState = remember{ mutableStateOf(false) } - if (nextStageState.value){ - viewModel.navigateToMain(appState.navController,LoginRootConstant.LOGIN_ONBOARD) + val nextStageState = remember { mutableStateOf(false) } + if (nextStageState.value) { + viewModel.navigateToMain(appState.navController, LoginRootConstant.LOGIN_ONBOARD) nextStageState.value = false } @@ -59,7 +55,7 @@ fun OnBoardScreen( }, shape = RoundedCornerShape(10.dp), color = Color.White - ){ + ) { Text( text = "next", fontSize = 20.sp, diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt index 62017795..9c9ea321 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/main/MainActivity.kt @@ -1,11 +1,11 @@ package ac.dnd.bookkeeping.android.presentation.ui.main import ac.dnd.bookkeeping.android.presentation.common.base.BaseActivity -import ac.dnd.bookkeeping.android.presentation.ui.navigation.MainNavGraph import ac.dnd.bookkeeping.android.presentation.common.state.ManageSystemUiState import ac.dnd.bookkeeping.android.presentation.common.state.rememberApplicationState import ac.dnd.bookkeeping.android.presentation.databinding.ActivityMainBinding import ac.dnd.bookkeeping.android.presentation.ui.main.theme.BookkeepingTheme +import ac.dnd.bookkeeping.android.presentation.ui.navigation.MainNavGraph import androidx.activity.compose.setContent import androidx.activity.viewModels import androidx.compose.foundation.layout.fillMaxSize diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt index bd75b4e9..99ea27de 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/LoginNavGraph.kt @@ -8,7 +8,6 @@ import ac.dnd.bookkeeping.android.presentation.ui.login.LoginScreen import ac.dnd.bookkeeping.android.presentation.ui.login.LoginViewModel import ac.dnd.bookkeeping.android.presentation.ui.login.OnBoardScreen import ac.dnd.bookkeeping.android.presentation.ui.splash.SplashScreen -import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.hilt.navigation.compose.hiltViewModel import androidx.navigation.NavGraphBuilder @@ -18,7 +17,6 @@ import androidx.navigation.navigation fun NavGraphBuilder.loginNavGraph( appState: ApplicationState ) { - navigation( startDestination = ScreenRootConstant.LOGIN_SPLASH, route = ScreenRootConstant.LOGIN_GRAPH @@ -32,7 +30,7 @@ fun NavGraphBuilder.loginNavGraph( } composable(LoginRootConstant.LOGIN_MAIN) { - val backStackEntry = remember(it){ + val backStackEntry = remember(it) { appState.navController.getBackStackEntry(ScreenRootConstant.LOGIN_GRAPH) } val loginViewModel: LoginViewModel = hiltViewModel(backStackEntry) @@ -40,7 +38,7 @@ fun NavGraphBuilder.loginNavGraph( } composable(LoginRootConstant.LOGIN_ONBOARD) { - val backStackEntry = remember(it){ + val backStackEntry = remember(it) { appState.navController.getBackStackEntry(ScreenRootConstant.LOGIN_GRAPH) } val loginViewModel: LoginViewModel = hiltViewModel(backStackEntry) @@ -48,5 +46,4 @@ fun NavGraphBuilder.loginNavGraph( } } - } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt index 76107ec7..73168ab8 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/navigation/MainNavGraph.kt @@ -19,13 +19,11 @@ import androidx.navigation.compose.composable fun MainNavGraph( appState: ApplicationState ) { - Scaffold( modifier = Modifier.fillMaxSize(), scaffoldState = appState.scaffoldState, bottomBar = { BottomBarScreen(appState = appState) } ) { innerPadding -> - BackHandler(enabled = true, onBack = {}) NavHost( navController = appState.navController, @@ -41,7 +39,5 @@ fun MainNavGraph( ) } } - } - } diff --git a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt index 847518fe..e8e7172f 100644 --- a/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/bookkeeping/android/presentation/ui/splash/SplashScreen.kt @@ -29,8 +29,15 @@ fun SplashScreen( scope.launch { delay(1000L) when (rootEntryPoint) { - RootEntryPoint.LOGIN -> viewModel.navigateToLogin(appState.navController,ScreenRootConstant.LOGIN_SPLASH) - RootEntryPoint.MAIN -> viewModel.navigateToMain(appState.navController,ScreenRootConstant.MAIN_SPLASH) + RootEntryPoint.LOGIN -> viewModel.navigateToLogin( + appState.navController, + ScreenRootConstant.LOGIN_SPLASH + ) + + RootEntryPoint.MAIN -> viewModel.navigateToMain( + appState.navController, + ScreenRootConstant.MAIN_SPLASH + ) } } }