I have a MVP Fragment (View) that hosts a custom implementation of a RecyclerView adapter (RecyclerViewAdapter). This adapter extends my custom RecyclerViewAdapterBase adapter. As the Presenter hosting the Fragment needs to know what data is currently modelled, the data which the RecyclerView will utilize is stored as a private field in the Presenter.
This being said, I am currently passing the Presenter to the RecyclerViewAdapter through the Adapter's constructor. Is this a risk?
The only risk I can see is the RecyclerViewAdapter outliving the Fragment and thus outliving the Presenter. However, this is not a possibility as the Fragment holds a private reference to the Adapter and the Presenter and both would be destroyed at the same time.
This being said, I've thought of only passing the data required to the RecyclerViewAdapter in the constructor, but then I am not certain how to update the data without a reference to the Presenter? (Where the data is currently modelled.)
Thank you for your ideas!