From eeb814a83ce49e3504ddbe7d83f1342f2e9dea2c Mon Sep 17 00:00:00 2001 From: max-klaus Date: Wed, 30 Oct 2019 17:57:02 +0300 Subject: [PATCH] Fix #7791 --- .../download/ui/DownloadMapToolbarController.java | 11 ++++++----- .../net/osmand/plus/views/DownloadedRegionsLayer.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/ui/DownloadMapToolbarController.java b/OsmAnd/src/net/osmand/plus/download/ui/DownloadMapToolbarController.java index a7c04b2882..990eb390fa 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/DownloadMapToolbarController.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/DownloadMapToolbarController.java @@ -21,6 +21,7 @@ import net.osmand.plus.helpers.FontCache; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType; import net.osmand.plus.widgets.style.CustomTypefaceSpan; +import net.osmand.util.Algorithms; public class DownloadMapToolbarController extends TopToolbarController { @@ -85,15 +86,15 @@ public class DownloadMapToolbarController extends TopToolbarController { } private void refreshView() { - if (regionName != null) { + if (!Algorithms.isEmpty(regionName)) { String descriptionText = String.format(mapActivity.getString(R.string.download_detailed_map), regionName); int startIndex = descriptionText.indexOf(regionName); int endIndex = startIndex + regionName.length(); - SpannableStringBuilder description = new SpannableStringBuilder(descriptionText); - Typeface typeface = FontCache.getRobotoMedium(mapActivity); - description.setSpan(new CustomTypefaceSpan(typeface), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - + if (startIndex != -1 && endIndex != -1) { + Typeface typeface = FontCache.getRobotoMedium(mapActivity); + description.setSpan(new CustomTypefaceSpan(typeface), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } tvDescription.setText(description); } diff --git a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java index 4424461c50..663bd49b1f 100644 --- a/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/DownloadedRegionsLayer.java @@ -277,7 +277,7 @@ public class DownloadedRegionsLayer extends OsmandMapLayer implements IContextMe } } } - if (indexItem != null && name != null) { + if (indexItem != null && !Algorithms.isEmpty(name)) { showDownloadMapToolbar(indexItem, name); } else { hideDownloadMapToolbar();