일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 알림
- hilt
- Navigation
- 안드로이드
- Behavior
- recyclerview
- kotlin
- 코틀린
- CustomView
- notification
- BOJ
- activity
- sqlite
- CoordinatorLayout
- onMeasure
- CollapsingToolbarLayout
- Algorithm
- View
- HTTP
- ViewModel
- room
- lifecycle
- DataBinding
- LiveData
- 알고리즘
- 백준
- onLayout
- Coroutine
- AppBarLayout
- Android
- Today
- Total
목록Android (111)
개발일지

OnTouchListener OnTouchListener는 터치가 발생했을 때 이벤트를 수신한다. 터치가 발생했을 때 MotionEvent가 발생하고 MotionEvent를 통해 터치한 손가락의 수, 각 터치별 위치, 손가락이 터치할 때, 손가락을 뗐을 때 등의 이벤트를 수신할 수 있다. 이러한 이벤트를 바탕으로 View를 드래그, 축소/확대, 회전등을 할 수 있다. Action MotionEvent의 action에는 비트 마스크 형식으로 Action, Touch Index 등 여러 정보를 저장하고 있다. action과 MotionEvent.ACTION_MASK를 통해 터치의 ACTION을 구할 수 있고, actionMasked를 통해 바로 ACTION을 구할 수 있다. ACTION_DOWN : 처음으로..

Notification Custom 사용자가 직접 Layout을 구성하여 RemoteView를 통해 Nofitication 템플릿을 만들 수 있습니다. * 보통 축소된 Notification은 64dp, 확장된 Notification은 256dp로 제한됩니다. RemoteViews를 만들고setCustomContentView를 통해 적용할 수 있다. * 확장된 CustomContentView는 setCustomBigContentView를 통해 적용할 수 있다. private fun createCustomContentView(): RemoteViews { return RemoteViews(context.packageName, R.layout.notification_content_view).apply { s..

그룹 Android 7.0(API 24)부터는 관련된 알림을 그룹으로 표시할 수 있습니다. 예를 들어, 앱에서 수신된 이메일의 알림을 표시하려면 모든 알림을 동일한 그룹에 포함하여 함께 축소할 수 있도록 해야 합니다. Android에서 기본적으로 그룹을 지정하지 않은 경우 4개 이상의 알림을 자동으로 그룹화 합니다. Notification 만들기 Notification을 만들 때 setGroup을 통해 그룹을 정해줍니다. val notification = NotificationCompat.Builder(context, CHANNEL_ID) .setSmallIcon(R.drawable.ic_android) .setContentTitle(message.title) .setContentText(message...

확장형 알림 기존의 알림보다 훨씬 많은 알림을 제공하기 위해 확장형 알림을 사용할 수 있다. 코드 @Singleton class ExtendNotificationManager @Inject constructor( @ApplicationContext private val context: Context ) { companion object { private const val CHANNEL_ID_IMPORTANCE_HIGH = "com.taetae98.notification.EXTEND.IMPORTANCE_HIGH" private const val CHANNEL_ID_IMPORTANCE_LOW = "com.taetae98.notification.EXTEND.IMPORTANCE_LOW" private const..

Notification Action 알림을 빠르게 대응할 수 있도록 알림을 탭했을 때 작업을 추가 하거나 최대 3개의 Action을 추가할 수 있다. setContentIntent 알림을 탭 했을 때 PendingIntent를 통해 작업을 정할 수 있다. private fun createPendingIntent(message: Message): PendingIntent { return NavDeepLinkBuilder(context) .setGraph(R.navigation.navigation_main) .setDestination(R.id.actionFragment) .setArguments( Bundle().apply { putSerializable("message", message) } ) .cre..

Notification 사용자에게 알림을 보내야할 때 사용한다. 앱 또는 사용자가 닫을 때까지 알림창에 표시된다. Head Up Notification 처럼 즉각적으로 알림을 보여줄 수 있다. (Android 5.0(API 21) 이상 가능) Lock Screen에 표시할 수 있고, 보여주는 내용을 지정할 수 있다. (Android 5.0(API 21) 이상 가능) Launcher에서 지원하는 경우 알림 뱃지를 설정할 수 있다. (Android 8.0(API 26) 이상 가능) Notification 구성 Small Icon : 필수 구성요소이며 setSmallIcon을 통해 설정할 수 있다. App Name : 앱 이름, 시스템에서 제공한다. Time : 시스템에서 제공하지만 setWhen으로 설정하거..
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

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..