-
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: remove ripple in LoginScreen * chore: use size instead of width + height, add parameters * chore: add strings * feat: add progress indicator * chore: reflect parameter updates * chore: remove ripple with box * chore: add HomeBottomCard * chore: rename EnergyCard to UserEnergyCard * chore: add image and icon resources * chore: add TreeEnergyCard * chore: add click event to WeeklyTopRankerProfileCard * chore: add arguments
- Loading branch information
1 parent
b7a9bfd
commit d1b388d
Showing
14 changed files
with
223 additions
and
29 deletions.
There are no files selected for viewing
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
150 changes: 139 additions & 11 deletions
150
app/src/main/java/univ/earthbreaker/namu/feature/home/HomeScreen.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 |
---|---|---|
@@ -1,54 +1,182 @@ | ||
package univ.earthbreaker.namu.feature.home | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Row | ||
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.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.saveable.rememberSaveable | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import univ.earthbreaker.namu.R | ||
import univ.earthbreaker.namu.feature.home.component.EnergyCard | ||
import univ.earthbreaker.namu.compose.CommonDialogWithXIcon | ||
import univ.earthbreaker.namu.feature.home.component.OpenDialogCard | ||
import univ.earthbreaker.namu.feature.home.component.TreeEnergyCard | ||
import univ.earthbreaker.namu.feature.home.component.UserEnergyCard | ||
import univ.earthbreaker.namu.feature.home.component.WeeklyTopRankerProfileCard | ||
import univ.earthbreaker.namu.ui.theme.GTTheme | ||
|
||
@Composable | ||
fun HomeScreen() { | ||
fun HomeScreen(level: Int, exp: Float, energyCount: Int, currentEnergy: Int, requiredEnergy: Int) { | ||
var doesDialogExist by rememberSaveable { | ||
mutableStateOf(false) | ||
} | ||
|
||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(color = GTTheme.colors.bgBlack), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.SpaceBetween, | ||
) { | ||
HomeTopCard(level, exp, energyCount, onProfileClick = { doesDialogExist = true }) | ||
Image( | ||
painter = painterResource(id = R.drawable.img_mock_character), | ||
contentDescription = null, | ||
) | ||
HomeBottomCard(currentEnergy = currentEnergy, requiredEnergy = requiredEnergy) | ||
} | ||
if (doesDialogExist) { | ||
Column( | ||
modifier = Modifier.fillMaxSize(), | ||
) { | ||
CommonDialogWithXIcon( | ||
content = { | ||
Column { | ||
repeat(15) { | ||
Text( | ||
text = "Hello World!", | ||
style = GTTheme.typography.titleSemiBold20, | ||
) | ||
} | ||
} | ||
}, | ||
dismiss = { doesDialogExist = false }, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun HomeTopCard(level: Int, exp: Float, energyCount: Int, onProfileClick: () -> Unit = {}) { | ||
Column { | ||
Row( | ||
modifier = Modifier.padding(start = 18.dp, end = 18.dp, top = 30.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
) { | ||
Text( | ||
text = "Lv. $level", | ||
style = GTTheme.typography.detailBold11, | ||
color = GTTheme.colors.white, | ||
) | ||
LinearProgressIndicator( | ||
modifier = Modifier | ||
.weight(1f) | ||
.padding(start = 7.dp) | ||
.height(11.dp) | ||
.clip(RoundedCornerShape(20.dp)), | ||
progress = exp, | ||
color = GTTheme.colors.green1, | ||
trackColor = GTTheme.colors.bg2Black, | ||
) | ||
} | ||
|
||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(start = 20.dp, end = 20.dp, top = 30.dp), | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
) { | ||
WeeklyTopRankerProfileCard() | ||
Column { | ||
EnergyCard() | ||
Spacer(Modifier.height(5.dp)) | ||
OpenDialogCard(text = stringResource(R.string.book)) { /* TODO */ } | ||
Spacer(Modifier.height(5.dp)) | ||
OpenDialogCard(text = stringResource(R.string.my)) { /* TODO */ } | ||
Spacer(Modifier.height(5.dp)) | ||
OpenDialogCard(text = stringResource(R.string.mission)) { /* TODO */ } | ||
WeeklyTopRankerProfileCard(onClick = onProfileClick) | ||
Spacer(Modifier.height(7.dp)) | ||
OpenDialogCard( | ||
text = stringResource(R.string.adding_friends), | ||
onClick = {}, | ||
width = 85.dp, | ||
) | ||
Spacer(Modifier.height(7.dp)) | ||
OpenDialogCard( | ||
text = stringResource(R.string.guestbook), | ||
onClick = {}, | ||
width = 72.dp, | ||
) | ||
} | ||
Column { | ||
UserEnergyCard(energyCount = energyCount) | ||
Spacer(Modifier.height(7.dp)) | ||
OpenDialogCard(text = stringResource(R.string.book), onClick = {}) | ||
Spacer(Modifier.height(7.dp)) | ||
OpenDialogCard(text = stringResource(R.string.mission), onClick = {}) | ||
Spacer(Modifier.height(7.dp)) | ||
OpenDialogCard(text = stringResource(R.string.my), onClick = {}) | ||
Spacer(Modifier.height(7.dp)) | ||
OpenDialogCard(text = stringResource(R.string.notification), onClick = {}) | ||
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun HomeBottomCard(currentEnergy: Int, requiredEnergy: Int) { | ||
val isReady = currentEnergy == requiredEnergy | ||
Column(horizontalAlignment = Alignment.CenterHorizontally) { | ||
TreeEnergyCard(currentEnergy, requiredEnergy) | ||
Spacer(modifier = Modifier.height(52.dp)) | ||
Box( | ||
modifier = Modifier | ||
.padding(horizontal = 30.dp) | ||
.fillMaxWidth() | ||
.background( | ||
color = if (isReady) GTTheme.colors.green1 else GTTheme.colors.gray3, | ||
shape = RoundedCornerShape(5.dp), | ||
) | ||
.clickable(enabled = isReady) { }, | ||
contentAlignment = Alignment.Center, | ||
) { | ||
Text( | ||
modifier = Modifier.padding(vertical = 15.dp), | ||
text = if (isReady) "다음 단계로 성장하기" else "에너지가 2개 모자라요 !", | ||
style = GTTheme.typography.titleSemiBold18, | ||
) | ||
} | ||
Spacer(modifier = Modifier.height(56.dp)) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun HomeScreenPreview() { | ||
HomeScreen() | ||
HomeScreen(level = 1, exp = 0.7f, energyCount = 1, currentEnergy = 1, requiredEnergy = 3) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun HomeTopCardPreview() { | ||
HomeTopCard(level = 1, exp = 0.7f, energyCount = 1) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun HomeBottomCardPreview() { | ||
HomeBottomCard(currentEnergy = 1, requiredEnergy = 3) | ||
} |
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
32 changes: 32 additions & 0 deletions
32
app/src/main/java/univ/earthbreaker/namu/feature/home/component/TreeEnergyCard.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,32 @@ | ||
package univ.earthbreaker.namu.feature.home.component | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import univ.earthbreaker.namu.R | ||
|
||
@Composable | ||
fun TreeEnergyCard(currentEnergy: Int, requiredEnergy: Int) { | ||
Row { | ||
repeat(requiredEnergy) { index -> | ||
Image( | ||
painter = painterResource( | ||
id = if (index < currentEnergy) { | ||
R.drawable.ic_filled_required_energy | ||
} else { | ||
R.drawable.ic_empty_required_energy | ||
}, | ||
), | ||
contentDescription = null, | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
fun TreeEnergyCardPreview() { | ||
TreeEnergyCard(currentEnergy = 1, requiredEnergy = 3) | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="26dp" | ||
android:height="27dp" | ||
android:viewportWidth="26" | ||
android:viewportHeight="27"> | ||
<path | ||
android:strokeWidth="1" | ||
android:pathData="M0.504,26.5C0.53,24.789 0.694,23.23 0.989,21.798L1.009,21.703L0.992,21.608C0.667,19.811 0.5,17.35 0.5,14.21C0.5,6.646 6.735,0.5 14.444,0.5C15.127,0.5 15.82,0.584 16.584,0.695C16.742,0.718 16.903,0.742 17.068,0.766C17.692,0.859 18.364,0.959 19.09,1.03C20.811,1.2 22.853,1.211 25.5,0.63V2.842C25.5,9.588 23.588,14.425 20.563,17.573C17.538,20.721 13.345,22.237 8.668,22.237H6.464C6.642,20.395 7.04,18.904 7.751,17.543C8.531,16.05 9.705,14.68 11.446,13.165C11.899,12.77 12.242,12.407 12.485,12.086C12.721,11.775 12.888,11.47 12.947,11.194C12.977,11.055 12.988,10.879 12.923,10.705C12.85,10.509 12.697,10.362 12.499,10.297C12.323,10.24 12.149,10.258 12.014,10.293C11.874,10.329 11.734,10.392 11.6,10.471L0.504,26.5ZM0.504,26.5H2.393L2.393,26.47L2.393,26.465H2.393C2.459,22.675 3.239,19.556 4.778,16.935C6.318,14.315 8.596,12.229 11.6,10.471L0.504,26.5Z" | ||
android:fillColor="#8E8C8C" | ||
android:fillAlpha="0.59" | ||
android:strokeColor="#ffffff"/> | ||
</vector> |
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,11 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="26dp" | ||
android:height="27dp" | ||
android:viewportWidth="26" | ||
android:viewportHeight="27"> | ||
<path | ||
android:strokeWidth="1" | ||
android:pathData="M0.504,26.5C0.53,24.789 0.694,23.23 0.989,21.798L1.009,21.703L0.992,21.608C0.667,19.811 0.5,17.35 0.5,14.21C0.5,6.646 6.735,0.5 14.444,0.5C15.127,0.5 15.82,0.584 16.584,0.695C16.742,0.718 16.903,0.742 17.068,0.766C17.692,0.859 18.364,0.959 19.09,1.03C20.811,1.2 22.853,1.211 25.5,0.63V2.842C25.5,9.588 23.588,14.425 20.563,17.573C17.538,20.721 13.345,22.237 8.668,22.237H6.464C6.642,20.395 7.04,18.904 7.751,17.543C8.531,16.05 9.705,14.68 11.446,13.165C11.899,12.77 12.242,12.407 12.485,12.086C12.721,11.775 12.888,11.47 12.947,11.194C12.977,11.055 12.988,10.879 12.923,10.705C12.85,10.509 12.697,10.362 12.499,10.297C12.323,10.24 12.149,10.258 12.014,10.293C11.874,10.329 11.734,10.392 11.6,10.471L0.504,26.5ZM0.504,26.5H2.393L2.393,26.47L2.393,26.465H2.393C2.459,22.675 3.239,19.556 4.778,16.935C6.318,14.315 8.596,12.229 11.6,10.471L0.504,26.5Z" | ||
android:fillColor="#4ECB71" | ||
android:strokeColor="#ffffff"/> | ||
</vector> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.