From f981d4a4bb2db5be0ee8f6fd26f464522c024181 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 22 Feb 2021 13:43:53 +0200 Subject: [PATCH] small fix --- .../SaveAsNewTrackBottomSheetDialogFragment.java | 2 +- .../net/osmand/plus/myplaces/AvailableGPXFragment.java | 2 +- .../osmand/plus/myplaces/MoveGpxFileBottomSheet.java | 10 +++++----- .../src/net/osmand/plus/track/TrackMenuFragment.java | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java index 30f863f5dd..8ab6619762 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/SaveAsNewTrackBottomSheetDialogFragment.java @@ -145,7 +145,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial if (activity != null) { File dest = getFile(app, folderName, fileName); MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(), - SaveAsNewTrackBottomSheetDialogFragment.this, dest.getAbsolutePath(), usedOnMap); + SaveAsNewTrackBottomSheetDialogFragment.this, dest.getAbsolutePath(), usedOnMap, true); } } }); diff --git a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java index 86f9654b73..22615a2f76 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/AvailableGPXFragment.java @@ -780,7 +780,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment implement private void moveGpx(final GpxInfo info) { FragmentActivity activity = getActivity(); if (activity != null) { - MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(), this, info.file.getAbsolutePath(), false); + MoveGpxFileBottomSheet.showInstance(activity.getSupportFragmentManager(), this, info.file.getAbsolutePath(), false, false); } } diff --git a/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java b/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java index 4121cebbb7..133a2d9552 100644 --- a/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/myplaces/MoveGpxFileBottomSheet.java @@ -21,7 +21,6 @@ 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; @@ -42,6 +41,7 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem private OsmandApplication app; private String filePath; + private boolean showAllFolders = false; @Override public void createMenuItems(Bundle savedInstanceState) { @@ -87,10 +87,9 @@ 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, isSaveAsNewFragment ? null : fileDir); - if (isSaveAsNewFragment || !Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) { + collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, showAllFolders ? null : fileDir); + if (showAllFolders || !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(); @@ -165,12 +164,13 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem } public static void showInstance(@NonNull FragmentManager fragmentManager, @Nullable Fragment target, - @NonNull String filePath, boolean usedOnMap) { + @NonNull String filePath, boolean usedOnMap, boolean showAllFolders) { try { if (!fragmentManager.isStateSaved() && fragmentManager.findFragmentByTag(MoveGpxFileBottomSheet.TAG) == null) { MoveGpxFileBottomSheet fragment = new MoveGpxFileBottomSheet(); fragment.filePath = filePath; fragment.setUsedOnMap(usedOnMap); + fragment.showAllFolders = showAllFolders; fragment.setTargetFragment(target, 0); fragment.show(fragmentManager, MoveGpxFileBottomSheet.TAG); } diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index e0a7290b33..413e22687f 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -791,7 +791,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card FileUtils.renameFile(mapActivity, new File(gpxFile.path), this, true); } else if (buttonIndex == CHANGE_FOLDER_BUTTON_INDEX) { FragmentManager fragmentManager = mapActivity.getSupportFragmentManager(); - MoveGpxFileBottomSheet.showInstance(fragmentManager, this, gpxFile.path, true); + MoveGpxFileBottomSheet.showInstance(fragmentManager, this, gpxFile.path, true, false); } else if (buttonIndex == DELETE_BUTTON_INDEX) { String fileName = Algorithms.getFileWithoutDirs(gpxFile.path);