Root Dialog Fragment
Root DialogFragment class providing common dialog functionality and permission management.
Serves as the foundation for all DialogFragment classes in the library.
공통 다이얼로그 기능과 권한 관리를 제공하는 루트 DialogFragment 클래스입니다.
라이브러리의 모든 DialogFragment 클래스의 기반이 됩니다.
Why this class exists / 이 클래스가 필요한 이유:
Android's DialogFragment requires repetitive setup for common dialog features like positioning, animation, and background customization.
Permission management needs careful lifecycle handling to survive configuration changes.
Dialog show/dismiss operations can throw exceptions in edge cases (fragment detached, state loss), requiring safe wrappers.
Provides a centralized foundation for all dialog variants (normal, ViewBinding, DataBinding) to inherit common functionality.
Android의 DialogFragment는 위치, 애니메이션, 배경 커스터마이징과 같은 공통 다이얼로그 기능에 대해 반복적인 설정이 필요합니다.
권한 관리는 구성 변경에서 살아남기 위해 신중한 생명주기 처리가 필요합니다.
다이얼로그 show/dismiss 작업은 엣지 케이스(프래그먼트 분리, 상태 손실)에서 예외를 던질 수 있어 안전한 래퍼가 필요합니다.
모든 다이얼로그 변형(normal, ViewBinding, DataBinding)이 공통 기능을 상속받을 수 있는 중앙화된 기반을 제공합니다.
Design decisions / 설계 결정 이유:
Extends DialogFragment to provide dialog-specific lifecycle and features.
Uses PermissionRequester pattern for reusable permission handling across DialogFragment/Fragment/Activity.
Provides abstract setBackgroundColor/setBackgroundResource methods for subclasses to implement based on their view access pattern.
Uses safeCatch wrapper for show/dismiss operations to prevent crashes from state loss exceptions.
Stores dialog configuration (gravity, animation, cancelable) as properties to allow dynamic updates after creation.
DialogFragment를 확장하여 다이얼로그 전용 생명주기 및 기능을 제공합니다.
DialogFragment/Fragment/Activity에서 재사용 가능한 권한 처리를 위해 PermissionRequester 패턴을 사용합니다.
하위 클래스가 뷰 접근 패턴에 따라 구현할 수 있도록 추상 setBackgroundColor/setBackgroundResource 메서드를 제공합니다.
상태 손실 예외로 인한 크래시를 방지하기 위해 show/dismiss 작업에 safeCatch 래퍼를 사용합니다.
생성 후 동적 업데이트를 허용하기 위해 다이얼로그 구성(gravity, animation, cancelable)을 프로퍼티로 저장합니다.
Important notes / 주의사항:
Permission requests must be made only after the DialogFragment is attached (isAdded == true).
Calling onRequestPermissions() before attachment is not supported; call only after the DialogFragment is attached.
Use safeShow/safeDismiss instead of show/dismiss to prevent crashes from IllegalStateException.
권한 요청은 DialogFragment가 attach된 이후(isAdded == true)에만 수행해야 합니다.
attach 이전의 onRequestPermissions() 호출은 지원하지 않으며, DialogFragment가 attach된 뒤에만 호출해야 합니다.
IllegalStateException으로 인한 크래시를 방지하기 위해 show/dismiss 대신 safeShow/safeDismiss를 사용하세요.
Features / 기능:
Custom animation styles for dialog appearance/disappearance
Dialog position control via gravity settings
Cancelable behavior configuration
Background color and drawable customization
Click listener support (positive, negative, other)
Safe show/dismiss methods with exception handling
Runtime permission management via PermissionRequester
Dialog size resizing based on screen ratio
다이얼로그 나타남/사라짐에 대한 커스텀 애니메이션 스타일
gravity 설정을 통한 다이얼로그 위치 제어
취소 가능 동작 구성
배경색 및 drawable 커스터마이징
클릭 리스너 지원 (positive, negative, other)
예외 처리가 포함된 안전한 show/dismiss 메서드
PermissionRequester를 통한 런타임 권한 관리
화면 비율 기반 다이얼로그 크기 조정
See also
For simple layout-based DialogFragment.
간단한 레이아웃 기반 DialogFragment는 BaseDialogFragment를 참조하세요.
For the abstract parent class of all binding-enabled dialog fragments.
모든 바인딩 지원 DialogFragment의 추상 부모 클래스는 ParentBindingViewDialogFragment를 참조하세요.
For ViewBinding-enabled DialogFragment.
ViewBinding을 사용하는 DialogFragment는 BaseViewBindingDialogFragment를 참조하세요.
For DataBinding-enabled DialogFragment.
DataBinding을 사용하는 DialogFragment는 BaseDataBindingDialogFragment를 참조하세요.
Inheritors
Properties
Functions
Requests permissions using the delegate.
Call only after the Fragment is attached (isAdded == true).
델리게이트를 사용하여 권한을 요청합니다.
Fragment가 attach된 이후(isAdded == true)에만 호출하세요.
Requests multiple permissions and returns denied results via callback.
여러 권한을 요청하고 거부 결과를 콜백으로 반환합니다.
Safely dismisses the dialog with exception handling.
Catches any exceptions that may occur during dismissal.
예외 처리와 함께 다이얼로그를 안전하게 닫습니다.
닫는 동안 발생할 수 있는 모든 예외를 잡습니다.
Safely shows the dialog with exception handling.
Catches any exceptions that may occur during showing.
예외 처리와 함께 다이얼로그를 안전하게 표시합니다.
표시하는 동안 발생할 수 있는 모든 예외를 잡습니다.
Sets the custom animation style for dialog appearance/disappearance.
Applied immediately if dialog is already showing.
다이얼로그 나타남/사라짐에 대한 커스텀 애니메이션 스타일을 설정합니다.
다이얼로그가 이미 표시 중인 경우 즉시 적용됩니다.
Sets whether the dialog can be canceled by pressing back button or touching outside.
Applied immediately if dialog is already showing.
뒤로 가기 버튼을 누르거나 외부를 터치하여 다이얼로그를 취소할 수 있는지 설정합니다.
다이얼로그가 이미 표시 중인 경우 즉시 적용됩니다.
Sets the position of the dialog on screen.
Applied immediately if dialog is already showing.
화면에서 다이얼로그의 위치를 설정합니다.
다이얼로그가 이미 표시 중인 경우 즉시 적용됩니다.
Creates and shows an indefinite duration Snackbar from a Fragment.
Logs an error if the Fragment's view is null.
Fragment에서 무제한 시간 Snackbar를 생성하고 표시합니다.
Fragment의 view가 null이면 에러를 로깅합니다.
Creates and shows a long duration Snackbar from a Fragment.
Logs an error if the Fragment's view is null.
Fragment에서 긴 시간 Snackbar를 생성하고 표시합니다.
Fragment의 view가 null이면 에러를 로깅합니다.
Creates and shows a short duration Snackbar from a Fragment.
Logs an error if the Fragment's view is null.
Fragment에서 짧은 시간 Snackbar를 생성하고 표시합니다.
Fragment의 view가 null이면 에러를 로깅합니다.
Creates and shows a long duration Toast message from a Fragment.
Logs an error if the Fragment's context is null.
Fragment에서 긴 시간 Toast 메시지를 생성하고 표시합니다.
Fragment의 context가 null이면 에러를 로깅합니다.
Creates and shows a short duration Toast message from a Fragment.
Logs an error if the Fragment's context is null.
Fragment에서 짧은 시간 Toast 메시지를 생성하고 표시합니다.
Fragment의 context가 null이면 에러를 로깅합니다.
Executes the given block and returns a result if the Fragment's context is not null.
Returns null and logs an error if the context is null.
Fragment의 context가 null이 아닌 경우 주어진 블록을 실행하고 결과를 반환합니다.
context가 null이면 null을 반환하고 에러를 로깅합니다.
Executes the given block and returns a result if the Fragment's view is not null.
Returns null and logs an error if the view is null.
Fragment의 view가 null이 아닌 경우 주어진 블록을 실행하고 결과를 반환합니다.
view가 null이면 null을 반환하고 에러를 로깅합니다.