Changing folder names

This commit is contained in:
Brandon Watson
2021-04-10 10:20:50 -04:00
parent f1a3771912
commit dd4632cdb6
62 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,44 @@
#PlayerControlContainer {
background-color: #303030;
}
Label {
color: white;
text-align: left;
vertical-align: middle;
word-wrap: break-word;
}
#MediaInfoContainer {
width: 150;
margin-top: 10;
margin-bottom: 10;
}
#MediaInfoContainer label {
margin-left: 20;
}
#AlbumArtBoxView {
background-color: black;
width: 80;
}
.PlayButton {
width: 40;
}
.DirectionButton {
width: 30;
}
.LibraryButton {
width: 25;
}
ImageButton {
margin-top: 10;
margin-left: 15;
margin-right: 15;
margin-bottom: 10;
}

View File

@ -0,0 +1,64 @@
<?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:imgBtn="clr-namespace:Aurora.Design.Components.ImageButton"
x:Class="Aurora.Design.Components.MediaPlayer.Player">
<ContentView.Resources>
<StyleSheet
Source="Player.css"/>
</ContentView.Resources>
<ContentView.Content>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="200"/>
<ColumnDefinition
Width="*"/>
<ColumnDefinition
Width="100"/>
</Grid.ColumnDefinitions>
<StackLayout
Grid.Column="0"
Orientation="Horizontal">
<BoxView
x:Name="AlbumArtBoxView"/>
<StackLayout
x:Name="MediaInfoContainer"
HorizontalOptions="StartAndExpand">
<Label
x:Name="SongTitleLabel"
LineBreakMode="TailTruncation"/>
<Label
x:Name="ArtistNameLabel"
LineBreakMode="TailTruncation"/>
</StackLayout>
</StackLayout>
<StackLayout
x:Name="PlayerControlContainer"
Grid.Column="1"
HorizontalOptions="Center"
Orientation="Horizontal">
<imgBtn:ImageButton
x:Name="ShuffleButton"
StyleClass="LibraryButton"
Source="Resources/shuffle.png"/>
<imgBtn:ImageButton
x:Name="PreviousButton"
StyleClass="DirectionButton"
Source="Resources/backward.png"/>
<imgBtn:ImageButton
x:Name="PlayButton"
StyleClass="PlayButton"/>
<imgBtn:ImageButton
x:Name="NextButton"
StyleClass="DirectionButton"
Source="Resources/forwards.png"/>
<imgBtn:ImageButton
x:Name="LoopButton"
StyleClass="LibraryButton"
Source="Resources/loop.png"/>
</StackLayout>
</Grid>
</ContentView.Content>
</ContentView>

View File

@ -0,0 +1,303 @@
using System;
using Xamarin.Forms;
namespace Aurora.Design.Components.MediaPlayer
{
public partial class Player : ContentView
{
public Player()
{
InitializeComponent();
PlayButton.Source = ImageSource.FromFile("Resources/play.png");
}
#region SongTitle Bindable
public static readonly BindableProperty SongTitleProperty =
BindableProperty.Create(propertyName: "SongTitle",
returnType: typeof(string),
declaringType: typeof(Player),
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
{
Player component = bindable as Player;
component.SongTitleLabel.Text = (string)newValue;
});
public string SongTitle
{
get
{
return (string)GetValue(SongTitleProperty);
}
set
{
SetValue(SongTitleProperty, value);
}
}
#endregion SongTitle Bindable
#region ArtistName Bindable
public static readonly BindableProperty ArtistNameProperty =
BindableProperty.Create(propertyName: "ArtistName",
returnType: typeof(string),
declaringType: typeof(Player),
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
{
Player component = bindable as Player;
component.ArtistNameLabel.Text = (string)newValue;
});
public string ArtistName
{
get
{
return (string)GetValue(ArtistNameProperty);
}
set
{
SetValue(ArtistNameProperty, value);
}
}
#endregion ArtistName Bindable
#region PreviousButton
public static readonly BindableProperty PreviousButtonCommandProperty =
BindableProperty.Create(propertyName: "PreviousButtonCommand",
returnType: typeof(Command),
propertyChanged: OnPreviousButtonPropertyChanged,
declaringType: typeof(Player));
public Command PreviousButtonCommand
{
get
{
return (Command)GetValue(PreviousButtonCommandProperty);
}
set
{
SetValue(PreviousButtonCommandProperty, value);
}
}
private void OnPreviousButtonClicked(object sender, EventArgs args)
{
if (PreviousButtonCommand.CanExecute(null))
{
PreviousButtonCommand.Execute(null);
PreviousButtonCommand.ChangeCanExecute();
PlayButtonCommand.ChangeCanExecute();
NextButtonCommand.ChangeCanExecute();
}
}
/// <summary>
/// Event handler to hook up can execute events on property changed
/// </summary>
/// <param name="bindable"></param>
/// <param name="newValue"></param>
/// <param name="oldValue"></param>
private static void OnPreviousButtonPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
Player component = bindable as Player;
if (newValue is Command)
{
Command cmd = newValue as Command;
component.PreviousButton.Tapped += component.OnPreviousButtonClicked;
cmd.CanExecuteChanged += (sender, e) => OnPreviousButtonCanExecuteChanged(sender, e, component, cmd);
}
if (oldValue is Command && oldValue != null)
{
Command cmd = newValue as Command;
component.PreviousButton.Tapped -= component.OnPreviousButtonClicked;
cmd.CanExecuteChanged -= (sender, e) => OnPreviousButtonCanExecuteChanged(sender, e, component, cmd);
}
}
/// <summary>
/// Can execute changed event handler
/// </summary>
/// <param name="sender"></param>
/// <param name="eventArgs"></param>
/// <param name="component"></param>
/// <param name="cmd"></param>
private static void OnPreviousButtonCanExecuteChanged(object sender,
EventArgs eventArgs,
Player component,
Command cmd)
{
component.NextButton.IsEnabled = cmd.CanExecute(null);
}
#endregion PreviousButton
#region PlayButton
public static readonly BindableProperty PlayButtonCommandProperty =
BindableProperty.Create(propertyName: "PlayButtonCommand",
returnType: typeof(Command),
propertyChanged: OnPlayButtonPropertyChanged,
declaringType: typeof(Player));
public Command PlayButtonCommand
{
get
{
return (Command)GetValue(PlayButtonCommandProperty);
}
set
{
SetValue(PlayButtonCommandProperty, value);
}
}
private void OnPlayButtonClicked(object sender, EventArgs args)
{
if (PlayButtonCommand.CanExecute(null))
{
PlayButtonCommand.Execute(null);
PreviousButtonCommand.ChangeCanExecute();
PlayButtonCommand.ChangeCanExecute();
NextButtonCommand.ChangeCanExecute();
}
}
/// <summary>
/// Event handler to hook up can execute events on property changed
/// </summary>
/// <param name="bindable"></param>
/// <param name="newValue"></param>
/// <param name="oldValue"></param>
private static void OnPlayButtonPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
Player component = bindable as Player;
if (newValue is Command)
{
Command cmd = newValue as Command;
component.PlayButton.Tapped += component.OnPlayButtonClicked;
cmd.CanExecuteChanged += (sender, e) => OnPlayButtonCanExecuteChanged(sender, e, component, cmd);
}
if (oldValue is Command && oldValue != null)
{
Command cmd = newValue as Command;
component.PlayButton.Tapped -= component.OnPlayButtonClicked;
cmd.CanExecuteChanged -= (sender, e) => OnPlayButtonCanExecuteChanged(sender, e, component, cmd);
}
}
/// <summary>
/// Can execute changed event handler
/// </summary>
/// <param name="sender"></param>
/// <param name="eventArgs"></param>
/// <param name="component"></param>
/// <param name="cmd"></param>
private static void OnPlayButtonCanExecuteChanged(object sender,
EventArgs eventArgs,
Player component,
Command cmd)
{
component.NextButton.IsEnabled = cmd.CanExecute(null);
}
#endregion PlayButton
#region NextButton
public static readonly BindableProperty NextButtonCommandProperty =
BindableProperty.Create(propertyName: "NextButtonCommand",
returnType: typeof(Command),
declaringType: typeof(Player),
propertyChanged: OnNextButtonPropertyChanged);
public Command NextButtonCommand
{
get
{
return (Command)GetValue(NextButtonCommandProperty);
}
set
{
SetValue(NextButtonCommandProperty, value);
}
}
private void OnNextButtonClicked(object sender, EventArgs args)
{
if (NextButtonCommand.CanExecute(null))
{
NextButtonCommand.Execute(null);
PreviousButtonCommand.ChangeCanExecute();
PlayButtonCommand.ChangeCanExecute();
NextButtonCommand.ChangeCanExecute();
}
}
/// <summary>
/// Event handler to hook up can execute events on property changed
/// </summary>
/// <param name="bindable"></param>
/// <param name="newValue"></param>
/// <param name="oldValue"></param>
private static void OnNextButtonPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
Player component = bindable as Player;
if (newValue is Command)
{
Command cmd = newValue as Command;
component.NextButton.Tapped += component.OnNextButtonClicked;
cmd.CanExecuteChanged += (sender, e) => OnNextButtonCanExecuteChanged(sender, e, component, cmd);
}
if (oldValue is Command && oldValue != null)
{
Command cmd = oldValue as Command;
component.NextButton.Tapped -= component.OnNextButtonClicked;
cmd.CanExecuteChanged -= (sender, e) => OnNextButtonCanExecuteChanged(sender, e, component, cmd);
}
}
/// <summary>
/// Can execute changed event handler
/// </summary>
/// <param name="sender"></param>
/// <param name="eventArgs"></param>
/// <param name="component"></param>
/// <param name="cmd"></param>
private static void OnNextButtonCanExecuteChanged(object sender,
EventArgs eventArgs,
Player component,
Command cmd)
{
component.NextButton.IsEnabled = cmd.CanExecute(null);
}
#endregion PlayButton
#region Playing Bindable
public static readonly BindableProperty IsPlayingProperty =
BindableProperty.Create(
propertyName: "IsPlaying",
returnType: typeof(bool),
declaringType: typeof(Player),
propertyChanged: (BindableObject bindable, object oldValue, object newValue) =>
{
Player control = (Player)bindable;
if ((bool)newValue == true)
{
control.PlayButton.Source = ImageSource.FromFile("Resources/pause.png");
}
else
{
control.PlayButton.Source = ImageSource.FromFile("Resources/play.png");
}
});
public bool IsPlaying
{
get { return (bool)GetValue(IsPlayingProperty); }
set { SetValue(IsPlayingProperty, value); }
}
#endregion Playing Binadable
}
}