EB Dialog is a modern, lightweight Android library for easy dialog management. It offers solutions for Information, Error, Confirmation, Input, and List dialogs with a fluent Kotlin API.
- ✅ Modern Kotlin API: Clean and idiomatic DSL/Builder support.
- ✅ ViewBinding: Safe and efficient UI management.
- ✅ Customization: Support for Light/Dark themes and custom layouts.
- ✅ Variety of Dialogs:
- Information & Error Boxes
- Confirmation Dialogs
- Input Dialogs (with text feedback)
- List Dialogs (for quick selection)
- Enhanced Loading Dialogs (with message support)
- Google Play Vote Dialogs
Add JitPack to your settings.gradle or root build.gradle:
dependencyResolutionManagement {
repositories {
maven { url = uri("https://jitpack.io") }
}
}Add the dependency to your module build.gradle:
dependencies {
implementation("com.github.bilginenes:ebdialogutilities:2.0.0")
}val state = rememberEBDialogState()
EBInfoDialog(
state = state,
title = "Hello",
message = "Welcome to EBDialog Compose!"
)
Button(onClick = { state.show() }) {
Text("Show Dialog")
}val state = rememberEBDialogState()
EBDialog(state = state) {
Title(text = "Custom DSL", icon = Icons.Default.Settings)
Message(text = "You can build any content here.")
Input(hint = "Enter something") { value -> /* handle */ }
Buttons(
positiveText = "Save",
onPositiveClick = { /* save */ },
negativeText = "Cancel"
)
}val sheetState = rememberEBDialogState()
EBBottomSheet(state = sheetState) {
Title(text = "Quick Actions")
ListContent(items = listOf("Share", "Edit", "Delete")) { index, item ->
// handle
}
}Initialize the library with your preferred theme (usually in Application.onCreate or Activity.onCreate):
EBDialogUtilities.initialize(context, DialogTheme.LIGHT_1)// Simple Info
EBDialogUtilities.showInfoBox(activity, "Information", "This is an informative message.")
// Simple Error
EBDialogUtilities.showErrorBox(activity, "Oops!", "Something went wrong.")Easily collect user input:
EBDialogUtilities.showInputBox(activity, "Your Name", hint = "Enter name here") { name ->
println("User entered: $name")
}Quick selection from a list of options:
val options = listOf("Option A", "Option B", "Option C")
EBDialogUtilities.showListBox(activity, "Select One", options) { index, item ->
println("Selected $item at position $index")
}val loader = EBDialogUtilities.showLoadingBox(activity, message = "Processing your request...")
// Dismiss when done
loader.dismiss()Use the powerful DSL for complex dialog configurations:
EBDialogUtilities.build(activity) {
headerText = "Custom DSL"
messageText = "Fully configured via Kotlin DSL"
buttons {
positive("Accept", color = R.color.md_green_700) {
// positive action
}
negative("Decline") {
// negative action
}
}
}.show(supportFragmentManager, "custom_dialog")This library is under MIT License.