From d96212bc1f904b7b08342121cb009377e15f6d79 Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Wed, 1 Nov 2017 18:05:33 +0300 Subject: [search] Fixed dancing search results. --- android/jni/com/mapswithme/maps/MapManager.cpp | 1 + map/framework.cpp | 11 ++++++----- map/framework.hpp | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/android/jni/com/mapswithme/maps/MapManager.cpp b/android/jni/com/mapswithme/maps/MapManager.cpp index 03a0efe283..8c2c98ddae 100644 --- a/android/jni/com/mapswithme/maps/MapManager.cpp +++ b/android/jni/com/mapswithme/maps/MapManager.cpp @@ -4,6 +4,7 @@ #include "coding/internal/file_data.hpp" +#include "storage/country_info_getter.hpp" #include "storage/storage.hpp" #include "storage/storage_helpers.hpp" diff --git a/map/framework.cpp b/map/framework.cpp index 11cb3d01fa..973bd1af6a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -285,6 +285,8 @@ void Framework::OnViewportChanged(ScreenBase const & screen) { m_currentModelView = screen; + auto const forceSearchInViewport = !m_isViewportInitialized; + if (!m_isViewportInitialized) { m_isViewportInitialized = true; @@ -300,7 +302,7 @@ void Framework::OnViewportChanged(ScreenBase const & screen) } } - PokeSearchInViewport(); + PokeSearchInViewport(forceSearchInViewport); m_trafficManager.UpdateViewport(m_currentModelView); m_localAdsManager.UpdateViewport(m_currentModelView); @@ -1326,16 +1328,15 @@ void Framework::SetCurrentCountryChangedListener(TCurrentCountryChanged const & m_lastReportedCountry = kInvalidCountryId; } -void Framework::PokeSearchInViewport() +void Framework::PokeSearchInViewport(bool forceSearch) { if (!m_isViewportInitialized || !IsViewportSearchActive()) return; - auto & intent = m_searchIntents[static_cast(search::Mode::Viewport)]; - auto & params = intent.m_params; + auto params = m_searchIntents[static_cast(search::Mode::Viewport)].m_params; SetViewportIfPossible(params); SetCurrentPositionIfPossible(params); - Search(intent); + Search(params, forceSearch); } bool Framework::SearchEverywhere(search::EverywhereSearchParams const & params) diff --git a/map/framework.hpp b/map/framework.hpp index c0f3a104b2..4c1777de74 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -557,7 +557,7 @@ public: // When search in viewport is active or delayed, restarts search in // viewport. - void PokeSearchInViewport(); + void PokeSearchInViewport(bool forceSearch = true); // Search everywhere. bool SearchEverywhere(search::EverywhereSearchParams const & params); -- cgit v1.2.3