use of org.odk.collect.geo.maps.MapFragment in project collect by opendatakit.
the class MapProvider method createMapFragment.
/**
* Gets a new MapFragment from the selected MapConfigurator.
*/
@Override
public MapFragment createMapFragment(@NonNull Context context) {
MapConfigurator cftor = getConfigurator();
MapFragment map = cftor.createMapFragment(context);
if (map != null) {
configuratorsByMap.put(map, cftor);
return map;
}
cftor.showUnavailableMessage(context);
return null;
}
use of org.odk.collect.geo.maps.MapFragment in project collect by opendatakit.
the class MapProvider method onMapFragmentStart.
void onMapFragmentStart(MapFragment map) {
MapConfigurator cftor = configuratorsByMap.get(map);
if (cftor != null) {
Settings generalSettings = PrefUtils.getSharedPrefs();
Settings.OnSettingChangeListener listener = key -> {
if (cftor.getPrefKeys().contains(key)) {
map.applyConfig(cftor.buildConfig(generalSettings));
}
};
map.applyConfig(cftor.buildConfig(generalSettings));
generalSettings.registerOnSettingChangeListener(listener);
listenersByMap.put(map, listener);
}
}
Aggregations