Hiding Bottom Nav bar on certain situations

I’m going to try and explain this the best way I can. I have a main activity with 3 fragments. In the main activity it has a bottom nav, a container(a constraint layout that holds my fragments), and a search bar at the top. The main activity is a constraint layout.

What I’m trying to do is when the user hits the search bar or a fab I have at the bottom it replaces the container with a search fragment. (I have the search fragment showing up and all that is great). In the search fragment there is a search bar, a recycler view, and set of buttons that only show when the keyboard is visible.

So when the user comes into the search view what I have happening right now is as soon as the search view shows the keyboard also automatically shows and those hidden buttons sit just on top of the keyboard. At this point I don’t want the bottom nav to be visible to the user. When the user hits the recycler view or hits the soft key to hide the keyboard I want those two buttons that are sitting on top of the keyboard to hide and the bottom nav to be visible again so the user can move back to the home page or go to other fragments.

I have tried using the manifest file and adding in a “adjustResize” and I’ve tried “adjustPan” and I’ve gotten close but can’t get what I want.

What I’ve tested is using a interface but because I am not actually hitting any button from the fragment that I can use to call back to the main activity I can’t kick off the function to show or hide the bottom nav. I’ve tried doing a listen on the buttons that sit on top of the keyboard to show they changed their layout but it doesn’t update the layout correctly.

Hopefully this was written clear as mud but if anyone has any ideas on how this might be done I’d greatly appreciate any feedback.