use of org.odk.collect.shared.settings.Settings in project collect by opendatakit.
the class AdminPasswordProviderTest method when_adminPassHasEmptyValue_should_getAdminPasswordReturnEmptyString.
@Test
public void when_adminPassHasEmptyValue_should_getAdminPasswordReturnEmptyString() {
Settings adminSharedPreferences = mock(Settings.class);
when(adminSharedPreferences.getString(KEY_ADMIN_PW)).thenReturn("");
AdminPasswordProvider adminPasswordProvider = new AdminPasswordProvider(adminSharedPreferences);
assertThat(adminPasswordProvider.getAdminPassword(), is(""));
}
use of org.odk.collect.shared.settings.Settings in project collect by opendatakit.
the class Collect method fixGoogleBug154855417.
// https://issuetracker.google.com/issues/154855417
private void fixGoogleBug154855417() {
try {
Settings metaSharedPreferences = settingsProvider.getMetaSettings();
boolean hasFixedGoogleBug154855417 = metaSharedPreferences.getBoolean(KEY_GOOGLE_BUG_154855417_FIXED);
if (!hasFixedGoogleBug154855417) {
File corruptedZoomTables = new File(getFilesDir(), "ZoomTables.data");
corruptedZoomTables.delete();
metaSharedPreferences.save(KEY_GOOGLE_BUG_154855417_FIXED, true);
}
} catch (Exception ignored) {
// ignored
}
}
use of org.odk.collect.shared.settings.Settings in project collect by opendatakit.
the class BackgroundAudioViewModelTest method setup.
@Before
public void setup() {
clock = mock(Supplier.class);
Settings generalSettings = TestSettingsProvider.getUnprotectedSettings();
generalSettings.clear();
viewModel = new BackgroundAudioViewModel(audioRecorder, generalSettings, recordAudioActionRegistry, permissionsChecker, clock);
}
use of org.odk.collect.shared.settings.Settings in project collect by opendatakit.
the class MapBoxInitializationFragment method initMapBox.
private void initMapBox(View rootView) {
Settings metaSharedPreferences = settingsProvider.getMetaSettings();
if (!metaSharedPreferences.getBoolean(KEY_MAPBOX_INITIALIZED) && connectivityProvider.isDeviceOnline()) {
// most likely to be available. This is annoyingly needed for offline tiles to work.
try {
mapView = new MapView(getContext());
FrameLayout mapBoxContainer = rootView.findViewById(R.id.map_box_container);
mapBoxContainer.addView(mapView);
mapView.getMapAsync(mapBoxMap -> mapBoxMap.setStyle(Style.MAPBOX_STREETS, style -> {
metaSharedPreferences.save(KEY_MAPBOX_INITIALIZED, true);
}));
} catch (Exception | Error ignored) {
// This will crash on devices where the arch for MapBox is not included
}
}
}
use of org.odk.collect.shared.settings.Settings in project collect by opendatakit.
the class MapProvider method onMapFragmentStop.
void onMapFragmentStop(MapFragment map) {
Settings.OnSettingChangeListener listener = listenersByMap.get(map);
if (listener != null) {
Settings prefs = PrefUtils.getSharedPrefs();
prefs.unregisterOnSettingChangeListener(listener);
listenersByMap.remove(map);
}
}
Aggregations