Expose `Expanded` state of `BeatmapCardContent` as read-only bindable

This is just to reduce complexity of these interactions by ensuring that
the expanded state can only be changed by the class itself.
This commit is contained in:
Dean Herbert 2021-12-15 15:51:47 +09:00
parent e9187cc3cf
commit 41e6c24dad
1 changed files with 7 additions and 5 deletions

View File

@ -31,7 +31,9 @@ public Drawable ExpandedContent
set => dropdownScroll.Child = value;
}
public Bindable<bool> Expanded { get; } = new BindableBool();
public IBindable<bool> Expanded => expanded;
private readonly BindableBool expanded = new BindableBool();
private readonly Box background;
private readonly Container content;
@ -128,7 +130,7 @@ public void ScheduleShow()
scheduledExpandedChange = Scheduler.AddDelayed(() =>
{
if (!Expanded.Disabled)
Expanded.Value = true;
expanded.Value = true;
}, 100);
}
@ -141,7 +143,7 @@ public void ScheduleHide()
scheduledExpandedChange = Scheduler.AddDelayed(() =>
{
if (!Expanded.Disabled)
Expanded.Value = false;
expanded.Value = false;
}, 500);
}
@ -154,7 +156,7 @@ private void checkForHide()
return;
scheduledExpandedChange?.Cancel();
Expanded.Value = false;
expanded.Value = false;
}
private void keep()
@ -163,7 +165,7 @@ private void keep()
return;
scheduledExpandedChange?.Cancel();
Expanded.Value = true;
expanded.Value = true;
}
private void updateState()