Skip to content

Commit

Permalink
[MOD/#1] section1 code reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Dec 14, 2023
1 parent 5b65523 commit 2a711dc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
Expand All @@ -25,8 +24,6 @@ import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -55,20 +52,16 @@ class MainActivity : ComponentActivity() {

@Composable
fun PracticeColumn() {
Surface(
color = MaterialTheme.colorScheme.background,
Column(
modifier = Modifier
.fillMaxSize()
.background(color = Color.Blue)
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceBetween,
) {
Column(
modifier = Modifier
.fillMaxSize()
.background(color = Color.Blue)
.padding(16.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.SpaceBetween,
) {
Text("Hello")
Text("World")
}
Text(stringResource(R.string.section1_hello))
Text(stringResource(R.string.section1_world))
}
}

Expand All @@ -80,26 +73,27 @@ class MainActivity : ComponentActivity() {
.fillMaxWidth()
.height(200.dp),
) {
Text("오늘 컴포즈")
Text(stringResource(R.string.section1_today_compose))
Box(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
contentAlignment = Alignment.BottomEnd,
) {
Text("완료")
Text(stringResource(R.string.section1_complete))
}
}
}

@Composable
fun PracticeListAndLazyColumn() {
// val scrollState = rememberScrollState()
// ListUsingColum(scrollState = scrollState)
ListUsingLazyColumn()
}

@Composable
private fun ListUsingColum(scrollState: ScrollState) {
val scrollState = rememberScrollState()
Column(
modifier = Modifier
.background(color = Color.Green)
Expand All @@ -116,7 +110,6 @@ class MainActivity : ComponentActivity() {

@Composable
fun ListUsingLazyColumn() {
val scrollState = rememberScrollState()
LazyColumn(
modifier = Modifier
.background(color = Color.Green)
Expand Down Expand Up @@ -166,17 +159,15 @@ class MainActivity : ComponentActivity() {
),
) {
Box(
modifier = Modifier
.height(200.dp),
modifier = Modifier.height(200.dp),
) {
Image(
painter = painterResource(id = R.drawable.img_kermit),
contentDescription = stringResource(R.string.section1_kermit_img),
contentScale = ContentScale.Crop,
)
Box(
modifier = Modifier
.fillMaxSize(),
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.TopEnd,
) {
IconButton(onClick = { onTabFavorite(!isFavorite) }) {
Expand All @@ -194,6 +185,8 @@ class MainActivity : ComponentActivity() {
@Preview(showBackground = true)
@Composable
fun DefaultPreview() {
PracticeColumn()
MyApplicationTheme {
PracticeImageCardState()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@
<string name="section1_header">HEADER</string>
<string name="section1_letter">글씨 %1$s</string>
<string name="section1_footer">FOOTER</string>
<string name="section1_today_compose">오늘 컴포즈</string>
<string name="section1_complete">완료</string>
<string name="section1_hello">Hello</string>
<string name="section1_world">World</string>
</resources>

0 comments on commit 2a711dc

Please sign in to comment.