This is not really an answer but an advice ...
Many times, I've felt the urge to use this method (onDetachedFromWindow) to unregister observers and/or clear scopes...
DO NOT DO THIS!!
onDetachedFromWindow() does not equal Fragment's onDestroyView().
There is no inner method that gets called specifically when the view is destroyed (unfortunately).
onDetachFromWindow() will get called when changing the page in a ViewPager/ViewPager2, while the view is not really being destroyed.
If you use onDetachFromWindow() to clear scopes, you'll either get a NullPointerException, or the view will simply stop responding to updates when scrolling back to the page in question.
The best and easiest thing you could do is use the onDestroyView() method to clear scopes.
The hardest/best way is to listen for the Fragment's LifeCycle (if you want a one time instantiated Adapter), and then dispatch an "destroyed" message through the Adapter to all views observing the Adapter and make them self-unregister themselves.... not even the DataSetObserver class is built to do this (when it should).