generated from NOW-SOPT-ANDROID/now-sopt-android-template
-
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.
Browse files
Browse the repository at this point in the history
Feat/#6 week2 compose 필수과제 구현
- Loading branch information
Showing
12 changed files
with
589 additions
and
151 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
8 changes: 8 additions & 0 deletions
8
app/src/main/java/com/sopt/now/compose/BottomNavigationItem.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,8 @@ | ||
package com.sopt.now.compose | ||
|
||
import androidx.compose.ui.graphics.vector.ImageVector | ||
|
||
data class BottomNavigationItem( | ||
val icon: ImageVector, | ||
val label: 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.sopt.now.compose | ||
|
||
import androidx.compose.ui.graphics.vector.ImageVector | ||
|
||
data class Friend( | ||
val profileImage: ImageVector, | ||
val name: String, | ||
val selfDescription: String, | ||
) |
51 changes: 51 additions & 0 deletions
51
app/src/main/java/com/sopt/now/compose/FriendProfileItem.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,51 @@ | ||
package com.sopt.now.compose | ||
|
||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.foundation.layout.width | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.text.style.TextOverflow | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
|
||
|
||
@Composable | ||
fun FriendProfileItem(friendImg: ImageVector, friendName: String, friendDescription: String) { | ||
Row( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(vertical = 10.dp), | ||
verticalAlignment = Alignment.CenterVertically | ||
) { | ||
Icon( | ||
modifier = Modifier.size(50.dp), | ||
imageVector = friendImg, | ||
contentDescription = null | ||
) | ||
Spacer(modifier = Modifier.width(10.dp)) | ||
Text( | ||
text = friendName, | ||
fontSize = 14.sp, | ||
fontWeight = FontWeight.Bold, | ||
overflow = TextOverflow.Ellipsis, | ||
maxLines = 1 | ||
) | ||
Spacer(modifier = Modifier.width(30.dp)) | ||
Spacer(modifier = Modifier.weight(1f)) | ||
Text( | ||
text = friendDescription, | ||
fontSize = 10.sp, | ||
overflow = TextOverflow.Ellipsis, | ||
maxLines = 1 | ||
) | ||
} | ||
} |
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,33 @@ | ||
package com.sopt.now.compose | ||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.material3.HorizontalDivider | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.unit.dp | ||
|
||
@Composable | ||
fun HomeUi(viewModel: HomeViewModel) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(horizontal = 10.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
LazyColumn { | ||
items(viewModel.userList) { | ||
UserProfileItem(it) | ||
HorizontalDivider(thickness = 1.dp, color = Color.DarkGray) | ||
} | ||
items(viewModel.friendList) { | ||
FriendProfileItem(it.profileImage,it.name,it.selfDescription) | ||
} | ||
} | ||
} | ||
} |
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,93 @@ | ||
package com.sopt.now.compose | ||
|
||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Person | ||
import androidx.lifecycle.ViewModel | ||
|
||
class HomeViewModel : ViewModel() { | ||
|
||
val userList = listOf<User>( | ||
User( | ||
profileImage = R.drawable.cute, | ||
name = "송혜음", | ||
selfDescription = "여러분 보고 시퍼yo 훌쩍훌쩍" | ||
) | ||
) | ||
|
||
val friendList = listOf<Friend>( | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "박동민", | ||
selfDescription = "곽의진...얼굴 재치 실력 모든걸 다 가진 남자... 하지만 밀양박씨 36대손인 나 박동민은 가지지 못했지" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "이석준", | ||
selfDescription = "죄송합니다 저 도핑했습니다... 안드-로이더 \uD83D\uDC89" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "박유진", | ||
selfDescription = "(ง˙∇˙)ว 에라 모르겠다" | ||
), Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "이의경", | ||
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지?" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "우상욱", | ||
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "배지현", | ||
selfDescription = "표정 풀자 ^^" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "이의경", | ||
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지?" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "우상욱", | ||
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "배지현", | ||
selfDescription = "표정 풀자 ^^" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "이의경", | ||
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지?" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "우상욱", | ||
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "배지현", | ||
selfDescription = "표정 풀자 ^^" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "이의경", | ||
selfDescription = "다들 빨리 끝내고 뒤풀이 가고 싶지?" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "우상욱", | ||
selfDescription = "나보다 안드 잘하는 사람 있으면 나와봐" | ||
), | ||
Friend( | ||
profileImage = Icons.Filled.Person, | ||
name = "배지현", | ||
selfDescription = "표정 풀자 ^^" | ||
) | ||
) | ||
} |
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.