Import all notes to the gpx if selected only locations item and import selected notes otherwise
This commit is contained in:
parent
ea3fa0cc37
commit
37e68dc582
4 changed files with 25 additions and 7 deletions
|
@ -9,8 +9,9 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/bottom_sheet_selected_item_title_height"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:minHeight="@dimen/bottom_sheet_selected_item_title_height">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/check_box"
|
||||
|
@ -34,11 +35,12 @@
|
|||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:layout_weight="1"
|
||||
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
|
@ -56,9 +58,9 @@
|
|||
android:id="@+id/description"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:layout_marginTop="@dimen/map_widget_icon_margin"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="3"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="Oct 13, 2017 * 3 MB * 01:14"/>
|
||||
|
|
|
@ -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
|
||||
-->
|
||||
<string name="av_locations_selected_desc">GPX file with coordinates and data of the selected notes.</string>
|
||||
<string name="av_locations_all_desc">GPX file with coordinates and data of all notes.</string>
|
||||
<string name="release_3_0">
|
||||
\u2022 Detection of stop signs now considers driving direction\n\n
|
||||
\u2022 New algorithm providing meaningful ascent/descent values for GPX tracks\n\n
|
||||
|
|
|
@ -470,6 +470,13 @@ public class NotesFragment extends OsmAndListFragment {
|
|||
startActivity(Intent.createChooser(intent, getString(R.string.share_note)));
|
||||
}
|
||||
|
||||
private Set<Recording> getRecordingsForGpx(Set<Recording> selected) {
|
||||
if (selected.size() == 1 && selected.contains(SHARE_LOCATION_FILE)) {
|
||||
return new HashSet<>(plugin.getAllRecordings());
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private File generateGPXForRecordings(Set<Recording> 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) {
|
||||
|
|
|
@ -205,7 +205,7 @@ public class NotesAdapter extends ArrayAdapter<Object> {
|
|||
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<Object> {
|
|||
});
|
||||
}
|
||||
|
||||
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));
|
||||
|
|
Loading…
Reference in a new issue