Proper GPX intent handling, replace undocumented 'category' with existing 'type' for favourites.gpx
This commit is contained in:
parent
8a1a1d86c5
commit
c3d5baf996
3 changed files with 12 additions and 4 deletions
|
@ -317,7 +317,7 @@ public class FavouritesDbHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
private File getExternalFile() {
|
||||
public File getExternalFile() {
|
||||
return new File(context.getAppPath(null), FILE_TO_SAVE);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ public class GPXUtilities {
|
|||
public double lat;
|
||||
public double lon;
|
||||
public String name = null;
|
||||
// previous undocumented feature 'category' ,now 'type'
|
||||
public String category = null;
|
||||
public String desc = null;
|
||||
// by default
|
||||
|
@ -754,7 +755,7 @@ public class GPXUtilities {
|
|||
}
|
||||
writeNotNullText(serializer, "name", p.name);
|
||||
writeNotNullText(serializer, "desc", p.desc);
|
||||
writeNotNullText(serializer, "category", p.category);
|
||||
writeNotNullText(serializer, "type", p.category);
|
||||
if (!Double.isNaN(p.hdop)) {
|
||||
writeNotNullText(serializer, "hdop", p.hdop + "");
|
||||
}
|
||||
|
@ -917,6 +918,10 @@ public class GPXUtilities {
|
|||
((WptPt) parse).desc = readText(parser, "desc");
|
||||
} else if (tag.equals("category")) {
|
||||
((WptPt) parse).category = readText(parser, "category");
|
||||
} else if (tag.equals("type")) {
|
||||
if(((WptPt) parse).category == null) {
|
||||
((WptPt) parse).category = readText(parser, "type");
|
||||
}
|
||||
} else if (parser.getName().equals("ele")) {
|
||||
String text = readText(parser, "ele");
|
||||
if (text != null) {
|
||||
|
|
|
@ -38,6 +38,7 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.text.Spannable;
|
||||
|
@ -524,9 +525,11 @@ public class FavouritesTreeFragment extends OsmandExpandableListFragment {
|
|||
hideProgressBar();
|
||||
final Intent sendIntent = new Intent();
|
||||
sendIntent.setAction(Intent.ACTION_SEND);
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, GPXUtilities.asString(gpxFile, getMyApplication()));
|
||||
sendIntent.putExtra(Intent.EXTRA_TEXT, "Favourites.gpx:\n\n\n"+GPXUtilities.asString(gpxFile, getMyApplication()));
|
||||
sendIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.share_fav_subject));
|
||||
sendIntent.setType("application/gpx+xml");
|
||||
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(helper.getExternalFile()));
|
||||
// sendIntent.setType("application/gpx+xml");
|
||||
sendIntent.setType("text/plain");
|
||||
startActivity(sendIntent);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue