@LooperMode(PAUSED) @Test public void openingEditableInstance_whenEditingSettingisOff_launchesViewActivity() { AdminSharedPreferences.getInstance().save(AdminKeys.KEY_EDIT_SAVED, false); MapPoint editableAndFinalized = new MapPoint(10.1, 125.6); MapPoint unfinalized = new MapPoint(10.1, 126.6); MapPoint failedToSend = new MapPoint(10.3, 125.6); MapPoint[] testPoints = {editableAndFinalized, unfinalized, failedToSend}; for (MapPoint toTap : testPoints) { int featureId = map.getFeatureIdFor(toTap); activity.onFeatureClicked(featureId); clickOnOpenFormChip(); Intent actual = shadowOf(RuntimeEnvironment.application).getNextStartedActivity(); assertThat(actual.getAction(), is(Intent.ACTION_EDIT)); assertThat(actual.getStringExtra(ApplicationConstants.BundleKeys.FORM_MODE), is(ApplicationConstants.FormModes.VIEW_SENT)); } }
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; }