more new resources from hardcoded messages

This commit is contained in:
afischerdev 2023-12-10 13:19:54 +01:00
parent b9cd75b7a0
commit 3acbd96575
2 changed files with 28 additions and 10 deletions

View file

@ -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();

View file

@ -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.</string>
<string name="title_sdcard">Enter SDCARD base dir:</string>
<string name="title_action">Select Action</string>
<string name="action_via_select">Check VIA Selection:</string>
<string name="action_nogo_select">Check NoGo Selection:</string>
@ -55,5 +56,17 @@
<string name="msg_no_used_profile">, no used profile</string>
<string name="msg_too_much_data">Too much data for download. Please reduce.</string>
<string name="msg_download_start">Download scheduled. Check internet connection if it doesn\'t start.</string>
<string name="msg_wpt_selection">current waypoint selection:\n</string>
<string name="msg_no_wpt_selection">Expecting waypoint selection\n</string>
<string name="msg_alternative">Alternative</string>
<string name="msg_status_result">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</string>
<string name="msg_read_wpt_error">Error reading waypoints</string>
<string name="msg_no_wpt">coordinate source does not contain any waypoints!</string>
<string name="msg_to_much_wpts">"coordinate source contains too much waypoints: %1$d (please use from/to/via names)</string>
</resources>