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

수료 제출 #99

Open
wants to merge 8 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
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,68 @@ 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( getString(R.string.happy_birthday_text), 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 = "ok",
fontSize = 24.sp,
)
Text(
text = message,
fontSize = 36.sp,
modifier = Modifier
.fillMaxWidth()
.wrapContentWidth(Alignment.CenterHorizontally)
.padding(start = 16.dp, top = 16.dp)
)
Text(
text = from,
fontSize = 24.sp,
modifier = Modifier
.fillMaxWidth()
.wrapContentWidth(Alignment.End)
.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(id = R.drawable.androidparty)
Box {
Image(
painter = image,
contentDescription = null,
modifier = Modifier
.fillMaxHeight()
.fillMaxWidth(),
contentScale = ContentScale.Crop
)
BirthdayGreetingWithText(message, from)

}
}

// 4. 이미지 컴포저블 추가
@Preview(showBackground = false)
@Composable
private fun BirthdayCardPreview() { }
private fun BirthdayCardPreview() {
BirthdayGreetingWithImage("Happy", "from")
// BirthdayGreetingWithText("Happy", "from")
}

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.
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@
-->
<resources>
<string name="app_name">Happy Birthday</string>
<string name="happy_birthday_text">Happy Birthday Sam!</string>
<string name="signature_text">- From Emma.</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ 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.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.res.painterResource
Expand All @@ -24,7 +24,9 @@ import com.example.composearticle.ui.theme.ComposeArticleTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { }
setContent {
DefaultPreview()
}
}
}

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

}
}


@Preview(showBackground = true)
@Composable
fun DefaultPreview() { }
fun DefaultPreview() {
ArticleCard(
"Jetpack Compose tutorial",
"Jetpack Compose is a modern toolkit for building native Android UI. Compose simplifies and accelerates UI development on Android with less code, powerful tools, and intuitive Kotlin APIs",
"In this tutorial, you build a simple UI component with declarative functions. You call Compose functions to say what elements you want and the Compose compiler does the rest. Compose is built around Composable functions. These functions let you define your app\\'s UI programmatically because they let you describe how it should look and provide data dependencies, rather than focus on the process of the UI\\'s construction, such as initializing an element and then attaching it to a parent. To create a Composable function, you add the @Composable annotation to the function name.",
painterResource(R.drawable.bg_compose_background),
Modifier.fillMaxWidth()



);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,44 @@ import com.example.composequadrant.ui.theme.ComposeQuadrantTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { }

setContent {
DefaultPreview()
}
}
}

@Composable
fun ComposeQuadrantApp() {
Column() {
Row() { }
Row() { }
Column(Modifier.fillMaxWidth()) {
Row(Modifier.weight(1f)) {
ComposableInfoCard(
"Text composable",
"Displays text and follows Material Design guidelines.",
Color.Green,
modifier = Modifier.weight(1f)
)
ComposableInfoCard(
"Image composable",
"Creates a composable that lays out and draws a given Painter class object.",
Color.Yellow,
modifier = Modifier.weight(1f)
)
}
Row(Modifier.weight(1f)) {
ComposableInfoCard(
"Row composable",
"A layout composable that places its children in a horizontal sequence.",
Color.Cyan,
modifier = Modifier.weight(1f)
)
ComposableInfoCard(
"Column composable",
"A layout composable that places its children in a vertical sequence.",
Color.LightGray,
modifier = Modifier.weight(1f)
)
}
}
}

Expand All @@ -41,10 +70,25 @@ private fun ComposableInfoCard(
backgroundColor: Color,
modifier: Modifier = Modifier
) {
Column( ) { }
Column(
modifier = modifier.fillMaxSize()
.background(backgroundColor)
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
)

{

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() {
ComposeQuadrantApp()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*

import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface
import androidx.compose.material.Text
Expand All @@ -22,15 +23,31 @@ import com.example.taskcompleted.ui.theme.TaskCompletedTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent { }

setContent {
DefaultPreview()
}
}
}

@Composable
fun TaskCompletedScreen() {
Column( ) { }
Column(
modifier = Modifier.fillMaxHeight().fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Image(painter = painterResource(R.drawable.ic_task_completed), contentDescription = null)
Text(text = "All tasks completed", fontSize = 24.sp, modifier = Modifier.padding(top = 24.dp, bottom = 8.dp))
Text(
text = "Nice work!",
fontSize = 16.sp
)
}
}

@Preview(showBackground = true)
@Composable
fun DefaultPreview() { }
fun DefaultPreview() {
TaskCompletedScreen()
}
15 changes: 15 additions & 0 deletions Unit2/Pathway2/Dice_Roller/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions Unit2/Pathway2/Dice_Roller/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading