-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
475 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
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,4 @@ | ||
// domain | ||
plugins { | ||
alias(libs.plugins.hankki.kotlin) | ||
} |
6 changes: 6 additions & 0 deletions
6
domain/my/src/main/java/com/hankki/domain/my/entity/UserInfoEntity.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,6 @@ | ||
package com.hankki.domain.my.entity | ||
|
||
data class UserInfoEntity ( | ||
val name : String, | ||
val image : 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
167 changes: 160 additions & 7 deletions
167
feature/my/src/main/java/com/hankki/feature/my/MyRoute.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,28 +1,181 @@ | ||
package com.hankki.feature.my | ||
|
||
import androidx.compose.foundation.Image | ||
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 | ||
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.material3.Button | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.foundation.shape.RoundedCornerShape | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.LaunchedEffect | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.layout.ContentScale | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.hilt.navigation.compose.hiltViewModel | ||
import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||
import coil.compose.AsyncImage | ||
import com.hankki.core.common.extension.noRippleClickable | ||
import com.hankki.core.designsystem.theme.Gray400 | ||
import com.hankki.core.designsystem.theme.Gray900 | ||
import com.hankki.core.designsystem.theme.HankkiTheme | ||
import com.hankki.core.designsystem.theme.HankkijogboTheme | ||
import com.hankki.core.designsystem.theme.Red | ||
import com.hankki.core.designsystem.theme.White | ||
import com.hankki.feature.my.component.ButtonWithArrowIcon | ||
import com.hankki.feature.my.component.ButtonWithImageAndBorder | ||
import com.hankki.feature.my.component.MyTitle | ||
|
||
@Composable | ||
fun MyRoute(paddingValues: PaddingValues, navigateToDummy: () -> Unit) { | ||
MyScreen(paddingValues, navigateToDummy = navigateToDummy) | ||
fun MyRoute( | ||
paddingValues: PaddingValues, | ||
navigateToDummy: () -> Unit, | ||
myViewModel: MyViewModel = hiltViewModel() | ||
) { | ||
val myState by myViewModel.myState.collectAsStateWithLifecycle() | ||
|
||
LaunchedEffect(true) { | ||
myViewModel.loadMockInformation() | ||
} | ||
|
||
MyScreen( | ||
paddingValues = paddingValues, | ||
navigateToDummy = navigateToDummy, | ||
userName = myState.userState.name, | ||
userImage = myState.userState.image | ||
) | ||
} | ||
|
||
@Composable | ||
fun MyScreen( | ||
paddingValues: PaddingValues, | ||
navigateToDummy: () -> Unit, | ||
userName: String, | ||
userImage: String | ||
) { | ||
Column(modifier = Modifier.padding(paddingValues)) { | ||
Text(text = "My") | ||
val scrollState = rememberScrollState() | ||
|
||
Column( | ||
modifier = Modifier | ||
.padding(paddingValues) | ||
.padding(horizontal = 22.dp) | ||
.fillMaxSize() | ||
.verticalScroll(scrollState), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
MyTitle(title = stringResource(R.string.my)) | ||
|
||
Spacer(modifier = Modifier.height(15.dp)) | ||
|
||
AsyncImage( | ||
modifier = Modifier | ||
.size(98.dp) | ||
.clip(CircleShape), | ||
model = userImage, | ||
contentDescription = stringResource(R.string.profile_image), | ||
contentScale = ContentScale.None | ||
) | ||
|
||
Spacer(modifier = Modifier.height(10.dp)) | ||
|
||
Text( | ||
text = stringResource(R.string.message_user_name, userName), | ||
color = Gray900, | ||
style = HankkiTheme.typography.suitH2, | ||
textAlign = TextAlign.Center | ||
) | ||
|
||
Spacer(modifier = Modifier.height(19.dp)) | ||
|
||
Button(onClick = navigateToDummy) { | ||
Text(text = "Go to Dummy") | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.background( | ||
Red, | ||
shape = RoundedCornerShape(12.dp) | ||
) | ||
.clip(RoundedCornerShape(12.dp)) | ||
.padding(start = 28.dp, end = 29.dp), | ||
verticalAlignment = Alignment.CenterVertically, | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
) { | ||
Text( | ||
text = stringResource(R.string.my_jogbo), | ||
style = HankkiTheme.typography.sub1, | ||
color = White, | ||
) | ||
Image( | ||
painter = painterResource(id = R.drawable.ic_mygraphic), | ||
contentDescription = null, | ||
) | ||
} | ||
|
||
Spacer(modifier = Modifier.height(19.dp)) | ||
|
||
Row { | ||
ButtonWithImageAndBorder( | ||
R.drawable.ic_report, | ||
stringResource(R.string.description_store_report), | ||
Modifier.weight(1f) | ||
) | ||
Spacer(modifier = Modifier.width(18.dp)) | ||
ButtonWithImageAndBorder( | ||
R.drawable.ic_good, | ||
stringResource(R.string.description_store_like), | ||
Modifier.weight(1f) | ||
) | ||
} | ||
|
||
ButtonWithArrowIcon(stringResource(R.string.faq), navigateToDummy) | ||
|
||
ButtonWithArrowIcon(stringResource(R.string.inquiry), navigateToDummy) | ||
|
||
ButtonWithArrowIcon(stringResource(R.string.logout), navigateToDummy) | ||
|
||
Box( | ||
modifier = Modifier | ||
.fillMaxWidth(), | ||
contentAlignment = Alignment.CenterEnd | ||
) { | ||
Text( | ||
text = stringResource(R.string.quit), | ||
modifier = Modifier | ||
.noRippleClickable(onClick = navigateToDummy) | ||
.padding(top = 14.dp, start = 15.dp, bottom = 13.dp), | ||
textAlign = TextAlign.End, | ||
style = HankkiTheme.typography.body4, | ||
color = Gray400, | ||
) | ||
} | ||
} | ||
} | ||
|
||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun MyScreenPreview() { | ||
HankkijogboTheme { | ||
MyScreen( | ||
paddingValues = PaddingValues(), navigateToDummy = {}, userName = "", userImage = "" | ||
) | ||
} | ||
} |
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,7 @@ | ||
package com.hankki.feature.my | ||
|
||
import com.hankki.domain.my.entity.UserInfoEntity | ||
|
||
data class MyState( | ||
val userState : UserInfoEntity = UserInfoEntity("","") | ||
) |
29 changes: 29 additions & 0 deletions
29
feature/my/src/main/java/com/hankki/feature/my/MyViewModel.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,29 @@ | ||
package com.hankki.feature.my | ||
|
||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import com.hankki.domain.my.entity.UserInfoEntity | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import kotlinx.coroutines.flow.MutableStateFlow | ||
import kotlinx.coroutines.flow.StateFlow | ||
import kotlinx.coroutines.flow.asStateFlow | ||
import kotlinx.coroutines.launch | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class MyViewModel @Inject constructor() : ViewModel() { | ||
private val _myState = MutableStateFlow(MyState()) | ||
val myState: StateFlow<MyState> | ||
get() = _myState.asStateFlow() | ||
|
||
fun loadMockInformation() { | ||
viewModelScope.launch { | ||
val mockUserName = "송한끼" | ||
val mockUserImage = "" | ||
val mockUserInformation = UserInfoEntity(mockUserName, mockUserImage) | ||
_myState.value = _myState.value.copy( | ||
userState = mockUserInformation | ||
) | ||
} | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
feature/my/src/main/java/com/hankki/feature/my/component/ButtonWithArrowIcon.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,53 @@ | ||
package com.hankki.feature.my.component | ||
|
||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import com.hankki.core.common.extension.noRippleClickable | ||
import com.hankki.core.designsystem.theme.Gray200 | ||
import com.hankki.core.designsystem.theme.Gray900 | ||
import com.hankki.core.designsystem.theme.HankkiTheme | ||
import com.hankki.core.designsystem.theme.HankkijogboTheme | ||
import com.hankki.feature.my.R | ||
|
||
@Composable | ||
fun ButtonWithArrowIcon( | ||
itemTitle: String, | ||
onClick: () -> Unit, | ||
modifier: Modifier = Modifier | ||
) { | ||
Row( | ||
modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 18.dp) | ||
.noRippleClickable(onClick = onClick), | ||
horizontalArrangement = Arrangement.SpaceBetween, | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Text( | ||
text = itemTitle, | ||
style = HankkiTheme.typography.body3, | ||
color = Gray900 | ||
) | ||
Image(painterResource(id = R.drawable.ic_arrow_right), "ic_arrow_right") | ||
} | ||
HorizontalDivider(thickness = 1.dp, color = Gray200) | ||
} | ||
|
||
@Composable | ||
@Preview | ||
fun ItemWithArrowPreview() { | ||
HankkijogboTheme { | ||
ButtonWithArrowIcon(itemTitle = "title", onClick = {}, modifier = Modifier) | ||
} | ||
} |
Oops, something went wrong.