I've an app that from now I have a list filled up from my api. Now I'm detecting the onClick on recyclerView
and I want to open a GoogleMaps
with a marker focused on the item I clicked (I have lat and long).
Is there a good approach to do this with it's Repository, usecases, model, etc?
The thing is that I have on my ModelView is the coordinates where it is, and the type of cat, also the id.
The thing is that I do not know what to send to the other activity because everytime I make an api call the data changes, so I do not know if I have to store it anywhere and then show the data from listView and then create a refresh button on mapActivity where I can restart the data from api.
Hope you understand my problem.
An example that I'm following is this one : GitHub repository this is what I have as a list, then when clicking on an item it should open the map.
EDIT
I ended up passing the list when I click on an item from the List (If you have any other way please feel free to tell me)
Then I created a contract that it's :
interface Presenter{
fun onMapReady()
}
interface View{
fun focusOnItem(latitude: Double, longitude: Double)
fun putMarkers(mList)
}
Then I do not know where to use rxJava
on my presenter, because I need to wait until I set stuff for my presenter like views and data and when I filled all up then start doing the putMarkers first, then focusOnItem, but I'm stuck on this.
So what I'm doing at the moment is from mapActivity I set the list and then I want to start doing the job.
TL;DR
Since start I had an activity (that is almost the same from the Github repo and then I need to pass the list to my other activity I ended up doing a setter to a presenter because dagger didn't know about that list so, my problem now is how do I set up all of the MVP with rxJava to load the map and load the markers on it. It should also zoom to the element clicked but I already have the location.
With a simple pseudo if you convince myself to do it this way I'll accept your answer as a correct, I just need to figure it out how to do this in rxJava.