From e86e1922f633e29286ab5a18f082ff57d9777116 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Tue, 15 Aug 2017 11:17:27 +0300 Subject: [PATCH] [Android] Fixed theme switching on the map --- .../com/mapswithme/util/ThemeSwitcher.java | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/android/src/com/mapswithme/util/ThemeSwitcher.java b/android/src/com/mapswithme/util/ThemeSwitcher.java index ff825279d4..0a48521885 100644 --- a/android/src/com/mapswithme/util/ThemeSwitcher.java +++ b/android/src/com/mapswithme/util/ThemeSwitcher.java @@ -91,9 +91,7 @@ public final class ThemeSwitcher if (!newTheme.equals(oldTheme)) { - // Activity and drape engine will be recreated so we have to mark new map style. - // Changes will be applied in process of recreation. - Framework.nativeMarkMapStyle(style); + SetMapStyle(style); DownloaderStatusIcon.clearCache(); @@ -107,11 +105,17 @@ public final class ThemeSwitcher int currentStyle = Framework.nativeGetMapStyle(); if (currentStyle == style) return; - - if (sRendererActive) - Framework.nativeSetMapStyle(style); - else - Framework.nativeMarkMapStyle(style); + SetMapStyle(style); } } + + private static void SetMapStyle(@Framework.MapStyle int style) + { + // If rendering is not active we can mark map style, because all graphics + // will be recreated after rendering activation. + if (sRendererActive) + Framework.nativeSetMapStyle(style); + else + Framework.nativeMarkMapStyle(style); + } }