Hide popover on file selection

This commit is contained in:
Salman Ahmed 2021-08-23 18:01:01 +03:00
parent c2c9a93e2c
commit bd42d7aada
2 changed files with 14 additions and 52 deletions

View File

@ -31,11 +31,6 @@ namespace osu.Game.Screens.Edit.Setup
public IEnumerable<string> HandledExtensions => handledExtensions;
/// <summary>
/// The target container to display the file chooser in.
/// </summary>
public Container Target;
private readonly Bindable<FileInfo> currentFile = new Bindable<FileInfo>();
[Resolved]
@ -72,7 +67,7 @@ namespace osu.Game.Screens.Edit.Setup
if (file.NewValue == null)
return;
Target.Clear();
this.HidePopover();
Current.Value = file.NewValue.FullName;
}

View File

@ -6,7 +6,6 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterfaceV2;
@ -39,62 +38,30 @@ namespace osu.Game.Screens.Edit.Setup
[BackgroundDependencyLoader]
private void load()
{
Container audioTrackFileChooserContainer = createFileChooserContainer();
Container backgroundFileChooserContainer = createFileChooserContainer();
Children = new Drawable[]
{
new FillFlowContainer
backgroundTextBox = new FileChooserLabelledTextBox(".jpg", ".jpeg", ".png")
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
backgroundTextBox = new FileChooserLabelledTextBox(".jpg", ".jpeg", ".png")
{
Label = "Background",
FixedLabelWidth = LABEL_WIDTH,
PlaceholderText = "Click to select a background image",
Current = { Value = working.Value.Metadata.BackgroundFile },
Target = backgroundFileChooserContainer,
TabbableContentContainer = this
},
backgroundFileChooserContainer,
}
Label = "Background",
FixedLabelWidth = LABEL_WIDTH,
PlaceholderText = "Click to select a background image",
Current = { Value = working.Value.Metadata.BackgroundFile },
TabbableContentContainer = this
},
new FillFlowContainer
audioTrackTextBox = new FileChooserLabelledTextBox(".mp3", ".ogg")
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
audioTrackTextBox = new FileChooserLabelledTextBox(".mp3", ".ogg")
{
Label = "Audio Track",
FixedLabelWidth = LABEL_WIDTH,
PlaceholderText = "Click to select a track",
Current = { Value = working.Value.Metadata.AudioFile },
Target = audioTrackFileChooserContainer,
TabbableContentContainer = this
},
audioTrackFileChooserContainer,
}
}
Label = "Audio Track",
FixedLabelWidth = LABEL_WIDTH,
PlaceholderText = "Click to select a track",
Current = { Value = working.Value.Metadata.AudioFile },
TabbableContentContainer = this
},
};
backgroundTextBox.Current.BindValueChanged(backgroundChanged);
audioTrackTextBox.Current.BindValueChanged(audioTrackChanged);
}
private static Container createFileChooserContainer() =>
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
};
public bool ChangeBackgroundImage(string path)
{
var info = new FileInfo(path);