Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keeping ExpandableFab from closing when a FabOption is clicked #23

Closed
Burakito opened this issue Jul 9, 2021 · 2 comments
Closed

Keeping ExpandableFab from closing when a FabOption is clicked #23

Burakito opened this issue Jul 9, 2021 · 2 comments

Comments

@Burakito
Copy link

Burakito commented Jul 9, 2021

Hi, first of all let me congratulate you on the quality of the library and the support I see you are providing.

I would like to use the expandable fab as a container for a set of checkboxes. In that scenario I need to keep the different FabOptions visible after clicking on one of them just in case the user wants to select more than one. The 'menu' would only be closed after clicking on the ExpandableFab itself. Is such a feature implemented? Is there any workaround to that?

@Burakito Burakito changed the title Keeping the ExpandableFab from closing when an FabOption is clicked Keeping ExpandableFab from closing when an FabOption is clicked Jul 9, 2021
@Burakito Burakito changed the title Keeping ExpandableFab from closing when an FabOption is clicked Keeping ExpandableFab from closing when a FabOption is clicked Jul 9, 2021
@kabumere
Copy link
Member

kabumere commented Jul 10, 2021

Hey @Burakito,

This seems like a very unique use case, so I'm hesitant to add the functionality to the official published API. However, there's an easy workaround to accomplish your desired effect:

  1. Clone the library and add it to your project (so don't pull it in from Maven Central, add the source code as a dependency to your project manually)
  2. Modify the FabOption's setOnClickListener function to directly call your custom onClick behavior without executing the default behavior when clicked (the default behavior for a FabOption's onClick includes closing the ExpandableFab). So in short, this method should now look like this:
override fun setOnClickListener(onClickListener: OnClickListener?) {
    super.setOnClickListener(onClickListener)

    setLabelOnClickListener()
}

If this functionality ever gets requested again, I may consider adding it to the library properly. And if I do, I'll comment on this ticket and let you know. As of now though, I can't imagine too many others needing to use the ExpandableFab as a container for checkboxes (though I must say that's a very cool and unique use case!).

EDIT: In case you're using an Overlay and want to prevent clicks on that from automatically closing the ExpandableFab as well, you can easily do that by deleting its overridden setOnClickListener method. So just delete this method. Any custom onClickListener you set on the Overlay will still be executed.

@kabumere
Copy link
Member

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants