Merge pull request #650 from krabaey/feature-export-gpx

export gpx files
This commit is contained in:
vshcherb 2014-05-25 02:03:30 +02:00
commit 079ff41618
2 changed files with 12 additions and 2 deletions

View file

@ -1246,6 +1246,7 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
<string name="local_index_mi_restore">Activate</string>
<string name="local_index_mi_backup">Deactivate</string>
<string name="local_index_mi_delete">Delete</string>
<string name="local_index_mi_export">Export</string>
<string name="local_index_mi_reload">Reload from sdcard</string>
<string name="local_index_download">Download</string>
<string name="local_index_poi_data">POI data</string>

View file

@ -10,6 +10,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.Set;
import android.net.Uri;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.access.AccessibleToast;
@ -192,8 +193,13 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
confirm.show();
} else if (resId == R.string.local_index_mi_backup) {
new LocalIndexOperationTask(BACKUP_OPERATION).execute(info);
} else if (resId == R.string.local_index_mi_export) {
final Uri fileUri = Uri.fromFile(new File(info.getPathToData()));
final Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_STREAM, fileUri);
sendIntent.setType("application/gpx+xml");
startActivity(sendIntent);
}
}
};
if(info.getType() == LocalIndexType.MAP_DATA || info.getType() == LocalIndexType.SRTM_DATA){
@ -205,7 +211,10 @@ public class LocalIndexesActivity extends OsmandExpandableListActivity {
adapter.item(R.string.local_index_mi_restore).listen(listener).position(2).reg();
}
adapter.item(R.string.local_index_mi_rename).listen(listener).position(3).reg();
adapter.item(R.string.local_index_mi_delete).listen(listener).position( 4 ).reg();
adapter.item(R.string.local_index_mi_delete).listen(listener).position(4).reg();
if (info.getType() == LocalIndexType.GPX_DATA) {
adapter.item(R.string.local_index_mi_export).listen(listener).position(5).reg();
}
}
private void renameFile(LocalIndexInfo info) {