-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
보관함 탭 UI 개발 #37
Merged
Merged
보관함 탭 UI 개발 #37
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ae4611f
[chore] 보관함 feature 모듈 생성
ddyeon 043fb3c
[feat] 보관함 리스트 컴포넌트 개발
ddyeon 85b168e
[chore] 라이브러리 추가
ddyeon 3654f2e
[feat] storage navigation 세팅
ddyeon eeda5e1
[feat] 보관함 폴더 리스트 UI 개발
ddyeon 3c12bb1
[fix] lint 변경
ddyeon 350f48e
[fix] lint 변경
ddyeon e512293
Merge branch 'develop' into feature/storage
ddyeon a76b77e
[fix] 보관함 navigation설정
ddyeon a968d0f
[fix] 기본 폴더 shape 지정
ddyeon 2d560a2
[fix] lint 변경
ddyeon 104fb38
fix : 변수 할당 제거
ddyeon f954f8c
fix : listitem 줄바꿈 정리
ddyeon 35a0e04
fix : data class title type 변경
ddyeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
22 changes: 22 additions & 0 deletions
22
...rage/src/androidTest/java/com/mashup/dorabangs/feature/storage/ExampleInstrumentedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.mashup.dorabangs.feature.storage | ||
|
||
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 | ||
|
||
/** | ||
* 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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
</manifest> |
18 changes: 18 additions & 0 deletions
18
...torage/src/main/java/com/mashup/dorabangs/feature/storage/navigation/StorageNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} |
169 changes: 169 additions & 0 deletions
169
...orage/src/main/java/com/mashup/dorabangs/feature/storage/storage/StorageFolderListItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
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.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 | ||
import com.mashup.dorabangs.feature.storage.storage.model.StorageFolderItem | ||
import com.mashup.dorabangs.feature.storage.storage.model.StorageListState | ||
|
||
@Composable | ||
fun StorageFolderList( | ||
customList: List<StorageFolderItem> = 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<StorageFolderItem> = StorageListState.defaultFolderList(), | ||
navigateToStorageDetail: (StorageFolderItem) -> Unit = {}, | ||
) { | ||
Column( | ||
modifier = Modifier | ||
.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) { | ||
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() }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 정리좀 ㅎ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 수정 완료!! |
||
) { | ||
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", | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun PreviewStorageFolderList() { | ||
StorageFolderList() | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
추가하면 조을듯 ~