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

[FEAT/#133] 네비게이션 관리 #138

Merged
merged 8 commits into from
Jul 18, 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
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_terning_launcher_foreground"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_terning_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TerningAndroid"
android:usesCleartextTraffic="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
Expand Down Expand Up @@ -93,7 +94,7 @@ fun DateItemsPicker(
firstIndex: Int,
onItemSelected: (String) -> Unit,
modifier: Modifier = Modifier,
isYear: Boolean
isYear: Boolean,
) {
val listState = rememberLazyListState(firstIndex)
val currentValue = remember { mutableStateOf("") }
Expand Down Expand Up @@ -133,7 +134,6 @@ fun DateItemsPicker(
if (it == firstVisibleItemIndex + 1) {
currentValue.value = items[index]
}
Spacer(modifier = Modifier.height(6.dp))
Text(
text =
when (isYear) {
Expand All @@ -142,9 +142,9 @@ fun DateItemsPicker(
},
style = TerningTheme.typography.title3,
color = if (it == firstVisibleItemIndex + 1) Grey500 else Grey300,
textAlign = TextAlign.Center
textAlign = TextAlign.Center,
modifier = modifier.padding(vertical = 8.dp)
)
Spacer(modifier = Modifier.height(6.dp))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ fun InternItem(
.data(imageUrl)
.build(),
contentDescription = title,
contentScale = ContentScale.Crop,
contentScale = ContentScale.Fit,
modifier = Modifier
.fillMaxHeight()
.aspectRatio(1f)
.clip(RoundedCornerShape(5.dp))
.background(color = Grey300)
)

Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,30 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.customShadow
import com.terning.core.extension.noRippleClickable

@Composable
fun InternItemWithShadow(
modifier: Modifier,
shadowRadius: Dp,
shadowWidth: Dp,
imageUrl: String,
title: String,
dateDeadline: String,
workingPeriod: String,
scrapId: Long?,
isScrapped: Boolean,
) {
Box(
modifier = Modifier
modifier = modifier
.customShadow(
color = Grey200,
shadowRadius = 10.dp,
shadowWidth = 2.dp,
shadowRadius = shadowRadius,
shadowWidth = shadowWidth,
)
.background(
color = White,
Expand All @@ -35,7 +40,7 @@ fun InternItemWithShadow(
title = title,
dateDeadline = dateDeadline,
workingPeriod = workingPeriod,
isScraped = scrapId != null
isScraped = isScrapped
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.terning.core.designsystem.component.textfield
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.text.input.ImeAction
import com.terning.core.designsystem.theme.Grey300
import com.terning.core.designsystem.theme.Grey400
import com.terning.core.designsystem.theme.TerningMain
Expand Down Expand Up @@ -32,6 +33,11 @@ fun SearchTextField(
hintColor = Grey300,
leftIcon = leftIcon,
leftIconColor = TerningMain,
imeAction = if (text.isNotBlank()) {
ImeAction.Search
} else {
ImeAction.Done
},
enabled = enabled,
readOnly = readOnly,
onDoneAction = onDoneAction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fun TerningBasicTextField(
strokeWidth: Float = 1f,
leftIcon: Int? = null,
leftIconColor: Color = TerningMain,
imeAction: ImeAction? = ImeAction.Done,
maxTextLength: Int? = null,
showTextLength: Boolean = false,
hint: String = "",
Expand All @@ -65,7 +66,9 @@ fun TerningBasicTextField(
onValueChange = onValueChange,
singleLine = true,
maxLines = 1,
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
keyboardOptions = KeyboardOptions(
imeAction = imeAction ?: ImeAction.Done
),
keyboardActions = KeyboardActions(
onDone = {
if (value.isNotBlank()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ private fun InternDialogContent(
.width(80.dp)
.aspectRatio(1f)
.clip(RoundedCornerShape(5.dp))
.background(color = Grey300)
.border(
width = 1.dp,
color = TerningMain,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.terning.feature.calendar.calendar.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
Expand All @@ -19,7 +21,20 @@ fun NavController.navigateCalendar(navOptions: NavOptions? = null) {
fun NavGraphBuilder.calendarNavGraph(
navHostController: NavController
) {
composable<Calendar> {
composable<Calendar>(
exitTransition = {
ExitTransition.None
},
popEnterTransition = {
EnterTransition.None
},
enterTransition = {
EnterTransition.None
},
popExitTransition = {
ExitTransition.None
}
) {
CalendarRoute(
navController = navHostController
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.terning.feature.filtering.startfiltering.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.terning.feature.filtering.starthome.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
Expand All @@ -19,7 +21,20 @@ fun NavController.navigateStartHome(navOptions: NavOptions? = null) {
fun NavGraphBuilder.startHomeNavGraph(
navHostController: NavHostController
) {
composable<StartHome> {
composable<StartHome>(
exitTransition = {
ExitTransition.None
},
popEnterTransition = {
EnterTransition.None
},
enterTransition = {
EnterTransition.None
},
popExitTransition = {
ExitTransition.None
}
) {
StartHomeScreen(navController = navHostController)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.terning.feature.home.changefilter.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
Expand All @@ -19,7 +21,20 @@ fun NavController.navigateChangeFilter(navOptions: NavOptions? = null) {
fun NavGraphBuilder.changeFilterNavGraph(
navHostController: NavHostController
) {
composable<ChangeFilter> {
composable<ChangeFilter>(
exitTransition = {
ExitTransition.None
},
popEnterTransition = {
EnterTransition.None
},
enterTransition = {
EnterTransition.None
},
popExitTransition = {
ExitTransition.None
}
) {
ChangeFilterRoute(
navController = navHostController
)
Expand Down
71 changes: 38 additions & 33 deletions feature/src/main/java/com/terning/feature/home/home/HomeRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.terning.feature.home.home
import androidx.compose.foundation.ExperimentalFoundationApi
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.Row
Expand All @@ -12,7 +11,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
Expand All @@ -37,14 +35,13 @@ import androidx.navigation.NavHostController
import com.google.accompanist.systemuicontroller.rememberSystemUiController
import com.terning.core.designsystem.component.bottomsheet.SortingBottomSheet
import com.terning.core.designsystem.component.button.SortingButton
import com.terning.core.designsystem.component.item.InternItem
import com.terning.core.designsystem.component.item.InternItemWithShadow
import com.terning.core.designsystem.component.topappbar.LogoTopAppBar
import com.terning.core.designsystem.theme.Black
import com.terning.core.designsystem.theme.Grey150
import com.terning.core.designsystem.theme.Grey200
import com.terning.core.designsystem.theme.TerningTheme
import com.terning.core.designsystem.theme.White
import com.terning.core.extension.customShadow
import com.terning.core.extension.noRippleClickable
import com.terning.core.extension.toast
import com.terning.core.state.UiState
import com.terning.domain.entity.response.HomeFilteringInfoModel
Expand All @@ -58,6 +55,7 @@ import com.terning.feature.home.home.component.HomeRecommendEmptyIntern
import com.terning.feature.home.home.component.HomeTodayEmptyIntern
import com.terning.feature.home.home.component.HomeTodayIntern
import com.terning.feature.home.home.navigation.navigateHome
import com.terning.feature.intern.navigation.navigateIntern

const val NAME_START_LENGTH = 7
const val NAME_END_LENGTH = 12
Expand Down Expand Up @@ -149,6 +147,7 @@ fun HomeRoute(
homeTodayInternList = homeTodayInternList,
recommendInternList = homeRecommendInternList,
onChangeFilterClick = { navController.navigateChangeFilter() },
navController = navController
)
}

Expand All @@ -161,6 +160,8 @@ fun HomeScreen(
homeTodayInternList: List<HomeTodayInternModel>,
recommendInternList: List<HomeRecommendInternModel>,
onChangeFilterClick: () -> Unit,
viewModel: HomeViewModel = hiltViewModel(),
navController: NavHostController,
) {
var sheetState by remember { mutableStateOf(false) }

Expand Down Expand Up @@ -227,14 +228,19 @@ fun HomeScreen(
modifier = Modifier
.padding(vertical = 4.dp)
)
Spacer(modifier = Modifier.padding(9.dp))
Spacer(
modifier = Modifier.padding(9.dp)
)
}
}
}

if (recommendInternList.isNotEmpty()) {
items(recommendInternList.size) { index ->
ShowRecommendIntern(homeRecommendInternModel = recommendInternList[index])
RecommendInternItem(
navController = navController,
intern = recommendInternList[index]
)
}
}
}
Expand All @@ -252,6 +258,30 @@ fun HomeScreen(
}
}


@Composable
private fun RecommendInternItem(
navController: NavHostController,
intern: HomeRecommendInternModel,
) {
InternItemWithShadow(
modifier = Modifier
.padding(horizontal = 24.dp)
.noRippleClickable {
navController.navigateIntern(
announcementId = intern.internshipAnnouncementId
)
},
imageUrl = intern.companyImage,
title = intern.title,
dateDeadline = intern.dDay,
workingPeriod = intern.workingPeriod,
isScrapped = intern.isScrapped,
shadowRadius = 5.dp,
shadowWidth = 1.dp
)
}

@Composable
private fun ShowMainTitleWithName(userName: String) {
Text(
Expand Down Expand Up @@ -301,7 +331,7 @@ private fun ShowRecommendTitle() {
@Composable
private fun ShowInternFilter(
homeFilteringInfo: HomeFilteringInfoModel,
onChangeFilterClick: () -> Unit
onChangeFilterClick: () -> Unit,
) {
if (homeFilteringInfo.grade == null) {
HomeFilteringScreen(
Expand Down Expand Up @@ -329,28 +359,3 @@ private fun ShowInternFilter(
}
}
}

@Composable
private fun ShowRecommendIntern(homeRecommendInternModel: HomeRecommendInternModel) {
Box(
modifier = Modifier
.padding(horizontal = 24.dp)
.customShadow(
color = Grey200,
shadowRadius = 5.dp,
shadowWidth = 1.dp
)
.background(
color = White,
shape = RoundedCornerShape(10.dp)
)
) {
InternItem(
imageUrl = homeRecommendInternModel.companyImage,
title = homeRecommendInternModel.title,
dateDeadline = homeRecommendInternModel.dDay,
workingPeriod = homeRecommendInternModel.workingPeriod,
isScraped = homeRecommendInternModel.isScrapped,
)
}
}
Loading
Loading