diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 92b96fa..878040f 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -37,6 +37,7 @@ diff --git a/app/src/main/java/kr/co/seedocs/MainActivity.kt b/app/src/main/java/kr/co/seedocs/MainActivity.kt index be78208..390cc64 100644 --- a/app/src/main/java/kr/co/seedocs/MainActivity.kt +++ b/app/src/main/java/kr/co/seedocs/MainActivity.kt @@ -4,6 +4,8 @@ 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?) { @@ -11,7 +13,9 @@ class MainActivity : ComponentActivity() { enableEdgeToEdge() setContent { - + SeeDocsTheme { + Main() + } } } } \ No newline at end of file diff --git a/core/navigation/src/main/java/kr/co/navigation/Route.kt b/core/navigation/src/main/java/kr/co/navigation/Route.kt index 09d7ce6..b13418b 100644 --- a/core/navigation/src/main/java/kr/co/navigation/Route.kt +++ b/core/navigation/src/main/java/kr/co/navigation/Route.kt @@ -6,6 +6,9 @@ sealed interface Route { @Serializable data class View(val channel: String) : Route + + @Serializable + data object Pdf : Route } sealed interface MainNavigation { diff --git a/core/ui/src/main/java/kr/co/ui/theme/Color.kt b/core/ui/src/main/java/kr/co/ui/theme/Color.kt index 387a56c..d92c5ae 100644 --- a/core/ui/src/main/java/kr/co/ui/theme/Color.kt +++ b/core/ui/src/main/java/kr/co/ui/theme/Color.kt @@ -50,7 +50,7 @@ internal val LightColors = SeeDocsColors( internal val DarkColors = SeeDocsColors( material = darkColorScheme(), - bg = Gray7, + bg = Black, text = Gray1, highlight = Blue2, icon = Gray1, diff --git a/core/ui/src/main/java/kr/co/ui/widget/FileBox.kt b/core/ui/src/main/java/kr/co/ui/widget/FileBox.kt new file mode 100644 index 0000000..ef44f57 --- /dev/null +++ b/core/ui/src/main/java/kr/co/ui/widget/FileBox.kt @@ -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 { }, + imageVector = SeeDocsIcon.PDF, + contentDescription = null, + tint = 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") + } +} \ No newline at end of file diff --git a/feature/bookmark/src/main/java/kr/co/bookmark/BookmarkScreen.kt b/feature/bookmark/src/main/java/kr/co/bookmark/BookmarkScreen.kt new file mode 100644 index 0000000..b5206bf --- /dev/null +++ b/feature/bookmark/src/main/java/kr/co/bookmark/BookmarkScreen.kt @@ -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() + ) + } +} \ No newline at end of file diff --git a/feature/bookmark/src/main/java/kr/co/bookmark/MyClass.kt b/feature/bookmark/src/main/java/kr/co/bookmark/MyClass.kt deleted file mode 100644 index 2e4cb9b..0000000 --- a/feature/bookmark/src/main/java/kr/co/bookmark/MyClass.kt +++ /dev/null @@ -1,4 +0,0 @@ -package kr.co.bookmark - -class MyClass { -} \ No newline at end of file diff --git a/feature/bookmark/src/main/java/kr/co/navigation/BookmarkNavGraph.kt b/feature/bookmark/src/main/java/kr/co/navigation/BookmarkNavGraph.kt new file mode 100644 index 0000000..84866f2 --- /dev/null +++ b/feature/bookmark/src/main/java/kr/co/navigation/BookmarkNavGraph.kt @@ -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 { + BookmarkRoute( + padding = padding + ) + } +} \ No newline at end of file diff --git a/feature/bookmark/src/main/res/values/strings.xml b/feature/bookmark/src/main/res/values/strings.xml new file mode 100644 index 0000000..707052f --- /dev/null +++ b/feature/bookmark/src/main/res/values/strings.xml @@ -0,0 +1,4 @@ + + + 북마크 + \ No newline at end of file diff --git a/feature/explore/src/main/java/kr/co/explore/ExploreScreen.kt b/feature/explore/src/main/java/kr/co/explore/ExploreScreen.kt new file mode 100644 index 0000000..26afa58 --- /dev/null +++ b/feature/explore/src/main/java/kr/co/explore/ExploreScreen.kt @@ -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(), + ) + } +} \ No newline at end of file diff --git a/feature/explore/src/main/java/kr/co/explore/ExploreViewModel.kt b/feature/explore/src/main/java/kr/co/explore/ExploreViewModel.kt new file mode 100644 index 0000000..5687c83 --- /dev/null +++ b/feature/explore/src/main/java/kr/co/explore/ExploreViewModel.kt @@ -0,0 +1,5 @@ +package kr.co.explore + +import androidx.lifecycle.ViewModel +import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject diff --git a/feature/explore/src/main/java/kr/co/explore/MyClass.kt b/feature/explore/src/main/java/kr/co/explore/MyClass.kt deleted file mode 100644 index ce59b40..0000000 --- a/feature/explore/src/main/java/kr/co/explore/MyClass.kt +++ /dev/null @@ -1,4 +0,0 @@ -package kr.co.explore - -class MyClass { -} \ No newline at end of file diff --git a/feature/explore/src/main/java/kr/co/navigation/ExploreNavGraph.kt b/feature/explore/src/main/java/kr/co/navigation/ExploreNavGraph.kt new file mode 100644 index 0000000..f6786d3 --- /dev/null +++ b/feature/explore/src/main/java/kr/co/navigation/ExploreNavGraph.kt @@ -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 { + ExploreRoute( + padding = padding, + navigateToPdf = navigateToPdf + ) + } +} \ No newline at end of file diff --git a/feature/explore/src/main/java/kr/co/widget/FolderBox.kt b/feature/explore/src/main/java/kr/co/widget/FolderBox.kt new file mode 100644 index 0000000..953d25a --- /dev/null +++ b/feature/explore/src/main/java/kr/co/widget/FolderBox.kt @@ -0,0 +1,72 @@ +package kr.co.widget + +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.layout.Arrangement +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.foundation.shape.RoundedCornerShape +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.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import kr.co.ui.icon.SeeDocsIcon +import kr.co.ui.icon.seedocsicon.Folder +import kr.co.ui.theme.SeeDocsTheme +import kr.co.ui.theme.Theme + +@Composable +internal fun FolderBox( + name: String, + modifier: Modifier = Modifier, +) { + Box( + modifier = modifier + .border( + width = 1.dp, + color = Theme.colors.grayText, + shape = RoundedCornerShape(8.dp) + ) + .padding(8.dp), + contentAlignment = Alignment.CenterStart + ) { + Row( + modifier = Modifier.fillMaxWidth(), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(12.dp) + ) { + Icon( + imageVector = SeeDocsIcon.Folder, + contentDescription = "폴더", + tint = Theme.colors.grayText, + ) + + Text( + text = name, + style = Theme.typography.body2r, + color = Theme.colors.text + ) + } + } +} + +@Preview +@Composable +private fun Preview() { + SeeDocsTheme { + Box( + modifier = Modifier.background(Color.White) + ) { + FolderBox( + name = "Download", + modifier = Modifier + ) + } + } +} \ No newline at end of file diff --git a/feature/main/build.gradle.kts b/feature/main/build.gradle.kts index 73a10fe..6d06fd0 100644 --- a/feature/main/build.gradle.kts +++ b/feature/main/build.gradle.kts @@ -11,4 +11,5 @@ dependencies { implementation(projects.feature.explore) implementation(projects.feature.recent) implementation(projects.feature.bookmark) + implementation(projects.feature.pdf) } \ No newline at end of file diff --git a/feature/main/src/main/java/kr/co/main/MainBottomBar.kt b/feature/main/src/main/java/kr/co/main/MainBottomBar.kt index 383983a..8b9db57 100644 --- a/feature/main/src/main/java/kr/co/main/MainBottomBar.kt +++ b/feature/main/src/main/java/kr/co/main/MainBottomBar.kt @@ -7,6 +7,7 @@ import androidx.compose.animation.slideIn import androidx.compose.animation.slideOut import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.fillMaxHeight @@ -15,8 +16,8 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.selection.selectable +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon -import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -33,30 +34,33 @@ internal fun MainBottomBar( tabs: List, currentTab: MainTab?, onTabSelected: (MainTab) -> Unit, + modifier: Modifier = Modifier, ) { AnimatedVisibility( visible = visible, enter = fadeIn() + slideIn { IntOffset(0, it.height) }, exit = fadeOut() + slideOut { IntOffset(0, it.height) } ) { - Row( - modifier = Modifier - .fillMaxWidth() - .height(56.dp) - .background( - color = Theme.colors.bg - ), - ) { - VerticalDivider( + Column { + HorizontalDivider( thickness = 1.dp, color = Theme.colors.stroke ) - tabs.forEach { tab -> - Item( - tab = tab, - selected = tab == currentTab, - onClick = { onTabSelected(tab) } - ) + Row( + modifier = modifier + .fillMaxWidth() + .height(56.dp) + .background( + color = Theme.colors.bg + ), + ) { + tabs.forEach { tab -> + Item( + tab = tab, + selected = tab == currentTab, + onClick = { onTabSelected(tab) } + ) + } } } } diff --git a/feature/main/src/main/java/kr/co/main/MainScreen.kt b/feature/main/src/main/java/kr/co/main/MainScreen.kt index a40a966..85de151 100644 --- a/feature/main/src/main/java/kr/co/main/MainScreen.kt +++ b/feature/main/src/main/java/kr/co/main/MainScreen.kt @@ -1,15 +1,43 @@ package kr.co.main +import androidx.compose.animation.AnimatedVisibility +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideIn +import androidx.compose.animation.slideOut 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.Row import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon import androidx.compose.material3.Scaffold +import androidx.compose.material3.Text +import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.VerticalDivider import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment 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.IntOffset +import androidx.compose.ui.unit.dp import kr.co.main.navigation.MainNavHost import kr.co.main.navigation.MainNavigator import kr.co.main.navigation.MainTab import kr.co.main.navigation.rememberMainNavigator +import kr.co.ui.icon.SeeDocsIcon +import kr.co.ui.icon.seedocsicon.Search +import kr.co.ui.icon.seedocsicon.Settings +import kr.co.ui.theme.SeeDocsTheme import kr.co.ui.theme.Theme @Composable @@ -26,8 +54,14 @@ private fun MainScreen( navigator: MainNavigator, ) { Scaffold( + topBar = { + MainTopBar( + navigator.bottomBarVisible() + ) + }, bottomBar = { MainBottomBar( + modifier = Modifier.navigationBarsPadding(), visible = navigator.bottomBarVisible(), tabs = MainTab.entries, currentTab = navigator.currentTab(), @@ -49,4 +83,73 @@ private fun MainScreen( } ) } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun MainTopBar( + visible: Boolean, + onSearchClick: () -> Unit = {}, + onSettingClick: () -> Unit = {}, +) { + AnimatedVisibility( + visible = visible, + enter = fadeIn() + slideIn { IntOffset(0, -it.height) }, + exit = fadeOut() + slideOut { IntOffset(0, -it.height) } + ) { + Column { + TopAppBar( + title = { + Text( + text = buildAnnotatedString { + append("See") + withStyle( + Theme.typography.title1sb.copy(color = Theme.colors.highlight) + .toSpanStyle() + ) { + append("Docs") + } + }, + style = Theme.typography.title1sb, + ) + }, + actions = { + Row( + modifier = Modifier.padding(end = 16.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp) + ) { + Icon( + modifier = Modifier.size(24.dp), + imageVector = SeeDocsIcon.Search, + contentDescription = "파일 검색", + tint = Theme.colors.icon + ) + + Icon( + modifier = Modifier.size(24.dp), + imageVector = SeeDocsIcon.Settings, + contentDescription = "설정", + tint = Theme.colors.icon + ) + } + }, + colors = TopAppBarDefaults.topAppBarColors( + containerColor = Theme.colors.bg + ) + ) + HorizontalDivider( + thickness = 1.dp, + color = Theme.colors.stroke + ) + } + } +} + +@Preview +@Composable +private fun Preview() { + SeeDocsTheme { + MainTopBar(true) + } } \ No newline at end of file diff --git a/feature/main/src/main/java/kr/co/main/navigation/MainNavHost.kt b/feature/main/src/main/java/kr/co/main/navigation/MainNavHost.kt index 3961223..5eafe6d 100644 --- a/feature/main/src/main/java/kr/co/main/navigation/MainNavHost.kt +++ b/feature/main/src/main/java/kr/co/main/navigation/MainNavHost.kt @@ -3,6 +3,11 @@ package kr.co.main.navigation import androidx.compose.foundation.layout.PaddingValues import androidx.compose.runtime.Composable import androidx.navigation.compose.NavHost +import kr.co.navigation.Route +import kr.co.navigation.bookmarkNavGraph +import kr.co.navigation.exploreNavGraph +import kr.co.navigation.pdfNavGraph +import kr.co.navigation.recentNavGraph @Composable internal fun MainNavHost( @@ -13,6 +18,21 @@ internal fun MainNavHost( navController = navigator.navController, startDestination = navigator.startDestination, ) { + exploreNavGraph( + padding = padding, + navigateToPdf = { navigator.navigate(Route.Pdf) } + ) + recentNavGraph( + padding = padding + ) + + bookmarkNavGraph( + padding = padding + ) + + pdfNavGraph( + popBackStack = navigator::popBackStack + ) } } diff --git a/feature/main/src/main/java/kr/co/main/navigation/MainNavigator.kt b/feature/main/src/main/java/kr/co/main/navigation/MainNavigator.kt index ec5d079..ebfc763 100644 --- a/feature/main/src/main/java/kr/co/main/navigation/MainNavigator.kt +++ b/feature/main/src/main/java/kr/co/main/navigation/MainNavigator.kt @@ -6,8 +6,10 @@ import androidx.navigation.NavDestination import androidx.navigation.NavDestination.Companion.hasRoute import androidx.navigation.NavHostController import androidx.navigation.NavOptions +import androidx.navigation.NavOptionsBuilder import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController +import androidx.navigation.navOptions import kr.co.navigation.MainNavigation import kr.co.navigation.Route @@ -41,8 +43,12 @@ internal class MainNavigator( currentDestination?.hasRoute(it.route::class) == true } - fun navigate(route: Route, navOptions: NavOptions) { - navController.navigate(route, navOptions) + inline fun navigate(noinline builder: NavOptionsBuilder.() -> Unit = {}) { + navController.navigate(T::class, navOptions(builder)) + } + + fun navigate(route: T, builder: NavOptionsBuilder.() -> Unit = {}) { + navController.navigate(route, navOptions(builder)) } fun popBackStack() { diff --git a/feature/pdf/.gitignore b/feature/pdf/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/feature/pdf/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/feature/pdf/build.gradle.kts b/feature/pdf/build.gradle.kts new file mode 100644 index 0000000..23d9567 --- /dev/null +++ b/feature/pdf/build.gradle.kts @@ -0,0 +1,8 @@ +import kr.co.convention.setNamespace + +plugins { + alias(libs.plugins.seedocs.feature) + alias(libs.plugins.seedocs.library.compose) +} + +setNamespace("feature.pdf") \ No newline at end of file diff --git a/feature/pdf/src/main/java/kr/co/navigation/PdfNavGraph.kt b/feature/pdf/src/main/java/kr/co/navigation/PdfNavGraph.kt new file mode 100644 index 0000000..acdb435 --- /dev/null +++ b/feature/pdf/src/main/java/kr/co/navigation/PdfNavGraph.kt @@ -0,0 +1,15 @@ +package kr.co.navigation + +import androidx.navigation.NavGraphBuilder +import androidx.navigation.compose.composable +import kr.co.pdf.PdfRoute + +fun NavGraphBuilder.pdfNavGraph( + popBackStack: () -> Unit = {} +) { + composable { + PdfRoute( + popBackStack = popBackStack + ) + } +} \ No newline at end of file diff --git a/feature/pdf/src/main/java/kr/co/pdf/PdfScreen.kt b/feature/pdf/src/main/java/kr/co/pdf/PdfScreen.kt new file mode 100644 index 0000000..61d0b3e --- /dev/null +++ b/feature/pdf/src/main/java/kr/co/pdf/PdfScreen.kt @@ -0,0 +1,40 @@ +package kr.co.pdf + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import kr.co.ui.theme.SeeDocsTheme +import kr.co.ui.theme.Theme + +@Composable +internal fun PdfRoute( + popBackStack: () -> Unit = {} +) { + PdfScreen( + popBackStack = popBackStack + ) +} + +@Composable +private fun PdfScreen( + popBackStack: () -> Unit = {} +) { + Box( + modifier = Modifier + .fillMaxSize() + .background(Theme.colors.bg) + ) { + //TODO PDF 화면 렌더링 기능 구현 후 UI 표시 + } +} + +@Preview +@Composable +private fun Preview() { + SeeDocsTheme { + PdfScreen() + } +} \ No newline at end of file diff --git a/feature/recent/src/main/java/kr/co/navigation/RecentNavGraph.kt b/feature/recent/src/main/java/kr/co/navigation/RecentNavGraph.kt new file mode 100644 index 0000000..06b13a3 --- /dev/null +++ b/feature/recent/src/main/java/kr/co/navigation/RecentNavGraph.kt @@ -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.recent.RecentRoute + +fun NavGraphBuilder.recentNavGraph( + padding: PaddingValues +) { + composable { + RecentRoute( + padding = padding + ) + } +} \ No newline at end of file diff --git a/feature/recent/src/main/java/kr/co/recent/MyClass.kt b/feature/recent/src/main/java/kr/co/recent/MyClass.kt deleted file mode 100644 index c1459a0..0000000 --- a/feature/recent/src/main/java/kr/co/recent/MyClass.kt +++ /dev/null @@ -1,4 +0,0 @@ -package kr.co.recent - -class MyClass { -} \ No newline at end of file diff --git a/feature/recent/src/main/java/kr/co/recent/RecentScreen.kt b/feature/recent/src/main/java/kr/co/recent/RecentScreen.kt new file mode 100644 index 0000000..979dfea --- /dev/null +++ b/feature/recent/src/main/java/kr/co/recent/RecentScreen.kt @@ -0,0 +1,75 @@ +package kr.co.recent + +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.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 + +@Composable +internal fun RecentRoute( + padding: PaddingValues +) { + RecentScreen( + padding = padding + ) +} + +@Composable +private fun RecentScreen( + 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 = "최근 본 파일", + style = Theme.typography.body1sb, + color = Theme.colors.text + ) + } + + items(listOf("Effective Kotlin", "Android Developer")) { file -> + FileBox( + name = file + ) + } + } + } +} + +@Preview +@Composable +private fun Preview() { + SeeDocsTheme { + RecentScreen( + padding = PaddingValues() + ) + } +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 59dae6e..419f6fb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -38,3 +38,4 @@ include(":feature:main") include(":feature:explore") include(":feature:recent") include(":feature:bookmark") +include(":feature:pdf")