Make FAB on click listener nullable

This commit is contained in:
kubasz 2019-09-27 22:41:22 +02:00
parent 84d6447887
commit e4ad01dc87
3 changed files with 13 additions and 4 deletions

4
.gitignore vendored
View File

@ -11,4 +11,6 @@
/build /build
/captures /captures
.externalNativeBuild .externalNativeBuild
/_hakerskie /_hakerskie
*.apk
app/release/

View File

@ -104,6 +104,14 @@ class NavBottomBar : BottomAppBar {
fabExtendedView?.text = value fabExtendedView?.text = value
} }
/**
* Set the FAB's on click listener
*/
fun setFabOnClickListener(onClickListener: OnClickListener?) {
fabView?.setOnClickListener(onClickListener)
fabExtendedView?.setOnClickListener(onClickListener)
}
private fun create(attrs: AttributeSet?, defStyle: Int) { private fun create(attrs: AttributeSet?, defStyle: Int) {
setOnTouchListener { _, event -> setOnTouchListener { _, event ->
if (bottomSheet?.enable != true || bottomSheet?.enableDragToOpen != true) if (bottomSheet?.enable != true || bottomSheet?.enableDragToOpen != true)

View File

@ -153,9 +153,8 @@ class NavView : FrameLayout {
/** /**
* Set the FAB's on click listener * Set the FAB's on click listener
*/ */
fun setFabOnClickListener(onClickListener: OnClickListener) { fun setFabOnClickListener(onClickListener: OnClickListener?) {
floatingActionButton.setOnClickListener(onClickListener) bottomBar.setFabOnClickListener(onClickListener)
extendedFloatingActionButton.setOnClickListener(onClickListener)
} }
internal var systemBarsUtil: SystemBarsUtil? = null internal var systemBarsUtil: SystemBarsUtil? = null