Search in sources :

Example 1 with LocationTracker

use of org.odk.collect.location.tracker.LocationTracker 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)1 Before (org.junit.Before)1 MapFragmentFactory (org.odk.collect.geo.maps.MapFragmentFactory)1 LocationTracker (org.odk.collect.location.tracker.LocationTracker)1 ShadowApplication (org.robolectric.shadows.ShadowApplication)1