From e4ad01dc879cf642cfe8fdd4616be0ffe8b2dd9b Mon Sep 17 00:00:00 2001 From: kubasz Date: Fri, 27 Sep 2019 22:41:22 +0200 Subject: [PATCH] Make FAB on click listener nullable --- .gitignore | 4 +++- .../src/main/java/pl/szczodrzynski/navlib/NavBottomBar.kt | 8 ++++++++ navlib/src/main/java/pl/szczodrzynski/navlib/NavView.kt | 5 ++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8f87c82..4725a2a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ /build /captures .externalNativeBuild -/_hakerskie \ No newline at end of file +/_hakerskie +*.apk +app/release/ \ No newline at end of file diff --git a/navlib/src/main/java/pl/szczodrzynski/navlib/NavBottomBar.kt b/navlib/src/main/java/pl/szczodrzynski/navlib/NavBottomBar.kt index d4f71fd..c09a2f4 100644 --- a/navlib/src/main/java/pl/szczodrzynski/navlib/NavBottomBar.kt +++ b/navlib/src/main/java/pl/szczodrzynski/navlib/NavBottomBar.kt @@ -104,6 +104,14 @@ class NavBottomBar : BottomAppBar { 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) { setOnTouchListener { _, event -> if (bottomSheet?.enable != true || bottomSheet?.enableDragToOpen != true) diff --git a/navlib/src/main/java/pl/szczodrzynski/navlib/NavView.kt b/navlib/src/main/java/pl/szczodrzynski/navlib/NavView.kt index 9cec610..4e9e78d 100644 --- a/navlib/src/main/java/pl/szczodrzynski/navlib/NavView.kt +++ b/navlib/src/main/java/pl/szczodrzynski/navlib/NavView.kt @@ -153,9 +153,8 @@ class NavView : FrameLayout { /** * Set the FAB's on click listener */ - fun setFabOnClickListener(onClickListener: OnClickListener) { - floatingActionButton.setOnClickListener(onClickListener) - extendedFloatingActionButton.setOnClickListener(onClickListener) + fun setFabOnClickListener(onClickListener: OnClickListener?) { + bottomBar.setFabOnClickListener(onClickListener) } internal var systemBarsUtil: SystemBarsUtil? = null