use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method unfinalizedInstance_hasEditableStatus.
@Test
public void unfinalizedInstance_hasEditableStatus() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_1, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> instances = viewModel.getMappableFormInstances();
assertThat(instances.get(2).getClickAction(), is(FormMapViewModel.ClickAction.OPEN_EDIT));
}
use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapViewModelTest method instanceThatFailedToSend_thatCanBeEdited_hasViewableStatus.
// Instances that failed to send are not editable starting in v2021.2
@Test
public void instanceThatFailedToSend_thatCanBeEdited_hasViewableStatus() {
FormMapViewModel viewModel = new FormMapViewModel(TEST_FORM_1, testInstancesRepository);
List<FormMapViewModel.MappableFormInstance> instances = viewModel.getMappableFormInstances();
assertThat(instances.get(3).getClickAction(), is(FormMapViewModel.ClickAction.OPEN_READ_ONLY));
}
use of org.odk.collect.android.activities.viewmodels.FormMapViewModel in project collect by opendatakit.
the class FormMapActivity method loadForm.
@Nullable
private Form loadForm() {
Form form = formsRepositoryProvider.get().get(getIntent().getLongExtra(EXTRA_FORM_ID, -1));
FormMapViewModelFactory viewModelFactory = new FormMapViewModelFactory(form, instancesRepositoryProvider.get());
formMapViewModel = new ViewModelProvider(this, viewModelFactory).get(FormMapViewModel.class);
return form;
}
Aggregations