FabDialog Save

:balloon: Fab into Dialog Animation on Android

Project README

FabDialog

sample

License Platform API

This is an Android project allowing to animate a custom Floating Action Button into a custom Dialog.

USAGE

Just add FabDialog view in your layout XML and FabDialog library in your project via Gradle:

dependencies {
  implementation 'com.bitvale:fabdialog:1.0.1'
}

XML

<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.

Properties:
  • app:fabBackgroundColor (color) -> default ?attr/colorAccent
  • app:dialogBackgroundColor (color) -> default ?attr/colorBackgroundFloating
  • app:dialogCornerRadius (dimension) -> default 8dp
  • app:dimBackgroundEnabled (boolean) -> default true
  • app:dimBackgroundColor (color) -> default BLACK with transparency (#99000000)
  • app:closeOnTouchOutside (boolean) -> default true

Kotlin

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

LICENCE

FabDialog by Alexander Kolpakov is licensed under a Apache License 2.0.

Open Source Agenda is not affiliated with "FabDialog" Project. README Source: bitvale/FabDialog
Stars
36
Open Issues
0
Last Commit
5 years ago
Repository

Open Source Agenda Badge

Open Source Agenda Rating