Skip to content
Merged
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
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/
.DS_Store
/build
/captures
Expand Down
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

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

This file was deleted.

26 changes: 0 additions & 26 deletions .idea/appInsightsSettings.xml

This file was deleted.

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

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/deploymentTargetSelector.xml

This file was deleted.

18 changes: 0 additions & 18 deletions .idea/gradle.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/migrations.xml

This file was deleted.

10 changes: 0 additions & 10 deletions .idea/misc.xml

This file was deleted.

17 changes: 0 additions & 17 deletions .idea/runConfigurations.xml

This file was deleted.

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

This file was deleted.

31 changes: 10 additions & 21 deletions app/src/main/java/com/hyeon/dayroutine/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.hyeon.dayroutine

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -10,38 +11,26 @@ import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.tooling.preview.Preview
import com.hyeon.dayroutine.ui.home.HomeScreen
import com.hyeon.dayroutine.ui.theme.DayRoutineTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
enableEdgeToEdge(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q) enableEdgeToEdge 에 대해서 설명해주세요

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[공부]
화면은 시스템바(상태바, 네비게이션바)영역까지 확장해서 UI를 그릴 수 있게 해줍니다.

statusBarStyle = SystemBarStyle.dark(
scrim = Color.Transparent.toArgb()
)
)
setContent {
DayRoutineTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "Android",
modifier = Modifier.padding(innerPadding)
)
HomeScreen()
}
}
}
}
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
DayRoutineTheme {
Greeting("Android")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.hyeon.dayroutine.ui.component

import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.ProgressIndicatorDefaults.drawStopIndicator
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.CornerRadius
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.unit.dp

@Composable
fun RoutineProgress(
modifier: Modifier,
progress: Float
) {
Copy link
Copy Markdown

@theo-f-lab theo-f-lab Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q) 이렇게 작성하는 Composable을 뭐라고 표현할까요?(stateless? stateful?)

Q2) stateless? stateful?에 대해 설명해주세요

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[공부]

  1. 해당 컴포저블은 상태를 외부에서 받아서 Canvas를 그리기만 하기때문에 Stateless입니다.
  2. stateful이란 직접 상태를 가지고 있는 컴포저블 함수를 말합니다. 반대로 stateless란 직접 상태를 가지지 않고 외부에서 상태를 받는 컴포저블 함수를 말합니다.

Canvas(
modifier = modifier
.fillMaxWidth()
.height(6.dp)
) {
val radius = size.height / 2
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q) 이 radius는 몇번이 계산될까요?

Q2) 리컴포지션에 대해서 설명해주세요

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. 해당 radius는 1번 계산이 되는거 같습니다
  2. 리컴포지션이란 State가 변경될 때 해당 State를 읽고있는 컴포저블이 재실행 되는걸 말합니다.


drawRoundRect(
color = Color(0xFF33334a),
cornerRadius = CornerRadius(radius)
)

drawRoundRect(
color = Color(0xFF6c63ff),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q) Color 정의하는 다른 방식은 없나요?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MaterialTheme에서 Color 값을 지정해서 사용할 수 있을거 같습니다. 아니면 Color 값을 관리하는 Object를 생성해서 사용할 수 있을거같습니다.

cornerRadius = CornerRadius(radius),
size = Size(width = size.width * progress, height = size.height)
)
}
}
Loading
Loading