/ Layout

A polished and dynamic way to show up layouts

A polished and dynamic way to show up layouts

Flourish

A polished and dynamic way to show up layouts.

Flourishz

Flourish

Including in your project

Download
Jitpack

Add below codes to your root build.gradle file (not your module build.gradle file).

allprojects {
    repositories {
        jcenter()
    }
}

And add a dependency code to your module's build.gradle file.

dependencies {
    implementation "com.github.skydoves:flourish:1.0.0"
}

Usage

Basic Example

Here is a basic example of implementing Flourish using Flourish.Builder class.

Flourish flourish = new Flourish.Builder(parentLayout)
    // sets the flourish layout for showing and dismissing on the parent layout.
    .setFlourishLayout(R.layout.layout_flourish_main)
    // sets the flourishing animation for showing and dismissing.
    .setFlourishAnimation(FlourishAnimation.BOUNCE)
    // sets the orientation of the starting point.
    .setFlourishOrientation(FlourishOrientation.TOP_LEFT)
    // sets a flourishListener for listening changes.
    .setFlourishListener(flourishListener)
    // sets the flourish layout should be showed on start. 
    .setIsShowedOnStart(false)
    // sets the duration of the flourishing.
    .setDuration(800L)
    .build();

Create using kotlin dsl

This is how to create an instance of Flourish using kotlin dsl.

val myFlourish = createFlourish(parentLayout) {
  setFlourishLayout(R.layout.layout_flourish_main)
  setFlourishAnimation(FlourishAnimation.ACCELERATE)
  setFlourishOrientation(FlourishOrientation.TOP_RIGHT)
  setIsShowedOnStart(true)
  setFlourishListener {  }
}

Show and dismiss

Here is how to show and dismiss.

flourish.show()
flourish.dismiss()

// we can do something after showed or dismissed using lambda.
flourish.show { toast("showed") }
flourish.dismiss { toast("dismissed") }

FlourishView

We can get a flourishView from an instance of Flourish.

val flourishView: View = flourish.flourishView

flourish.flourishView.toolbar_title.text = "Profile"
flourish.flourishView.toolbar_more.setOnClickListener {
  flourish.dismiss { toast("dismissed") }
}

FlourishListener

We can listen to the fourish layout is showed or dismissed.

.setFlourishListener(new FlourishListener() {
  @Override
  public void onChanged(boolean isShowing) {
    // do something
  }
})

We can simplify using lambda in kotlin.

.setFlourishListener { 
  toast("isShowing : $it") 
}

FlourishOrientation

We can customize a start point orientation of the showing and dismiss.

.setFlourishOrientation(FlourishOrientation.TOP_LEFT)
.setFlourishOrientation(FlourishOrientation.TOP_RIGHT)
.setFlourishOrientation(FlourishOrientation.BOTTOM_LEFT)
.setFlourishOrientation(FlourishOrientation.BOTTOM_RIGHT)
TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT

FlourishAnimation

We can customize an animation of the showing and dismiss.

NORMAL ACCELERATE BOUNCE

Find this library useful? :heart:

Support it by joining stargazers for this repository. :star:

And follow me for my next creations!

GitHub