Search in sources :

Example 1 with MapFragmentFactory

use of org.odk.collect.geo.maps.MapFragmentFactory in project collect by opendatakit.

the class GeoPointMapActivityTest method setUp.

@Before
public void setUp() throws Exception {
    ShadowApplication shadowApplication = shadowOf(ApplicationProvider.<Application>getApplicationContext());
    shadowApplication.grantPermissions("android.permission.ACCESS_FINE_LOCATION");
    shadowApplication.grantPermissions("android.permission.ACCESS_COARSE_LOCATION");
    RobolectricApplication application = ApplicationProvider.getApplicationContext();
    application.geoDependencyComponent = DaggerGeoDependencyComponent.builder().application(application).geoDependencyModule(new GeoDependencyModule() {

        @NonNull
        @Override
        public MapFragmentFactory providesMapFragmentFactory() {
            return context -> mapFragment;
        }

        @NonNull
        @Override
        public ReferenceLayerSettingsNavigator providesReferenceLayerSettingsNavigator() {
            return activity -> {
            };
        }
    }).build();
}
Also used : MapFragmentFactory(org.odk.collect.geo.maps.MapFragmentFactory) NonNull(androidx.annotation.NonNull) ShadowApplication(org.robolectric.shadows.ShadowApplication) Before(org.junit.Before)

Example 2 with MapFragmentFactory

use of org.odk.collect.geo.maps.MapFragmentFactory in project collect by opendatakit.

the class GeoPolyActivityTest method setUp.

@Before
public void setUp() throws Exception {
    ShadowApplication shadowApplication = shadowOf(ApplicationProvider.<Application>getApplicationContext());
    shadowApplication.grantPermissions("android.permission.ACCESS_FINE_LOCATION");
    shadowApplication.grantPermissions("android.permission.ACCESS_COARSE_LOCATION");
    RobolectricApplication application = ApplicationProvider.getApplicationContext();
    application.geoDependencyComponent = DaggerGeoDependencyComponent.builder().application(application).geoDependencyModule(new GeoDependencyModule() {

        @NonNull
        @Override
        public MapFragmentFactory providesMapFragmentFactory() {
            return (context) -> mapFragment;
        }

        @NonNull
        @Override
        public ReferenceLayerSettingsNavigator providesReferenceLayerSettingsNavigator() {
            return (activity) -> {
            };
        }

        @NonNull
        @Override
        public LocationTracker providesLocationTracker() {
            return locationTracker;
        }
    }).build();
}
Also used : MapFragmentFactory(org.odk.collect.geo.maps.MapFragmentFactory) LocationTracker(org.odk.collect.location.tracker.LocationTracker) NonNull(androidx.annotation.NonNull) ShadowApplication(org.robolectric.shadows.ShadowApplication) Before(org.junit.Before)

Aggregations

NonNull (androidx.annotation.NonNull)2 Before (org.junit.Before)2 MapFragmentFactory (org.odk.collect.geo.maps.MapFragmentFactory)2 ShadowApplication (org.robolectric.shadows.ShadowApplication)2 LocationTracker (org.odk.collect.location.tracker.LocationTracker)1