diff --git a/README.md b/README.md
index 7f5ae34..1e6d96e 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ See [app/proguard-rules.pro](app/proguard-rules.pro) for an example.
// Java
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
-
+
// Kotlin (without Android extensions)
val fab = findViewById(R.id.fab) as FloatingActionButton
@@ -63,17 +63,17 @@ The FAB can be positioned in any of the four corners of the activity via XML or
// Java
fab.setButtonPosition(POSITION_BOTTOM | POSITION_END);
-
+
// Kotlin
fab.setButtonPosition(POSITION_BOTTOM.or(POSITION_END))
-
+
// XML
-
+
The FAB is aware of text-direction (right-to-left or left-to-right) and adjusts the meaning of "start" and "end" positions accordingly. This functionality can be overridden using the named constants for left and right.
### FAB Icon
@@ -82,10 +82,10 @@ The icon displayed in the centre of the FAB can be set via XML using a `Drawable
// Java
fab.setButtonIconResource(R.drawable.ic_add);
-
+
// Kotlin
fab.setButtonIconResource(R.drawable.ic_add)
-
+
// XML
// ...
@@ -139,7 +139,7 @@ The colour of the content cover can be set programmatically with `fab.setContent
// Java
fab.setContentCoverColour(0xffff9900);
-
+
// Kotlin
fab.setContentCoverColour(0xffff9900.toInt())
@@ -148,7 +148,7 @@ The cover can be enabled/disabled programmatically with `fab.setContentCoverEnab
// Java
fab.setContentCoverEnabled(true);
fab.setContentCoverEnabled(false);
-
+
// Kotlin
fab.setContentCoverEnabled(true)
fab.setContentCoverEnabled(false)
@@ -164,7 +164,7 @@ State change events are fired when the speed-dial menu opens or closes, which ca
// ...
}
});
-
+
// Kotlin
fab.setOnSpeedDialMenuOpenListener { floatingActionButton ->
// ...
@@ -172,10 +172,28 @@ State change events are fired when the speed-dial menu opens or closes, which ca
### Show/Hide Controls
-The FAB can be hidden and shown with the `fab.hide()` and `fab.show()` methods, and the method `fab.isShown()` will return a boolean indicating the current state. These methods animate the FAB in and out of visibility. If the speed-dial menu is open when `.hide()` is called it will be closed.
+The FAB can be hidden and shown with the `fab.hide()` and `fab.show()` methods, and the method `fab.isShown()` will return a boolean indicating the current state. These methods animate the FAB in and out of visibility. If the speed-dial menu is open when `.hide()` is called it will be closed.
The speed-dial menu can be manually opened and closed with `fab.openSpeedDialMenu()` and `fab.closeSpeedDialMenu()`. These methods will do nothing if no speed-dial menu adapter is set, if an adapter is set but disabled, if the FAB is hidden, or if they are called when the menu is already in the indicated state (i.e. `fab.openSpeedDialMenu()` will do nothing if the menu is already open).
+### Access to Underlying Views
+
+The FAB's key underlying views can be accessed using the three properties/methods detailed below:
+
+ // Java
+ fab.getCardView() // the card behind the button itself
+ fab.getContentCoverView() // the view that obscures content behind the speed-dial menu
+ fab.getIconWrapper() // the wrapper used to place icons in the button
+
+ // Kotlin
+ fab.cardView
+ fab.contentCoverView
+ fab.iconWrapper
+
+The card view is implemented as a `CardView` on SDK 21+ and a `LinearLayout` on SDK 20 and below.
+
+The content cover view and icon wrapper are implemented as a `View` and `LinearLayout` respectively on all SDKs.
+
### Note: Click Action Priority
As per Material Design specs, the FAB functions as a regular button **or** a trigger for the speed-dial menu, but not both. For this reason, the click listener and the speed-dial menu are never invoked at the same time.
@@ -183,7 +201,7 @@ As per Material Design specs, the FAB functions as a regular button **or** a tri
The speed-dial menu is given priority: when the FAB is clicked the speed-dial menu will be shown if the speed-dial menu adapter is non-null, the adapter's `isEnabled()` function returns `true` and the adapter's `getCount()` returns a number greater than zero. Otherwise, the FAB's click listener will be called (if it has been set).
Setting a speed-dial menu adapter does not remove the click listener, and setting a click listener does not remove the speed-dial menu adapter. For an example of how the two operation modes interact, check the demo app's source code.
-
+
To receive state change updates when the speed-dial menu is opened or closed, use the open/close listeners described above.
### Note: State Preservation
diff --git a/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt b/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt
index df0a849..457f0e5 100644
--- a/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt
+++ b/fab/src/main/kotlin/uk/co/markormesher/android_fab/FloatingActionButton.kt
@@ -14,6 +14,7 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.LinearLayout
import android.widget.RelativeLayout
import kotlinx.android.synthetic.main.fab_container.view.*
import kotlinx.android.synthetic.main.floating_action_button.view.*
@@ -466,4 +467,14 @@ class FloatingActionButton: RelativeLayout {
})
}
}
+
+ val cardView: View
+ get() = fab_card
+
+ val contentCoverView: View
+ get() = content_cover
+
+ val iconWrapper: LinearLayout
+ get() = fab_icon_wrapper
+
}