목록분류 전체보기 (140)
시배's Android
1158번: 요세푸스 문제 첫째 줄에 N과 K가 빈 칸을 사이에 두고 순서대로 주어진다. (1 ≤ K ≤ N ≤ 5,000) www.acmicpc.net private fun main(){ val (n,k) = readLine()!!.split(" ").map { it.toInt() } val people = mutableListOf().also { it.addAll(1..n) } val result = mutableListOf() var i = 0 while(people.size > 1){ i = (i + k-1) % people.size result.add(people.removeAt(i)) } result.add(people[0]) print("") }
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dKrTRs/btsvl785XiX/nOXk96vSNWntmbmY9WOw4k/img.png)
The “Real” Clean Architecture in Android: Modularization An overview of the principles behind modularization betterprogramming.pub “If the SOLID principles tell us how to arrange the bricks into walls and rooms, then the component principles tell us how to arrange the rooms into buildings.” ~ Robert C. Martin, Clean Architecture 레이어별로 패키징해야 하나요, 아니면 피쳐별로 패키징해야 하나요? 다른 접근 방식이 있나요? 프로젝트 컴파일 시간을 단축..
제 생각에 Kotlin 코루틴을 사용할 때 해야 할 일과 하지 말아야 할 일(또는 최소한 피해야 할 일) 몇 가지에 대해 글을 쓰기로 결정했습니다. Wrap async calls with coroutineScope or use SupervisorJob to handle exceptions ❌ async 블록이 예외를 발생시킬 수 있는 경우 try/catch 블록으로 감싸는 것에 의존하지 마세요. val job: Job = Job() val scope = CoroutineScope(Dispatchers.Default + job) // may throw Exception fun doWork(): Deferred = scope.async { ... } // (1) fun loadData() = scope.la..
이번 글에서는 animateScrollToItem or scrollToItem을 통해 특정 아이템으로 스크롤을 할 때 NestedScrollConnection 불려지지 않아 커스텀 된 TopAppBar의 상태가 변경되지 않는 문제로 삽질을 하다가, 구글의 의도를 알 수 있었고 조금은 cracky 한 방법으로 해결을 하였는 것을 공유하고자 합니다. 문제의 발생 현재 저는 NetstedScrollConnection을 활용하여 scroll에 따라 특정 state를 변경시키며 이를 TopAppBar에 적용시켜 커스텀한 동작을하는 TopAppBar를 구현하여 사용 중에 있었습니다. 추후 요구사항이 추가되어 animateScrollToItem을 통해 최상단을 도달하게 하는 기능을 추가하고 나니 animateScro..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dk2zyE/btsu0td9seS/1qIJESb3M8ntAkKxNT5k30/img.gif)
Animation modifiers and composables | Jetpack Compose | Android Developers Animation modifiers and composables Stay organized with collections Save and categorize content based on your preferences. Compose comes with built-in composables and modifiers for handling common animation use cases. Built-in animated composables Animate developer.android.com Built-in animated composables Animate appeara..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ljxS1/btsu7QfiLxt/pvTceyyOWHPlQcDRKAQn60/img.png)
Modular Navigation with Jetpack Compose A large amount of mobile apps will need some form of Navigation, allowing users to move between different parts of an application. When… medium.com 대부분의 모바일 앱에는 사용자가 애플리케이션의 여러 부분 사이를 이동할 수 있도록 하는 일종의 내비게이션이 필요합니다. Android 앱 내에서 이러한 요구 사항을 구현할 때 애플리케이션은 자체 솔루션을 구현하거나 기존의 인텐트 또는 조각 관리자에 의존하거나 최근 몇 년 동안 탐색 컴포넌트 옵션을 탐색해 왔습니다. Jetpack Compose의 알파 버전과 개발자 프리뷰 버..
이번 글에서는 Compose에서 다중 클릭 이벤트를 처리하는 방법에 대해 소개하겠습니다. interface MultipleEventsCutterManager { fun processEvent(event: () -> Unit) } @OptIn(FlowPreview::class) @Composable fun multipleEventsCutter( content: @Composable (MultipleEventsCutterManager) -> T ) : T { val debounceState = remember { MutableSharedFlow Unit>( replay = 0, extraBufferCapacity = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST ) ..
The Big Difference Between Flows and Channels in Kotlin Stop worrying if flows are hot or cold, and focus on good old-fashioned encapsulation instead betterprogramming.pub "Channel은 Hot이고 Flow은 Cold"는 Kotlin 프로그래머의 말을 들어보셨을 것입니다. 이는 비동기 데이터 스트림으로 작업하는 두 가지 방법을 유용하게 구분하는 말입니다. Flow와 Channel은 함수와 개체만큼이나 서로 다릅니다. 하지만 이것이 전부는 아닙니다. Flow 자체는 적어도 두 가지 매우 다른 형태로 제공되기 때문입니다. 바로 이 지점에서 제한적인 Hot, Cold 비유가..