PatilShreyas / MaterialDialog-Android

📱Android Library to implement animated, 😍beautiful, 🎨stylish Material Dialog in android apps easily.
Apache License 2.0
939 stars 143 forks source link

Migrated the project to Kotlin #33

Open 2307vivek opened 4 years ago

2307vivek commented 4 years ago

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")
}
PatilShreyas commented 4 years ago

Thanks, @2307vivek for this PR 😃

2307vivek commented 4 years ago

Thanks, @2307vivek for this PR

@PatilShreyas My pleasure. 😀