2018-02-25 21:48:39 +08:00
|
|
|
|
using osu.Framework.Configuration;
|
2018-02-26 01:11:47 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2018-02-25 21:48:39 +08:00
|
|
|
|
using osu.Game.Online.API.Requests;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2018-02-26 03:46:46 +08:00
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
2018-02-25 21:48:39 +08:00
|
|
|
|
{
|
2018-02-26 03:46:46 +08:00
|
|
|
|
internal class PaginatedRecentActivityContainer : PaginatedContainer
|
2018-02-25 21:48:39 +08:00
|
|
|
|
{
|
|
|
|
|
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
|
|
|
|
: base(user, header, missing)
|
|
|
|
|
{
|
|
|
|
|
ItemsPerPage = 5;
|
|
|
|
|
}
|
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
protected override void ShowMore()
|
|
|
|
|
{
|
|
|
|
|
base.ShowMore();
|
2018-02-25 21:48:39 +08:00
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
var req = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++ * ItemsPerPage);
|
2018-02-25 21:48:39 +08:00
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
req.Success += activities =>
|
|
|
|
|
{
|
|
|
|
|
ShowMoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0);
|
|
|
|
|
ShowMoreLoading.Hide();
|
2018-02-25 21:48:39 +08:00
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
if (!activities.Any() && VisiblePages == 1)
|
|
|
|
|
{
|
|
|
|
|
MissingText.Show();
|
|
|
|
|
return;
|
|
|
|
|
}
|
2018-02-25 21:48:39 +08:00
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
MissingText.Hide();
|
2018-02-25 21:48:39 +08:00
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
foreach (RecentActivity activity in activities)
|
|
|
|
|
{
|
2018-02-26 03:46:46 +08:00
|
|
|
|
ItemsContainer.Add(new DrawableRecentActivity(activity));
|
2018-02-26 01:11:47 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
2018-02-25 21:48:39 +08:00
|
|
|
|
|
2018-02-26 01:11:47 +08:00
|
|
|
|
Api.Queue(req);
|
|
|
|
|
}
|
2018-02-25 21:48:39 +08:00
|
|
|
|
}
|
|
|
|
|
}
|