본문 바로가기

전체 글

(103)
Android / Version Catalog 적용 - 안드로이드 버전관리 1. gradle/libs.versions.toml 파일 생성[versions]coreKtx = "1.9.0"androidApplication = "8.1.0"[libraries]core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }[plugins]android-application = { id = "com.android.application", version.ref = "androidApplication" } 2. app/build.gradle.kt 에 적용implementation(libs.core.ktx) 3. build.gradle.kt에 적용plugins { alias(libs.plugins.and..
Android version 맞추기 (targetSdk 34 업그레이드/kotlin 버전 업그레이드) 1. 라이브러리 모듈과 프로젝트의 코틀린 버전의 충돌이 남. Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0. 1. targetSdk를 34로 업그레이드 하고(내친김에), 코틀린 버전을 1.8.0으로 올림 targetSdk 33 -> 34 compileSdk 33 -> 34 'com.android.tools.build:gradle:7.2.1' -> 'com.android.tools.build:gradle:7.2.2' 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21' -> 'org...
Compose / 밀어서 삭제 구현 SwipeToDismiss 사용하기 Compose SwipeToDismiss를 사용하면 밀어서 삭제를 간단하게 구현할 수 있다. LazyColumn(modifier = Modifier.fillMaxHeight()) { items( items = tempList, key = { temp -> temp.no} ) { item -> val currentItem by rememberUpdatedState(newValue = item) SwipeToDismiss( state = rememberDismissState(confirmStateChange = { if(it == DismissValue.DismissedToStart){ // 밀었을때 액션 } true }), directions = setOf(DismissDirection.EndToStart..
Android / 안드로이드 notification Icon 적용 안드로이드 푸시메세지를 받았을때 뜨는 notification의 icon은 svg, 흰색, 24dp
Android / 푸시알림 클릭시 PendingIntent Bundle값 전달 안되는 경우 푸시 알림 클릭하면 PendingIntent를 이용하여 MainActivity로 이동하는 로직에서 intent로 전달된 Bundle값이 초기값으로만 이동되는 현상이 발생하였다. 반복적으로 푸시알림이 들어와 노티가 쌓이게 되면 bundle값이 캐싱되어 실시간으로 값 변동이 전달되지 않는다. public static PendingIntent getActivity(Context context, int requestCode, @NonNull Intent intent, int flags, @Nullable Bundle options) { throw new RuntimeException("Stub!"); } PendingIntent.getActivity 함수를 보면 requestCode를 인자로 받고있다. 해당 인..
Compose / LazyClumn items 리컴포지션 일어나지 않는 경우 (상태변화 감지 안됨) items에 넣은 List의 해시값이 변해도 이미 그려놓은 리스트는 해시값이 변경된걸 모른다. 리컴포지션일 일어나게 하기 위해서는 items에 key값을 지정해줘서, 리스트가 변경될때 키값 변경이 감지되도록 해야한다. items 함수를 살펴보자. inline fun LazyListScope.items( items: List, noinline key: ((item: T) -> Any)? = null, noinline contentType: (item: T) -> Any? = { null }, crossinline itemContent: @Composable LazyItemScope.(item: T) -> Unit ) = items( count = items.size, key = if (key != null..
Kotlin / 모의고사 https://school.programmers.co.kr/learn/courses/30/lessons/42840 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 수포자는 수학을 포기한 사람의 준말입니다. 수포자 삼인방은 모의고사에 수학 문제를 전부 찍으려 합니다. 수포자는 1번 문제부터 마지막 문제까지 다음과 같이 찍습니다. 1번 수포자가 찍는 방식: 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ... 2번 수포자가 찍는 방식: 2, 1, 2, 3, 2, 4, 2, 5, 2, 1, 2, 3, 2, 4, 2, 5, ... 3번 수포자가 ..
Kotlin / 프로세스 https://school.programmers.co.kr/learn/courses/30/lessons/42587 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr 문제 설명 운영체제의 역할 중 하나는 컴퓨터 시스템의 자원을 효율적으로 관리하는 것입니다. 이 문제에서는 운영체제가 다음 규칙에 따라 프로세스를 관리할 경우 특정 프로세스가 몇 번째로 실행되는지 알아내면 됩니다. 1. 실행 대기 큐(Queue)에서 대기중인 프로세스 하나를 꺼냅니다. 2. 큐에 대기중인 프로세스 중 우선순위가 더 높은 프로세스가 있다면 방금 꺼낸 프로세스를 다시 큐에 넣습니다. 3..

반응형