Display toast message when track is downloaded

This commit is contained in:
Victor Shcherb 2014-07-02 17:07:27 +02:00
parent 6c553891eb
commit 73d7be61aa
3 changed files with 15 additions and 3 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="osmo_gpx_track_downloaded">OsMo track %1$s downloaded.</string>
<string name="no_index_file_to_download">Nothing to download, please check internet connection.</string>
<string name="select_index_file_to_download">Nothing was found. If you can\'t find your region, you can make it yourself (see http://osmand.net).</string>
<string name="none_selected_gpx">No GPX files selected. In order to select press and hold on available track.</string>

View file

@ -325,9 +325,9 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
return service;
}
public AsyncTask<JSONObject, GPXFile, String> getDownloadGpxTask(final boolean makeVisible) {
public AsyncTask<JSONObject, String, String> getDownloadGpxTask(final boolean makeVisible) {
return new AsyncTask<JSONObject, GPXFile, String> (){
return new AsyncTask<JSONObject, String, String> (){
@Override
protected String doInBackground(JSONObject... params) {
@ -364,6 +364,7 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
log.error("Timestamp updates are not supported");
}
}
publishProgress(app.getString(R.string.osmo_gpx_track_downloaded, obj.getString("name")));
}
if(visible && (changed || makeVisible)) {
GPXFile selectGPXFile = GPXUtilities.loadGPXFile(app, f);
@ -380,6 +381,16 @@ public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlSer
return errors;
}
protected void onProgressUpdate(String... values) {
if (values != null) {
String t = "";
for (String s : values) {
t += s + "\n";
}
app.showToastMessage(t.trim());
}
};
@Override
protected void onPostExecute(String result) {
if(result.length() > 0) {

View file

@ -277,7 +277,7 @@ public class OsMoService implements OsMoReactor {
} else if(command.equals("TRACK_GET")) {
try {
JSONArray ar = new JSONArray(data);
AsyncTask<JSONObject, GPXFile, String> task = plugin.getDownloadGpxTask(false);
AsyncTask<JSONObject, String, String> task = plugin.getDownloadGpxTask(false);
JSONObject[] a = new JSONObject[ar.length()];
for(int i = 0; i < a.length; i++) {
a[i] = (JSONObject) ar.get(i);