[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 <me@alex.bio>
This commit is contained in:
Alexander Borsuk 2022-09-19 23:25:38 +02:00 committed by Alexander Borsuk
parent 140e5fca59
commit 5ca4b00dce

View file

@ -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()