Skip to content
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

Feature/UI #18

Merged
merged 15 commits into from
Dec 16, 2024
Merged
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion app/src/main/java/kr/co/seedocs/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import kr.co.main.Main
import kr.co.ui.theme.SeeDocsTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()

setContent {

SeeDocsTheme {
Main()
}
}
}
}
3 changes: 3 additions & 0 deletions core/navigation/src/main/java/kr/co/navigation/Route.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ sealed interface Route {

@Serializable
data class View(val channel: String) : Route

@Serializable
data object Pdf : Route
}

sealed interface MainNavigation {
Expand Down
2 changes: 1 addition & 1 deletion core/ui/src/main/java/kr/co/ui/theme/Color.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ internal val LightColors = SeeDocsColors(

internal val DarkColors = SeeDocsColors(
material = darkColorScheme(),
bg = Gray7,
bg = Black,
text = Gray1,
highlight = Blue2,
icon = Gray1,
Expand Down
82 changes: 82 additions & 0 deletions core/ui/src/main/java/kr/co/ui/widget/FileBox.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package kr.co.ui.widget

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
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.Color
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kr.co.ui.icon.SeeDocsIcon
import kr.co.ui.icon.seedocsicon.PDF
import kr.co.ui.theme.SeeDocsTheme
import kr.co.ui.theme.Theme

@Composable
fun FileBox(
name: String,
onFileClick: () -> Unit = {},
) {
Row(
modifier = Modifier
.fillMaxWidth()
.clickable(onClick = onFileClick)
.padding(
vertical = 12.dp,
horizontal = 8.dp
)
.semantics {
contentDescription = name
},
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(24.dp)
) {
Icon(
modifier = Modifier.size(32.dp)
.clearAndSetSemantics { },

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clearAndSetSemantics는 어떤 의도로 추가했나요?

imageVector = SeeDocsIcon.PDF,
contentDescription = null,
tint = Color.Unspecified

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Color.Unspecified 로 설정하신 이유가 궁금합니다.

)

Column(
modifier = Modifier
.clearAndSetSemantics { },
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
Text(
modifier = Modifier
.clearAndSetSemantics { },
text = name,
style = Theme.typography.body2sb,
color = Theme.colors.text
)
Text(
modifier = Modifier
.clearAndSetSemantics { },
text = "2023.01.01",
style = Theme.typography.caption1r,
color = Theme.colors.grayText
)
}
}
}

@Preview
@Composable
private fun Preview() {
SeeDocsTheme {
FileBox("Effective Kotlin")
}
}
77 changes: 77 additions & 0 deletions feature/bookmark/src/main/java/kr/co/bookmark/BookmarkScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package kr.co.bookmark

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
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.items
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kr.co.seedocs.feature.bookmark.R
import kr.co.ui.theme.SeeDocsTheme
import kr.co.ui.theme.Theme
import kr.co.ui.widget.FileBox

@Composable
internal fun BookmarkRoute(
padding: PaddingValues
) {
BookmarkScreen(
padding = padding
)
}

@Composable
private fun BookmarkScreen(
padding: PaddingValues,
) {
Box(
modifier = Modifier
.fillMaxSize()
.background(Theme.colors.bg)
.padding(padding)
) {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp),
verticalArrangement = Arrangement.spacedBy(24.dp)
) {
item {
Spacer(Modifier.height(32.dp))

Text(
text = stringResource(R.string.feature_bookmark_bookmark),
style = Theme.typography.body1sb,
color = Theme.colors.text
)
}

items(listOf("Effective Kotlin", "Android Developer")) { file ->
FileBox(
name = file
)
}
}
}
}

@Preview
@Composable
private fun Preview() {
SeeDocsTheme {
BookmarkScreen(
padding = PaddingValues()
)
}
}
4 changes: 0 additions & 4 deletions feature/bookmark/src/main/java/kr/co/bookmark/MyClass.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package kr.co.navigation

import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import kr.co.bookmark.BookmarkRoute

fun NavGraphBuilder.bookmarkNavGraph(
padding: PaddingValues
) {
composable<MainNavigation.Bookmark> {
BookmarkRoute(
padding = padding
)
}
}
4 changes: 4 additions & 0 deletions feature/bookmark/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="feature_bookmark_bookmark">북마크</string>
</resources>
113 changes: 113 additions & 0 deletions feature/explore/src/main/java/kr/co/explore/ExploreScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
package kr.co.explore

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import kr.co.ui.theme.SeeDocsTheme
import kr.co.ui.theme.Theme
import kr.co.ui.widget.FileBox
import kr.co.widget.FolderBox

@Composable
internal fun ExploreRoute(
padding: PaddingValues,
navigateToPdf: () -> Unit = {}
) {

ExploreScreen(
padding = padding,
onFileClick = navigateToPdf
)
}

@Composable
private fun ExploreScreen(
padding: PaddingValues,
onFileClick: () -> Unit = {}
) {
Box(
modifier = Modifier
.fillMaxSize()
.padding(padding)
.background(color = Theme.colors.bg)
) {
LazyVerticalGrid(
contentPadding = PaddingValues(
top = 32.dp,
start = 16.dp,
end = 16.dp,
),
columns = GridCells.Fixed(2),
horizontalArrangement = Arrangement.spacedBy(12.dp),
verticalArrangement = Arrangement.spacedBy(24.dp)
) {
item(
span = { GridItemSpan(maxLineSpan) }
) {
Column(
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Text(
text = "파일 탐색",
style = Theme.typography.body1sb,
color = Theme.colors.text
)
Text(
text = buildAnnotatedString {
append("규상의 S24 >")
withStyle(
Theme.typography.caption1r.copy(color = Theme.colors.highlight)
.toSpanStyle()
) {
append("Download")
}
},
style = Theme.typography.caption1r,
color = Theme.colors.grayText,
)
}
}

items(listOf("Download", "Documents", "DCIM")) { folder ->
FolderBox(
name = folder
)
}

items(
items = listOf("Effective Kotlin", "Android Developer"),
span = { GridItemSpan(maxLineSpan) }
) { file ->
FileBox(
name = file,
onFileClick = onFileClick
)
}
}
}
}

@Preview
@Composable
private fun Preview() {
SeeDocsTheme {
ExploreScreen(
padding = PaddingValues(),
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package kr.co.explore

import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

의미없는 코드는 커밋에 포함되지 않도록 하시는게 좋을 것 같아요.
이를 방지하기 위해선 개발 계획을 잘 세우시는게 중요합니다.

4 changes: 0 additions & 4 deletions feature/explore/src/main/java/kr/co/explore/MyClass.kt

This file was deleted.

18 changes: 18 additions & 0 deletions feature/explore/src/main/java/kr/co/navigation/ExploreNavGraph.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package kr.co.navigation

import androidx.compose.foundation.layout.PaddingValues
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import kr.co.explore.ExploreRoute

fun NavGraphBuilder.exploreNavGraph(
padding: PaddingValues,
navigateToPdf: () -> Unit = {}
) {
composable<MainNavigation.Explore> {
ExploreRoute(
padding = padding,
navigateToPdf = navigateToPdf
)
}
}
Loading
Loading