-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: change app logo * chore: change timeout duration * chore: change background image * chore: update Loading Screen * chore: use UiState * chore: CharacterDetailDialog change padding * chore: change timeout to ten minutes * chore: move to another package * chore: remove Loading Screen in FinalCharacterRoute * feat: implement random loading view * feat: apply random loading view
- Loading branch information
1 parent
a453da7
commit 742df08
Showing
41 changed files
with
282 additions
and
251 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
app/src/main/java/univ/earthbreaker/namu/feature/home/HomeLoadingScreen.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
app/src/main/java/univ/earthbreaker/namu/feature/loading/LoadingActions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package univ.earthbreaker.namu.feature.loading | ||
|
||
data class LoadingActions( | ||
val generateNewLoadingContent: () -> Unit, | ||
) |
102 changes: 102 additions & 0 deletions
102
app/src/main/java/univ/earthbreaker/namu/feature/loading/LoadingScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package univ.earthbreaker.namu.feature.loading | ||
|
||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
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.shape.RoundedCornerShape | ||
import androidx.compose.material3.LinearProgressIndicator | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.draw.paint | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import univ.earthbreaker.namu.R | ||
import univ.earthbreaker.namu.compose.noRippleClickable | ||
import univ.earthbreaker.namu.ui.theme.GTTheme | ||
|
||
@Composable | ||
fun LoadingScreen(loadingContent: LoadingContent, actions: LoadingActions) { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(color = GTTheme.colors.bgBlack) | ||
.paint( | ||
painter = painterResource(id = R.drawable.img_background), | ||
contentScale = ContentScale.Crop, | ||
), | ||
contentAlignment = Alignment.Center, | ||
) { | ||
Column(modifier = Modifier.padding(horizontal = 20.dp)) { | ||
LinearProgressIndicator( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.height(7.dp) | ||
.padding(horizontal = 10.dp) | ||
.clip(shape = RoundedCornerShape(30.dp)), | ||
color = GTTheme.colors.green1, | ||
trackColor = GTTheme.colors.green2, | ||
) | ||
Spacer(Modifier.height(20.dp)) | ||
Column( | ||
modifier = Modifier | ||
.background( | ||
color = GTTheme.colors.white, | ||
shape = RoundedCornerShape(15.dp), | ||
) | ||
.padding(horizontal = 38.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
) { | ||
Spacer(modifier = Modifier.height(30.dp)) | ||
Text( | ||
loadingContent.title, | ||
style = GTTheme.typography.titleSemiBold16, | ||
color = GTTheme.colors.gray8, | ||
) | ||
Spacer(modifier = Modifier.height(50.dp)) | ||
Text( | ||
loadingContent.description, | ||
style = GTTheme.typography.detailMedium14, | ||
color = GTTheme.colors.gray6, | ||
) | ||
Spacer(modifier = Modifier.height(30.dp)) | ||
Box( | ||
modifier = Modifier | ||
.background(color = GTTheme.colors.green2, RoundedCornerShape(10.dp)) | ||
.padding(10.dp) | ||
.noRippleClickable(onClick = actions.generateNewLoadingContent), | ||
) { | ||
Text( | ||
"또 다른 내용 알아보기", | ||
style = GTTheme.typography.detailMedium14, | ||
color = GTTheme.colors.green1, | ||
) | ||
} | ||
Spacer(modifier = Modifier.height(40.dp)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun HomeLoadingScreenPreview() { | ||
LoadingScreen( | ||
loadingContent = LoadingContent( | ||
title = "대나무는 나무일까 풀일까?", | ||
description = "사람들이 대나무를 일반적인 나무로 생각하기 쉽지만, 엄밀히 말해 대나무는 나무가 아니다." + | ||
" 대나무는 오래 살고 줄기가 단단해 얼핏 나무로 보이지만, 부피생장을 하지 않고 속이 비어 있다는 점에서 풀에 가깝다.\n" + | ||
"대나무는 생장하기 시작한 후 수십 일 동안 자라고는 더 이상 굵어지지 않고 굳어지기만 한다. 풀줄기가 딱딱해지는 것이다.", | ||
), | ||
actions = LoadingActions { }, | ||
) | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/main/java/univ/earthbreaker/namu/feature/loading/LoadingViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package univ.earthbreaker.namu.feature.loading | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import kotlinx.coroutines.launch | ||
|
||
class LoadingViewModel : ViewModel() { | ||
private val _loadingContent: MutableStateFlow<LoadingContent> = | ||
MutableStateFlow(RandomLoadingContentGenerator.generateRandomContent()) | ||
val loadingContent: StateFlow<LoadingContent> = _loadingContent.asStateFlow() | ||
|
||
fun getNewLoadingContent() { | ||
viewModelScope.launch { | ||
_loadingContent.emit(RandomLoadingContentGenerator.generateRandomContent(without = loadingContent.value)) | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/src/main/java/univ/earthbreaker/namu/feature/loading/RandomLoadingContentGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package univ.earthbreaker.namu.feature.loading | ||
|
||
object RandomLoadingContentGenerator { | ||
private val loadingContentList: List<LoadingContent> = listOf( | ||
LoadingContent( | ||
title = "대나무는 나무일까 풀일까?", | ||
description = "사람들이 대나무를 일반적인 나무로 생각하기 쉽지만, 엄밀히 말해 대나무는 나무가 아니다." + | ||
" 대나무는 오래 살고 줄기가 단단해 얼핏 나무로 보이지만, 부피생장을 하지 않고 속이 비어 있다는 점에서 풀에 가깝다.\n" + | ||
"대나무는 생장하기 시작한 후 수십 일 동안 자라고는 더 이상 굵어지지 않고 굳어지기만 한다. 풀줄기가 딱딱해지는 것이다.", | ||
), | ||
LoadingContent( | ||
title = "세상에서 가장 키가 큰 나무", | ||
description = "미국의 나무 Hyperion은 현재 살아있는 나무 중 세계에서 가장 키가 큰 나무로, " + | ||
"미국 캘리포니아주 레드우드 국립공원에 있는 세쿼이아이다. 높이가 약 115.61m(379.3피트), 나이는 600년으로 추정되며, " + | ||
"보통 세쿼이아의 수명이 1200년에서 2200년 정도인 것을 볼 때, 아직 아기라고 볼 수 있다.", | ||
), | ||
LoadingContent( | ||
title = "은행나무는 암수 구별이 가능하다 ?!", | ||
description = "은행나무는 암나무와 숫나무가 있다. 이는 앞사귀, 가지 모양, 꽃 모양, 열매의 유무 등의 차이점으로 구분할 수 있다." + | ||
" 예를 들면 열매가 열린 나무는 암그루, 열리지 않으면 수그루로 구별할 수 있다.", | ||
), | ||
LoadingContent( | ||
title = "재산을 가지고 세금을 내는 나무", | ||
description = "예천군에 있는 소나무인 석송령은 인격이 부여된 특이한 존재로 재산을 가지고 재산세를 납부하고 있다.\n" + | ||
"전설에 따르면 이 소나무는 약 600년 전 홍수에 떠내려 오는 것을 지나가던 사람이 건져내어 심은 것이라 한다. " + | ||
"그런데 이 마을의 주민이었던 이수목이라는 사람이 이 나무에 영감을 느끼게 되어 석송령이라는 이름을 지어주고 " + | ||
"자신이 소유한 6,600㎡의 토지를 상속시켜 문서 등기를 마쳤다고 한다.", | ||
), | ||
) | ||
|
||
fun generateRandomContent(without: LoadingContent? = null): LoadingContent = | ||
if (without == null) { | ||
loadingContentList.random() | ||
} else { | ||
loadingContentList.minus(without).random() | ||
} | ||
} | ||
|
||
data class LoadingContent( | ||
val title: String, | ||
val description: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.