From 8cc7ca3a39fd3d35acc4e77adc6a59357748a36b Mon Sep 17 00:00:00 2001 From: Skalii Date: Fri, 19 Feb 2021 04:41:46 +0200 Subject: [PATCH] fix "Tracks" folder display in all folders list; fix recently added folder display in all folders list --- .../SaveAsNewTrackBottomSheetDialogFragment.java | 1 + .../net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java index d214560f16..224594f9bd 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java @@ -359,6 +359,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial nameTextBox.setError(getString(R.string.file_with_name_already_exist)); } else { nameTextBox.setError(null); + nameTextBox.setErrorEnabled(false); fileName = text; rightButtonEnabled = true; } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java b/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java index e2fa32671d..4121cebbb7 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java @@ -21,6 +21,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription; import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; import net.osmand.plus.helpers.AndroidUiHelper; +import net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment; import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet.OnTrackFolderAddListener; import net.osmand.util.Algorithms; @@ -74,7 +75,7 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem FragmentActivity activity = getActivity(); if (activity != null) { AddNewTrackFolderBottomSheet.showInstance(activity.getSupportFragmentManager(), - MoveGpxFileBottomSheet.this, usedOnMap); + MoveGpxFileBottomSheet.this, usedOnMap); } } }) @@ -86,9 +87,10 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem dividerItem.setMargins(0, 0, 0, 0); items.add(dividerItem); + boolean isSaveAsNewFragment = getTargetFragment() instanceof SaveAsNewTrackBottomSheetDialogFragment; final List dirs = new ArrayList<>(); - collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, fileDir); - if (!Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) { + collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, isSaveAsNewFragment ? null : fileDir); + if (isSaveAsNewFragment || !Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) { dirs.add(0, app.getAppPath(IndexConstants.GPX_INDEX_DIR)); } String gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getPath();