MaterialDialog-Android icon indicating copy to clipboard operation
MaterialDialog-Android copied to clipboard

Migrated the project to Kotlin

Open 2307vivek opened this issue 5 years ago • 2 comments

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")
}

2307vivek avatar Oct 01 '20 10:10 2307vivek

Thanks, @2307vivek for this PR 😃

PatilShreyas avatar Oct 01 '20 10:10 PatilShreyas

Thanks, @2307vivek for this PR

@PatilShreyas My pleasure. 😀

2307vivek avatar Oct 01 '20 11:10 2307vivek