From 3acbd96575d7ef3200f6674142977da60bcd5a32 Mon Sep 17 00:00:00 2001 From: afischerdev Date: Sun, 10 Dec 2023 13:19:54 +0100 Subject: [PATCH] more new resources from hardcoded messages --- .../java/btools/routingapp/BRouterView.java | 25 +++++++++++-------- .../src/main/res/values/strings.xml | 13 ++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) 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 ff50885..5c7be2b 100644 --- a/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java +++ b/brouter-routing-app/src/main/java/btools/routingapp/BRouterView.java @@ -380,14 +380,14 @@ public class BRouterView extends View { try { cor.readAllPoints(); } catch (Exception e) { - msg = "Error reading waypoints: " + e; + msg = getContext().getString(R.string.msg_read_wpt_error)+ ": " + e; } int size = cor.allpoints.size(); if (size < 1) - msg = "coordinate source does not contain any waypoints!"; + msg = getContext().getString(R.string.msg_no_wpt); if (size > 1000) - msg = "coordinate source contains too much waypoints: " + size + "(please use from/to/via names)"; + msg = getContext().getString(R.string.msg_to_much_wpts, size); } if (msg != null) { @@ -471,13 +471,13 @@ public class BRouterView extends View { if (needsWaypointSelection) { StringBuilder msg; if (wpList.size() == 0) { - msg = new StringBuilder("Expecting waypoint selection\n" + "(coordinate-source: " + cor.basedir + cor.rootdir + ")"); + msg = new StringBuilder(getContext().getString(R.string.msg_no_wpt_selection) + "(coordinate-source: " + cor.basedir + cor.rootdir + ")"); } else { - msg = new StringBuilder("current waypoint selection:\n"); + msg = new StringBuilder(getContext().getString(R.string.msg_wpt_selection)); for (int i = 0; i < wpList.size(); i++) msg.append(i > 0 ? "->" : "").append(wpList.get(i).name); } - ((BRouterActivity) getContext()).showResultMessage("Select Action", msg.toString(), wpList.size()); + ((BRouterActivity) getContext()).showResultMessage(getContext().getString(R.string.title_action), msg.toString(), wpList.size()); return; } @@ -718,8 +718,13 @@ public class BRouterView extends View { ((BRouterActivity) getContext()).showErrorMessage(cr.getErrorMessage()); } else { String memstat = memoryClass + "mb pathPeak " + ((cr.getPathPeak() + 500) / 1000) + "k"; - String result = "version = BRouter-" + getContext().getString(R.string.app_version) + "\n" + "mem = " + memstat + "\ndistance = " + cr.getDistance() / 1000. + " km\n" + "filtered ascend = " + cr.getAscend() - + " m\n" + "plain ascend = " + cr.getPlainAscend() + " m\n" + "estimated time = " + cr.getTime(); + String result = getContext().getString(R.string.msg_status_result, + getContext().getString(R.string.app_version), + memstat, + Double.toString(cr.getDistance() / 1000.), + Integer.toString(cr.getAscend()), + Integer.toString(cr.getPlainAscend()), + cr.getTime()); rawTrack = cr.getFoundRawTrack(); @@ -728,9 +733,9 @@ public class BRouterView extends View { writeRawTrackToPath(rawTrackPath); } - String title = "Success"; + String title = getContext().getString(R.string.success); if (cr.getAlternativeIndex() > 0) - title += " / " + cr.getAlternativeIndex() + ". Alternative"; + title += " / " + cr.getAlternativeIndex() + ". " + getContext().getString(R.string.msg_alternative); ((BRouterActivity) getContext()).showResultMessage(title, result, rawTrackPath == null ? -1 : -3); trackOutfile = cr.getOutfile(); diff --git a/brouter-routing-app/src/main/res/values/strings.xml b/brouter-routing-app/src/main/res/values/strings.xml index 903d95c..2c1b384 100644 --- a/brouter-routing-app/src/main/res/values/strings.xml +++ b/brouter-routing-app/src/main/res/values/strings.xml @@ -40,6 +40,7 @@ maptool, with the exact same destination point and a close-by starting point, this request is guaranteed not to time out. Enter SDCARD base dir: + Select Action Check VIA Selection: Check NoGo Selection: @@ -55,5 +56,17 @@ , no used profile Too much data for download. Please reduce. Download scheduled. Check internet connection if it doesn\'t start. + current waypoint selection:\n + Expecting waypoint selection\n + Alternative + version = BRouter-%1$s \n + mem = %2$s \n + distance = %3$s km\n + filtered ascend = %4$s m\n + plain ascend = %5$s m\n + estimated time = %6$s + Error reading waypoints + coordinate source does not contain any waypoints! + "coordinate source contains too much waypoints: %1$d (please use from/to/via names)