Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandr Zatsepin <alexzatsepin@users.noreply.github.com>2017-06-01 18:40:40 +0300
committerGitHub <noreply@github.com>2017-06-01 18:40:40 +0300
commit8ad0ed5f2db28215bc4f59a812b29b349171bdec (patch)
tree69a61ae30305de5a122ab4a0a1f18363f1756d18
parent09ff0ea883fe21650ab7bbe9a25c405880ea0cff (diff)
parentb03a9659fbbe1bb77d36d129da65190e37413543 (diff)
Merge pull request #6178 from rokuz/refactored-first-launch-animbeta-841
Refactored first launch animation
-rw-r--r--android/jni/com/mapswithme/maps/Framework.cpp6
-rw-r--r--android/src/com/mapswithme/maps/Framework.java2
-rw-r--r--android/src/com/mapswithme/maps/location/LocationHelper.java2
-rw-r--r--drape_frontend/backend_renderer.cpp9
-rw-r--r--drape_frontend/drape_engine.cpp7
-rw-r--r--drape_frontend/drape_engine.hpp2
-rwxr-xr-xdrape_frontend/frontend_renderer.cpp33
-rwxr-xr-xdrape_frontend/frontend_renderer.hpp6
-rw-r--r--drape_frontend/message.hpp1
-rw-r--r--drape_frontend/message_subclasses.hpp6
-rw-r--r--iphone/Maps/Core/Framework/MWMFrameworkHelper.h2
-rw-r--r--iphone/Maps/Core/Framework/MWMFrameworkHelper.mm4
-rw-r--r--iphone/Maps/UI/Welcome/FirstLaunchController.swift2
-rw-r--r--map/framework.cpp6
-rw-r--r--map/framework.hpp2
15 files changed, 79 insertions, 11 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp
index b7e3168b9a..d0dbfc5e56 100644
--- a/android/jni/com/mapswithme/maps/Framework.cpp
+++ b/android/jni/com/mapswithme/maps/Framework.cpp
@@ -1298,4 +1298,10 @@ Java_com_mapswithme_maps_Framework_nativeLogLocalAdsEvent(JNIEnv * env, jclass,
{
g_framework->LogLocalAdsEvent(static_cast<local_ads::EventType>(type), lat, lon, accuracy);
}
+
+JNIEXPORT void JNICALL
+Java_com_mapswithme_maps_Framework_nativeRunFirstLaunchAnimation(JNIEnv * env, jclass)
+{
+ frm()->RunFirstLaunchAnimation();
+}
} // extern "C"
diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java
index d5b964df42..38e1641b7d 100644
--- a/android/src/com/mapswithme/maps/Framework.java
+++ b/android/src/com/mapswithme/maps/Framework.java
@@ -325,4 +325,6 @@ public class Framework
private static native void nativeLogLocalAdsEvent(@LocalAdsEventType int eventType,
double lat, double lon, int accuracy);
+
+ public static native void nativeRunFirstLaunchAnimation();
}
diff --git a/android/src/com/mapswithme/maps/location/LocationHelper.java b/android/src/com/mapswithme/maps/location/LocationHelper.java
index 9594b6ea8e..82dce7bf07 100644
--- a/android/src/com/mapswithme/maps/location/LocationHelper.java
+++ b/android/src/com/mapswithme/maps/location/LocationHelper.java
@@ -599,7 +599,7 @@ public enum LocationHelper
{
notifyLocationUpdated();
mLogger.d(TAG, "Current location is available, so play the nice zoom animation");
- Framework.nativeZoomToPoint(location.getLatitude(), location.getLongitude(), 14, true);
+ Framework.nativeRunFirstLaunchAnimation();
return;
}
diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp
index 58aece281c..d42f4fb08e 100644
--- a/drape_frontend/backend_renderer.cpp
+++ b/drape_frontend/backend_renderer.cpp
@@ -185,12 +185,9 @@ void BackendRenderer::AcceptMessage(ref_ptr<Message> message)
{
TOverlaysRenderData overlays;
overlays.swap(m_overlays);
- if (!overlays.empty())
- {
- m_commutator->PostMessage(ThreadsCommutator::RenderThread,
- make_unique_dp<FlushOverlaysMessage>(move(overlays)),
- MessagePriority::Normal);
- }
+ m_commutator->PostMessage(ThreadsCommutator::RenderThread,
+ make_unique_dp<FlushOverlaysMessage>(move(overlays)),
+ MessagePriority::Normal);
break;
}
diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp
index 2faa9eea32..3a0e9069a5 100644
--- a/drape_frontend/drape_engine.cpp
+++ b/drape_frontend/drape_engine.cpp
@@ -655,4 +655,11 @@ void DrapeEngine::SetPosteffectEnabled(PostprocessRenderer::Effect effect, bool
make_unique_dp<SetPosteffectEnabledMessage>(effect, enabled),
MessagePriority::Normal);
}
+
+void DrapeEngine::RunFirstLaunchAnimation()
+{
+ m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread,
+ make_unique_dp<RunFirstLaunchAnimationMessage>(),
+ MessagePriority::Normal);
+}
} // namespace df
diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp
index debfbc2494..b277ac5bfe 100644
--- a/drape_frontend/drape_engine.hpp
+++ b/drape_frontend/drape_engine.hpp
@@ -207,6 +207,8 @@ public:
void SetPosteffectEnabled(PostprocessRenderer::Effect effect, bool enabled);
+ void RunFirstLaunchAnimation();
+
private:
void AddUserEvent(drape_ptr<UserEvent> && e);
void ModelViewChanged(ScreenBase const & screen);
diff --git a/drape_frontend/frontend_renderer.cpp b/drape_frontend/frontend_renderer.cpp
index 1f4292f706..6611c5e6d1 100755
--- a/drape_frontend/frontend_renderer.cpp
+++ b/drape_frontend/frontend_renderer.cpp
@@ -231,6 +231,13 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
}
}
UpdateCanBeDeletedStatus();
+
+ m_firstTilesReady = true;
+ if (m_firstLaunchAnimationTriggered)
+ {
+ CheckAndRunFirstLaunchAnimation();
+ m_firstLaunchAnimationTriggered = false;
+ }
break;
}
@@ -788,6 +795,14 @@ void FrontendRenderer::AcceptMessage(ref_ptr<Message> message)
break;
}
+ case Message::RunFirstLaunchAnimation:
+ {
+ ref_ptr<RunFirstLaunchAnimationMessage> msg = message;
+ m_firstLaunchAnimationTriggered = true;
+ CheckAndRunFirstLaunchAnimation();
+ break;
+ }
+
default:
ASSERT(false, ());
}
@@ -1507,6 +1522,7 @@ void FrontendRenderer::OnDragEnded(m2::PointD const & distance)
{
m_myPositionController->DragEnded(distance);
PullToBoundArea(false /* randomPlace */, false /* applyZoom */);
+ m_firstLaunchAnimationInterrupted = true;
}
void FrontendRenderer::OnScaleStarted()
@@ -1538,12 +1554,14 @@ void FrontendRenderer::OnScaleEnded()
{
m_myPositionController->ScaleEnded();
PullToBoundArea(false /* randomPlace */, false /* applyZoom */);
+ m_firstLaunchAnimationInterrupted = true;
}
void FrontendRenderer::OnAnimatedScaleEnded()
{
m_myPositionController->ResetBlockAutoZoomTimer();
PullToBoundArea(false /* randomPlace */, false /* applyZoom */);
+ m_firstLaunchAnimationInterrupted = true;
}
void FrontendRenderer::OnTouchMapAction()
@@ -1689,6 +1707,8 @@ void FrontendRenderer::OnContextDestroy()
m_contextFactory->getDrawContext()->doneCurrent();
m_needRestoreSize = true;
+ m_firstTilesReady = false;
+ m_firstLaunchAnimationInterrupted = false;
}
void FrontendRenderer::OnContextCreate()
@@ -1983,6 +2003,19 @@ void FrontendRenderer::CollectShowOverlaysEvents()
m_overlaysShowStatsCallback(m_overlaysTracker->Collect());
}
+void FrontendRenderer::CheckAndRunFirstLaunchAnimation()
+{
+ if (!m_firstTilesReady || m_firstLaunchAnimationInterrupted ||
+ !m_myPositionController->IsModeHasPosition())
+ {
+ return;
+ }
+
+ int constexpr kDesiredZoomLevel = 13;
+ m2::PointD const pos = m_myPositionController->GetDrawablePosition();
+ AddUserEvent(make_unique_dp<SetCenterEvent>(pos, kDesiredZoomLevel, true /* isAnim */));
+}
+
FrontendRenderer::RenderLayer::RenderLayerID FrontendRenderer::RenderLayer::GetLayerID(dp::GLState const & state)
{
if (state.GetDepthLayer() == dp::GLState::OverlayLayer)
diff --git a/drape_frontend/frontend_renderer.hpp b/drape_frontend/frontend_renderer.hpp
index 309e7e6acc..1bf7750189 100755
--- a/drape_frontend/frontend_renderer.hpp
+++ b/drape_frontend/frontend_renderer.hpp
@@ -228,6 +228,8 @@ private:
void CollectShowOverlaysEvents();
+ void CheckAndRunFirstLaunchAnimation();
+
drape_ptr<dp::GpuProgramManager> m_gpuProgramManager;
struct RenderLayer
@@ -323,6 +325,10 @@ private:
drape_ptr<ScenarioManager> m_scenarioManager;
+ bool m_firstTilesReady = false;
+ bool m_firstLaunchAnimationTriggered = false;
+ bool m_firstLaunchAnimationInterrupted = false;
+
#ifdef DEBUG
bool m_isTeardowned;
#endif
diff --git a/drape_frontend/message.hpp b/drape_frontend/message.hpp
index 048f167290..8497ac901f 100644
--- a/drape_frontend/message.hpp
+++ b/drape_frontend/message.hpp
@@ -80,6 +80,7 @@ public:
UpdateCustomSymbols,
SetPostprocessStaticTextures,
SetPosteffectEnabled,
+ RunFirstLaunchAnimation,
};
virtual ~Message() {}
diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp
index d322832e69..e162819127 100644
--- a/drape_frontend/message_subclasses.hpp
+++ b/drape_frontend/message_subclasses.hpp
@@ -1230,4 +1230,10 @@ private:
PostprocessRenderer::Effect const m_effect;
bool const m_enabled;
};
+
+class RunFirstLaunchAnimationMessage : public Message
+{
+public:
+ Type GetType() const override { return Message::RunFirstLaunchAnimation; }
+};
} // namespace df
diff --git a/iphone/Maps/Core/Framework/MWMFrameworkHelper.h b/iphone/Maps/Core/Framework/MWMFrameworkHelper.h
index 1e05550bdc..651878f331 100644
--- a/iphone/Maps/Core/Framework/MWMFrameworkHelper.h
+++ b/iphone/Maps/Core/Framework/MWMFrameworkHelper.h
@@ -2,7 +2,7 @@
@interface MWMFrameworkHelper : NSObject
-+ (void)zoomToCurrentPosition;
++ (void)processFirstLaunch;
+ (void)setVisibleViewport:(CGRect)rect;
diff --git a/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm b/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm
index 3ef43d7ae5..f75b405f75 100644
--- a/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm
+++ b/iphone/Maps/Core/Framework/MWMFrameworkHelper.mm
@@ -9,14 +9,14 @@
@implementation MWMFrameworkHelper
-+ (void)zoomToCurrentPosition
++ (void)processFirstLaunch
{
auto & f = GetFramework();
CLLocation * lastLocation = [MWMLocationManager lastLocation];
if (!lastLocation)
f.SwitchMyPositionNextMode();
else
- f.SetViewportCenter(lastLocation.mercator, 13 /* zoom */);
+ f.RunFirstLaunchAnimation();
}
+ (void)setVisibleViewport:(CGRect)rect
diff --git a/iphone/Maps/UI/Welcome/FirstLaunchController.swift b/iphone/Maps/UI/Welcome/FirstLaunchController.swift
index c4a5ed2029..999d9bbab0 100644
--- a/iphone/Maps/UI/Welcome/FirstLaunchController.swift
+++ b/iphone/Maps/UI/Welcome/FirstLaunchController.swift
@@ -64,6 +64,6 @@ final class FirstLaunchController: MWMViewController, WelcomeProtocol {
@objc
private func close() {
pageController.close()
- MWMFrameworkHelper.zoomToCurrentPosition()
+ MWMFrameworkHelper.processFirstLaunch()
}
}
diff --git a/map/framework.cpp b/map/framework.cpp
index 680fdf9de4..aa30de587a 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -1239,6 +1239,12 @@ int Framework::GetDrawScale() const
return df::GetDrawTileScale(m_currentModelView);
}
+void Framework::RunFirstLaunchAnimation()
+{
+ if (m_drapeEngine != nullptr)
+ m_drapeEngine->RunFirstLaunchAnimation();
+}
+
bool Framework::IsCountryLoaded(m2::PointD const & pt) const
{
// TODO (@gorshenin, @govako): the method's name is quite
diff --git a/map/framework.hpp b/map/framework.hpp
index 77c1e7a748..8248cbba23 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -641,6 +641,8 @@ public:
int GetDrawScale() const;
+ void RunFirstLaunchAnimation();
+
/// Set correct viewport, parse API, show balloon.
bool ShowMapForURL(string const & url);
url_scheme::ParsedMapApi::ParsingResult ParseAndSetApiURL(string const & url);