diff options
author | vng <viktor.govako@gmail.com> | 2013-02-13 19:55:55 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:50:50 +0300 |
commit | 7db377947d72a0593b770aa2dcee4ed5643ab7cf (patch) | |
tree | 663fae4e7534d6c0e467c6ac0146f257eec45be6 /android | |
parent | e0c7ce95516bb9574954a7c6c4c942ca4e1567dc (diff) |
[android] [bookmarks] Fix bug with creation of balloon's image.
Diffstat (limited to 'android')
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.cpp | 18 | ||||
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.hpp | 7 |
2 files changed, 20 insertions, 5 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 3d83b83ea3..b293231cf4 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -53,10 +53,16 @@ namespace android m_bmCategory = m_work.GetStringsBundle().GetString("my_places"); m_bmType = "placemark-red"; + + for (size_t i = 0; i < ARRAY_SIZE(m_images); ++i) + m_images[i] = 0; } Framework::~Framework() { + for (size_t i = 0; i < ARRAY_SIZE(m_images); ++i) + delete m_images[i]; + delete m_videoTimer; } @@ -155,6 +161,10 @@ namespace android return false; } + graphics::EDensity const density = m_work.GetRenderPolicy()->Density(); + m_images[IMAGE_PLUS] = new ImageT("plus.png", density); + m_images[IMAGE_ARROW] = new ImageT("right-arrow.png", density); + m_work.SetUpdatesEnabled(true); m_work.EnterForeground(); return true; @@ -566,7 +576,7 @@ namespace android if (ValidateBookmarkAndCategory(bac)) { Bookmark const * pBM = m_work.GetBmCategory(bac.first)->GetBookmark(bac.second); - ActivatePopup(pBM->GetOrg(), pBM->GetName(), "right-arrow.png"); + ActivatePopup(pBM->GetOrg(), pBM->GetName(), IMAGE_ARROW); return true; } else @@ -597,18 +607,18 @@ namespace android if (name.empty()) name = m_work.GetStringsBundle().GetString("dropped_pin"); - ActivatePopup(pos, name, "plus.png"); + ActivatePopup(pos, name, IMAGE_PLUS); m_work.DrawPlacemark(pos); m_work.Invalidate(); } - void Framework::ActivatePopup(m2::PointD const & pos, string const & name, string const & imageName) + void Framework::ActivatePopup(m2::PointD const & pos, string const & name, PopupImageIndexT index) { BookmarkBalloon * b = GetBookmarkBalloon(); m_work.DisablePlacemark(); - b->setImage(graphics::Image::Info(imageName.c_str(), m_work.GetRenderPolicy()->Density())); + b->setImage(*m_images[index]); b->setGlbPivot(pos); b->setBookmarkName(name); b->setIsVisible(true); diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index 7198879196..e580ec7463 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -60,7 +60,12 @@ namespace android bool HandleOnSmthClick(double x, double y); bool AdditionalHandlingForLongClick(double x, double y); - void ActivatePopup(m2::PointD const & pos, string const & name, string const & imageName); + + typedef graphics::Image::Info ImageT; + ImageT * m_images[2]; + enum PopupImageIndexT { IMAGE_PLUS = 0, IMAGE_ARROW = 1 }; + void ActivatePopup(m2::PointD const & pos, string const & name, PopupImageIndexT index); + void ActivatePopupWithAddressInfo(m2::PointD const & pos, ::Framework::AddressInfo const & addrInfo); static inline bool ValidateBookmarkAndCategory(BookmarkAndCategory const & bac) |