Merge branch 'feature/party_view'
This commit is contained in:
commit
3d92926922
@ -30,10 +30,12 @@
|
||||
<Folder Include="Frontend\Views\Albums\" />
|
||||
<Folder Include="Frontend\Views\Artists\" />
|
||||
<Folder Include="Frontend\Views\Stations\" />
|
||||
<Folder Include="Frontend\Components\MusicPlayer\" />
|
||||
<Folder Include="Backend\Utils\" />
|
||||
<Folder Include="Backend\Models\" />
|
||||
<Folder Include="Backend\Services\" />
|
||||
<Folder Include="Frontend\Views\Party\" />
|
||||
<Folder Include="Frontend\Components\HostSelector\" />
|
||||
<Folder Include="Frontend\Components\MemberList\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="Frontend\Components\MusicPlayer\Player.xaml.cs">
|
||||
|
@ -1,38 +0,0 @@
|
||||
using System;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Components
|
||||
{
|
||||
public class ContentPresenter : ContentView
|
||||
{
|
||||
public static readonly BindableProperty ItemTemplateProperty = BindableProperty.Create("ItemTemplate", typeof(DataTemplate), typeof(ContentPresenter), null, propertyChanged: OnItemTemplateChanged);
|
||||
|
||||
private static void OnItemTemplateChanged(BindableObject bindable, object oldvalue, object newvalue)
|
||||
{
|
||||
var cp = (ContentPresenter)bindable;
|
||||
|
||||
var template = cp.ItemTemplate;
|
||||
if (template != null)
|
||||
{
|
||||
var content = (View)template.CreateContent();
|
||||
cp.Content = content;
|
||||
}
|
||||
else
|
||||
{
|
||||
cp.Content = null;
|
||||
}
|
||||
}
|
||||
|
||||
public DataTemplate ItemTemplate
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DataTemplate)GetValue(ItemTemplateProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(ItemTemplateProperty, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Movies.Controls
|
||||
namespace Aurora.Frontend.Components.HorizontalList
|
||||
{
|
||||
public class HorizontalList : Grid
|
||||
{
|
||||
@ -62,7 +62,7 @@ namespace Movies.Controls
|
||||
|
||||
public HorizontalList()
|
||||
{
|
||||
BackgroundColor = Color.FromHex("#1E2634");
|
||||
// BackgroundColor = Color.FromHex("#1E2634");
|
||||
Spacing = 6;
|
||||
_scrollView = new ScrollView();
|
||||
_itemsStackLayout = new StackLayout
|
||||
|
13
Aurora/Frontend/Components/HostSelector/HostSelector.xaml
Normal file
13
Aurora/Frontend/Components/HostSelector/HostSelector.xaml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Aurora.Frontend.Components.HostSelector.HostSelector">
|
||||
<ContentView.Content>
|
||||
<StackLayout HorizontalOptions="Center"
|
||||
VerticalOptions="Center"
|
||||
BackgroundColor="Red">
|
||||
<Button Text="Host Session"/>
|
||||
<Button Text="Join Session"/>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
14
Aurora/Frontend/Components/HostSelector/HostSelector.xaml.cs
Normal file
14
Aurora/Frontend/Components/HostSelector/HostSelector.xaml.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Components.HostSelector
|
||||
{
|
||||
public partial class HostSelector : ContentView
|
||||
{
|
||||
public HostSelector()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
24
Aurora/Frontend/Components/MemberList/MemberList.xaml
Normal file
24
Aurora/Frontend/Components/MemberList/MemberList.xaml
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:hl="clr-namespace:Aurora.Frontend.Components.HorizontalList"
|
||||
x:Class="Aurora.Frontend.Components.MemberList.MemberList">
|
||||
<ContentView.Content>
|
||||
<StackLayout>
|
||||
<hl:HorizontalList
|
||||
x:Name="MembersHorizontalList"
|
||||
ListOrientation="Horizontal"
|
||||
VerticalOptions="Start">
|
||||
<hl:HorizontalList.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Frame>
|
||||
<Label
|
||||
Text="{Binding .}"/>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</hl:HorizontalList.ItemTemplate>
|
||||
</hl:HorizontalList>
|
||||
</StackLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
61
Aurora/Frontend/Components/MemberList/MemberList.xaml.cs
Normal file
61
Aurora/Frontend/Components/MemberList/MemberList.xaml.cs
Normal file
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
using Aurora.Frontend.Components.HorizontalList;
|
||||
|
||||
namespace Aurora.Frontend.Components.MemberList
|
||||
{
|
||||
public partial class MemberList : ContentView
|
||||
{
|
||||
public MemberList()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bindable property for members list.
|
||||
/// </summary>
|
||||
/// <param name=""Members""></param>
|
||||
/// <param name="typeof(IEnumerable<string>"></param>
|
||||
/// <returns></returns>
|
||||
public static readonly BindableProperty MembersProperty =
|
||||
BindableProperty.Create(propertyName: "Members",
|
||||
returnType: typeof(IEnumerable<string>),
|
||||
declaringType: typeof(MemberList),
|
||||
defaultBindingMode: BindingMode.Default,
|
||||
propertyChanged: OnMembersChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Backing property for MembersProperty
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public IEnumerable<string> Members
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IEnumerable<string>)GetValue(MembersProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(MembersProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Memberes changed event handler. Assign member list source.
|
||||
/// </summary>
|
||||
/// <param name="bindable"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
private static void OnMembersChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var control = (MemberList)bindable;
|
||||
var membersList = control.FindByName("MembersHorizontalList") as HorizontalList.HorizontalList;
|
||||
if (membersList != null)
|
||||
{
|
||||
membersList.ItemsSource = newValue as IEnumerable<string>;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -34,6 +34,12 @@ namespace Aurora.Frontend.Components.NavigationMenu
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Items changed event handler. Organizes items in groups for display.
|
||||
/// </summary>
|
||||
/// <param name="bindable">The changed Item.</param>
|
||||
/// <param name="oldValue">The previous value.</param>
|
||||
/// <param name="newValue">The new value.</param>
|
||||
private static void OnItemsChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
var control = (NavigationMenu)bindable;
|
||||
|
48
Aurora/Frontend/Components/Queue/Queue.xaml
Normal file
48
Aurora/Frontend/Components/Queue/Queue.xaml
Normal file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
|
||||
x:Class="Aurora.Frontend.Components.Queue.Queue">
|
||||
<ContentView.Content>
|
||||
<dg:DataGrid
|
||||
x:Name="QueueDataGrid"
|
||||
SelectionEnabled="True"
|
||||
RowHeight="25"
|
||||
HeaderHeight="40"
|
||||
BorderColor="#CCCCCC"
|
||||
HeaderBackground="#E0E6F8">
|
||||
<dg:DataGrid.HeaderFontSize>
|
||||
<OnIdiom
|
||||
x:TypeArguments="x:Double">
|
||||
<OnIdiom.Tablet>15</OnIdiom.Tablet>
|
||||
<OnIdiom.Phone>13</OnIdiom.Phone>
|
||||
<OnIdiom.Desktop>20</OnIdiom.Desktop>
|
||||
</OnIdiom>
|
||||
</dg:DataGrid.HeaderFontSize>
|
||||
<dg:DataGrid.Columns>
|
||||
<dg:DataGridColumn
|
||||
Title="Title"
|
||||
PropertyName="Metadata.Title"
|
||||
Width="2*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Album"
|
||||
PropertyName="Metadata.Album"
|
||||
Width="0.95*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Artist"
|
||||
PropertyName="Metadata.Artist"
|
||||
Width="1*"/>
|
||||
<dg:DataGridColumn
|
||||
Title="Duration"
|
||||
PropertyName="Metadata.Duration"/>
|
||||
</dg:DataGrid.Columns>
|
||||
<dg:DataGrid.RowsBackgroundColorPalette>
|
||||
<dg:PaletteCollection>
|
||||
<Color>#F2F2F2</Color>
|
||||
<Color>#FFFFFF</Color>
|
||||
</dg:PaletteCollection>
|
||||
</dg:DataGrid.RowsBackgroundColorPalette>
|
||||
</dg:DataGrid>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
109
Aurora/Frontend/Components/Queue/Queue.xaml.cs
Normal file
109
Aurora/Frontend/Components/Queue/Queue.xaml.cs
Normal file
@ -0,0 +1,109 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Xamarin.Forms;
|
||||
using Xamarin.Forms.DataGrid;
|
||||
using Aurora.Backend.Models.Media;
|
||||
|
||||
namespace Aurora.Frontend.Components.Queue
|
||||
{
|
||||
public partial class Queue : ContentView
|
||||
{
|
||||
public Queue()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
#region ItemsSource Property
|
||||
/// <summary>
|
||||
/// Bindable Property for the ItemsSource of the datagrid.
|
||||
/// </summary>
|
||||
/// <param name=""ItemsSource""></param>
|
||||
/// <param name="typeof(IEnumerable<object>"></param>
|
||||
/// <returns></returns>
|
||||
public static readonly BindableProperty ItemsSourceProperty =
|
||||
BindableProperty.Create(propertyName: "ItemsSource",
|
||||
returnType: typeof(IEnumerable<object>),
|
||||
declaringType: typeof(Queue),
|
||||
defaultBindingMode: BindingMode.Default,
|
||||
propertyChanged: OnItemsSourceChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Backing property for the ItemsSource property.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public IEnumerable<object> ItemsSource
|
||||
{
|
||||
get
|
||||
{
|
||||
return (IEnumerable<object>)GetValue(ItemsSourceProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(ItemsSourceProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ItemsSource Changed event handler
|
||||
/// </summary>
|
||||
/// <param name="bindable"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
private static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
|
||||
{
|
||||
Queue control = bindable as Queue;
|
||||
var queueDataGrid = control.FindByName("QueueDataGrid") as DataGrid;
|
||||
queueDataGrid.ItemsSource = newValue as IEnumerable<object>;
|
||||
}
|
||||
|
||||
#endregion ItemsSource Property
|
||||
|
||||
/// <summary>
|
||||
/// Bindable property for the selected item field on the datagrid.
|
||||
/// </summary>
|
||||
/// <param name=""SelectedItem""></param>
|
||||
/// <param name="typeof(BaseMetadata"></param>
|
||||
/// <returns></returns>
|
||||
public static readonly BindableProperty SelectedItemProperty =
|
||||
BindableProperty.Create(propertyName: "SelectedItem",
|
||||
returnType: typeof(object),
|
||||
declaringType: typeof(Queue),
|
||||
defaultBindingMode: BindingMode.TwoWay,
|
||||
propertyChanged: OnSelectedItemChanged);
|
||||
|
||||
/// <summary>
|
||||
/// Backing property for the SelectedItem property.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public object SelectedItem
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((object)GetValue(SelectedItemProperty));
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue(SelectedItemProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles selection change events.
|
||||
/// </summary>
|
||||
/// <param name="bindable">The bindable object.</param>
|
||||
/// <param name="newValue"></param>
|
||||
/// <param name="oldValue"></param>
|
||||
private static void OnSelectedItemChanged(BindableObject bindable, object newValue, object oldValue)
|
||||
{
|
||||
Queue control = bindable as Queue;
|
||||
var queueDataGrid = control.FindByName("QueueDataGrid") as DataGrid;
|
||||
IEnumerable<object> source = (IEnumerable<object>)queueDataGrid.ItemsSource;
|
||||
if (source.Contains(newValue))
|
||||
{
|
||||
queueDataGrid.SelectedItem = newValue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Aurora.Frontend.Views.Albums.AlbumsView">
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="Aurora.Frontend.Views.Albums.AlbumsView">
|
||||
<ContentPage.Content>
|
||||
<Label Text="Albums" />
|
||||
<Grid></Grid>
|
||||
</ContentPage.Content>
|
||||
</ContentView>
|
@ -7,6 +7,7 @@ using Aurora.Frontend.Views.Albums;
|
||||
using Aurora.Frontend.Views.Artists;
|
||||
using Aurora.Frontend.Views.Songs;
|
||||
using Aurora.Frontend.Views.Stations;
|
||||
using Aurora.Frontend.Views.Party;
|
||||
|
||||
namespace Aurora.Frontend.Views.MainView
|
||||
{
|
||||
@ -30,7 +31,7 @@ namespace Aurora.Frontend.Views.MainView
|
||||
{
|
||||
_pages = new ObservableCollection<NavigationItem>(new[]
|
||||
{
|
||||
new NavigationItem { Id = 4, Title = "Party", Group="Social", TargetType = typeof(ArtistsView)},
|
||||
new NavigationItem { Id = 4, Title = "Party", Group="Social", TargetType = typeof(PartyView)},
|
||||
new NavigationItem { Id = 5, Title = "Profile", Group="Social", TargetType = typeof(ArtistsView)},
|
||||
new NavigationItem { Id = 0, Title = "Songs", Group="Library", TargetType = typeof(SongsView) },
|
||||
new NavigationItem { Id = 1, Title = "Artists", Group="Library", TargetType = typeof(ArtistsView)},
|
||||
|
29
Aurora/Frontend/Views/Party/PartyView.xaml
Normal file
29
Aurora/Frontend/Views/Party/PartyView.xaml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ContentView
|
||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:hs="clr-namespace:Aurora.Frontend.Components.HostSelector"
|
||||
xmlns:ml="clr-namespace:Aurora.Frontend.Components.MemberList"
|
||||
xmlns:qu="clr-namespace:Aurora.Frontend.Components.Queue"
|
||||
x:Class="Aurora.Frontend.Views.Party.PartyView">
|
||||
<ContentView.Content>
|
||||
<AbsoluteLayout
|
||||
VerticalOptions="FillAndExpand"
|
||||
HorizontalOptions="FillAndExpand">
|
||||
<StackLayout>
|
||||
<Label
|
||||
Text="Party Members"/>
|
||||
<ml:MemberList
|
||||
Members="{Binding Members}"/>
|
||||
<Label
|
||||
Text="Queue"/>
|
||||
<qu:Queue/>
|
||||
</StackLayout>
|
||||
<hs:HostSelector
|
||||
AbsoluteLayout.LayoutFlags="All"
|
||||
AbsoluteLayout.LayoutBounds="0.5,0.5,0.7,0.7"
|
||||
BackgroundColor="Green"
|
||||
IsVisible="False"/>
|
||||
</AbsoluteLayout>
|
||||
</ContentView.Content>
|
||||
</ContentView>
|
15
Aurora/Frontend/Views/Party/PartyView.xaml.cs
Normal file
15
Aurora/Frontend/Views/Party/PartyView.xaml.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Aurora.Frontend.Views.Party
|
||||
{
|
||||
public partial class PartyView : ContentView
|
||||
{
|
||||
public PartyView()
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = new PartyViewModel();
|
||||
}
|
||||
}
|
||||
}
|
31
Aurora/Frontend/Views/Party/PartyViewModel.cs
Normal file
31
Aurora/Frontend/Views/Party/PartyViewModel.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Aurora.Frontend.Views.Party
|
||||
{
|
||||
public class PartyViewModel : BaseViewModel
|
||||
{
|
||||
private ObservableCollection<string> _members;
|
||||
public PartyViewModel()
|
||||
{
|
||||
_members = new ObservableCollection<string>()
|
||||
{
|
||||
"Kevin",
|
||||
"Brandon",
|
||||
"Sheila",
|
||||
"Dale",
|
||||
"Austin",
|
||||
"Tori",
|
||||
"Ashley",
|
||||
"Spencer",
|
||||
};
|
||||
OnPropertyChanged("Members");
|
||||
}
|
||||
|
||||
public ObservableCollection<string> Members
|
||||
{
|
||||
get { return _members; }
|
||||
set { SetProperty(ref _members, value); }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user