From 5ca4b00dce5ce48eda1a81b22e12b33ec7f9bfaf Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Mon, 19 Sep 2022 23:25:38 +0200 Subject: [PATCH] [android] Fixed not updated menu badge after updating maps and returning back to the map A better fix should also monitor the "update finished" event. But this one is more than enough for most cases. Signed-off-by: Alexander Borsuk --- .../src/com/mapswithme/maps/maplayer/MapButtonsController.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/src/com/mapswithme/maps/maplayer/MapButtonsController.java b/android/src/com/mapswithme/maps/maplayer/MapButtonsController.java index 132350ca02..ebc892be33 100644 --- a/android/src/com/mapswithme/maps/maplayer/MapButtonsController.java +++ b/android/src/com/mapswithme/maps/maplayer/MapButtonsController.java @@ -88,6 +88,7 @@ public class MapButtonsController extends Fragment if (menuButton != null) { menuButton.setOnClickListener((v) -> mMapButtonClickListener.onClick(MapButtons.menu)); + // This hack is needed to show the badge on the initial startup. For some reason, updateMenuBadge does not work from onResume() there. menuButton.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { @@ -292,6 +293,7 @@ public class MapButtonsController extends Fragment { super.onResume(); mSearchWheel.onResume(); + updateMenuBadge(); } public void resetSearch()