diff --git a/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileViewRenderer.java b/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileViewRenderer.java index 813a9d8ba4..86f4fa0cc0 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileViewRenderer.java +++ b/android/src/com/mapswithme/maps/widget/placepage/ElevationProfileViewRenderer.java @@ -17,6 +17,7 @@ import java.util.Objects; public class ElevationProfileViewRenderer implements PlacePageViewRenderer { + // Must be correspond to map/elevation_info.hpp constants. private static final int MAX_DIFFICULTY_LEVEL = 3; @SuppressWarnings("NullableProblems") @@ -92,6 +93,9 @@ public class ElevationProfileViewRenderer implements PlacePageViewRenderer MAX_DIFFICULTY_LEVEL) + return; + for (int i = 0; i < level; i++) mDifficultyLevels[i].setEnabled(true); } diff --git a/map/elevation_info.cpp b/map/elevation_info.cpp index b46928899f..00a58af2aa 100644 --- a/map/elevation_info.cpp +++ b/map/elevation_info.cpp @@ -49,7 +49,7 @@ ElevationInfo::ElevationInfo(Track const & track) if (m_difficulty > kMaxDifficulty) { LOG(LWARNING, ("Invalid difficulty value", m_difficulty, "in track", track.GetName())); - m_difficulty = kMaxDifficulty; + m_difficulty = kInvalidDifficulty; } FillProperty(properties, kDurationKey, m_duration); diff --git a/map/elevation_info.hpp b/map/elevation_info.hpp index a5d1c3c36e..c884b62713 100644 --- a/map/elevation_info.hpp +++ b/map/elevation_info.hpp @@ -40,6 +40,7 @@ public: private: static uint8_t constexpr kMaxDifficulty = 3; + static uint8_t constexpr kInvalidDifficulty = kMaxDifficulty + 1; kml::TrackId m_id = kml::kInvalidTrackId; std::string m_name; @@ -54,7 +55,8 @@ private: // Altitude in meters. uint16_t m_maxAltitude = 0; // Some digital difficulty level with value in range [0-kMaxDifficulty] - uint8_t m_difficulty = 0; + // or kInvalidDifficulty when difficulty is not found or incorrect. + uint8_t m_difficulty = kInvalidDifficulty; // Duration in seconds. uint32_t m_duration = 0; };