To implement a basic BoomMenuButton, follow these three steps:
- Add the view to your XML layout: Use
com.nightonke.boommenu.BoomMenuButton. You can configure properties like app:boom_inActionBar, app:boom_button_color, and app:boom_button_pressed_color. - Find the view in
onCreate(): Use findViewById to get the instance. - Initialize in
onWindowFocusChanged(): Call .init() with your sub-button assets and configuration parameters to ensure the view is ready for animation.
Note: The init() method requires non-null drawables for sub-buttons.
<com.nightonke.boommenu.BoomMenuButton
android:id="@+id/boom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_margin="20dp"
app:boom_inActionBar="false"
app:boom_button_color="@color/colorPrimary"
app:boom_button_pressed_color="@color/colorPrimary"
/>
// 2. Get view
boomMenuButton = (BoomMenuButton)findViewById(R.id.boom);
// 3. Initialize
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
boomMenuButton.init(
subButtonDrawables, // Non-null
subButtonTexts, // Can be null
subButtonColors, // Normal and pressed states
ButtonType.HAM,
BoomType.PARABOLA,
PlaceType.HAM_3_1,
null, null, null, // Ease types (move, scale, rotate) for showing
null, null, null, // Ease types (move, scale, rotate) for dismissing
null // Rotation degree
);
}