maxkeppeler / sheets

⭐ ‎‎‎‏‏‎ ‎Offers a range of beautiful sheets (dialogs & bottom sheets) for quick use in your project. Includes many ways to customize sheets.
https://maxkeppeler.github.io/sheets/
Apache License 2.0
923 stars 77 forks source link

How to find out if sheet is visible? #89

Closed GraxCode closed 3 years ago

GraxCode commented 3 years ago

I want to make sure a sheet is closed using connectSheet.dismiss();. This throws an exception (java.lang.IllegalStateException: Fragment InputSheet{30375ec} (b24c50ad-42e2-4095-95d7-ff6fc0af69df) not associated with a fragment manager.) when the sheet has not called the show method. How do i check if it is visible before dismissing and make sure no exception is thrown?

maxkeppeler commented 3 years ago

Just use the normal method isVisible form the DialogFragment to check if it is visible or not. Or handle the state with a global property for the sheet which has a value when displayed or null when dismissed.