diff --git a/app/build.gradle b/app/build.gradle index 9c6bc2a1..f6c0af58 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ dependencies { implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" implementation 'androidx.work:work-runtime-ktx:2.7.1' - def nav_version = "2.4.2" + def nav_version = "2.5.3" implementation("androidx.navigation:navigation-compose:$nav_version") implementation "com.google.dagger:hilt-android:$hilt_version" diff --git a/app/src/main/java/com/xquare/xquare_android/component/BottomNavigation.kt b/app/src/main/java/com/xquare/xquare_android/component/BottomNavigation.kt index bd3a45a3..445ad495 100644 --- a/app/src/main/java/com/xquare/xquare_android/component/BottomNavigation.kt +++ b/app/src/main/java/com/xquare/xquare_android/component/BottomNavigation.kt @@ -3,11 +3,20 @@ package com.xquare.xquare_android.component import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.interaction.MutableInteractionSource -import androidx.compose.foundation.layout.* +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.height +import androidx.compose.foundation.layout.size import androidx.compose.material.Icon import androidx.compose.material.ripple.rememberRipple import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp @@ -15,12 +24,12 @@ import androidx.navigation.NavController import androidx.navigation.NavDestination.Companion.hierarchy import androidx.navigation.compose.currentBackStackEntryAsState import com.semicolon.design.Body3 -import com.semicolon.design.color.primary.gray.gray50 import com.semicolon.design.color.primary.gray.gray300 import com.semicolon.design.color.primary.gray.gray800 -import com.semicolon.design.color.primary.gray.gray900 import com.semicolon.design.color.primary.white.white import com.xquare.xquare_android.navigation.BottomNavigationItem +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch @Composable fun BottomNavigation( @@ -41,13 +50,16 @@ fun BottomNavigation( .weight(1f) .background(color = white) .clickable( - interactionSource = MutableInteractionSource(), - indication = rememberRipple( - radius = 28.dp - ), - enabled = !selected + interactionSource = remember { MutableInteractionSource() }, + indication = rememberRipple(radius = 28.dp), ) { - navController.navigate(screen.route) { popUpTo(0) } + navController.navigate(screen.route) { + popUpTo(0) { + saveState = true + } + launchSingleTop = true + restoreState = true + } }, horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center diff --git a/app/src/main/java/com/xquare/xquare_android/feature/alarm/AlarmScreen.kt b/app/src/main/java/com/xquare/xquare_android/feature/alarm/AlarmScreen.kt index 67c0d06f..87e707ae 100644 --- a/app/src/main/java/com/xquare/xquare_android/feature/alarm/AlarmScreen.kt +++ b/app/src/main/java/com/xquare/xquare_android/feature/alarm/AlarmScreen.kt @@ -135,9 +135,10 @@ fun AlarmItem( "APPLICATION_PICNIC_PASS", "APPLICATION_WEEKEND_PICNIC", "APPLICATION_WEEKEND_PICNIC_RESERVATION" -> R.drawable.ic_apply - "ALL_BAD_POINT","ALL_PENALTY_LEVEL"->R.drawable.img_bad - "ALL_GOOD_POINT", "FEED_NOTICE_LIKE", "FEED_BAMBOO_LIKE" ->R.drawable.img_good - "FEED_NOTICE","FEED_NOTICE_COMMENT", "FEED_BAMBOO_COMMENT", -> R.drawable.ic_feed + "ALL_BAD_POINT","ALL_PENALTY_LEVEL"->R.drawable.ic_thums_down + "ALL_GOOD_POINT"->R.drawable.ic_thumbs_up + "FEED_NOTICE","FEED_NOTICE_COMMENT", "FEED_NOTICE_LIKE", + "FEED_BAMBOO_COMMENT", "FEED_BAMBOO_LIKE" -> R.drawable.ic_feed "SCHEDULE_LOCAL","SCHEDULE_SOCIAL" -> R.drawable.ic_schedule else -> R.drawable.ic_alarm } diff --git a/app/src/main/java/com/xquare/xquare_android/feature/home/HomeScreen.kt b/app/src/main/java/com/xquare/xquare_android/feature/home/HomeScreen.kt index dc163f1f..4a65799d 100644 --- a/app/src/main/java/com/xquare/xquare_android/feature/home/HomeScreen.kt +++ b/app/src/main/java/com/xquare/xquare_android/feature/home/HomeScreen.kt @@ -64,8 +64,6 @@ fun HomeScreen(navController: NavController) { viewModel.run { fetchPassTime() fetchClassPosition() - fetchUserSimpleData() - fetchTodayMeal() } viewModel.eventFlow.collect { when (it) { diff --git a/app/src/main/java/com/xquare/xquare_android/feature/home/HomeViewModel.kt b/app/src/main/java/com/xquare/xquare_android/feature/home/HomeViewModel.kt index 7266e5f9..0135c01b 100644 --- a/app/src/main/java/com/xquare/xquare_android/feature/home/HomeViewModel.kt +++ b/app/src/main/java/com/xquare/xquare_android/feature/home/HomeViewModel.kt @@ -27,6 +27,10 @@ class HomeViewModel @Inject constructor( private val _userSimpleData = MutableStateFlow(HomeUserEntity("", "", 0, 0)) val userSimpleData: StateFlow = _userSimpleData + init { + fetchTodayMeal() + fetchUserSimpleData() + } private val _todayMeal = MutableStateFlow( MealEntity( emptyList(), @@ -36,7 +40,7 @@ class HomeViewModel @Inject constructor( )) val todayMeal: StateFlow = _todayMeal - fun fetchUserSimpleData() { + private fun fetchUserSimpleData() { execute( job = { fetchUserSimpleDataUseCase.execute(Unit) }, onSuccess = { it.collect { userSimpleData -> _userSimpleData.tryEmit(userSimpleData)} }, @@ -44,7 +48,7 @@ class HomeViewModel @Inject constructor( ) } - fun fetchTodayMeal() { + private fun fetchTodayMeal() { execute( job = { fetchTodayMealUseCase.execute(Unit) diff --git a/app/src/main/java/com/xquare/xquare_android/feature/schedule/ScheduleScreen.kt b/app/src/main/java/com/xquare/xquare_android/feature/schedule/ScheduleScreen.kt index d34876c0..438ee525 100644 --- a/app/src/main/java/com/xquare/xquare_android/feature/schedule/ScheduleScreen.kt +++ b/app/src/main/java/com/xquare/xquare_android/feature/schedule/ScheduleScreen.kt @@ -70,12 +70,6 @@ fun ScheduleScreen(navController: NavController) { var isLoadingSchedule by remember { mutableStateOf(false) } var loadingMonth by remember { mutableStateOf(LocalDate.now().monthValue) } - LaunchedEffect(Unit){ - timetableViewModel.run { - fetchWeekTimetables() - } - } - LaunchedEffect(Unit) { scheduleViewModel.fetchSchedules(loadingMonth) scheduleViewModel.eventFlow.collect { diff --git a/app/src/main/java/com/xquare/xquare_android/feature/schedule/TimetableViewModel.kt b/app/src/main/java/com/xquare/xquare_android/feature/schedule/TimetableViewModel.kt index be5371d8..62da6758 100644 --- a/app/src/main/java/com/xquare/xquare_android/feature/schedule/TimetableViewModel.kt +++ b/app/src/main/java/com/xquare/xquare_android/feature/schedule/TimetableViewModel.kt @@ -13,13 +13,16 @@ import javax.inject.Inject class TimetableViewModel @Inject constructor( private val fetchWeekTimetablesUseCase: FetchWeekTimetablesUseCase, ): BaseViewModel() { + init { + fetchWeekTimetables() + } private val _timetable = MutableStateFlow( TimetableEntity( emptyList() )) val timetable: MutableStateFlow = _timetable - fun fetchWeekTimetables() { + private fun fetchWeekTimetables() { execute( job = { fetchWeekTimetablesUseCase.execute(Unit) }, onSuccess = { it.collect { timetable -> _timetable.tryEmit(timetable) } }, diff --git a/app/src/main/res/drawable/ic_thumbs_up.xml b/app/src/main/res/drawable/ic_thumbs_up.xml index 27de1525..e00009e9 100644 --- a/app/src/main/res/drawable/ic_thumbs_up.xml +++ b/app/src/main/res/drawable/ic_thumbs_up.xml @@ -1,10 +1,11 @@ - + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + + + diff --git a/app/src/main/res/drawable/ic_thums_down.xml b/app/src/main/res/drawable/ic_thums_down.xml new file mode 100644 index 00000000..b0fe85e8 --- /dev/null +++ b/app/src/main/res/drawable/ic_thums_down.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/img_bad.png b/app/src/main/res/drawable/img_bad.png deleted file mode 100644 index 06af1157..00000000 Binary files a/app/src/main/res/drawable/img_bad.png and /dev/null differ diff --git a/app/src/main/res/drawable/img_good.png b/app/src/main/res/drawable/img_good.png deleted file mode 100644 index 66653c64..00000000 Binary files a/app/src/main/res/drawable/img_good.png and /dev/null differ