일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 31 |
- onMeasure
- 알림
- sqlite
- Behavior
- lifecycle
- notification
- recyclerview
- LiveData
- Coroutine
- room
- activity
- Navigation
- 백준
- hilt
- ViewModel
- CustomView
- 알고리즘
- HTTP
- 코틀린
- 안드로이드
- DataBinding
- onLayout
- CoordinatorLayout
- kotlin
- View
- AppBarLayout
- BOJ
- Algorithm
- Android
- CollapsingToolbarLayout
- Today
- Total
목록전체 글 (212)
개발일지
개념 충족 가능성 문제 중 하나로써 아래와 같은 형태를 2-SAT 문제라 한다. * 충족 가능성 문제 : Boolean으로 이루어진 식이 있을 때 해당 식이 True인 경우를 찾는 문제 f=(¬x1∨x2)∧(¬x2∨x3)∧(x1∨x3)∧(x3∨x2) 인 경우에 f를 true로 만드는 경우 ¬ : NOT ∨ : OR ∧ : AND 괄호 안의 OR 연산으로 이루어진 것을 절(Clause)이라고 표현하고 AND와 절로 이루어진 식을 CNF(Conjunctive Normal Form)라고 한다. 각 절의 변수의 개수가 2개면 2-SAT이라 하고 N개면 N-SAT이라고 한다. 2개 같은 경우 SCC 알고리즘을 사용하여 쉽게 해결할 수 있지만, 3개 이상의 SAT 문제에서는 NP-Hard 문제이다. 작동원리 1. ..
ActivityNavigator에서 Transition을 설정하면 된다. 해당 코드를 Activity finish에 작성한다. override fun finish() { super.finish() ActivityNavigator.applyPopAnimationsToPendingTransition(this) } Git (예제소스) github.com/KangTaeJong98/Example/tree/main/Android/Navigation KangTaeJong98/Example My Example Code. Contribute to KangTaeJong98/Example development by creating an account on GitHub. github.com

개념 파란점에서 빨간점까지 탐색한다고 생각할 때 파란점 기준으로 탐색하면 초록색 영역만큼 탐색해야한다. 하지만 파란점과 빨간점을 기준으로 만나는 노란색 점을 탐색하면 탐색해야 하는 불필요한 영역이 줄어든다. 이처럼 기준을 바꿔서 다르게 생각하면 좀 더 연산을 줄일 수 있다. 문제 https://www.acmicpc.net/problem/1450 1450번: 냅색문제 첫째 줄에 N과 C가 주어진다. N은 30보다 작거나 같은 자연수이고, C는 10^9보다 작거나 같은 음이아닌 정수이고. 둘째 줄에 물건의 무게가 주어진다. 무게도 10^9보다 작거나 같은 자연수이다. www.acmicpc.net 코드 #include using namespace std; int n, c; vector input; vector..
Gson Json을 Serialize, Deserialize를 돕는 라이브러리입니다. Gson을 통해 Object와 Json을 쉽게 직렬화, 역직렬화 할 수 있고 다양한 옵션을 제공하기 때문에 상황에 맞게 Strategy를 설정할 수 있습니다. Class data class LoginForm( @SerializedName(value = "id", alternate = ["clientId", "userId"]) val id: String? = null, @SerializedName(value = "password", alternate = ["clientPassword", "userPassword"]) val password: String? = null ) data class Profile( val name..

PagingAdapter RecyclerView와 결합하여 사용할 수 있고, LoadState로 Loading, Error 등 상황을 표시할 수 있습니다. 코드 BasePagingAdapter abstract class BasePagingAdapter(itemCallback: DiffUtil.ItemCallback) : PagingDataAdapter(itemCallback) { override fun onBindViewHolder(holder: BaseHolder, position: Int) { getItem(position)?.let { holder.bind(it) } } override fun onBindViewHolder(holder: BaseHolder, position: Int, payload..

Pager PagingConfig를 바탕으로 PagerSource로부터 PagingData를 만들어서 Flow형으로 반환한다. 코드 @HiltViewModel class ViewerViewModel @Inject constructor(): ViewModel() { fun getPagingData(webToon: WebToon, episode: Int): Flow { return Pager(PagingConfig(pageSize = 10), episode - 1) { ViewerPagingSource(webToon, episode) }.flow // 데이터를 변환해야 할 경우 // .map { // it // } .cachedIn(viewModelScope) } } override fun onCreate(..

PagingSource PagingSource는 데이터 소스를 얻는 방법을 정의하고 로컬 데이터 베이스에서 얻거나 서버로 부터 데이터를 얻을지 정의할 수 있다. PagingSource에서 Key값은 Page의 Key 유형이고 Value는 얻는 데이터의 유형입니다. 코드 package com.taetae98.paging.paging import androidx.paging.PagingSource import androidx.paging.PagingState import com.taetae98.paging.dto.WebToon class ViewerPagingSource( private val webToon: WebToon, private val episode: Int ) : PagingSource() { ..

Paging은 필요한 데이터만 로드하여 표시하는 라이브러리입니다. 사용자에게 리스트를 보여주는 앱에서 사용자에게 한번에 보여줄 수 있는 리스트의 양은 화면 크기에 제한됩니다. 서버에 저장된 모든 리스트 목록을 한번에 받고 메모리에 캐쉬하는 방식보다 필요한 만큼 데이터를 불러와서 리스트를 보여주는 것이 효과적입니다. Paging3 구조 Repository PagingSource : 각 페이지에서 데이터를 얻는 방법을 정의한다. (로컬 데이터베이스에서 데이터를 얻거나 서버에서 받아오도록 설정할 수 있다.) RemoteMediator : 앱에서 캐쉬된 데이터를 모두 사용한 경우 페이징 라이브러에게 신호를 보내는 역할을 한다. ViewModel PagingConfig를 바탕으로 PagingSource에서 데이터..