Configure profile as service when changing profile settings
When trying to change settings for a profile that was not yet configured as a service in the android app, the app exits instead of configuring the profile. This behavior is not very intuitive for users. This change instead adds a dialog to configure the profile as a new service in case `Profile Settings` is selected and the selected profile is not yet configured as a service.
This commit is contained in:
parent
e63cc9888f
commit
e18e2a16f4
13 changed files with 31 additions and 34 deletions
|
|
@ -817,17 +817,17 @@ public class BRouterView extends View {
|
|||
}
|
||||
}
|
||||
|
||||
public void startConfigureService() {
|
||||
public void startConfigureService(String sparams) {
|
||||
String[] modes = new String[]
|
||||
{"foot_short", "foot_fast", "bicycle_short", "bicycle_fast", "motorcar_short", "motorcar_fast"};
|
||||
boolean[] modesChecked = new boolean[6];
|
||||
|
||||
String msg = "Choose service-modes to configure (" + profileName + " [" + nogoVetoList.size() + "])";
|
||||
|
||||
((BRouterActivity) getContext()).selectRoutingModes(modes, modesChecked, msg);
|
||||
((BRouterActivity) getContext()).selectRoutingModes(modes, modesChecked, msg, sparams);
|
||||
}
|
||||
|
||||
public void configureService(String[] routingModes, boolean[] checkedModes) {
|
||||
public void configureService(String[] routingModes, boolean[] checkedModes, String sparams) {
|
||||
// read in current config
|
||||
TreeMap<String, ServiceModeConfig> map = new TreeMap<>();
|
||||
BufferedReader br = null;
|
||||
|
|
@ -861,7 +861,8 @@ public class BRouterView extends View {
|
|||
s = sm.params;
|
||||
p = sm.profile;
|
||||
}
|
||||
if (s == null || !p.equals(profileName)) s = "noparams";
|
||||
if (!p.equals(profileName)) s = sparams;
|
||||
if (s == null || s.equals("")) s = "noparams";
|
||||
ServiceModeConfig smc = new ServiceModeConfig(routingModes[i], profileName, s);
|
||||
for (OsmNodeNamed nogo : nogoVetoList) {
|
||||
smc.nogoVetos.add(nogo.ilon + "," + nogo.ilat);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue