Skip to content
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

수료 제출 #102

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
## 완료한 코드랩
완료한 코드랩을 체크 해주세요. 16개의 코드랩 중 12개 이상 완주하셔야 Compose Camp가 준비한 트래킹 완주 기념품을 배송해 드립니다.

- [ ] Unit1/Pathway3/BirthdayCard
- [ ] Unit1/Pathway3/ComposeArticle
- [ ] Unit1/Pathway3/ComposeQuadrant
- [ ] Unit1/Pathway3/TaskCompleted
- [ ] Unit2/Pathway2/DiceRoller
- [ ] Unit2/Pathway2/Lemonade
- [ ] Unit2/Pathway3/TipTime
- [ ] Unit2/Pathway3/ArtSpace
- [ ] Unit3/Pathway2/AffirmationsCodelab
- [ ] Unit3/Pathway3/WoofCodelab
- [ ] Unit4/Pathway1/DessertClicker
- [ ] Unit4/Pathway1/Unscamble
- [ ] Unit4/Pathway2/CupCake
- [O] Unit1/Pathway3/BirthdayCard
- [O] Unit1/Pathway3/ComposeArticle
- [O] Unit1/Pathway3/ComposeQuadrant
- [O] Unit1/Pathway3/TaskCompleted
- [O] Unit2/Pathway2/DiceRoller
- [O] Unit2/Pathway2/Lemonade
- [O] Unit2/Pathway3/TipTime
- [O] Unit2/Pathway3/ArtSpace
- [O] Unit3/Pathway2/AffirmationsCodelab
- [O] Unit3/Pathway3/WoofCodelab
- [O] Unit4/Pathway1/DessertClicker
- [O] Unit4/Pathway1/Unscamble
- [O] Unit4/Pathway2/CupCake
- [ ] Unit4/Pathway2/LaunchTray
- [ ] Unit4/Pathway3/ReplyApp
- [ ] Unit4/Pathway3/TrainingSports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import android.text.Layout
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
Expand All @@ -38,23 +39,72 @@ import com.example.happybirthday.ui.theme.HappyBirthdayTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { }
setContent {
HappyBirthdayTheme {
// A surface container using the 'background' color from the theme
Surface(color = MaterialTheme.colors.background) {
BirthdayGreetingWithImage(message = getString(R.string.happy_birthday_text), from = getString(
R.string.signature_text))
}
}
}
}
}

// 7. 텍스트 정렬 및 패딩 추가
@Composable
fun BirthdayGreetingWithText(message: String, from: String) {
// Create a column so that texts don't overlap
Column { }
Column {
Text(
text = message,
fontSize = 36.sp,
modifier = Modifier
.fillMaxWidth()
// .wrapContentWidth(Alignment.Start)
.wrapContentWidth(Alignment.CenterHorizontally)
.padding(start = 16.dp, top = 16.dp)
)
Text(
text = from,
fontSize = 24.sp,
modifier = Modifier
.fillMaxWidth()
// .wrapContentWidth(Alignment.End)
.wrapContentWidth(Alignment.CenterHorizontally)
.padding(start = 16.dp, end = 16.dp)
)
}
}

// 5. Box 레이아웃 추
@Composable
fun BirthdayGreetingWithImage(message: String, from: String) { }
fun BirthdayGreetingWithImage(message: String, from: String) {
val image = painterResource(R.drawable.androidparty)
Box {
Image(
painter = image,
contentDescription = null,
modifier = Modifier
.fillMaxHeight()
.fillMaxWidth(),
contentScale = ContentScale.Crop

)
BirthdayGreetingWithText(message = message, from = from)
}


}

// 4. 이미지 컴포저블 추가
@Preview(showBackground = false)
@Preview(showBackground = true)
@Composable
private fun BirthdayCardPreview() { }
private fun BirthdayCardPreview() {
HappyBirthdayTheme() {
BirthdayGreetingWithImage(message = stringResource(R.string.preview_happy_birthday_text), from = stringResource(
R.string.preview_signature_text) )
}

}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
-->
<resources>
<string name="app_name">Happy Birthday</string>
<string name="happy_birthday_text">Happy Birthday DE!</string>
<string name="signature_text">- Harim</string>
<string name="preview_happy_birthday_text">Happy Birthday Sam!</string>
<string name="preview_signature_text">- from Emma</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
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
Expand All @@ -24,12 +23,24 @@ import com.example.composearticle.ui.theme.ComposeArticleTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { }
setContent {
androidx.compose.material.Surface(color = MaterialTheme.colors.background) {
ComposeArticleApp()
}
}
}
}

@Composable
fun ComposeArticleApp() { }
fun ComposeArticleApp() {
ArticleCard(title = stringResource(R.string.title_jetpack_compose_tutorial),
shortDescription = stringResource(R.string.compose_short_desc),
longDescription = stringResource(R.string.compose_long_desc),
imagePainter = painterResource(id = R.drawable.bg_compose_background),
modifier = Modifier
)

}

@Composable
private fun ArticleCard(
Expand All @@ -39,10 +50,52 @@ private fun ArticleCard(
imagePainter: Painter,
modifier: Modifier = Modifier,
) {
Column() { }
Column() {
Image(painter = imagePainter,
contentDescription = null,
contentScale = ContentScale.FillWidth
)
Text(
text = title,
fontSize = 24.sp,
modifier = modifier
.padding(start = 16.dp, end = 16.dp, bottom = 16.dp, top = 16.dp)
)
Text(
text = shortDescription,
textAlign = TextAlign.Justify,
modifier = modifier
.padding(start = 16.dp, end = 16.dp)
)
Text(
text = longDescription,
textAlign = TextAlign.Justify,
modifier = modifier
.padding(start = 16.dp, end = 16.dp, bottom = 16.dp, top = 16.dp)
)
}

}


@Preview(showBackground = true)
@Composable
fun DefaultPreview() { }
fun DefaultPreview() {
ComposeArticleTheme() {
Surface {
ComposeArticleApp()
}
}
}












Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
Expand All @@ -22,15 +23,56 @@ import com.example.composequadrant.ui.theme.ComposeQuadrantTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { }
setContent {
ComposeQuadrantTheme() {
Surface{
ComposeQuadrantApp()
}
}
}
}
}

@Composable
fun ComposeQuadrantApp() {
Column() {
Row() { }
Row() { }
Column(modifier = Modifier
.fillMaxWidth()
.fillMaxHeight()
) {
Row(
modifier = Modifier
.weight(1f)
) {
ComposableInfoCard(
title = stringResource(id = R.string.first_title),
description = stringResource(id = R.string.first_description),
backgroundColor = Color.Green,
modifier = Modifier.weight(1f)
)
ComposableInfoCard(
title = stringResource(id = R.string.second_title),
description = stringResource(id = R.string.second_description),
backgroundColor = Color.Yellow,
modifier = Modifier.weight(1f)
)
}
Row(
modifier = Modifier
.weight(1f)
) {
ComposableInfoCard(
title = stringResource(id = R.string.third_title),
description = stringResource(id = R.string.third_description),
backgroundColor = Color.Cyan,
modifier = Modifier.weight(1f)
)
ComposableInfoCard(
title = stringResource(id = R.string.fourth_title),
description = stringResource(id = R.string.fourth_description),
backgroundColor = Color.LightGray,
modifier = Modifier.weight(1f)
)
}
}
}

Expand All @@ -41,10 +83,47 @@ private fun ComposableInfoCard(
backgroundColor: Color,
modifier: Modifier = Modifier
) {
Column( ) { }
Column(
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center,
modifier = modifier
.fillMaxWidth()
.fillMaxHeight()
.background(backgroundColor)
.padding(16.dp)
) {
Text(
text = title,
fontWeight = FontWeight.Bold,
modifier = Modifier.padding(bottom = 16.dp)
)
Text(
text = description,
textAlign = TextAlign.Justify
)
}
}


@Preview(showBackground = true)
@Composable
fun DefaultPreview() { }
fun DefaultPreview() {
ComposeQuadrantTheme() {
Surface{
ComposeQuadrantApp()
}
}
}













Loading