Bottom Dialog

This is an Android library that is adding bottom dialog (like on iOS) to your application. It pops up from the bottom to display a couple of buttons and disappears. You can set how many buttons (but not unlimited), the title of the dialog and a few other options. In return, you will get a listener for each button.

It’s made 100% in Kotlin. It’s simple and light and easy to setup. You can just add it to the gradle and start using it.

Implementation

Gradle

implementation("com.kovacivan:BottomDialog:1.1")

UsagE

If you only want to see how it works:

BottomDialog(this, binding.root)
   .showBottomDialog()

Set button text:

BottomDialog(this, binding.root)
	.topButtonText("Delete")
	.bottomButtonText("Edit")
	.cancelButtonText("Cancel")
	.showBottomDialog()

And this is how you handle button clicks:

class MainActivity : AppCompatActivity(), BottomDialogListener {

...

val bottomDialog = BottomDialog(this, binding.root)
	.topButtonText("Delete")
	.bottomButtonText("Edit")
	.cancelButtonText("Cancel")
	.showBottomDialog()

...

override fun topButtonClicked() {
	// Do your stuff here
}

override fun bottomButtonClicked() {
	// Do your stuff here
}

override fun cancelButtonClicked() {
	// Do your stuff here
}
}

Button click example:

override fun topButtonClicked() {
	Snackbar.make(
		binding.root,
		"Top button clicked",
		Snackbar.LENGTH_SHORT
	).show()
}

override fun bottomButtonClicked() {
	Snackbar.make(
		binding.root,
		"Bottom button clicked",
		Snackbar.LENGTH_SHORT
	).show()
}

override fun cancelButtonClicked() {
	Snackbar.make(
		binding.root,
		"Cancel button clicked",
		Snackbar.LENGTH_SHORT
	).show()
}