From d02453b52f760459c41dc4dd825cacdb744a8e5f Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Sat, 19 Feb 2022 00:46:48 +0100 Subject: [PATCH] [android] Properly show PP when clicking on a search result Signed-off-by: Alexander Borsuk --- map/framework.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/map/framework.cpp b/map/framework.cpp index 511e61d31c..daaa52c2d7 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -94,6 +94,8 @@ #include "base/string_utils.hpp" #include "base/timer.hpp" +#include "std/target_os.hpp" + #include #include "defines.hpp" @@ -1964,6 +1966,15 @@ void Framework::SetPlacePageListeners(PlacePageEvent::OnOpen onOpen, m_onPlacePageOpen = std::move(onOpen); m_onPlacePageClose = std::move(onClose); m_onPlacePageUpdate = std::move(onUpdate); +#ifdef OMIM_OS_ANDROID + // A click on the Search result from the search activity in Android calls + // ShowSearchResult/SelectSearchResult, but SetPlacePageListeners is set later, + // when MWMActivity::onStart is called. So PP is displayed here if its info was set previously. + // TODO: A better approach is to use an intent with params to pass the search result into MWMActivity, + // like it is done when selected bookmark is displayed on the map. + if (m_onPlacePageOpen && HasPlacePageInfo()) + m_onPlacePageOpen(); +#endif // OMIM_OS_ANDROID } place_page::Info const & Framework::GetCurrentPlacePageInfo() const