I am trying to reorganize one of my activity classes to implement mvp (using the mvp mosby library). I have a RecyclerView, and in this view there are some elements to which some changes apply to them during runtime. for example, I perform an I / O operation and change one line.
I think it's best to keep my subjects in the class of presenters; what is the best thing for? keep it in 1) the presenter or 2) activity or 3) save only the element related to viewing in the adapter and all other elements in the presenter.
activity now saves items directly and changes the line item in action, and then notifies the adapter. isn't it better to move this whole line in the adapter and notify the adapter in the adapter class? for example, I want to change the icon of a line. Where and which class is responsible for this? adapter? Events? Now I want to implement it like this in the adapter:
changeItemIcon(int position, int iconRes){ mImages.get(position).setICon(iconRes); notifyItemChanged(position); }
I call this method by activity and the activity method from the host is called.
it's good? What is the best practice for this?
UPDATE
I also find this question ( Best way to update data using the RecyclerView adapter ) using the adapter method to modify the elements. but what about modifications? Do I need to store links to objects in my activity?
source share