Adjust layout, remove green circle for blue selector

This commit is contained in:
Isaac Marovitz 2023-01-04 17:09:52 -05:00
parent 8ce206892c
commit 21bf409929
No known key found for this signature in database
GPG key ID: 97250B2B09A132E1
2 changed files with 26 additions and 19 deletions

View file

@ -1,3 +1,4 @@
using Avalonia.Media;
using Ryujinx.Ava.UI.Controls; using Ryujinx.Ava.UI.Controls;
using Ryujinx.Ava.UI.ViewModels; using Ryujinx.Ava.UI.ViewModels;
using Ryujinx.Ava.UI.Views.User; using Ryujinx.Ava.UI.Views.User;
@ -15,6 +16,7 @@ namespace Ryujinx.Ava.UI.Models
private string _name; private string _name;
private UserId _userId; private UserId _userId;
private bool _isPointerOver; private bool _isPointerOver;
private IBrush _backgroundColor;
public uint MaxProfileNameLength => 0x20; public uint MaxProfileNameLength => 0x20;
public byte[] Image public byte[] Image
@ -57,6 +59,16 @@ namespace Ryujinx.Ava.UI.Models
} }
} }
public IBrush BackgroundColor
{
get => _backgroundColor;
set
{
_backgroundColor = value;
OnPropertyChanged();
}
}
public UserProfile(Profile profile, NavigationDialogHost owner) public UserProfile(Profile profile, NavigationDialogHost owner)
{ {
_profile = profile; _profile = profile;
@ -67,11 +79,16 @@ namespace Ryujinx.Ava.UI.Models
UserId = profile.UserId; UserId = profile.UserId;
} }
public bool IsOpened => _profile.AccountState == AccountState.Open;
public void UpdateState() public void UpdateState()
{ {
OnPropertyChanged(nameof(IsOpened)); Avalonia.Application.Current.Styles.TryGetResource("ControlFillColorSecondary", out object color);
if (color is not null)
{
BackgroundColor = _profile.AccountState == AccountState.Open
? new SolidColorBrush((Color)color)
: Brushes.Transparent;
}
OnPropertyChanged(nameof(Name)); OnPropertyChanged(nameof(Name));
} }

View file

@ -59,16 +59,14 @@
PointerEnter="Grid_PointerEntered" PointerEnter="Grid_PointerEntered"
PointerLeave="Grid_OnPointerExited"> PointerLeave="Grid_OnPointerExited">
<Border <Border
Margin="2"
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
ClipToBounds="True" ClipToBounds="True"
CornerRadius="5"> CornerRadius="5"
Background="{Binding BackgroundColor}">
<StackPanel <StackPanel
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" VerticalAlignment="Stretch">
Spacing="5"
Margin="5">
<Image <Image
Width="96" Width="96"
Height="96" Height="96"
@ -77,23 +75,15 @@
Source="{Binding Image, Converter={StaticResource ByteImage}}" /> Source="{Binding Image, Converter={StaticResource ByteImage}}" />
<TextBlock <TextBlock
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Width="96" MaxWidth="96"
Text="{Binding Name}" Text="{Binding Name}"
TextAlignment="Center" TextAlignment="Center"
TextWrapping="Wrap" TextWrapping="Wrap"
TextTrimming="CharacterEllipsis" TextTrimming="CharacterEllipsis"
MaxLines="2" /> MaxLines="2"
Margin="5" />
</StackPanel> </StackPanel>
</Border> </Border>
<Border
Width="10"
Height="10"
Margin="5"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Background="LimeGreen"
CornerRadius="5"
IsVisible="{Binding IsOpened}" />
<Border <Border
Height="30" Height="30"
Width="30" Width="30"