Fix recycler view positions

This commit is contained in:
PavelRatushnyi 2017-09-11 00:58:45 +03:00
parent b88bed8e01
commit 1810e5fcbf
2 changed files with 2 additions and 2 deletions

View file

@ -49,7 +49,7 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
@Override @Override
public void onItemClick(View view) { public void onItemClick(View view) {
int pos = recyclerView.indexOfChild(view); int pos = recyclerView.getChildAdapterPosition(view);
MapMarker marker = adapter.getItem(pos); MapMarker marker = adapter.getItem(pos);
mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(), mapActivity.getMyApplication().getSettings().setMapLocationToShow(marker.getLatitude(), marker.getLongitude(),
15, marker.getPointDescription(mapActivity), true, marker); 15, marker.getPointDescription(mapActivity), true, marker);

View file

@ -46,7 +46,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
adapter.setAdapterListener(new MapMarkersHistoryAdapter.MapMarkersHistoryAdapterListener() { adapter.setAdapterListener(new MapMarkersHistoryAdapter.MapMarkersHistoryAdapterListener() {
@Override @Override
public void onItemClick(View view) { public void onItemClick(View view) {
int pos = recyclerView.indexOfChild(view); int pos = recyclerView.getChildAdapterPosition(view);
Object item = adapter.getItem(pos); Object item = adapter.getItem(pos);
if (item instanceof MapMarker) { if (item instanceof MapMarker) {
MapMarker marker = (MapMarker) item; MapMarker marker = (MapMarker) item;