From 37e68dc582010d172dc817fe451a1b17b37cd738 Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Wed, 20 Dec 2017 19:16:09 +0200 Subject: [PATCH] Import all notes to the gpx if selected only locations item and import selected notes otherwise --- OsmAnd/res/layout/note_list_item.xml | 12 +++++++----- OsmAnd/res/values/strings.xml | 2 ++ .../net/osmand/plus/audionotes/NotesFragment.java | 9 ++++++++- .../plus/audionotes/adapters/NotesAdapter.java | 9 ++++++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/OsmAnd/res/layout/note_list_item.xml b/OsmAnd/res/layout/note_list_item.xml index 91f89197c9..b0aa6c6c20 100644 --- a/OsmAnd/res/layout/note_list_item.xml +++ b/OsmAnd/res/layout/note_list_item.xml @@ -9,8 +9,9 @@ + android:layout_height="wrap_content" + android:background="?attr/selectableItemBackground" + android:minHeight="@dimen/bottom_sheet_selected_item_title_height"> diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index ddd4d52ea3..8284ca7348 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 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 --> + GPX file with coordinates and data of the selected notes. + GPX file with coordinates and data of all notes. \u2022 Detection of stop signs now considers driving direction\n\n \u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n diff --git a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java index c43e4fb721..f92ad0d035 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/NotesFragment.java @@ -470,6 +470,13 @@ public class NotesFragment extends OsmAndListFragment { startActivity(Intent.createChooser(intent, getString(R.string.share_note))); } + private Set getRecordingsForGpx(Set selected) { + if (selected.size() == 1 && selected.contains(SHARE_LOCATION_FILE)) { + return new HashSet<>(plugin.getAllRecordings()); + } + return selected; + } + @Nullable private File generateGPXForRecordings(Set selected) { File externalCacheDir = getActivity().getExternalCacheDir(); @@ -479,7 +486,7 @@ public class NotesFragment extends OsmAndListFragment { File tmpFile = new File(externalCacheDir, "share/noteLocations.gpx"); tmpFile.getParentFile().mkdirs(); GPXFile file = new GPXFile(); - for (Recording r : selected) { + for (Recording r : getRecordingsForGpx(selected)) { if (r != SHARE_LOCATION_FILE) { String desc = r.getDescriptionName(r.getFileName()); if (desc == null) { diff --git a/OsmAnd/src/net/osmand/plus/audionotes/adapters/NotesAdapter.java b/OsmAnd/src/net/osmand/plus/audionotes/adapters/NotesAdapter.java index fa7f286156..1fe1548665 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/adapters/NotesAdapter.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/adapters/NotesAdapter.java @@ -205,7 +205,7 @@ public class NotesAdapter extends ArrayAdapter { setupBackground(holder.view); if (recording == NotesFragment.SHARE_LOCATION_FILE) { holder.title.setText(R.string.av_locations); - holder.description.setText(R.string.av_locations_descr); + holder.description.setText(getLocationsDescId()); } else { holder.title.setText(recording.getName(app, true)); holder.description.setText(recording.getExtendedDescription(app)); @@ -255,6 +255,13 @@ public class NotesAdapter extends ArrayAdapter { }); } + private int getLocationsDescId() { + if (selected.contains(NotesFragment.SHARE_LOCATION_FILE)) { + return selected.size() == 1 ? R.string.av_locations_all_desc : R.string.av_locations_selected_desc; + } + return R.string.av_locations_descr; + } + private void setupBackground(View view) { if (!portrait) { view.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.color_transparent));