Skip to content

Commit

Permalink
๐Ÿ”— :: (#657) ์‹ ์ฒญํ™”๋ฉด ์ž”๋ฅ˜์‹ ์ฒญํ•˜๊ธฐ ํƒœ๊ทธ ์—…๋ฐ์ดํŠธ ์•ˆ๋จ
Browse files Browse the repository at this point in the history
๐Ÿ”— :: (#657) ์‹ ์ฒญํ™”๋ฉด ์ž”๋ฅ˜์‹ ์ฒญํ•˜๊ธฐ ํƒœ๊ทธ ์—…๋ฐ์ดํŠธ ์•ˆ๋จ
  • Loading branch information
parkuiery authored Jun 12, 2024
2 parents dd225c0 + 6f30327 commit d30195c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.res.stringResource
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.lifecycle.withResumed
import com.ramcosta.composedestinations.annotation.Destination
import team.aliens.dms.android.core.designsystem.ContainedButton
import team.aliens.dms.android.core.designsystem.DmsTheme
Expand Down Expand Up @@ -53,6 +57,8 @@ internal fun ApplicationScreen(
val viewModel: ApplicationViewModel = hiltViewModel()
val uiState by viewModel.stateFlow.collectAsStateWithLifecycle()

LocalLifecycleOwner.current.lifecycle.addObserver(viewModel)

Scaffold(
modifier = modifier,
topBar = {
Expand Down Expand Up @@ -137,25 +143,24 @@ private fun ApplicationCard(
color = DmsTheme.colorScheme.onSurface,
style = DmsTheme.typography.title2,
)
// TODO: ํƒœ๊ทธ ์—…๋ฐ์ดํŠธ ๋กœ์ง ์ถ”๊ฐ€
// AnimatedVisibility(
// visible = appliedTitle != null,
// enter = slideInVertically() + fadeIn(),
// exit = slideOutVertically() + fadeOut(),
// ) {
// if (appliedTitle != null) {
// RoundedButton(
// onClick = {},
// fillMinSize = false,
// contentPadding = PaddingValues(
// horizontal = PaddingDefaults.Medium,
// vertical = PaddingDefaults.Small,
// ),
// ) {
// Text(text = appliedTitle)
// }
// }
// }
AnimatedVisibility(
visible = appliedTitle != null,
enter = slideInVertically() + fadeIn(),
exit = slideOutVertically() + fadeOut(),
) {
if(appliedTitle!= null) {
RoundedButton(
onClick = { },
fillMinSize = false,
contentPadding = PaddingValues(
horizontal = PaddingDefaults.Medium,
vertical = PaddingDefaults.Small,
),
) {
Text(text = appliedTitle)
}
}
}
}
Text(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package team.aliens.dms.android.feature.main.application

import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Dispatchers
Expand All @@ -20,10 +22,15 @@ internal class ApplicationViewModel @Inject constructor(
private val remainsRepository: RemainsRepository,
) : BaseMviViewModel<ApplicationUiState, ApplicationIntent, ApplicationSideEffect>(
initialState = ApplicationUiState.initial(),
) {
init {
fetchAppliedStudyRoom()
fetchAppliedRemainsOption()
), DefaultLifecycleObserver {

override fun onCreate(owner: LifecycleOwner) {
super.onCreate(owner)
// TODO: onDispose๋ฅผ ์ด์šฉํ•˜์—ฌ ์ด๋ฒคํŠธ ๋„˜๊ธฐ๊ธฐ
viewModelScope.launch {
fetchAppliedStudyRoom()
fetchAppliedRemainsOption()
}
}

private fun fetchAppliedStudyRoom() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import com.ramcosta.composedestinations.annotation.Destination
import org.threeten.bp.DayOfWeek
import team.aliens.dms.android.core.designsystem.ButtonDefaults
import team.aliens.dms.android.core.designsystem.ContainedButton
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.DmsIcon
import team.aliens.dms.android.core.designsystem.DmsTheme
import team.aliens.dms.android.core.designsystem.DmsTopAppBar
import team.aliens.dms.android.core.designsystem.RoundedButton
import team.aliens.dms.android.core.designsystem.ShadowDefaults
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.Scaffold
import team.aliens.dms.android.core.designsystem.VerticallyFadedLazyColumn
import team.aliens.dms.android.core.designsystem.clickable
import team.aliens.dms.android.core.designsystem.shadow
import team.aliens.dms.android.core.ui.DefaultHorizontalSpace
import team.aliens.dms.android.core.ui.PaddingDefaults
Expand Down Expand Up @@ -73,7 +73,7 @@ internal fun RemainsApplicationScreen(
navigationIcon = {
IconButton(onClick = navigator::navigateUp) {
Icon(
painter = painterResource(id = R.drawable.ic_baseline_arrow_back_24),
painter = painterResource(id = DmsIcon.Back),
contentDescription = stringResource(id = R.string.top_bar_back_button),
)
}
Expand Down

0 comments on commit d30195c

Please sign in to comment.