This is kind of a FloatingActionButton includes Animations .
- FAB: Curve fab, Rectangle feb
- Easy Set up
- Items setup : Icons, colors, text
- Free Position : Put anywhere in Parent Layout
- Get Running Function :Repeatdly to do
- Animations: Enter and Exit
- Colors : Changing colors from / to
Install my-project with https://jitpack.io/
dependencies {
implementation 'com.github.Mori-hub:Advanced_FAB:1.0.0'
}
// Call Lib Rectangle feb
val rectangle = Rectangle(this, R.id.mainParent)
// Call Lib Curve fab
val curve = Curve(this, R.id.mainParent,findViewById(R.id.floatingActionButton))
- Parent Layout : This must be a Layout and put anywhere
- null : For Running Function and Finish Function
- Show : When you call main method, the layout will attach to the window
- SetItems : For set as you need
fun setItems(
icons: ArrayList<Int>,
colors: ArrayList<Int>,
textIn: ArrayList<String>,
textColor: Int,
runningFunctions: ArrayList<(() -> Unit)?>
)
rectangle.setItems(
//Icons from Res
arrayListOf(
android.R.drawable.ic_media_play,
android.R.drawable.ic_input_add,
android.R.drawable.btn_star_big_on,
android.R.drawable.ic_delete
),
// Colors of row
arrayListOf(
Color.parseColor("black"),
Color.parseColor("#8A351A"),
Color.parseColor("#FF5722"),
Color.parseColor("#9C27B0")
),
// Text of each row
arrayListOf("One", " two", "see it", "fun"),
// Text Color
Color.WHITE,
// OnClick must be in {}
arrayListOf(
null,
{Toast.makeText(applicationContext, "Hi", Toast.LENGTH_SHORT).show()
println("Hi there!")
},
null,
null
)
)
This menu attachs to a floatingActionButton, so must be as a parameter
Curve(activity: Activity, parentLayout: Int, targetButton: View)
setItems(
icons: ArrayList<Int>,
colors: ArrayList<Int>,
runningFunctions: ArrayList<(() -> Unit)?>
)
val curve = Curve(this, R.id.mainParent,findViewById(R.id.floatingActionButton))
curve.setItems(
//Icons from Res
arrayListOf(
android.R.drawable.ic_media_play, android.R.drawable.ic_input_add
, android.R.drawable.btn_star_big_on, android.R.drawable.ic_delete
),
// Colors of background icons
arrayListOf(Color.parseColor("black"),
Color.parseColor("#8A351A"),
Color.parseColor("#FF5722"),
Color.parseColor("#9C27B0")),
// OnClick must be in {}
arrayListOf(null,
{ Toast.makeText(applicationContext, "Hi", Toast.LENGTH_SHORT).show()
println("Hi there!")
},
null,
null))
Please add parameters due to number of icons, otherwise the app will crash and close.
I'm a full stack developer...
Java, Kotlin, CSS....
Important: For Gradle 7.2 & jitpack.io Please use this way : https://stackoverflow.com/a/71603699/12272687
Update: March 2022
If you have any feedback, please reach out to us at [email protected]