Listener interfaces have mixed responsibilities
The UI makes heavy use of listener interfaces that inherit from either DestroyableContext or BaseFragmentListener. These are used for various purposes:
- Callbacks from a controller to the UI (e.g.
- Injecting dependencies into fragments (
- Manipulating other parts of the UI (e.g.
- Running tasks (
These different purposes would ideally be separated into different interfaces. Maybe it would clarify things if communication from controllers back to the UI used the "listener" name and communication between fragments and their activities used some other name.
Listeners are usually provided by casting an Activity or Context (passed to
Fragment#onAttach()) to an arbitrary listener interface. This is a bit of a hack - it would be nice if we could provide listeners in a type-safe way, for example by injection.
Related to #752 (closed).