This commit is contained in:
max-klaus 2019-10-30 17:57:02 +03:00
parent b6ec27a931
commit eeb814a83c
2 changed files with 7 additions and 6 deletions

View file

@ -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);
}

View file

@ -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();