diff --git a/android/src/com/mapswithme/maps/bookmarks/Holders.java b/android/src/com/mapswithme/maps/bookmarks/Holders.java index 87fcf78fd7..6ebfc8a7fb 100644 --- a/android/src/com/mapswithme/maps/bookmarks/Holders.java +++ b/android/src/com/mapswithme/maps/bookmarks/Holders.java @@ -344,14 +344,11 @@ public class Holders BookmarkInfo bookmark = new BookmarkInfo(category.getId(), bookmarkId); mName.setText(bookmark.getTitle()); final Location loc = LocationHelper.INSTANCE.getSavedLocation(); - if (loc != null) - { - final DistanceAndAzimut daa = bookmark.getDistanceAndAzimuth(loc.getLatitude(), - loc.getLongitude(), 0.0); - mDistance.setText(daa.getDistance()); - } - else - mDistance.setText(null); + + String distanceValue = loc == null ? null : bookmark.getDistance(loc.getLatitude(), + loc.getLongitude(), 0.0); + mDistance.setText(distanceValue); + UiUtils.hideIf(TextUtils.isEmpty(distanceValue), mDistance); mIcon.setImageResource(bookmark.getIcon().getSelectedResId()); } diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java index f1e3f599ce..94cf53ed94 100644 --- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java +++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkInfo.java @@ -53,4 +53,10 @@ public class BookmarkInfo { return mIcon; } + + @NonNull + public String getDistance(double latitude, double longitude, double v) + { + return getDistanceAndAzimuth(latitude, longitude, v).getDistance(); + } }