Hiding floating action button based on flag

So I have a FAB in a fragment, along with some buttons in the layout. Depending on which button is pressed, I would like to hide the FAB, then if another button is pressed, show the FAB. Basically I would like to toggle the visibility of the FAB in the same fragment. Is this a good design method, or should the FAB be always visible (except on scroll for some cases) if included?