From 7ef710de2205e1af671fa5f4f0af76efc16373c5 Mon Sep 17 00:00:00 2001 From: Susko3 <16479013+Susko3@users.noreply.github.com> Date: Sat, 19 Feb 2022 18:14:56 +0100 Subject: [PATCH] Allow exiting/minimizing on Android when on the initial cookie screen --- osu.Game/Screens/Menu/MainMenu.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 8b1bab52b3..2391903861 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -70,12 +70,16 @@ namespace osu.Game.Screens.Menu private ParallaxContainer buttonsContainer; private SongTicker songTicker; + private readonly BindableBool allowExitingAndroid = new BindableBool(true); + [BackgroundDependencyLoader(true)] private void load(BeatmapListingOverlay beatmapListing, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics) { holdDelay = config.GetBindable(OsuSetting.UIHoldActivationDelay); loginDisplayed = statics.GetBindable(Static.LoginOverlayDisplayed); + host.AllowExitingAndroid.AddSource(allowExitingAndroid); + if (host.CanExit) { AddInternal(exitConfirmOverlay = new ExitConfirmOverlay @@ -134,6 +138,8 @@ namespace osu.Game.Screens.Menu ApplyToBackground(b => b.FadeColour(OsuColour.Gray(0.8f), 500, Easing.OutSine)); break; } + + allowExitingAndroid.Value = state == ButtonSystemState.Initial; }; buttons.OnSettings = () => settings?.ToggleVisibility(); @@ -297,5 +303,11 @@ namespace osu.Game.Screens.Menu Schedule(loadSoloSongSelect); } + + protected override void Dispose(bool isDisposing) + { + host.AllowExitingAndroid.RemoveSource(allowExitingAndroid); + base.Dispose(isDisposing); + } } }