generated from NOW-SOPT-ANDROID/now-sopt-android-template
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat/#4] week2 - compose / essential(필수) #7
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 BottomNaviItem ( | ||
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,92 @@ | ||
package com.sopt.now.compose | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.lazy.LazyColumn | ||
import androidx.compose.foundation.lazy.items | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import com.sopt.now.compose.friend.Friend | ||
import com.sopt.now.compose.friend.FriendItem | ||
import com.sopt.now.compose.user.UserInfo | ||
import com.sopt.now.compose.user.UserItem | ||
|
||
|
||
val userList = listOf<UserInfo>( | ||
UserInfo( | ||
id = "nagaeng", | ||
password = "qazwsx!@#", | ||
nickname = "이나경", | ||
mbti = "ENTJ" | ||
) | ||
) | ||
|
||
val friendList = listOf<Friend>( | ||
Friend( | ||
profileImage = R.drawable.baeinhyeok, | ||
name = "배인혁", | ||
selfDescription = "아 제 이상형입니다", | ||
), | ||
Friend( | ||
profileImage = R.drawable.leejungha, | ||
name = "이정하", | ||
selfDescription = "귀여운 사람이 좋습니다", | ||
), | ||
Friend( | ||
profileImage = R.drawable.leedohyun, | ||
name = "이도현", | ||
selfDescription = "청순한 상도 좋아합니다", | ||
), | ||
Friend( | ||
profileImage = R.drawable.jangyeongdo, | ||
name = "장영도", | ||
selfDescription = "좋아했는데 이제는 좋아하지 않는..", | ||
), | ||
Friend( | ||
profileImage = R.drawable.hahyunsang, | ||
name = "하현상", | ||
selfDescription = "말랑뽀짝 현상이", | ||
), | ||
Friend( | ||
profileImage = R.drawable.seohocheol, | ||
name = "서호철", | ||
selfDescription = "이적한다면 따라갈지도..", | ||
), | ||
Friend( | ||
profileImage = R.drawable.kimwonpil, | ||
name = "김원필", | ||
selfDescription = "김원필 직캠 보며 잠들기", | ||
), | ||
Friend( | ||
profileImage = R.drawable.kimseokjin, | ||
name = "김석진", | ||
selfDescription = "인생 처음이자 마지막 최애입니다", | ||
), | ||
Friend( | ||
profileImage = R.drawable.minhyeok, | ||
name = "이민혁", | ||
selfDescription = "수많은 민혁 중 몬스타엑스 이민혁", | ||
), | ||
Friend( | ||
profileImage = R.drawable.last, | ||
name = "이현우", | ||
selfDescription = "이 분은 나이를 안 먹으시더라구요..", | ||
), | ||
) | ||
@Composable | ||
fun HomeView() { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxSize(), | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
) { | ||
LazyColumn { | ||
items(userList) { | ||
UserItem(it) | ||
} | ||
items(friendList) { | ||
FriendItem(it) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 나경이두 요거 하나의 데이터로 만들어서 연결하는 법 알아보면 좋을 것 같아요! |
||
} | ||
} | ||
} | ||
} |
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,66 +1,63 @@ | ||
package com.sopt.now.compose | ||
|
||
import android.content.Intent | ||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.compose.foundation.Image | ||
import androidx.compose.foundation.layout.* | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.ButtonDefaults | ||
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.Color | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.unit.sp | ||
import com.sopt.now.compose.ui.theme.NOWSOPTAndroidTheme | ||
import com.sopt.now.compose.ui.theme.PurpleGrey40 | ||
|
||
class MainActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
val id = intent.getStringExtra("id") | ||
val password = intent.getStringExtra("password") | ||
val nickname = intent.getStringExtra("nickname") | ||
|
||
setContent { | ||
MainActivityContent(id = id ?: "", password = password ?: "", nickname = nickname?: "") | ||
} | ||
} | ||
} | ||
|
||
import com.sopt.now.compose.user.UserInfo | ||
@Composable | ||
fun MainActivityContent(id: String, password: String, nickname: String) { | ||
fun MypageView(userInfo: UserInfo) { | ||
Column( | ||
modifier = Modifier | ||
.fillMaxWidth() | ||
.padding(16.dp), | ||
verticalArrangement = Arrangement.Center, | ||
horizontalAlignment = Alignment.CenterHorizontally | ||
.fillMaxSize() | ||
.padding(30.dp), | ||
verticalArrangement = Arrangement.spacedBy(40.dp), | ||
) { | ||
Image ( | ||
painter = painterResource(id = R.drawable.apple), // 이미지 리소스 추가 | ||
contentDescription = null, | ||
modifier = Modifier | ||
.aspectRatio(1.5f) // aspectRatio 설정 | ||
.padding(top = 30.dp) | ||
.padding(bottom = 10.dp) | ||
) | ||
UserInfoComposable(id, password, nickname) | ||
if (userInfo != null) { | ||
Image( | ||
painter = painterResource(id = R.drawable.apple), | ||
contentDescription = null, | ||
modifier = Modifier | ||
.size(110.dp) | ||
.aspectRatio(1f) | ||
) | ||
Text(text = "안녕하세요, ${userInfo.nickname}님", | ||
fontSize = 20.sp, | ||
fontWeight = FontWeight.Bold, | ||
) | ||
Spacer(modifier = Modifier.height(15.dp)) | ||
Text(text = userInfo.id) | ||
Spacer(modifier = Modifier.height(15.dp)) | ||
Text(text = userInfo.password) | ||
} else { | ||
Text( | ||
text = "사용자 정보를 불러올 수 없습니다.", | ||
fontSize = 20.sp, | ||
Comment on lines
+46
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. string,,,추출,,,해조요,,,, |
||
fontWeight = FontWeight.Bold, | ||
modifier = Modifier.fillMaxWidth() | ||
) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
}@Composable | ||
fun UserInfoComposable(id: String, password: String, nickname: String) { | ||
Column( | ||
modifier = Modifier.padding(16.dp), | ||
verticalArrangement = Arrangement.spacedBy(8.dp) | ||
) { | ||
Text(text = "안녕하세요, $id 님!\n", | ||
Text(text = "안녕하세요, $nickname 님!\n", | ||
fontSize = 24.sp, | ||
fontWeight = FontWeight.ExtraBold) | ||
|
||
|
@@ -77,7 +74,7 @@ fun UserInfoComposable(id: String, password: String, nickname: String) { | |
|
||
Button( | ||
onClick = { }, | ||
|
||
contentPadding = PaddingValues(start = 90.dp, end = 90.dp), | ||
colors = ButtonDefaults.buttonColors( | ||
containerColor = Color.LightGray, | ||
|
@@ -89,18 +86,5 @@ fun UserInfoComposable(id: String, password: String, nickname: String) { | |
) | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
@Preview(showBackground = true) | ||
@Composable | ||
fun MainPreview() { | ||
NOWSOPTAndroidTheme { | ||
UserInfoComposable( | ||
id = "exampleId", | ||
password = "examplePassword", | ||
nickname = "exampleNickname" | ||
) | ||
} | ||
} |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
내 정보는 리스트로 안해도 되지 않을까용