본문 바로가기

Android 개인공부

Android Custom Progress Dialog

반응형
반응형

안드로이드 오레오(8.0)에서 프로그래스 다이얼로그가 Deprecated 되었다.

이유인 즉슨 ProgressDialog가 모달 대화상자기 때문에 사용자와의 상호작용성을 떨어트리기 때문이라고 한다.
잘 써먹던 건데 이래되버리니 그냥 내가 만들어서 라이브러리로 만들어 놓고 써야겠다 싶어서 만들고 공유한다.

https://github.com/welcome2c/LottieProgressDialo

 

welcome2c/LottieProgressDialog

Custom Dialog. Contribute to welcome2c/LottieProgressDialog development by creating an account on GitHub.

github.com

 

- Top level build.gradle 에 추가
allprojects {
    repositories {
        /// ....
        maven { url "https://jitpack.io" }
    }
}

- App level build.gradle 에 추가
implementation 'com.github.welcome2c:LottieProgressDialog:1.0.1'

LottieProgressDialog(     
    context: Context,   
    // setting cancelable.     
    private val isCancel: Boolean,   
    // if you want change dialog size input value not null.     
    private val dialogWidth: Int?,   
    private val dialogHeight: Int?,   
    // if you want change animation size input value not null.    
    private val animationViewWidth: Int?,   
    private val animationViewHeight: Int?,   
    // if you want change animation in samples refer to companion object.  
    // if you want specific file input file name not null.  
    private val fileName: String,   
    // if you want change title input string not null.  
    private val title: String?,   
    // if you want change title visible input visible value not null.  
    private val titleVisible: Int?  
).show()

- 사용예시
LottieProgressDialog(
    context = this,
    isCancel = true,
    dialogWidth = null,
    dialogHeight = null,
    animationViewWidth = null,
    animationViewHeight = null,
    fileName = LottieProgressDialog.SAMPLE_1,
    title = null,
    titleVisible = null
).show()

 

프리뷰

 

반응형

'Android 개인공부' 카테고리의 다른 글

MVVM  (0) 2022.07.21
Repository Pattern  (0) 2022.07.21
AAC LifeCycles  (0) 2020.12.16
Kotlin?  (0) 2020.11.26
코틀린 let, with, apply, also, run  (0) 2020.10.12