use of net.osmand.plus.profiles.data.PredefinedProfilesGroup in project Osmand by osmandapp.
the class SelectNavProfileBottomSheet method savePredefinedEngine.
private void savePredefinedEngine(RoutingDataObject profile) {
String stringKey = profile.getStringKey();
OnlineRoutingHelper helper = app.getOnlineRoutingHelper();
ProfilesGroup profilesGroup = findGroupOfProfile(profile);
if (profilesGroup != null) {
PredefinedProfilesGroup group = (PredefinedProfilesGroup) profilesGroup;
String type = group.getType().toUpperCase();
OnlineRoutingEngine engine = EngineType.getTypeByName(type).newInstance(null);
engine.put(EngineParameter.KEY, stringKey);
engine.put(EngineParameter.VEHICLE_KEY, NONE_VEHICLE.getKey());
engine.put(EngineParameter.CUSTOM_URL, profile.getDescription());
String namePattern = getString(R.string.ltr_or_rtl_combine_via_dash);
String name = String.format(namePattern, group.getTitle(), profile.getName());
engine.put(EngineParameter.CUSTOM_NAME, name);
helper.saveEngine(engine);
}
}
Aggregations