use of net.osmand.plus.profiles.data.ProfilesGroup 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);
}
}
use of net.osmand.plus.profiles.data.ProfilesGroup in project Osmand by osmandapp.
the class SelectNavProfileBottomSheet method createProfilesList.
private void createProfilesList() {
for (ProfilesGroup group : profileGroups) {
List<ProfileDataObject> items = group.getProfiles();
if (!Algorithms.isEmpty(items)) {
addGroupHeader(group.getTitle(), group.getDescription(app, nightMode));
for (ProfileDataObject item : items) {
addProfileItem(item);
}
addDivider();
}
}
}
Aggregations