The `emptyViewHandler` already handles hiding and showing both the empty
view and the recycler view on data changes, so this commit removes this
part of the logic from the episodes fragment.
It also hides the empty view right after creating the recycle adapter
for the first time (when the fragment is created) to prevent the
progress bar and the empty view from being displayed at the same time.
`createRecycleAdapter()` signature was changed to make it explicit that
it depends on both the `recyclerView` and `emptyViewHandler`. Similarly,
`onFragmentLoaded()`, since it also depends on the new data that gets
loaded.
Unregistering from the EventDistributor on stop will prevent downloads
from updating when an episode finishes playing while the screen was off
(#2747), so this registers/unregisters on view create/destroy.
Disposing of the request to load items on stop could potentially cause
the same issue. Since we're disposing of this request on destroy,
there's no need to keep checking and disposing of it in the several
lifecycle methods.
There's no need to call `onFragmentLoaded()` on attach, since this is
the first lifecycle method to be called [[1]], meaning the items will
always be null by the time this method is called.
Finally, since `loadItems` depends on the view being created, it is now
only called on view create to avoid having to store state in the class
about whether the view has been created, taking advantage of the native
fragment lifecycle.
[1]: https://developer.android.com/guide/components/fragmentsCloses: #2747
This splits the logic in `ActionButtonUtils` and
`DefaultActionButtonCallback` into multiple specialized classes to
reduce duplication figuring out which button/action to use while at the
same time making each individual button to have a single responsability.
This displays a progress bar with the amount of used/free space in each
storage location to make it easier to identify storage devices. This is
particularly useful for devices that use non-standard names.
Reference: #3049
This is in preparation to add a progress bar displaying the amount of
used/free space in the dialog (#3049). Since we'll need a custom view to
do it, this extracts the layout beforehand.