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/Main Navigation #60

Merged
merged 4 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,8 @@ dependencies {
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
androidTestImplementation(platform(libs.androidx.compose.bom))

implementation(projects.network.core)
implementation(projects.designsystem)
implementation(projects.featureMain.main)
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.SeugiTest"
android:name=".util.SeugiApplication"
tools:targetApi="31">
<activity
android:name=".MainActivity"
Expand Down
34 changes: 12 additions & 22 deletions app/src/main/java/com/apeun/gidaechi/seugi/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,33 @@ import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.apeun.gidaechi.seugi.ui.theme.SeugiTestTheme
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.apeun.gidaechi.designsystem.theme.SeugiTheme
import com.apeun.gidaechi.main.navigation.MAIN_ROUTE
import com.apeun.gidaechi.main.navigation.mainScreen
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
SeugiTestTheme {
SeugiTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
) {
Greeting("Android")
NavHost(
navController = rememberNavController(),
startDestination = MAIN_ROUTE,
) {
mainScreen()
}
}
}
}
}
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier,
)
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
SeugiTestTheme {
Greeting("Android")
}
}
11 changes: 0 additions & 11 deletions app/src/main/java/com/apeun/gidaechi/seugi/ui/theme/Color.kt

This file was deleted.

70 changes: 0 additions & 70 deletions app/src/main/java/com/apeun/gidaechi/seugi/ui/theme/Theme.kt

This file was deleted.

34 changes: 0 additions & 34 deletions app/src/main/java/com/apeun/gidaechi/seugi/ui/theme/Type.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.apeun.gidaechi.seugi
package com.apeun.gidaechi.seugi.util

import android.app.Application
import dagger.hilt.android.HiltAndroidApp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -50,12 +51,20 @@ fun SeugiBottomNavigation(modifier: Modifier = Modifier, selected: BottomNavigat
modifier = modifier
.fillMaxWidth()
.height(96.dp)
.dropShadow(DropShadowType.Nav),
.dropShadow(DropShadowType.Nav)
.background(
color = White,
shape = RoundedCornerShape(
topStart = 16.dp,
topEnd = 16.dp,
),
),
) {
Row(
modifier = Modifier
.fillMaxWidth()
.height(62.dp),
verticalAlignment = Alignment.CenterVertically,
) {
Spacer(modifier = Modifier.width(32.dp))
SeugiBottomNavigationItem(
Expand Down
1 change: 1 addition & 0 deletions feature-main/main/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
11 changes: 11 additions & 0 deletions feature-main/main/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
alias(libs.plugins.seugi.android.feature)
}

android {
namespace = "com.apeun.gidaechi.main"
}

dependencies {
implementation(projects.designsystem)
}
Empty file.
21 changes: 21 additions & 0 deletions feature-main/main/proguard-rules.pro
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
4 changes: 4 additions & 0 deletions feature-main/main/src/main/AndroidManifest.xml
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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.apeun.gidaechi.main

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.apeun.gidaechi.designsystem.component.BottomNavigationItemType
import com.apeun.gidaechi.designsystem.component.SeugiBottomNavigation

@Composable
internal fun MainScreen(navHostController: NavHostController = rememberNavController()) {
var selectItemState: BottomNavigationItemType by remember { mutableStateOf(BottomNavigationItemType.Home) }

Scaffold(
modifier = Modifier.fillMaxSize(),
bottomBar = {
SeugiBottomNavigation(selected = selectItemState) {
selectItemState = it
navHostController.navigate(
when (it) {
is BottomNavigationItemType.Home -> "route"
is BottomNavigationItemType.Chat -> "route"
is BottomNavigationItemType.Group -> "route"
is BottomNavigationItemType.Notification -> "route"
is BottomNavigationItemType.Profile -> "route"
else -> "route"
},
)
}
},
) {
NavHost(
modifier = Modifier.padding(it),
navController = navHostController,
startDestination = "route",
) {
// TODO("DELETE DUMMY ROUTE")
composable("route") {
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.apeun.gidaechi.main.navigation

import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.apeun.gidaechi.main.MainScreen

const val MAIN_ROUTE = "main"

fun NavController.navigateToMain(navOptions: NavOptions? = null) = navigate(MAIN_ROUTE, navOptions)

fun NavGraphBuilder.mainScreen() {
composable(route = MAIN_ROUTE) {
MainScreen()
}
}
3 changes: 2 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ include(
":designsystem",
":designsystem-preview",
":network:core",
":common"
":common",
":feature-main:main"
)
Loading