diff --git a/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml b/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml
index cd6f08e0fe..8c04121290 100644
--- a/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml
+++ b/OsmAnd/res/layout/bottom_sheet_plan_route_select_file.xml
@@ -14,10 +14,11 @@
android:paddingLeft="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:paddingRight="@dimen/content_padding"
- android:paddingTop="@dimen/bottom_sheet_title_padding_top"
+ android:paddingTop="@dimen/multi_selection_menu_padding_top"
android:paddingBottom="@dimen/bottom_sheet_title_padding_bottom"
android:text="@string/plan_route_open_existing_track"
- android:textAppearance="@style/TextAppearance.ListItemCategoryTitle" />
+ android:textAppearance="@style/TextAppearance.ListItemTitle"
+ osmand:typeface="@string/font_roboto_medium" />
+ osmand:typeface="@string/font_roboto_medium" />
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
index 003297cb87..965c43b3b5 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java
@@ -78,7 +78,6 @@ import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.OsmandSettings;
import net.osmand.plus.views.MapControlsLayer;
import net.osmand.plus.views.controls.ReorderItemTouchHelperCallback;
-import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarView;
@@ -788,8 +787,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
}
@Override
- public void openLastEditTrackOnClick(GPXFile gpxFile) {
- addNewGpxData(gpxFile);
+ public void openLastEditTrackOnClick(String gpxFileName) {
+ getGpxFile(gpxFileName);
}
@Override
@@ -802,8 +801,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
private SelectFileListener createSelectFileListener() {
return new SelectFileListener() {
@Override
- public void selectFileOnCLick(GPXFile gpxFile) {
- addNewGpxData(gpxFile);
+ public void selectFileOnCLick(String gpxFileName) {
+ getGpxFile(gpxFileName);
}
@Override
@@ -817,6 +816,21 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
};
}
+ private void getGpxFile(String gpxFileName) {
+ OsmandApplication app = getMyApplication();
+ GPXFile gpxFile;
+ if (app != null) {
+ SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByName(gpxFileName);
+ if (selectedGpxFile != null) {
+ gpxFile = selectedGpxFile.getGpxFile();
+ } else {
+ gpxFile = GPXUtilities.loadGPXFile(new File(
+ getMyApplication().getAppPath(IndexConstants.GPX_INDEX_DIR), gpxFileName));
+ }
+ addNewGpxData(gpxFile);
+ }
+ }
+
public void addNewGpxData(GPXFile gpxFile) {
QuadRect rect = gpxFile.getRect();
TrkSegment segment = getTrkSegment(gpxFile);
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java b/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java
index 4e1a46c162..914043b804 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/SelectFileBottomSheet.java
@@ -10,8 +10,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils;
-import net.osmand.GPXUtilities;
-import net.osmand.GPXUtilities.GPXFile;
import net.osmand.IndexConstants;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@@ -22,7 +20,6 @@ import net.osmand.plus.helpers.GpxTrackAdapter.OnItemClickListener;
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter;
import net.osmand.plus.mapcontextmenu.other.HorizontalSelectionAdapter.HorizontalSelectionAdapterListener;
-import net.osmand.util.Algorithms;
import java.io.File;
import java.util.ArrayList;
@@ -85,9 +82,8 @@ public class SelectFileBottomSheet extends MenuBottomSheetDialogFragment {
public void onItemClick(int position) {
if (position != RecyclerView.NO_POSITION && position < allGpxList.size()) {
String fileName = allGpxList.get(position).getFileName();
- GPXFile gpxFile = GPXUtilities.loadGPXFile(new File(gpxDir, fileName));
if (listener != null) {
- listener.selectFileOnCLick(gpxFile);
+ listener.selectFileOnCLick(fileName);
}
}
dismiss();
@@ -163,7 +159,7 @@ public class SelectFileBottomSheet extends MenuBottomSheetDialogFragment {
interface SelectFileListener {
- void selectFileOnCLick(GPXFile gpxFile);
+ void selectFileOnCLick(String fileName);
void dismissButtonOnClick();
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java b/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java
index 52f8b64b25..9540e2aedf 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/StartPlanRouteBottomSheet.java
@@ -15,8 +15,6 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import net.osmand.AndroidUtils;
-import net.osmand.GPXUtilities;
-import net.osmand.GPXUtilities.GPXFile;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
@@ -24,7 +22,7 @@ import net.osmand.plus.R;
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithDescription;
-import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
+import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.helpers.GpxTrackAdapter;
import net.osmand.plus.helpers.GpxUiHelper.GPXInfo;
@@ -106,7 +104,7 @@ public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
.create();
items.add(importTrackItem);
- items.add(new DividerHalfItem(getContext()));
+ items.add(new DividerItem(getContext()));
final RecyclerView recyclerView = mainView.findViewById(R.id.gpx_track_list);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
@@ -125,7 +123,7 @@ public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
}
});
final List gpxTopList = gpxList.subList(0, Math.min(5, gpxList.size()));
- adapter = new GpxTrackAdapter(requireContext(), gpxList, false);
+ adapter = new GpxTrackAdapter(requireContext(), gpxTopList, false);
adapter.setAdapterListener(new GpxTrackAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
@@ -143,11 +141,9 @@ public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
private void onItemClick(int position, List gpxInfoList) {
if (position != RecyclerView.NO_POSITION && position < gpxInfoList.size()) {
- OsmandApplication app = requiredMyApplication();
String fileName = gpxInfoList.get(position).getFileName();
- GPXFile gpxFile = GPXUtilities.loadGPXFile(new File(app.getAppPath(IndexConstants.GPX_INDEX_DIR), fileName));
if (listener != null) {
- listener.openLastEditTrackOnClick(gpxFile);
+ listener.openLastEditTrackOnClick(fileName);
}
}
dismiss();
@@ -221,7 +217,7 @@ public class StartPlanRouteBottomSheet extends MenuBottomSheetDialogFragment {
void openExistingTrackOnClick();
- void openLastEditTrackOnClick(GPXFile gpxFile);
+ void openLastEditTrackOnClick(String fileName);
void dismissButtonOnClick();