fix "Tracks" folder display in all folders list;

fix recently added folder display in all folders list
This commit is contained in:
Skalii 2021-02-19 04:41:46 +02:00
parent 90c29ef6fe
commit 8cc7ca3a39
2 changed files with 6 additions and 3 deletions

View file

@ -359,6 +359,7 @@ public class SaveAsNewTrackBottomSheetDialogFragment extends MenuBottomSheetDial
nameTextBox.setError(getString(R.string.file_with_name_already_exist)); nameTextBox.setError(getString(R.string.file_with_name_already_exist));
} else { } else {
nameTextBox.setError(null); nameTextBox.setError(null);
nameTextBox.setErrorEnabled(false);
fileName = text; fileName = text;
rightButtonEnabled = true; rightButtonEnabled = true;
} }

View file

@ -21,6 +21,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem; import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem; import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.measurementtool.SaveAsNewTrackBottomSheetDialogFragment;
import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet.OnTrackFolderAddListener; import net.osmand.plus.myplaces.AddNewTrackFolderBottomSheet.OnTrackFolderAddListener;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
@ -74,7 +75,7 @@ public class MoveGpxFileBottomSheet extends MenuBottomSheetDialogFragment implem
FragmentActivity activity = getActivity(); FragmentActivity activity = getActivity();
if (activity != null) { if (activity != null) {
AddNewTrackFolderBottomSheet.showInstance(activity.getSupportFragmentManager(), 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); dividerItem.setMargins(0, 0, 0, 0);
items.add(dividerItem); items.add(dividerItem);
boolean isSaveAsNewFragment = getTargetFragment() instanceof SaveAsNewTrackBottomSheetDialogFragment;
final List<File> dirs = new ArrayList<>(); final List<File> dirs = new ArrayList<>();
collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, fileDir); collectDirs(app.getAppPath(IndexConstants.GPX_INDEX_DIR), dirs, isSaveAsNewFragment ? null : fileDir);
if (!Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) { if (isSaveAsNewFragment || !Algorithms.objectEquals(fileDir, app.getAppPath(IndexConstants.GPX_INDEX_DIR))) {
dirs.add(0, app.getAppPath(IndexConstants.GPX_INDEX_DIR)); dirs.add(0, app.getAppPath(IndexConstants.GPX_INDEX_DIR));
} }
String gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getPath(); String gpxDir = app.getAppPath(IndexConstants.GPX_INDEX_DIR).getPath();