In the View system, ConstraintLayout was the recommended way to create large and complex layouts, as a flat view hierarchy was better for performance than nested views are. However, this is not a concern in Compose, which is able to efficiently handle deep layout hierarchies.
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
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.InternalComposeApi | |
import androidx.compose.runtime.NonRestartableComposable | |
import androidx.compose.runtime.RememberObserver | |
import androidx.compose.runtime.currentComposer | |
import androidx.compose.runtime.remember | |
import kotlin.coroutines.CoroutineContext | |
import kotlinx.coroutines.CancellationException | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job |
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
@Stable | |
fun Modifier.dropShadow( | |
borderRadius: Dp, | |
spreadRadius: Dp = 3.dp, | |
blurRadius: Dp = spreadRadius, | |
color: Color = Color.DarkGray.copy(alpha = 0.1f), | |
offsetX: Dp = 0.dp, | |
offsetY: Dp = 0.dp, | |
) = | |
drawBehind { |
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
@Stable | |
fun Modifier.drawHorizontalFadingEdges( | |
target: Color = Color.White, | |
width: Dp = 10.dp, | |
scrollState: ScrollableState, | |
) = | |
if (!scrollState.canScrollForward && !scrollState.canScrollBackward) this | |
else drawWithCache { | |
val gradientWidth = width.toPx() |
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
/* | |
* Designed and developed by "옴마야" Team 2023. | |
* | |
* Licensed under the MIT. | |
* Please see full license: https://github.com/mash-up-kr/WeQuiz-Android/blob/main/LICENSE | |
*/ | |
package team.ommaya.wequiz.android | |
import android.os.Bundle |
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
/** | |
* Boolean | |
* | |
* The most basic datatype is the simple true/false value, | |
* which JavaScript and TypeScript (as well as other languages) call a 'boolean' value. | |
*/ | |
var isDone: boolean = false; | |
/** | |
* Number |
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
class PlaygroundActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
Layout( | |
modifier = Modifier.fillMaxSize(), | |
content = { | |
Box( | |
modifier = Modifier | |
.layoutId("green") |
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
fun <A, B> mutableStatePairOf(first: A, second: B): SnapshotMutablePair<A, B> { | |
return SnapshotMutablePairImpl(first, second) | |
} | |
fun <A, B> mutableStatePairOf(value: Pair<A, B>): SnapshotMutablePair<A, B> { | |
return SnapshotMutablePairImpl(value.first, value.second) | |
} | |
@Stable | |
interface SnapshotMutablePair<A, B> { |
안녕하세요! 성빈랜드 스터디 공지 드립니다. 성빈랜드 메인 프로젝트 개발을 시작하기 전에 한 달간 코루틴과 안드로이드 프레임워크 내부 딥다이브 스터디를 진행하려고 합니다. 평소 혼자 공부하는 편이지만 워낙 어렵고 좋은 주제인 만큼 함께 공부해 보면 좋을 거 같아 스터디원을 모집하게 됐습니다.
최신 내용은 성빈랜드 공지를 통해 확인해 주세요!
이 스터디의 첫 번째 목적은 엔지니어적 관점에서 역량을 키우기 위함입니다. 또한 내부를 알고 설계하는 것과 내부를 모르고 설계하는 것에서 분명한 차이가 있음을 제가 컴포즈 내부 공부를 통해 느꼈으므로 더 좋은 안드로이드 개발을 위한 목적도 있습니다.
제가 컴포즈 내부를 공부하면서 느낀 점이 혼자서 이 많은 내용을 이해하기가 너무 어렵다는 거였습니다. 초반엔 어느 흐름을 봐야 할 지도 모르겠어서 방황하는 시간이 너무 많았습니다. 이를 극복하기 위해 제가 시도했던 일들은 제가 참고한 컴포즈 내부 레퍼런스의 작성자분과 외국 안드로이드 GDE 이신 분들, StackOverflow, kotlinlang 슬랙, 그리고 구글 컴포즈 팀에 계신 분들에게 여러 번 질문을 통해 6개월간 씨름 끝에 드디어 방향을 잡고 이해할 수 있었고, 성빈랜드에 컴포즈 내부 글을 작성할 수 있었습니다.
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
open class PeopleWrapper(open val name: String, open val age: Int) { | |
override fun toString() = "name: $name, age: $age" | |
} | |
class MutablePeopleWrapper(name: String, age: Int) : PeopleWrapper(name, age) { | |
private val _name = MutableStateFlow(name) | |
override var name | |
get() = _name.value | |
set(value) { | |
_name.value = value |
NewerOlder