diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java index f633b47f..ead60b97 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterActivity.java @@ -78,6 +78,7 @@ public class BRouterActivity extends AppCompatActivity implements ActivityCompat private String title; private int wpCount; private boolean startSilent; + private String configuredParams = null; ActivityResultLauncher someActivityResultLauncher; @@ -108,7 +109,12 @@ public void onActivityResult(ActivityResult result) { if (data != null && data.hasExtra("PROFILE_HASH")) { profile_hash = data.getExtras().getString("PROFILE_HASH", ""); } - mBRouterView.configureServiceParams(profile, sparams); + + if (mBRouterView.getConfigureServiceParams(profile) == null) { + mBRouterView.startConfigureService(sparams); + } else { + mBRouterView.configureServiceParams(profile, sparams); + } } } @@ -203,6 +209,7 @@ public void onClick(DialogInterface dialog, int id) { return builder.create(); */ case DIALOG_ROUTINGMODES_ID: + String configuredParams = this.configuredParams; builder.setTitle(message); builder.setMultiChoiceItems(routingModes, routingModesChecked, new DialogInterface.OnMultiChoiceClickListener() { @@ -213,7 +220,7 @@ public void onClick(DialogInterface dialog, int which, boolean isChecked) { }); builder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { - mBRouterView.configureService(routingModes, routingModesChecked); + mBRouterView.configureService(routingModes, routingModesChecked, configuredParams); } }); return builder.create(); @@ -345,7 +352,7 @@ public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int item) { if (slist.size() > 1 && item == 0) { if (wpCount == 0) { - mBRouterView.startConfigureService(); + mBRouterView.startConfigureService(null); } else if (wpCount == -3) { showRepeatTimeoutHelp(); } else if (wpCount >= 2) { @@ -456,21 +463,20 @@ private void showProfileSettings(String selectedProfile) { } String sparams = mBRouterView.getConfigureServiceParams(selectedProfile); - if (sparams != null) { - if (listParams.size() > 0) { - Intent i = new Intent(BRouterActivity.this, RoutingParameterDialog.class); - i.putExtra("PROFILE", selectedProfile); - i.putExtra("PROFILE_HASH", String.format("B%X", profile.getAbsolutePath().hashCode())); - i.putExtra("PARAMS", (Serializable) listParams); - i.putExtra("PARAMS_VALUES", sparams); - //startActivityForResult(i, 100); - someActivityResultLauncher.launch(i); - } else { - Toast.makeText(this, R.string.msg_no_profile, Toast.LENGTH_LONG).show(); - finish(); - } + if (sparams == null) { + // profile is not used yet + sparams = ""; + } + if (listParams.size() > 0) { + Intent i = new Intent(BRouterActivity.this, RoutingParameterDialog.class); + i.putExtra("PROFILE", selectedProfile); + i.putExtra("PROFILE_HASH", String.format("B%X", profile.getAbsolutePath().hashCode())); + i.putExtra("PARAMS", (Serializable) listParams); + i.putExtra("PARAMS_VALUES", sparams); + //startActivityForResult(i, 100); + someActivityResultLauncher.launch(i); } else { - Toast.makeText(this, selectedProfile + getString(R.string.msg_no_used_profile), Toast.LENGTH_LONG).show(); + Toast.makeText(this, R.string.msg_no_profile, Toast.LENGTH_LONG).show(); finish(); } } @@ -539,10 +545,11 @@ public void selectBasedir(ArrayList items, String message) { } } - public void selectRoutingModes(String[] modes, boolean[] modesChecked, String message) { + public void selectRoutingModes(String[] modes, boolean[] modesChecked, String message, String sparams) { routingModes = modes; routingModesChecked = modesChecked; this.message = message; + this.configuredParams = sparams; showADialog(DIALOG_ROUTINGMODES_ID); } @@ -666,7 +673,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis private void onItemClick(AdapterView adapterView, View view, int which, long l) { if (which == 0) { if (wpCount == 0) { - mBRouterView.startConfigureService(); + mBRouterView.startConfigureService(null); } else if (wpCount == -3) { showRepeatTimeoutHelp(); } else if (wpCount >= 2) { diff --git a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java index efdbdfb2..f19af8de 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -817,17 +817,17 @@ private void writeRawTrackToPath(String rawTrackPath) { } } - 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 map = new TreeMap<>(); BufferedReader br = null; @@ -861,7 +861,8 @@ public void configureService(String[] routingModes, boolean[] checkedModes) { 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); diff --git a/brouter-routing-app/src/main/res/values-ar/strings.xml b/brouter-routing-app/src/main/res/values-ar/strings.xml index 8759f4af..b53a0c07 100644 --- a/brouter-routing-app/src/main/res/values-ar/strings.xml +++ b/brouter-routing-app/src/main/res/values-ar/strings.xml @@ -53,7 +53,6 @@ اختر إلى/عبر لا توجد بيانات ملف التعريف - ، لا يوجد ملف تعريف مستخدم هناك الكثير من البيانات للتنزيل، من فضلك قم بتقليلها. تمت جدولة التنزيل، وتحقق من اتصالك بالإنترنت إذا لم يبدأ التنزيل. نقاط الطريق الحالية المحددة:\n diff --git a/brouter-routing-app/src/main/res/values-ca/strings.xml b/brouter-routing-app/src/main/res/values-ca/strings.xml index 9df7107e..ec24bc21 100644 --- a/brouter-routing-app/src/main/res/values-ca/strings.xml +++ b/brouter-routing-app/src/main/res/values-ca/strings.xml @@ -53,7 +53,6 @@ Seleccionar a/via no hi ha dades al perfil - , cap perfil utilitzat Massa dades per baixar. Si us plau, redueix-les. Baixada programada. Comprovar la connexió a internet si no comença. selecció actual de fita:\n diff --git a/brouter-routing-app/src/main/res/values-de/strings.xml b/brouter-routing-app/src/main/res/values-de/strings.xml index 902aa4d6..faccfa23 100644 --- a/brouter-routing-app/src/main/res/values-de/strings.xml +++ b/brouter-routing-app/src/main/res/values-de/strings.xml @@ -53,7 +53,6 @@ "Nach"/Via wählen Keine Profildaten - , kein verwendetes Profil Zu viele Daten für den Download. Bitte reduzieren. Download geplant. Überprüfen Sie die Internetverbindung, wenn der Download nicht startet. aktuelle Wegpunktauswahl:\n diff --git a/brouter-routing-app/src/main/res/values-el/strings.xml b/brouter-routing-app/src/main/res/values-el/strings.xml index f5d098b4..5e275e50 100644 --- a/brouter-routing-app/src/main/res/values-el/strings.xml +++ b/brouter-routing-app/src/main/res/values-el/strings.xml @@ -53,7 +53,6 @@ Επιλέξτε προς/μέσω μη δεδομένα προφίλ - , μη χρησιμοποιημένο προφίλ Πάρα πολλά δεδομένα για λήψη. Παρακαλώ μειώστε. Προγραμματισμένη λήψη. Ελέγξτε τη σύνδεση στο διαδίκτυο εάν δεν ξεκινά. τρέχουσα επιλογή σημείου:\n diff --git a/brouter-routing-app/src/main/res/values-es/strings.xml b/brouter-routing-app/src/main/res/values-es/strings.xml index 37094da4..4c96c4ef 100644 --- a/brouter-routing-app/src/main/res/values-es/strings.xml +++ b/brouter-routing-app/src/main/res/values-es/strings.xml @@ -53,7 +53,6 @@ Seleccionar a/vía no hay datos en el perfil - , ningún perfil utilizado Demasiados datos a descargar. Por favor, reducidlos. Descarga programada. Comprueba la conexión a internet si no se inicia. selección actual de waypoint:\n diff --git a/brouter-routing-app/src/main/res/values-fr/strings.xml b/brouter-routing-app/src/main/res/values-fr/strings.xml index 0b028f72..f0391c60 100644 --- a/brouter-routing-app/src/main/res/values-fr/strings.xml +++ b/brouter-routing-app/src/main/res/values-fr/strings.xml @@ -53,7 +53,6 @@ Sélectionner vers/via aucune donnée de profil - , aucun profil utilisé Trop de données à télécharger. Veuillez réduire. Téléchargement planifié. Vérifiez la connexion Internet si elle ne démarre pas. sélection actuelle du waypoint:\n diff --git a/brouter-routing-app/src/main/res/values-it/strings.xml b/brouter-routing-app/src/main/res/values-it/strings.xml index c82a6e28..e2e66340 100644 --- a/brouter-routing-app/src/main/res/values-it/strings.xml +++ b/brouter-routing-app/src/main/res/values-it/strings.xml @@ -53,7 +53,6 @@ Seleziona a/via nessun dato del profilo - , nessun profilo utilizzato Troppi dati per il download. Per favore riduci. Download programmato. Controlla la connessione Internet se non si avvia. selezione del waypoint corrente:\n diff --git a/brouter-routing-app/src/main/res/values-ko/strings.xml b/brouter-routing-app/src/main/res/values-ko/strings.xml index 1c316edf..ec16890d 100644 --- a/brouter-routing-app/src/main/res/values-ko/strings.xml +++ b/brouter-routing-app/src/main/res/values-ko/strings.xml @@ -53,7 +53,6 @@ 선택 ~로/경유하여 프로필 데이터 없음 - , 사용된 프로필 없음 다운로드 하기에 너무 많은 데이터. 줄이도록 하세요. 다운로드 계획되어 있음. 인터넷 연결 체크 그렇지 않다면 시작. 현재 장소 선택:\n diff --git a/brouter-routing-app/src/main/res/values-nl/strings.xml b/brouter-routing-app/src/main/res/values-nl/strings.xml index fea694aa..f34f1ef4 100644 --- a/brouter-routing-app/src/main/res/values-nl/strings.xml +++ b/brouter-routing-app/src/main/res/values-nl/strings.xml @@ -53,7 +53,6 @@ Selecteer naar/via geen profiel data - , geen gebruikt profiel Te veel gegevens om te downloaden. Verminder a.u.b. Download is gepland. Controleer de internetverbinding als deze niet start. huidige waypointselectie:\n diff --git a/brouter-routing-app/src/main/res/values-pl/strings.xml b/brouter-routing-app/src/main/res/values-pl/strings.xml index 69012403..6cff5b2e 100644 --- a/brouter-routing-app/src/main/res/values-pl/strings.xml +++ b/brouter-routing-app/src/main/res/values-pl/strings.xml @@ -53,7 +53,6 @@ Wybierz do/przez brak danych profilu - , brak używanego profilu Za dużo danych do pobrania. Proszę ogranicz. Pobieranie zaplanowane. Jeśli się nie rozpocznie, sprawdź połączenie internetowe. bieżący wybór punktu trasy:\n diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index fe274abc..669cb7e1 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -53,7 +53,6 @@ Select to/via no profile data - , no used profile Too much data for download. Please reduce. Download scheduled. Check internet connection if it doesn\'t start. current waypoint selection:\n