MaterialDialog-Android
MaterialDialog-Android copied to clipboard
Migrated the project to Kotlin
Summary
Migrated the whole project to use Kotlin as the primary language. This results in reduction of the codebase size, along with improved code readability.
Resolves #32
Build Dialogs with Kotlin DSL
Building dialogs is easier than ever with kotlin dsl.
Animated Material Dialog
val animatedMaterialDialog = materialDialog(this) {
title = "Delete"
message = "Are you sure you want to delete this file?"
isCancelable = false
setPositiveButton("Delete", R.drawable.ic_delete) { dialog, which ->
Toast.makeText(applicationContext, "Deleted!", Toast.LENGTH_SHORT).show()
dialog.dismiss()
}
setNegativeButton("Cancel", R.drawable.ic_close) { dialog, which ->
Toast.makeText(applicationContext, "Cancelled!", Toast.LENGTH_SHORT).show()
dialog.dismiss()
}
setAnimation("delete_anim.json")
}
Animated BottomSheetMaterialDialog
val animatedBottomSheetDialog = bottomSheetMaterialDialog(this) {
title = "Delete"
message = "Are you sure you want to delete this file?"
isCancelable = false
setPositiveButton("Delete", R.drawable.ic_delete) { dialog, which ->
Toast.makeText(applicationContext, "Deleted!", Toast.LENGTH_SHORT).show()
dialog.dismiss()
}
setNegativeButton("Cancel", R.drawable.ic_close) { dialog, which ->
Toast.makeText(applicationContext, "Cancelled!", Toast.LENGTH_SHORT).show()
dialog.dismiss()
}
setAnimation("delete_anim.json")
}
Thanks, @2307vivek for this PR 😃
Thanks, @2307vivek for this PR
@PatilShreyas My pleasure. 😀