From 80b2ef48c5dfa30a704ec2b3c0d1a0200b7748b7 Mon Sep 17 00:00:00 2001 From: alexzatsepin Date: Tue, 14 Feb 2017 14:33:12 +0300 Subject: [PATCH] [android] Added 'mInFirsRun' checking before posting location updates to the core --- .../maps/location/LocationHelper.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/android/src/com/mapswithme/maps/location/LocationHelper.java b/android/src/com/mapswithme/maps/location/LocationHelper.java index 5e0c72bbf4..293a75352e 100644 --- a/android/src/com/mapswithme/maps/location/LocationHelper.java +++ b/android/src/com/mapswithme/maps/location/LocationHelper.java @@ -49,6 +49,16 @@ public enum LocationHelper @Override public void onLocationUpdated(Location location) { + // If we are still in the first run mode, i.e. user is staying on the first run screens, + // not on the map, we mustn't post location update to the core. Only this preserving allows us + // to play nice zoom animation once a user will leave first screens and will see a map. + if (mInFirstRun) + { + mLogger.d(TAG, "Location update is obtained and must be ignored, " + + "because the app is in a first run mode"); + return; + } + mPredictor.onLocationUpdated(location); nativeLocationUpdated(location.getTime(), @@ -257,15 +267,6 @@ public enum LocationHelper return; } - // If we are still in the first run mode, i.e. user stays on the first run screens, - // not on the map, we mustn't post location update to the core. Only this preserving allows us - // to play nice zoom animation once a user will see map. - if (mInFirstRun) - { - mLogger.d(TAG, "Location update is obtained, but ignore, because it's a first run mode"); - return; - } - for (LocationListener listener : mListeners) listener.onLocationUpdated(mSavedLocation); mListeners.finishIterate(); @@ -323,7 +324,8 @@ public enum LocationHelper /** * Registers listener about location changes. - * @param listener listener to register. + * + * @param listener listener to register. * @param forceUpdate instantly notify given listener about available location, if any. */ @UiThread