This is an Android project allowing to animate a custom Floating Action Button into a custom Dialog.
Just add FabDialog view in your layout XML and FabDialog library in your project via Gradle:
dependencies {
implementation 'com.bitvale:fabdialog:1.0.1'
}
<com.bitvale.fabdialog.widget.FabDialog
android:id="@+id/dialog_fab"
android:layout_width="@dimen/fab_size"
android:layout_height="@dimen/fab_size"
android:layout_marginEnd="@dimen/fab_margin"
android:layout_marginBottom="@dimen/fab_margin"
android:padding="@dimen/fab_padding"
app:dialogBackgroundColor="@color/dialogColor"
app:fabIcon="@drawable/android_icon" />
You must use the following properties in your XML to change your FabDialog.
app:fabBackgroundColor
(color) -> default ?attr/colorAccentapp:dialogBackgroundColor
(color) -> default ?attr/colorBackgroundFloatingapp:dialogCornerRadius
(dimension) -> default 8dpapp:dimBackgroundEnabled
(boolean) -> default trueapp:dimBackgroundColor
(color) -> default BLACK with transparency (#99000000)app:closeOnTouchOutside
(boolean) -> default true
with(dialog_fab) {
setTitle(R.string.dialog_title)
setMessage(R.string.dialog_message)
setDialogIcon(R.drawable.android_icon)
setFabIcon(R.drawable.android_icon)
setFabBackgroundColor(ContextCompat.getColor(context, R.color.fabColor))
setDialogBackgroundColor(ContextCompat.getColor(context, R.color.dialogColor))
setPositiveButton(R.string.positive_btn) { // some action }
setNegativeButton(R.string.negative_btn) { dialog_fab.collapseDialog() }
setOnClickListener { dialog_fab.expandDialog() }
setListener(this@MainActivity)
}
FabDialog by Alexander Kolpakov is licensed under a Apache License 2.0.