From 08621d17fdadcc19ce80aba303b637f66c5b6f53 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 28 Jan 2021 11:35:23 +0200 Subject: [PATCH] Add new method for updating menu state after layout calculation --- .../osmand/plus/track/TrackMenuFragment.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index cfc6610b5b..7f3fef69ed 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -270,12 +270,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card setupToolbar(); updateHeader(); setupButtons(view); - runLayoutListener(new Runnable() { - @Override - public void run() { - updateMenuState(); - } - }); + calculateLayoutAndUpdateMenuState(); } return view; } @@ -842,12 +837,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card menuType = type; setupCards(); updateHeader(); - runLayoutListener(new Runnable() { - @Override - public void run() { - updateMenuState(); - } - }); + calculateLayoutAndUpdateMenuState(); break; } } @@ -856,6 +846,15 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card }); } + private void calculateLayoutAndUpdateMenuState() { + runLayoutListener(new Runnable() { + @Override + public void run() { + updateMenuState(); + } + }); + } + private void updateMenuState() { if (menuType == TrackMenuType.OPTIONS) { openMenuFullScreen();