Fix long recent activity text overlapping timestamp.

- Also remove unnecessary fallback from absolute URL helper
This commit is contained in:
naoey 2018-02-27 21:21:53 +05:30
parent a77d1eedae
commit 62913163e0
No known key found for this signature in database
GPG Key ID: 3908EC682A3E19C7
1 changed files with 11 additions and 8 deletions

View File

@ -19,19 +19,16 @@ public class DrawableRecentActivity : DrawableProfileRow
private APIAccess api; private APIAccess api;
private readonly RecentActivity activity; private readonly RecentActivity activity;
private readonly string userLinkTemplate;
private readonly string beatmapLinkTemplate; private string userLinkTemplate;
private readonly string beatmapsetLinkTemplate; private string beatmapLinkTemplate;
private string beatmapsetLinkTemplate;
private LinkFlowContainer content; private LinkFlowContainer content;
public DrawableRecentActivity(RecentActivity activity) public DrawableRecentActivity(RecentActivity activity)
{ {
this.activity = activity; this.activity = activity;
userLinkTemplate = $"[{urlToAbsolute(activity.User?.Url)} {activity.User?.Username}]";
beatmapLinkTemplate = $"[{urlToAbsolute(activity.Beatmap?.Url)} {activity.Beatmap?.Title}]";
beatmapsetLinkTemplate = $"[{urlToAbsolute(activity.Beatmapset?.Url)} {activity.Beatmapset?.Title}]";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -39,6 +36,12 @@ private void load(APIAccess api)
{ {
this.api = api; this.api = api;
userLinkTemplate = $"[{toAbsoluteUrl(activity.User?.Url)} {activity.User?.Username}]";
beatmapLinkTemplate = $"[{toAbsoluteUrl(activity.Beatmap?.Url)} {activity.Beatmap?.Title}]";
beatmapsetLinkTemplate = $"[{toAbsoluteUrl(activity.Beatmapset?.Url)} {activity.Beatmapset?.Title}]";
LeftFlowContainer.Padding = new MarginPadding { Left = 10, Right = 160 };
LeftFlowContainer.Add(content = new LinkFlowContainer LeftFlowContainer.Add(content = new LinkFlowContainer
{ {
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
@ -90,7 +93,7 @@ protected override Drawable CreateLeftVisual()
} }
} }
private string urlToAbsolute(string url) => $"{api?.Endpoint ?? @"https://osu.ppy.sh"}{url}"; private string toAbsoluteUrl(string url) => $"{api.Endpoint}{url}";
private string activityToString() private string activityToString()
{ {