@LooperMode(PAUSED) @Test public void tappingOnInstance_centersToThatInstanceAndKeepsTheSameZoom() { MapPoint sent = new MapPoint(10.3, 125.7); map.zoomToPoint(new MapPoint(7, 8), 7, false); assertThat(map.getLatestZoomPoint().lat, is(7.0)); assertThat(map.getLatestZoomPoint().lon, is(8.0)); assertThat(map.getZoom(), is(7.0)); activity.onFeatureClicked(map.getFeatureIdFor(sent)); assertThat(map.getLatestZoomPoint().lat, is(10.3)); assertThat(map.getLatestZoomPoint().lon, is(125.7)); assertThat(map.getZoom(), is(7.0)); }
public void onFeatureClicked(int featureId) { summarySheet.setState(BottomSheetBehavior.STATE_HIDDEN); if (!isSummaryForGivenSubmissionDisplayed(featureId)) { removeEnlargedMarkerIfExist(featureId); FormMapViewModel.MappableFormInstance mappableFormInstance = instancesByFeatureId.get(featureId); if (mappableFormInstance != null) { map.zoomToPoint(new MapPoint(mappableFormInstance.getLatitude(), mappableFormInstance.getLongitude()), map.getZoom(), true); updateSubmissionMarker(featureId, mappableFormInstance.getStatus(), true); setUpSummarySheetDetails(mappableFormInstance); } viewModel.setSelectedSubmissionId(featureId); } }
FormMapActivity extends BaseGeoMapActivity { public void onFeatureClicked(int featureId) { summarySheet.setState(BottomSheetBehavior.STATE_HIDDEN); if (!isSummaryForGivenSubmissionDisplayed(featureId)) { removeEnlargedMarkerIfExist(featureId); FormMapViewModel.MappableFormInstance mappableFormInstance = instancesByFeatureId.get(featureId); if (mappableFormInstance != null) { map.zoomToPoint(new MapPoint(mappableFormInstance.getLatitude(), mappableFormInstance.getLongitude()), map.getZoom(), true); updateSubmissionMarker(featureId, mappableFormInstance.getStatus(), true); setUpSummarySheetDetails(mappableFormInstance); } viewModel.setSelectedSubmissionId(featureId); } } }
FormMapActivity extends BaseGeoMapActivity { public void onFeatureClicked(int featureId) { summarySheet.setState(BottomSheetBehavior.STATE_HIDDEN); if (!isSummaryForGivenSubmissionDisplayed(featureId)) { removeEnlargedMarkerIfExist(featureId); FormMapViewModel.MappableFormInstance mappableFormInstance = instancesByFeatureId.get(featureId); if (mappableFormInstance != null) { map.zoomToPoint(new MapPoint(mappableFormInstance.getLatitude(), mappableFormInstance.getLongitude()), map.getZoom(), true); updateSubmissionMarker(featureId, mappableFormInstance.getStatus(), true); setUpSummarySheetDetails(mappableFormInstance); } viewModel.setSelectedSubmissionId(featureId); } }  }
FormMapActivity extends BaseGeoMapActivity { public void onFeatureClicked(int featureId) { summarySheet.setState(BottomSheetBehavior.STATE_HIDDEN); if (!isSummaryForGivenSubmissionDisplayed(featureId)) { removeEnlargedMarkerIfExist(featureId); FormMapViewModel.MappableFormInstance mappableFormInstance = instancesByFeatureId.get(featureId); if (mappableFormInstance != null) { map.zoomToPoint(new MapPoint(mappableFormInstance.getLatitude(), mappableFormInstance.getLongitude()), map.getZoom(), true); updateSubmissionMarker(featureId, mappableFormInstance.getStatus(), true); setUpSummarySheetDetails(mappableFormInstance); } viewModel.setSelectedSubmissionId(featureId); } }  @Override void onCreate(Bundle savedInstanceState); @Override void onResume(); @Override void onBackPressed(); @SuppressLint("MissingPermission") // Permission handled in Constructor void initMap(MapFragment newMapFragment); void onLocationChanged(MapPoint point); void onFeatureClicked(int featureId); }
FormMapActivity extends BaseGeoMapActivity { public void onFeatureClicked(int featureId) { summarySheet.setState(BottomSheetBehavior.STATE_HIDDEN); if (!isSummaryForGivenSubmissionDisplayed(featureId)) { removeEnlargedMarkerIfExist(featureId); FormMapViewModel.MappableFormInstance mappableFormInstance = instancesByFeatureId.get(featureId); if (mappableFormInstance != null) { map.zoomToPoint(new MapPoint(mappableFormInstance.getLatitude(), mappableFormInstance.getLongitude()), map.getZoom(), true); updateSubmissionMarker(featureId, mappableFormInstance.getStatus(), true); setUpSummarySheetDetails(mappableFormInstance); } viewModel.setSelectedSubmissionId(featureId); } }  @Override void onCreate(Bundle savedInstanceState); @Override void onResume(); @Override void onBackPressed(); @SuppressLint("MissingPermission") // Permission handled in Constructor void initMap(MapFragment newMapFragment); void onLocationChanged(MapPoint point); void onFeatureClicked(int featureId); static final String MAP_CENTER_KEY; static final String MAP_ZOOM_KEY; public BottomSheetBehavior summarySheet; @VisibleForTesting public ViewModelProvider.Factory viewModelFactory; }