1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-24 11:07:20 +08:00

Add loading spinner

This commit is contained in:
Andrei Zavatski 2020-07-11 08:50:35 +03:00
parent b1b2e961bc
commit 84392d0d13

View File

@ -22,6 +22,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Extensions.IEnumerableExtensions;
using System.Collections.Specialized;
using osu.Game.Overlays.Comments.Buttons;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Comments
{
@ -51,6 +52,7 @@ namespace osu.Game.Overlays.Comments
private ShowRepliesButton showRepliesButton;
private ChevronButton chevronButton;
private DeletedCommentsCounter deletedCommentsCounter;
private Loading loading;
public DrawableComment(Comment comment)
{
@ -192,7 +194,12 @@ namespace osu.Game.Overlays.Comments
},
loadRepliesButton = new LoadRepliesButton
{
Action = () => RepliesRequested(this, ++currentPage)
Action = () =>
{
RepliesRequested(this, ++currentPage);
loadRepliesButton.Hide();
loading.Show();
}
}
}
}
@ -202,6 +209,11 @@ namespace osu.Game.Overlays.Comments
}
}
},
loading = new Loading
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
childCommentsVisibilityContainer = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
@ -355,8 +367,7 @@ namespace osu.Game.Overlays.Comments
chevronButton.FadeTo(loadedReplesCount != 0 ? 1 : 0);
showMoreButton.IsLoading = false;
//loadRepliesButton.IsLoading = false;
loading.Hide();
}
private class ChevronButton : ShowChildrenButton
@ -427,5 +438,31 @@ namespace osu.Game.Overlays.Comments
return parentComment.HasMessage ? parentComment.Message : parentComment.IsDeleted ? @"deleted" : string.Empty;
}
}
private class Loading : Container
{
private readonly LoadingSpinner loading;
public Loading()
{
Child = loading = new LoadingSpinner
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
Size = new Vector2(15),
Margin = new MarginPadding
{
Vertical = 5,
Left = 80
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
loading.Show();
}
}
}
}