### Handle FabSpeedDial Menu Item Selection Event in Java Source: https://github.com/yavski/fab-speed-dial/blob/master/README.md This Java snippet demonstrates how to implement the `onMenuItemSelected` callback within a `SimpleMenuListenerAdapter` for `FabSpeedDial`. This method is invoked when a user selects an item from the speed dial menu, allowing the application to respond to the selection, for example, by starting a new activity. ```Java FabSpeedDial fabSpeedDial = (FabSpeedDial) findViewById(R.id.fab_speed_dial); fabSpeedDial.setMenuListener(new SimpleMenuListenerAdapter() { @Override public boolean onMenuItemSelected(MenuItem menuItem) { //TODO: Start some activity return false; } }); ``` -------------------------------- ### FabSpeedDial Basic Styling Attributes Reference Source: https://github.com/yavski/fab-speed-dial/blob/master/README.md Provides a reference for `FabSpeedDial` attributes, distinguishing between main FAB (`fab` prefix) and mini FAB (`miniFab` prefix) styling. Includes links to Android documentation for standard attributes and notes on how color arrays override single color attributes. ```APIDOC Attribute: app:fabDrawable Description: Sets the icon drawable of the main FAB Android Equivalent: android:src (http://developer.android.com/reference/android/widget/ImageView.html#attr_android:src) Attribute: app:fabDrawableTint Description: Tints the icon drawable of the main FAB Android Equivalent: android:tint (http://developer.android.com/reference/android/widget/ImageView.html#attr_android:tint) Attribute: app:fabBackgroundTint Description: Tints the background colour of the main FAB Android Equivalent: android:backgroundTint (http://developer.android.com/reference/android/view/View.html#attr_android:backgroundTint) Attribute: app:miniFabDrawableTint Description: Tints the icon drawable of the mini FAB(s) Android Equivalent: android:tint (http://developer.android.com/reference/android/widget/ImageView.html#attr_android:tint) Attribute: app:miniFabBackgroundTint Description: Tints the background colour of the mini FAB(s) Android Equivalent: android:backgroundTint (http://developer.android.com/reference/android/view/View.html#attr_android:backgroundTint) Attribute: app:miniFabBackgroundTintList Description: An array containing the background colors for each of the mini FABs. Attribute: app:miniFabTitleTextColor Description: Sets the color of the title of the mini FAB. Android Equivalent: android:textColor (https://developer.android.com/reference/android/widget/TextView.html#attr_android:textColor) Attribute: app:miniFabTitleTextColorList Description: An array containing the colors for each of the titles of the mini FABs. Attribute: app:miniFabTitleBackgroundTint Description: Tints the background colour of the title(s) of the mini FAB(s) Android Equivalent: android:backgroundTint (http://developer.android.com/reference/android/view/View.html#attr_android:backgroundTint) Attribute: app:miniFabTitlesEnabled Description: Convenience for hiding the title(s) of the mini FAB(s) Attribute: app:touchGuard Description: Hide FAB when touching out of its bounds Attribute: app:touchGuardDrawable Description: Sets background to the container of FAB Android Equivalent: android:background (http://developer.android.com/reference/android/view/View.html#setBackground(android.graphics.drawable.Drawable)) ``` -------------------------------- ### Handle FabSpeedDial Menu Preparation Event in Java Source: https://github.com/yavski/fab-speed-dial/blob/master/README.md This Java snippet shows how to set a `MenuListener` on `FabSpeedDial` to intercept the `onPrepareMenu` callback. This allows dynamic updates to menu items or conditional display of the menu before it is presented to the user. ```Java FabSpeedDial fabSpeedDial = (FabSpeedDial) findViewById(R.id.fab_speed_dial); fabSpeedDial.setMenuListener(new SimpleMenuListenerAdapter() { @Override public boolean onPrepareMenu(NavigationMenu navigationMenu) { // TODO: Do something with yout menu items, or return false if you don't want to show them return true; } }); ``` -------------------------------- ### Add Gradle Dependency for fab-speed-dial Source: https://github.com/yavski/fab-speed-dial/blob/master/README.md This snippet shows how to add the `fab-speed-dial` library as a compile dependency to your `build.gradle` file, allowing your Android project to use its functionalities. ```Gradle dependencies { compile 'io.github.yavski:fab-speed-dial:1.0.6' } ``` -------------------------------- ### Define Android Menu Resource for FabSpeedDial Source: https://github.com/yavski/fab-speed-dial/blob/master/README.md This XML snippet defines a standard Android menu resource with three items (Call, Text, Email), each with an ID, icon, and title. This menu will be used by `FabSpeedDial` to display actionable buttons. ```XML
``` -------------------------------- ### Integrate FabSpeedDial into Android Layout XML Source: https://github.com/yavski/fab-speed-dial/blob/master/README.md This XML snippet demonstrates how to add the `FabSpeedDial` component to an Android layout file. It's placed within a `FrameLayout` and configured with gravity, a reference to the defined menu resource, and custom tinting for mini-FABs and titles. An ID is crucial for state persistence across configuration changes. ```XML