From ae4611f40fc3ffdcc76aed8176fe18d67c8685d6 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Wed, 26 Jun 2024 22:53:09 +0900 Subject: [PATCH 01/13] =?UTF-8?q?[chore]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20f?= =?UTF-8?q?eature=20=EB=AA=A8=EB=93=88=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/storage/.gitignore | 1 + feature/storage/build.gradle.kts | 76 +++++++++++++++++++ feature/storage/consumer-rules.pro | 0 feature/storage/proguard-rules.pro | 21 +++++ .../storage/ExampleInstrumentedTest.kt | 23 ++++++ feature/storage/src/main/AndroidManifest.xml | 4 + .../feature/storage/StorageScreen.kt | 2 + .../feature/storage/ExampleUnitTest.kt | 16 ++++ settings.gradle.kts | 1 + 9 files changed, 144 insertions(+) create mode 100644 feature/storage/.gitignore create mode 100644 feature/storage/build.gradle.kts create mode 100644 feature/storage/consumer-rules.pro create mode 100644 feature/storage/proguard-rules.pro create mode 100644 feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt create mode 100644 feature/storage/src/main/AndroidManifest.xml create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt create mode 100644 feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt diff --git a/feature/storage/.gitignore b/feature/storage/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/feature/storage/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/storage/build.gradle.kts b/feature/storage/build.gradle.kts new file mode 100644 index 00000000..3826bb20 --- /dev/null +++ b/feature/storage/build.gradle.kts @@ -0,0 +1,76 @@ +plugins { + alias(libs.plugins.com.android.library) + alias(libs.plugins.org.jetbrains.kotlin.android) + alias(libs.plugins.hilt) + alias(libs.plugins.kotlin.kapt) +} + +android { + namespace = "com.mashup.dorabangs.feature.storage" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = "1.4.3" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_18 + targetCompatibility = JavaVersion.VERSION_18 + } + kotlinOptions { + jvmTarget = "18" + } +} + +dependencies { + implementation(project(":domain")) + implementation(project(":core:coroutine")) + implementation(project(":core:designsystem")) + implementation(project(":core:navigation")) + + // Compose + implementation(libs.ui) + implementation(libs.ui.graphics) + implementation(libs.ui.tooling.preview) + implementation(libs.material3) + implementation(platform(libs.compose.bom)) + implementation(libs.material) + + // Test + androidTestImplementation(libs.androidx.test.ext.junit) + androidTestImplementation(libs.espresso.core) + androidTestImplementation(platform(libs.compose.bom)) + androidTestImplementation(libs.ui.test.junit4) + debugImplementation(libs.ui.tooling) + debugImplementation(libs.ui.test.manifest) + testImplementation(libs.junit) + + // Hilt + implementation(libs.hilt.android) + kapt(libs.hilt.compiler) + implementation(libs.hilt.navigation.compose) + + // Orbit + implementation(libs.orbit.core) + implementation(libs.orbit.viewmodel) + implementation(libs.orbit.compose) +} \ No newline at end of file diff --git a/feature/storage/consumer-rules.pro b/feature/storage/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/feature/storage/proguard-rules.pro b/feature/storage/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/feature/storage/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt b/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..d213273c --- /dev/null +++ b/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt @@ -0,0 +1,23 @@ +package com.mashup.dorabangs.feature.storage + +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.ext.junit.runners.AndroidJUnit4 +import org.junit.Assert.assertEquals + +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.mashup.dorabangs.feature.storage.test", appContext.packageName) + } +} \ No newline at end of file diff --git a/feature/storage/src/main/AndroidManifest.xml b/feature/storage/src/main/AndroidManifest.xml new file mode 100644 index 00000000..a5918e68 --- /dev/null +++ b/feature/storage/src/main/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt new file mode 100644 index 00000000..653a632b --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt @@ -0,0 +1,2 @@ +package com.mashup.dorabangs.feature.storage + diff --git a/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt b/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt new file mode 100644 index 00000000..21b7922a --- /dev/null +++ b/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.mashup.dorabangs.feature.storage + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index c1374270..3299997c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -23,3 +23,4 @@ include(":feature:home") include(":core:coroutine") include(":core:designsystem") include(":core:navigation") +include(":feature:storage") From 043fb3cd5a3a3074193fd148a8f8ff25d0c29f7d Mon Sep 17 00:00:00 2001 From: ddyeon Date: Thu, 27 Jun 2024 00:23:13 +0900 Subject: [PATCH 02/13] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/storage/StorageComponent.kt | 73 +++++++++++ .../feature/storage/StorageScreen.kt | 116 ++++++++++++++++++ 2 files changed, 189 insertions(+) create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt new file mode 100644 index 00000000..99501072 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt @@ -0,0 +1,73 @@ +package com.mashup.dorabangs.feature.storage + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens +import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens + +@Composable +fun StorageListItem( + title: String, + count: Int, + isDefaultFolder: Boolean +) { + Box( + modifier = Modifier + .fillMaxWidth() + .padding(vertical = 14.dp) + ) { + Row( + modifier = Modifier.align(Alignment.CenterStart) + ) { + Icon( + painter = painterResource(id = androidx.core.R.drawable.ic_call_answer), + contentDescription = "folderIcon" + ) + Text( + modifier = Modifier + .padding(start = 12.dp) + .align(Alignment.CenterVertically), + textAlign = TextAlign.Center, + text = title, + color = DoraColorTokens.G9, + style = DoraTypoTokens.caption3Medium + ) + } + Row( + modifier = Modifier.align(Alignment.CenterEnd) + ) { + Text( + modifier = Modifier + .padding(end = 12.dp) + .align(Alignment.CenterVertically), + text = "$count", + color = DoraColorTokens.G4, + style = DoraTypoTokens.caption3Medium + ) + val icon = + if(isDefaultFolder) androidx.core.R.drawable.ic_call_answer + else androidx.core.R.drawable.ic_call_answer + Icon( + painter = painterResource(id = icon), + contentDescription = "folderIcon" + ) + } + } +} + +@Preview +@Composable +fun PreviewStorageListItem() { + StorageListItem(title = "디자인", count = 3, isDefaultFolder = true) +} \ No newline at end of file diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt index 653a632b..884d7e58 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt @@ -1,2 +1,118 @@ package com.mashup.dorabangs.feature.storage +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +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.lazy.LazyColumn +import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.core.R +import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens +import com.mashup.dorabangs.core.designsystem.theme.DoraRoundTokens +import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens + +@Composable +fun StorageRoute() { + +} + +@Composable +fun StorageScreen() { + Column( + modifier = Modifier.fillMaxSize().background(color = DoraColorTokens.G1) + ) { + StorageTopAppBar() + Spacer(modifier = Modifier.height(20.dp)) + Column( + modifier = Modifier.padding(horizontal = 20.dp) + ) { + StorageDefaultFolder() + Spacer(modifier = Modifier.height(20.dp)) + StorageCustomFolder() + } + } +} + +@Composable +fun StorageTopAppBar( + modifier: Modifier = Modifier +) { + Row( + modifier = modifier + .fillMaxWidth() + .background(Color.Transparent) + .padding(horizontal = 20.dp, vertical = 12.dp), + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = "보관함", + style = DoraTypoTokens.base1Bold + ) + Icon( + painter = painterResource(id = R.drawable.ic_call_answer), + contentDescription = "folderIcon" + ) + } +} + +@Composable +fun StorageDefaultFolder( + list: List = listOf("다연", "석주", "호현") +) { + Column( + modifier = Modifier + .fillMaxWidth() + .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) + .padding(horizontal = 12.dp) + ) { + list.forEachIndexed { idx, item -> + StorageListItem(title = item, count = 1, isDefaultFolder = true) + if(idx != list.lastIndex) { + HorizontalDivider(modifier = Modifier + .height(1.dp) + .background(color = DoraColorTokens.G1)) + } + } + + } +} + +@Composable +fun StorageCustomFolder( + list: List = listOf("다연", "석주", "호현") +) { + LazyColumn( + modifier = Modifier.fillMaxWidth() + .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) + .padding(horizontal = 12.dp) + ) { + itemsIndexed(list) { idx, item -> + StorageListItem(title = item, count = 1, isDefaultFolder = false) + if(idx != list.lastIndex) { + HorizontalDivider(modifier = Modifier + .height(1.dp) + .background(color = DoraColorTokens.G1)) + } + } + } +} + +@Preview +@Composable +fun PreviewStorageScreen() { + StorageScreen() +} \ No newline at end of file From 85b168e2e5e498f76f43e011f50f0af68ef0af82 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 17:13:29 +0900 Subject: [PATCH 03/13] =?UTF-8?q?[chore]=20=EB=9D=BC=EC=9D=B4=EB=B8=8C?= =?UTF-8?q?=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 95a0eed7..d0a2ec3e 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -64,12 +64,13 @@ android { } dependencies { - implementation(project(":feature:home")) implementation(project(":domain")) implementation(project(":data")) implementation(project(":core:coroutine")) implementation(project(":core:designsystem")) implementation(project(":core:navigation")) + implementation(project(":feature:home")) + implementation(project(":feature:storage")) implementation(libs.core.ktx) implementation(libs.kotlin.android) From 3654f2e88993aec7eb53655b1909a496d1d6e1db Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 17:13:50 +0900 Subject: [PATCH 04/13] =?UTF-8?q?[feat]=20storage=20navigation=20=EC=84=B8?= =?UTF-8?q?=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mashup/dorabangs/navigation/MainNavHost.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt index db330e55..956753e4 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/MainNavHost.kt @@ -5,6 +5,7 @@ import androidx.compose.ui.Modifier import androidx.navigation.compose.NavHost import com.mashup.core.navigation.NavigationRoute import com.mashup.dorabangs.feature.navigation.homeNavigation +import com.mashup.dorabangs.feature.storage.navigation.storageNavigation @Composable fun MainNavHost( @@ -18,5 +19,6 @@ fun MainNavHost( startDestination = startDestination, ) { homeNavigation() + storageNavigation() } } From eeda5e1c45b8d5eb04aa5c7d45a6e079b5424dba Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 17:14:51 +0900 Subject: [PATCH 05/13] =?UTF-8?q?[feat]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20UI=20?= =?UTF-8?q?=EA=B0=9C=EB=B0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/storage/StorageComponent.kt | 73 -------- .../feature/storage/StorageScreen.kt | 118 ------------- .../storage/navigation/StorageNavigation.kt | 18 ++ .../storage/storage/StorageFolderListItem.kt | 166 ++++++++++++++++++ .../feature/storage/storage/StorageScreen.kt | 81 +++++++++ .../storage/storage/StorageViewModel.kt | 21 +++ .../storage/model/StorageListSideEffect.kt | 5 + .../storage/storage/model/StorageListState.kt | 45 +++++ .../storage/src/main/res/values/string.xml | 11 ++ 9 files changed, 347 insertions(+), 191 deletions(-) delete mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt delete mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt create mode 100644 feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt create mode 100644 feature/storage/src/main/res/values/string.xml diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt deleted file mode 100644 index 99501072..00000000 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageComponent.kt +++ /dev/null @@ -1,73 +0,0 @@ -package com.mashup.dorabangs.feature.storage - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens -import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens - -@Composable -fun StorageListItem( - title: String, - count: Int, - isDefaultFolder: Boolean -) { - Box( - modifier = Modifier - .fillMaxWidth() - .padding(vertical = 14.dp) - ) { - Row( - modifier = Modifier.align(Alignment.CenterStart) - ) { - Icon( - painter = painterResource(id = androidx.core.R.drawable.ic_call_answer), - contentDescription = "folderIcon" - ) - Text( - modifier = Modifier - .padding(start = 12.dp) - .align(Alignment.CenterVertically), - textAlign = TextAlign.Center, - text = title, - color = DoraColorTokens.G9, - style = DoraTypoTokens.caption3Medium - ) - } - Row( - modifier = Modifier.align(Alignment.CenterEnd) - ) { - Text( - modifier = Modifier - .padding(end = 12.dp) - .align(Alignment.CenterVertically), - text = "$count", - color = DoraColorTokens.G4, - style = DoraTypoTokens.caption3Medium - ) - val icon = - if(isDefaultFolder) androidx.core.R.drawable.ic_call_answer - else androidx.core.R.drawable.ic_call_answer - Icon( - painter = painterResource(id = icon), - contentDescription = "folderIcon" - ) - } - } -} - -@Preview -@Composable -fun PreviewStorageListItem() { - StorageListItem(title = "디자인", count = 3, isDefaultFolder = true) -} \ No newline at end of file diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt deleted file mode 100644 index 884d7e58..00000000 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/StorageScreen.kt +++ /dev/null @@ -1,118 +0,0 @@ -package com.mashup.dorabangs.feature.storage - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -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.lazy.LazyColumn -import androidx.compose.foundation.lazy.itemsIndexed -import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.res.painterResource -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.core.R -import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens -import com.mashup.dorabangs.core.designsystem.theme.DoraRoundTokens -import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens - -@Composable -fun StorageRoute() { - -} - -@Composable -fun StorageScreen() { - Column( - modifier = Modifier.fillMaxSize().background(color = DoraColorTokens.G1) - ) { - StorageTopAppBar() - Spacer(modifier = Modifier.height(20.dp)) - Column( - modifier = Modifier.padding(horizontal = 20.dp) - ) { - StorageDefaultFolder() - Spacer(modifier = Modifier.height(20.dp)) - StorageCustomFolder() - } - } -} - -@Composable -fun StorageTopAppBar( - modifier: Modifier = Modifier -) { - Row( - modifier = modifier - .fillMaxWidth() - .background(Color.Transparent) - .padding(horizontal = 20.dp, vertical = 12.dp), - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text( - text = "보관함", - style = DoraTypoTokens.base1Bold - ) - Icon( - painter = painterResource(id = R.drawable.ic_call_answer), - contentDescription = "folderIcon" - ) - } -} - -@Composable -fun StorageDefaultFolder( - list: List = listOf("다연", "석주", "호현") -) { - Column( - modifier = Modifier - .fillMaxWidth() - .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) - .padding(horizontal = 12.dp) - ) { - list.forEachIndexed { idx, item -> - StorageListItem(title = item, count = 1, isDefaultFolder = true) - if(idx != list.lastIndex) { - HorizontalDivider(modifier = Modifier - .height(1.dp) - .background(color = DoraColorTokens.G1)) - } - } - - } -} - -@Composable -fun StorageCustomFolder( - list: List = listOf("다연", "석주", "호현") -) { - LazyColumn( - modifier = Modifier.fillMaxWidth() - .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) - .padding(horizontal = 12.dp) - ) { - itemsIndexed(list) { idx, item -> - StorageListItem(title = item, count = 1, isDefaultFolder = false) - if(idx != list.lastIndex) { - HorizontalDivider(modifier = Modifier - .height(1.dp) - .background(color = DoraColorTokens.G1)) - } - } - } -} - -@Preview -@Composable -fun PreviewStorageScreen() { - StorageScreen() -} \ No newline at end of file diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt new file mode 100644 index 00000000..807c915a --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt @@ -0,0 +1,18 @@ +package com.mashup.dorabangs.feature.storage.navigation + +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable +import com.mashup.core.navigation.NavigationRoute +import com.mashup.dorabangs.feature.storage.storage.StorageRoute + +fun NavController.navigateToStorage(navOptions: NavOptions) = navigate(NavigationRoute.StorageScreen.route, navOptions) + +fun NavGraphBuilder.storageNavigation() { + composable( + route = NavigationRoute.StorageScreen.route, + ) { + StorageRoute() + } +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt new file mode 100644 index 00000000..68f36242 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -0,0 +1,166 @@ +package com.mashup.dorabangs.feature.storage.storage + +import androidx.compose.foundation.background +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.RectangleShape +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.dp +import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens +import com.mashup.dorabangs.core.designsystem.theme.DoraRoundTokens +import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens +import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem +import com.mashup.dorabangs.feature.storage.storage.model.StorageListState + +@Composable +fun StorageFolderList( + customList: List = StorageListState.customFolderList(), + navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, + onClickAddMoreButton: (StorageFolderItem) -> Unit = {}, +) { + LazyColumn( + modifier = Modifier.padding(horizontal = 20.dp), + ) { + item { + Spacer(modifier = Modifier.height(20.dp)) + StorageDefaultFolder() + Spacer(modifier = Modifier.height(20.dp)) + } + itemsIndexed(customList) { idx, item -> + val isFirstItem = idx == 0 + val isLastItem = idx == customList.lastIndex + StorageListItem( + item = item, + isFirstItem = isFirstItem, + isLastItem = isLastItem, + navigateToStorageDetail = { navigateToStorageDetail(item) }, + onClickAddMoreButton = { onClickAddMoreButton(item) }, + ) + if (!isLastItem) { + HorizontalDivider( + modifier = + Modifier + .height(0.5.dp) + .background(color = DoraColorTokens.G1), + ) + } + } + item { + Spacer(modifier = Modifier.height(60.dp)) + } + } +} + +@Composable +fun StorageDefaultFolder( + list: List = StorageListState.defaultFolderList(), + navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, +) { + Column( + modifier = + Modifier + .fillMaxWidth() + .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) + .padding(horizontal = 12.dp), + ) { + list.forEachIndexed { idx, item -> + StorageListItem( + item = item, + navigateToStorageDetail = { navigateToStorageDetail(item) }, + ) + if (idx != list.lastIndex) { + HorizontalDivider( + modifier = + Modifier + .height(0.5.dp) + .background(color = DoraColorTokens.G1), + ) + } + } + } +} + +@Composable +fun StorageListItem( + item: StorageFolderItem, + isDefault: Boolean = false, + isFirstItem: Boolean = false, + isLastItem: Boolean = false, + navigateToStorageDetail: () -> Unit = {}, + onClickAddMoreButton: () -> Unit = {}, +) { + val shape = + if (isFirstItem) { + RoundedCornerShape(topStart = 12.dp, topEnd = 12.dp) + } else if (isLastItem) { + RoundedCornerShape(bottomStart = 12.dp, bottomEnd = 12.dp) + } else { + RectangleShape + } + Box( + modifier = + Modifier + .fillMaxWidth() + .background(color = DoraColorTokens.P1, shape = shape) + .padding(vertical = 14.dp, horizontal = 12.dp), + ) { + Row( + modifier = Modifier.align(Alignment.CenterStart).clickable { navigateToStorageDetail() }, + ) { + Icon( + painter = painterResource(id = androidx.core.R.drawable.ic_call_answer), + contentDescription = "folderIcon", + ) + Text( + modifier = + Modifier + .padding(start = 12.dp) + .align(Alignment.CenterVertically), + textAlign = TextAlign.Center, + text = item.folderTitle, + color = DoraColorTokens.G9, + style = DoraTypoTokens.caption3Medium, + ) + } + Row( + modifier = Modifier.align(Alignment.CenterEnd), + ) { + Text( + modifier = + Modifier + .padding(end = 12.dp) + .align(Alignment.CenterVertically), + text = "${item.postCount}", + color = DoraColorTokens.G4, + style = DoraTypoTokens.caption3Medium, + ) + val icon = + if (isDefault) { + androidx.core.R.drawable.ic_call_answer + } else { + androidx.core.R.drawable.ic_call_answer + } + Icon( + modifier = Modifier.clickable { if (isDefault) navigateToStorageDetail() else onClickAddMoreButton() }, + painter = painterResource(id = icon), + contentDescription = "folderIcon", + ) + } + } +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt new file mode 100644 index 00000000..41841e62 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageScreen.kt @@ -0,0 +1,81 @@ +package com.mashup.dorabangs.feature.storage.storage + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +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.material3.Icon +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +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.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.hilt.navigation.compose.hiltViewModel +import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens +import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens +import com.mashup.dorabangs.feature.storage.R +import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem + +@Composable +fun StorageRoute( + storageViewModel: StorageViewModel = hiltViewModel(), + navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, +) { + StorageScreen( + navigateToStorageDetail = navigateToStorageDetail, + onClickAddMoreButton = storageViewModel::showEditFolderBottomSheet, + ) +} + +@Composable +fun StorageScreen( + navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, + onClickAddMoreButton: (StorageFolderItem) -> Unit = {}, +) { + Column( + modifier = Modifier + .fillMaxSize() + .background(color = DoraColorTokens.G1), + ) { + StorageTopAppBar() + StorageFolderList( + navigateToStorageDetail = navigateToStorageDetail, + onClickAddMoreButton = onClickAddMoreButton, + ) + } +} + +@Composable +fun StorageTopAppBar(modifier: Modifier = Modifier) { + Row( + modifier = + modifier + .fillMaxWidth() + .height(48.dp) + .padding(horizontal = 20.dp, vertical = 12.dp) + .background(Color.Transparent), + horizontalArrangement = Arrangement.SpaceBetween, + ) { + Text( + text = stringResource(id = R.string.storage), + style = DoraTypoTokens.base1Bold, + ) + Icon( + painter = painterResource(id = com.google.android.material.R.drawable.ic_call_answer), + contentDescription = "folderIcon", + ) + } +} + +@Preview +@Composable +fun PreviewStorageScreen() { + StorageRoute() +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt new file mode 100644 index 00000000..7323b3bb --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt @@ -0,0 +1,21 @@ +package com.mashup.dorabangs.feature.storage.storage + +import androidx.lifecycle.ViewModel +import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem +import com.mashup.dorabangs.feature.storage.storage.model.StorageListSideEffect +import com.mashup.dorabangs.feature.storage.storage.model.StorageListState +import dagger.hilt.android.lifecycle.HiltViewModel +import org.orbitmvi.orbit.ContainerHost +import org.orbitmvi.orbit.syntax.simple.intent +import org.orbitmvi.orbit.syntax.simple.postSideEffect +import org.orbitmvi.orbit.viewmodel.container +import javax.inject.Inject + +@HiltViewModel +class StorageViewModel @Inject constructor() : ViewModel(), ContainerHost { + override val container = container(StorageListState()) + + fun showEditFolderBottomSheet(item: StorageFolderItem) = intent { + postSideEffect(sideEffect = StorageListSideEffect.showEditFolderBottomSheet) + } + } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt new file mode 100644 index 00000000..3e507a48 --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt @@ -0,0 +1,5 @@ +package com.mashup.dorabangs.feature.storage.storage.model + +sealed class StorageListSideEffect { + object showEditFolderBottomSheet: StorageListSideEffect() +} \ No newline at end of file diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt new file mode 100644 index 00000000..0eacf09b --- /dev/null +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt @@ -0,0 +1,45 @@ +package com.mashup.dorabangs.feature.storage.storage.model + +data class StorageListState( + val defaultStorageFolderList: List = listOf(), + val customStorageFolderList: List = listOf(), +) { + companion object { + fun defaultFolderList() = + listOf( + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + ) + fun customFolderList() = + listOf( + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + + ) + } +} + +data class StorageFolderItem( + val folderTitle: String = "", + val postCount: Int = 0, +) + +enum class StorageDefaultFolder(val title: String) { + ALL("모든 링크"), + FAVORITE("즐겨찾기"), + LATER_READ("나중에 읽을 링크"), +} diff --git a/feature/storage/src/main/res/values/string.xml b/feature/storage/src/main/res/values/string.xml new file mode 100644 index 00000000..ee9f18ea --- /dev/null +++ b/feature/storage/src/main/res/values/string.xml @@ -0,0 +1,11 @@ + + + 나중에 읽을 링크 + 모든 링크 + 즐겨찾기 + 최신순 + 과거순 + 전체 + 읽지 않은 + 보관함 + \ No newline at end of file From 3c12bb1a0c001e6439cb1ec6bf88b9fa6937ea2a Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 17:22:16 +0900 Subject: [PATCH 06/13] =?UTF-8?q?[fix]=20lint=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/feature/storage/storage/StorageViewModel.kt | 2 +- .../feature/storage/storage/model/StorageListSideEffect.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt index 7323b3bb..c16b0e1b 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt @@ -16,6 +16,6 @@ class StorageViewModel @Inject constructor() : ViewModel(), ContainerHost(StorageListState()) fun showEditFolderBottomSheet(item: StorageFolderItem) = intent { - postSideEffect(sideEffect = StorageListSideEffect.showEditFolderBottomSheet) + postSideEffect(sideEffect = StorageListSideEffect.ShowEditFolderBottomSheet) } } diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt index 3e507a48..5a2cdf2d 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt @@ -1,5 +1,5 @@ package com.mashup.dorabangs.feature.storage.storage.model sealed class StorageListSideEffect { - object showEditFolderBottomSheet: StorageListSideEffect() + object ShowEditFolderBottomSheet: StorageListSideEffect() } \ No newline at end of file From 350f48e2a580afbeadb09eb8c69beb4d62a8bb78 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 17:31:52 +0900 Subject: [PATCH 07/13] =?UTF-8?q?[fix]=20lint=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/storage/build.gradle.kts | 4 +- .../storage/ExampleInstrumentedTest.kt | 5 +- .../storage/storage/StorageFolderListItem.kt | 47 +++++++++---------- .../storage/storage/StorageViewModel.kt | 4 +- .../storage/model/StorageListSideEffect.kt | 4 +- .../feature/storage/ExampleUnitTest.kt | 2 +- 6 files changed, 30 insertions(+), 36 deletions(-) diff --git a/feature/storage/build.gradle.kts b/feature/storage/build.gradle.kts index 3826bb20..49854b8d 100644 --- a/feature/storage/build.gradle.kts +++ b/feature/storage/build.gradle.kts @@ -21,7 +21,7 @@ android { isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" + "proguard-rules.pro", ) } } @@ -73,4 +73,4 @@ dependencies { implementation(libs.orbit.core) implementation(libs.orbit.viewmodel) implementation(libs.orbit.compose) -} \ No newline at end of file +} diff --git a/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt b/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt index d213273c..771ce998 100644 --- a/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt +++ b/feature/storage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt @@ -1,9 +1,8 @@ package com.mashup.dorabangs.feature.storage -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry import org.junit.Assert.assertEquals - import org.junit.Test import org.junit.runner.RunWith @@ -20,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("com.mashup.dorabangs.feature.storage.test", appContext.packageName) } -} \ No newline at end of file +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index 68f36242..c407cbc9 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -55,9 +55,9 @@ fun StorageFolderList( if (!isLastItem) { HorizontalDivider( modifier = - Modifier - .height(0.5.dp) - .background(color = DoraColorTokens.G1), + Modifier + .height(0.5.dp) + .background(color = DoraColorTokens.G1), ) } } @@ -73,11 +73,10 @@ fun StorageDefaultFolder( navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, ) { Column( - modifier = - Modifier - .fillMaxWidth() - .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) - .padding(horizontal = 12.dp), + modifier = Modifier + .fillMaxWidth() + .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) + .padding(horizontal = 12.dp), ) { list.forEachIndexed { idx, item -> StorageListItem( @@ -86,10 +85,9 @@ fun StorageDefaultFolder( ) if (idx != list.lastIndex) { HorizontalDivider( - modifier = - Modifier - .height(0.5.dp) - .background(color = DoraColorTokens.G1), + modifier = Modifier + .height(0.5.dp) + .background(color = DoraColorTokens.G1), ) } } @@ -114,11 +112,10 @@ fun StorageListItem( RectangleShape } Box( - modifier = - Modifier - .fillMaxWidth() - .background(color = DoraColorTokens.P1, shape = shape) - .padding(vertical = 14.dp, horizontal = 12.dp), + modifier = Modifier + .fillMaxWidth() + .background(color = DoraColorTokens.P1, shape = shape) + .padding(vertical = 14.dp, horizontal = 12.dp), ) { Row( modifier = Modifier.align(Alignment.CenterStart).clickable { navigateToStorageDetail() }, @@ -128,10 +125,9 @@ fun StorageListItem( contentDescription = "folderIcon", ) Text( - modifier = - Modifier - .padding(start = 12.dp) - .align(Alignment.CenterVertically), + modifier = Modifier + .padding(start = 12.dp) + .align(Alignment.CenterVertically), textAlign = TextAlign.Center, text = item.folderTitle, color = DoraColorTokens.G9, @@ -142,10 +138,9 @@ fun StorageListItem( modifier = Modifier.align(Alignment.CenterEnd), ) { Text( - modifier = - Modifier - .padding(end = 12.dp) - .align(Alignment.CenterVertically), + modifier = Modifier + .padding(end = 12.dp) + .align(Alignment.CenterVertically), text = "${item.postCount}", color = DoraColorTokens.G4, style = DoraTypoTokens.caption3Medium, @@ -157,7 +152,7 @@ fun StorageListItem( androidx.core.R.drawable.ic_call_answer } Icon( - modifier = Modifier.clickable { if (isDefault) navigateToStorageDetail() else onClickAddMoreButton() }, + modifier = Modifier.clickable { if (isDefault) navigateToStorageDetail() else onClickAddMoreButton() }, painter = painterResource(id = icon), contentDescription = "folderIcon", ) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt index c16b0e1b..f1721005 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageViewModel.kt @@ -13,9 +13,9 @@ import javax.inject.Inject @HiltViewModel class StorageViewModel @Inject constructor() : ViewModel(), ContainerHost { - override val container = container(StorageListState()) + override val container = container(StorageListState()) fun showEditFolderBottomSheet(item: StorageFolderItem) = intent { postSideEffect(sideEffect = StorageListSideEffect.ShowEditFolderBottomSheet) } - } +} diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt index 5a2cdf2d..07ee8a6c 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListSideEffect.kt @@ -1,5 +1,5 @@ package com.mashup.dorabangs.feature.storage.storage.model sealed class StorageListSideEffect { - object ShowEditFolderBottomSheet: StorageListSideEffect() -} \ No newline at end of file + object ShowEditFolderBottomSheet : StorageListSideEffect() +} diff --git a/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt b/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt index 21b7922a..dd35f39a 100644 --- a/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt +++ b/feature/storage/src/test/java/com/mashup/dorabangs/feature/storage/ExampleUnitTest.kt @@ -13,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} From a76b77eb3a36afb9527d246649c55680d2bb12e6 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 17:44:01 +0900 Subject: [PATCH 08/13] =?UTF-8?q?[fix]=20=EB=B3=B4=EA=B4=80=ED=95=A8=20nav?= =?UTF-8?q?igation=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mashup/dorabangs/navigation/DoraAppState.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt b/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt index 08ecb378..4f7b2e44 100644 --- a/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt +++ b/app/src/main/java/com/mashup/dorabangs/navigation/DoraAppState.kt @@ -11,6 +11,7 @@ import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions import com.mashup.dorabangs.core.designsystem.component.bottomnavigation.BottomNavigationDestination import com.mashup.dorabangs.feature.navigation.navigateToHome +import com.mashup.dorabangs.feature.storage.navigation.navigateToStorage import okhttp3.internal.toImmutableList @Composable @@ -41,7 +42,7 @@ class DoraAppState( when (bottomNavigationDestination) { BottomNavigationDestination.HOME -> navController.navigateToHome(bottomNavigationOption) - BottomNavigationDestination.STORAGE -> navController.navigateToHome(bottomNavigationOption) + BottomNavigationDestination.STORAGE -> navController.navigateToStorage(bottomNavigationOption) } } From a968d0f2a28db86cd47ee700860833e120a20c93 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 18:34:54 +0900 Subject: [PATCH 09/13] =?UTF-8?q?[fix]=20=EA=B8=B0=EB=B3=B8=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=20shape=20=EC=A7=80=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/storage/StorageFolderListItem.kt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index c407cbc9..d98414cd 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -21,6 +21,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens import com.mashup.dorabangs.core.designsystem.theme.DoraRoundTokens @@ -74,13 +75,15 @@ fun StorageDefaultFolder( ) { Column( modifier = Modifier - .fillMaxWidth() - .background(color = DoraColorTokens.P1, shape = DoraRoundTokens.Round12) - .padding(horizontal = 12.dp), + .fillMaxWidth(), ) { list.forEachIndexed { idx, item -> + val isFirstItem = idx == 0 + val isLastItem = idx == list.lastIndex StorageListItem( item = item, + isFirstItem = isFirstItem, + isLastItem = isLastItem, navigateToStorageDetail = { navigateToStorageDetail(item) }, ) if (idx != list.lastIndex) { @@ -159,3 +162,9 @@ fun StorageListItem( } } } + +@Preview +@Composable +fun PreviewStorageFolderList() { + StorageFolderList() +} \ No newline at end of file From 2d560a2a925a79b4f739af100cef602cf5579b00 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 19:02:04 +0900 Subject: [PATCH 10/13] =?UTF-8?q?[fix]=20lint=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dorabangs/feature/storage/storage/StorageFolderListItem.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index d98414cd..59658b24 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -24,7 +24,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.mashup.dorabangs.core.designsystem.theme.DoraColorTokens -import com.mashup.dorabangs.core.designsystem.theme.DoraRoundTokens import com.mashup.dorabangs.core.designsystem.theme.DoraTypoTokens import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem import com.mashup.dorabangs.feature.storage.storage.model.StorageListState @@ -167,4 +166,4 @@ fun StorageListItem( @Composable fun PreviewStorageFolderList() { StorageFolderList() -} \ No newline at end of file +} From 104fb38a8381eea9fa7167f8e2e6c10b270d3cc1 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 19:40:28 +0900 Subject: [PATCH 11/13] =?UTF-8?q?fix=20:=20=EB=B3=80=EC=88=98=20=ED=95=A0?= =?UTF-8?q?=EB=8B=B9=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/storage/StorageFolderListItem.kt | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index 59658b24..4682f180 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -43,16 +43,14 @@ fun StorageFolderList( Spacer(modifier = Modifier.height(20.dp)) } itemsIndexed(customList) { idx, item -> - val isFirstItem = idx == 0 - val isLastItem = idx == customList.lastIndex StorageListItem( item = item, - isFirstItem = isFirstItem, - isLastItem = isLastItem, + isFirstItem = idx == 0, + isLastItem = idx == customList.lastIndex, navigateToStorageDetail = { navigateToStorageDetail(item) }, onClickAddMoreButton = { onClickAddMoreButton(item) }, ) - if (!isLastItem) { + if (idx != customList.lastIndex) { HorizontalDivider( modifier = Modifier @@ -77,12 +75,10 @@ fun StorageDefaultFolder( .fillMaxWidth(), ) { list.forEachIndexed { idx, item -> - val isFirstItem = idx == 0 - val isLastItem = idx == list.lastIndex StorageListItem( item = item, - isFirstItem = isFirstItem, - isLastItem = isLastItem, + isFirstItem = idx == 0, + isLastItem = idx == list.lastIndex, navigateToStorageDetail = { navigateToStorageDetail(item) }, ) if (idx != list.lastIndex) { From f954f8c7d52279ce5b1d19496958abeb5f275b02 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 19:47:46 +0900 Subject: [PATCH 12/13] =?UTF-8?q?fix=20:=20listitem=20=EC=A4=84=EB=B0=94?= =?UTF-8?q?=EA=BF=88=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/storage/storage/StorageFolderListItem.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index 4682f180..f043e007 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -116,7 +116,9 @@ fun StorageListItem( .padding(vertical = 14.dp, horizontal = 12.dp), ) { Row( - modifier = Modifier.align(Alignment.CenterStart).clickable { navigateToStorageDetail() }, + modifier = Modifier + .align(Alignment.CenterStart) + .clickable { navigateToStorageDetail() }, ) { Icon( painter = painterResource(id = androidx.core.R.drawable.ic_call_answer), From 35a0e0494237e6abafcfdf00257fdf3580b883d9 Mon Sep 17 00:00:00 2001 From: ddyeon Date: Sat, 29 Jun 2024 20:21:35 +0900 Subject: [PATCH 13/13] =?UTF-8?q?fix=20:=20data=20class=20title=20type=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../storage/storage/StorageFolderListItem.kt | 2 +- .../storage/storage/model/StorageListState.kt | 38 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt index f043e007..edc7c268 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt @@ -129,7 +129,7 @@ fun StorageListItem( .padding(start = 12.dp) .align(Alignment.CenterVertically), textAlign = TextAlign.Center, - text = item.folderTitle, + text = item.folderTitle.title, color = DoraColorTokens.G9, style = DoraTypoTokens.caption3Medium, ) diff --git a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt index 0eacf09b..5b1da38b 100644 --- a/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt +++ b/feature/storage/src/main/java/com/mashup/dorabangs/feature/storage/storage/model/StorageListState.kt @@ -7,34 +7,34 @@ data class StorageListState( companion object { fun defaultFolderList() = listOf( - StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ, postCount = 0), ) fun customFolderList() = listOf( - StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.ALL.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE.title, postCount = 0), - StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ.title, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.ALL, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.FAVORITE, postCount = 0), + StorageFolderItem(folderTitle = StorageDefaultFolder.LATER_READ, postCount = 0), ) } } data class StorageFolderItem( - val folderTitle: String = "", + val folderTitle: StorageDefaultFolder, val postCount: Int = 0, )