Search in sources :

Example 1 with PermissionsProvider

use of org.odk.collect.permissions.PermissionsProvider in project collect by opendatakit.

the class BackgroundAudioPermissionDialogFragmentTest method setup.

@Before
public void setup() {
    backgroundAudioViewModel = mock(BackgroundAudioViewModel.class);
    fakePermissionsProvider = new FakePermissionsProvider();
    CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public BackgroundAudioViewModel.Factory providesBackgroundAudioViewModelFactory(AudioRecorder audioRecorder, SettingsProvider settingsProvider, PermissionsChecker permissionsChecker, Analytics analytics) {
            return new BackgroundAudioViewModel.Factory(audioRecorder, settingsProvider.getUnprotectedSettings(), permissionsChecker, System::currentTimeMillis) {

                @NonNull
                @Override
                public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
                    return (T) backgroundAudioViewModel;
                }
            };
        }

        @Override
        public PermissionsProvider providesPermissionsProvider(PermissionsChecker permissionsChecker) {
            return fakePermissionsProvider;
        }
    });
}
Also used : AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Analytics(org.odk.collect.analytics.Analytics) PermissionsProvider(org.odk.collect.permissions.PermissionsProvider) FakePermissionsProvider(org.odk.collect.android.fakes.FakePermissionsProvider) SettingsProvider(org.odk.collect.settings.SettingsProvider) NonNull(androidx.annotation.NonNull) AudioRecorder(org.odk.collect.audiorecorder.recording.AudioRecorder) PermissionsChecker(org.odk.collect.permissions.PermissionsChecker) FakePermissionsProvider(org.odk.collect.android.fakes.FakePermissionsProvider) Before(org.junit.Before)

Aggregations

NonNull (androidx.annotation.NonNull)1 Before (org.junit.Before)1 Analytics (org.odk.collect.analytics.Analytics)1 FakePermissionsProvider (org.odk.collect.android.fakes.FakePermissionsProvider)1 AppDependencyModule (org.odk.collect.android.injection.config.AppDependencyModule)1 AudioRecorder (org.odk.collect.audiorecorder.recording.AudioRecorder)1 PermissionsChecker (org.odk.collect.permissions.PermissionsChecker)1 PermissionsProvider (org.odk.collect.permissions.PermissionsProvider)1 SettingsProvider (org.odk.collect.settings.SettingsProvider)1