From a963f82c1d28b75c8e4c39c15755cf3f2079e7b1 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Wed, 15 Apr 2020 19:07:31 +0300 Subject: [PATCH] Refactor --- OsmAnd/assets/poi_categories.json | 14 -------------- .../helpers/SelectGpxTrackBottomSheet.java | 18 +++++++++++------- 2 files changed, 11 insertions(+), 21 deletions(-) delete mode 100644 OsmAnd/assets/poi_categories.json diff --git a/OsmAnd/assets/poi_categories.json b/OsmAnd/assets/poi_categories.json deleted file mode 100644 index 51afd627af..0000000000 --- a/OsmAnd/assets/poi_categories.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "categories" : { - "special" : { - "icons" : [ - "special_star", "special_star_stroked", "special_marker", "special_flag_stroke", "special_house", "special_building" - ] - }, - "amenity" : { - "icons": [ - "amenity_bar", "amenity_cafe", "amenity_atm", "amenity_biergarten", "amenity_cinema", "amenity_fire_station", "amenity_parking" - ] - } - } -} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java b/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java index e56efac33e..be1dfcd63d 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/helpers/SelectGpxTrackBottomSheet.java @@ -1,5 +1,6 @@ package net.osmand.plus.helpers; +import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.TextView; @@ -81,7 +82,10 @@ public class SelectGpxTrackBottomSheet extends MenuBottomSheetDialogFragment { callbackWithObject.processResult(new GPXUtilities.GPXFile[]{selectedGpxFile.getGpxFile()}); } else { File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); - GpxUiHelper.loadGPXFileInDifferentThread(requireActivity(), callbackWithObject, dir, null, fileName); + Activity activity = getActivity(); + if (activity != null) { + GpxUiHelper.loadGPXFileInDifferentThread(activity, callbackWithObject, dir, null, fileName); + } } } } @@ -90,13 +94,13 @@ public class SelectGpxTrackBottomSheet extends MenuBottomSheetDialogFragment { public static void showInstance(FragmentManager fragmentManager, boolean showCurrentGpx, CallbackWithObject callbackWithObject, List gpxInfoList) { - SelectGpxTrackBottomSheet fragment = new SelectGpxTrackBottomSheet(); - fragment.setUsedOnMap(true); - fragment.setRetainInstance(true); - fragment.setShowCurrentGpx(showCurrentGpx); - fragment.setCallbackWithObject(callbackWithObject); - fragment.setGpxInfoList(gpxInfoList); if (!fragmentManager.isStateSaved()) { + SelectGpxTrackBottomSheet fragment = new SelectGpxTrackBottomSheet(); + fragment.setUsedOnMap(true); + fragment.setRetainInstance(true); + fragment.setShowCurrentGpx(showCurrentGpx); + fragment.setCallbackWithObject(callbackWithObject); + fragment.setGpxInfoList(gpxInfoList); fragment.show(fragmentManager, SelectGpxTrackBottomSheet.TAG); } }