School Commit Init

This commit is contained in:
2024-08-31 12:07:21 +03:00
commit 0b130ee18c
2801 changed files with 4720552 additions and 0 deletions
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.AnalystDashboard"
Title="AnalystDashboard">
<VerticalStackLayout>
<Label
Text="Dashboard"
VerticalOptions="Center"
HorizontalOptions="Center" />
<VerticalStackLayout Spacing="15" Padding="10, 0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="Total Minutes Listened" />
<Label Grid.Column="1" Text="Total Plays" />
<Label Grid.Column="2" Text="Total Likes" />
<Label Grid.Column="3" Text="Total Dislikes" />
<Label Grid.Column="4" Text="Total Skips" />
</Grid>
<Grid x:Name="Dashboard">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding TotalMinutesListened}" />
<Label Grid.Column="1" Text="{Binding TotalPlays}" />
<Label Grid.Column="2" Text="{Binding TotalLikes}" />
<Label Grid.Column="3" Text="{Binding TotalDislikes}" />
<Label Grid.Column="4" Text="{Binding TotalSkips}" />
</Grid>
</VerticalStackLayout>
</VerticalStackLayout>
</ContentPage>
@@ -0,0 +1,16 @@
using TechTitans.Models;
using TechTitans.Services;
//using System.IO;
namespace TechTitans.Views;
public partial class AnalystDashboard : ContentPage
{
public AnalystDashboard()
{
InitializeComponent();
FullDetailsOnSongController fullDetailsOnSongController = new FullDetailsOnSongController();
FullDetailsOnSong FullDetails = fullDetailsOnSongController.GetFullDetailsOnSong(201);
FullDetailsOnSong CurrentMonth = fullDetailsOnSongController.GetCurrentMonthDetails(201);
this.BindingContext = CurrentMonth;
}
}
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--import pt Components namesapace ca sa putem refolosi componente (this some DRY shit)
asta e syntaxa: xmlns:controls="clr-namespace:TechTitans.Views.Components"-->
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
x:Class="TechTitans.Views.AnalystPage"
Title="AnalystPage">
<VerticalStackLayout Margin="15,0">
<StackLayout Orientation="Horizontal">
<StackLayout Padding="10">
<Picker Title="Select Month:" x:Name="MonthPicker" SelectedIndex="0" >
<Picker.ItemsSource>
<x:Array Type="{x:Type x:Int32}">
<x:Int32>1</x:Int32>
<x:Int32>2</x:Int32>
<x:Int32>3</x:Int32>
<x:Int32>4</x:Int32>
<x:Int32>5</x:Int32>
<x:Int32>6</x:Int32>
<x:Int32>7</x:Int32>
<x:Int32>8</x:Int32>
<x:Int32>9</x:Int32>
<x:Int32>10</x:Int32>
<x:Int32>11</x:Int32>
<x:Int32>12</x:Int32>
</x:Array>
</Picker.ItemsSource>
</Picker>
</StackLayout>
<StackLayout Padding="10">
<Picker Title="Select Year:" x:Name="YearPicker" SelectedIndex="0" >
<Picker.ItemsSource>
<x:Array Type="{x:Type x:Int32}">
<x:Int32>2020</x:Int32>
<x:Int32>2021</x:Int32>
<x:Int32>2022</x:Int32>
<x:Int32>2023</x:Int32>
<x:Int32>2024</x:Int32>
<x:Int32>2025</x:Int32>
<x:Int32>2026</x:Int32>
<x:Int32>2027</x:Int32>
<x:Int32>2028</x:Int32>
<x:Int32>2029</x:Int32>
<x:Int32>2030</x:Int32>
</x:Array>
</Picker.ItemsSource>
</Picker>
</StackLayout>
<Button Text="Show Top 3s" Clicked="OnShowTop3Clicked" HeightRequest="40" HorizontalOptions="CenterAndExpand"/>
</StackLayout>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<StackLayout Orientation="Vertical" Spacing="20">
<!-- First row -->
<StackLayout x:Name="Top3Genres">
<Label Text="Top 3 Genres" FontSize="30"/>
<HorizontalStackLayout Spacing="20">
<VerticalStackLayout>
<Label Text="Genre" FontSize="20"/>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<Label x:Name="Genre1Name" HorizontalOptions="Center" />
<Label x:Name="Genre2Name" HorizontalOptions="Center" />
<Label x:Name="Genre3Name" HorizontalOptions="Center" />
</VerticalStackLayout>
<VerticalStackLayout>
<Label Text="Total Listens" FontSize="20"/>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<Label x:Name="Genre1Minutes" HorizontalOptions="Center"/>
<Label x:Name="Genre2Minutes" HorizontalOptions="Center"/>
<Label x:Name="Genre3Minutes" HorizontalOptions="Center"/>
</VerticalStackLayout>
<VerticalStackLayout>
<Label Text="Percentage" FontSize="20"/>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<Label x:Name="Percentage1" HorizontalOptions="Center"/>
<Label x:Name="Percentage2" HorizontalOptions="Center"/>
<Label x:Name="Percentage3" HorizontalOptions="Center"/>
</VerticalStackLayout>
</HorizontalStackLayout>
</StackLayout>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<StackLayout>
<Label Text="Top 3 Subgenres" FontSize="30"/>
<HorizontalStackLayout Spacing="20">
<VerticalStackLayout>
<Label Text="Genre" FontSize="20"/>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<Label x:Name="Subgenre1Name" />
<Label x:Name="Subgenre2Name" />
<Label x:Name="Subgenre3Name" />
</VerticalStackLayout>
<VerticalStackLayout>
<Label Text="Total Listens" FontSize="20"/>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<Label x:Name="Subgenre1Minutes" />
<Label x:Name="Subgenre2Minutes" />
<Label x:Name="Subgenre3Minutes" />
</VerticalStackLayout>
<VerticalStackLayout>
<Label Text="Percentage" FontSize="20"/>
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="0, 5" />
<Label x:Name="Subgenre1Percentage"/>
<Label x:Name="Subgenre2Percentage"/>
<Label x:Name="Subgenre3Percentage"/>
</VerticalStackLayout>
</HorizontalStackLayout>
</StackLayout>
</StackLayout>
</VerticalStackLayout>
</ContentPage>
@@ -0,0 +1,58 @@
using TechTitans.Models;
using TechTitans.Services;
using System.IO;
namespace TechTitans.Views;
public partial class AnalystPage : ContentPage
{
private TopGenresController topGenresController;
private Dictionary<String, int> genreCount = new Dictionary<String, int>();
private Dictionary<String, int> subgenreCount = new Dictionary<String, int>();
public AnalystPage()
{
InitializeComponent();
topGenresController = new TopGenresController();
}
public void ClearText()
{
Genre1Name.Text = "";
Genre1Minutes.Text = "";
Genre2Name.Text = "";
Genre2Minutes.Text = "";
Genre3Name.Text = "";
Genre3Minutes.Text = "";
}
private void OnShowTop3Clicked(object sender, EventArgs e)
{
ClearText();
int monthInt = 0;
int yearInt = 0;
var month = MonthPicker.SelectedItem;
var year = YearPicker.SelectedItem;
if (month != null && year != null)
{
try
{
// make them ints
monthInt = Convert.ToInt32(month);
yearInt = Convert.ToInt32(year);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
topGenresController.getTop3Genres(monthInt, yearInt,Genre1Name,Genre1Minutes,Percentage1,Genre2Name,Genre2Name,Percentage2,Genre3Name,Genre3Minutes,Percentage3);
topGenresController.top3SubGenres(monthInt, yearInt,Subgenre1Name,Subgenre1Minutes,Subgenre1Percentage,Subgenre2Name,Subgenre2Minutes,Subgenre2Percentage,Subgenre3Name,Subgenre3Minutes,Subgenre3Percentage);
}
}
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--import pt Components namesapace ca sa putem refolosi componente (this some DRY shit)
asta e syntaxa: xmlns:controls="clr-namespace:TechTitans.Views.Components"-->
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
x:Class="TechTitans.Views.ArtistPage"
Title="Welcome DummyArtist69!">
<VerticalStackLayout>
<Label
Text="Your Top Songs"
VerticalOptions="Center"
HorizontalOptions="Start"
FontAttributes="Bold"
FontSize="16"
Margin="10,0,0,0"
/>
<BoxView Color="#6E6E6E" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="10,5"/>
<VerticalStackLayout Spacing="15" Padding="10, 0">
<Grid x:Name="SongsGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</VerticalStackLayout>
</VerticalStackLayout>
</ContentPage>
@@ -0,0 +1,133 @@
namespace TechTitans.Views;
using TechTitans.Views.Components.Artist;
using TechTitans.Views.Components;
using TechTitans.Models;
using TechTitans.Services;
public partial class ArtistPage : ContentPage
{
public ArtistSongDashboardController service = new();
public ArtistPage()
{
InitializeComponent();
LoadSongs();
}
private void LoadSongs()
{
var songs = service.getSongsForMainPage(); // Get your list of songs from somewhere (e.g., database, API, local storage)
// initial row
SongsGrid.RowDefinitions.Add(new RowDefinition());
// Loop through each song and dynamically create SongItem controls
int rowIndex = 0;
int columnIndex = 0;
foreach (var song in songs)
{
var songItem = new SongItem(); // Create a new instance of SongItem
songItem.BindingContext = song; // Set the song as the binding context of the SongItem
songItem.Margin = new Thickness(0, 5, 0, 5); // Set margin as needed
// Add TapGestureRecognizer to handle tap event
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += SongItem_Tapped;
songItem.GestureRecognizers.Add(tapGestureRecognizer);
// Set the row and column of the SongItem in the grid
Grid.SetRow(songItem, rowIndex);
Grid.SetColumn(songItem, columnIndex);
// Add the SongItem to the grid
SongsGrid.Children.Add(songItem);
columnIndex++;
if (columnIndex == 2) // bun cod
{
columnIndex = 0;
rowIndex++;
SongsGrid.RowDefinitions.Add(new RowDefinition());
}
}
}
private void SongItem_Tapped(object sender, System.EventArgs e)
{
// open ArtistSongDashboard page with song details
var songItem = (SongItem)sender;
var songInfo = songItem.BindingContext as SongBasicInfo;
Navigation.PushAsync(new ArtistSongDashboard(songInfo));
}
// Sample method to get list of songs (replace this with your actual method)
private List<SongBasicInfo> GetSongs()
{
// mocked songs, to be replaced with actual data retrieval from db
return new List<SongBasicInfo>
{
new SongBasicInfo
{
SongId = 10,
Name = "Song 1",
Artist = "Artist 1",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 201,
Name = "Song 2",
Artist = "Artist 2",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 2,
Name = "Song 3",
Artist = "Artist 3",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 3,
Name = "Song 4",
Artist = "Artist 4",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 4,
Name = "Song 5",
Artist = "Artist 5",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 5,
Name = "Song 6",
Artist = "Artist 6",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 6,
Name = "Song 7",
Artist = "Artist 7",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 7,
Name = "Song 8",
Artist = "Artist 8",
Image = "song_img_default.png"
},
new SongBasicInfo
{
SongId = 8,
Name = "Song 9",
Artist = "Artist 9",
Image = "song_img_default.png"
},
};
}
}
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
x:Class="TechTitans.Views.Components.Artist.ArtistSongDashboard"
Title="Song Dashboard">
<VerticalStackLayout>
<VerticalStackLayout Padding="20" Spacing="10">
<Image
x:Name="SongImage"
HorizontalOptions="Start"
HeightRequest="256"
WidthRequest="256"
/>
<Label
x:Name="SongTitle"
Text=""
FontSize="32"
FontAttributes="Bold"
WidthRequest="256"
HorizontalOptions="Start"
/>
<Label
x:Name="SongArtist"
Text=""
FontSize="20"
TextColor="#6E6E6E"
Margin="0,-10,0,0"
HorizontalOptions="Start"
/>
<Label
x:Name="SongAlbum"
Text=""
FontSize="24"
HorizontalOptions="Start"
/>
</VerticalStackLayout>
<!--linie f ghetto-->
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="10, 5" />
<HorizontalStackLayout HorizontalOptions="CenterAndExpand" Spacing="10">
<VerticalStackLayout>
<Button
Text="Info"
TextColor="#6E6E6E"
FontAttributes="Bold"
Style="{StaticResource TabNavButton}"
Clicked="OnInfoClick"
/>
<BoxView x:Name="InfoBoxView" Color="#6E6E6E" HeightRequest="2" HorizontalOptions="FillAndExpand"/>
</VerticalStackLayout>
<VerticalStackLayout>
<Button
Text="Performance"
TextColor="#6E6E6E"
FontAttributes="Bold"
Style="{StaticResource TabNavButton}"
Clicked="OnPerformanceCLick"
/>
<BoxView x:Name="PerformanceBoxView" Color="#1E1E1E" HeightRequest="2" HorizontalOptions="FillAndExpand"/>
</VerticalStackLayout>
</HorizontalStackLayout>
<Frame
CornerRadius="10"
Margin="20,20,20,0"
Padding="10"
BackgroundColor="#6E6E6E"
>
<HorizontalStackLayout Spacing="40" HorizontalOptions="Center">
<VerticalStackLayout Spacing="20" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label
x:Name="label1"
Text=""
FontSize="16"
/>
<Label
x:Name="label2"
Text=""
FontSize="16"
/>
<Label
x:Name="label3"
Text=""
FontSize="16"
/>
<Label
x:Name="label4"
Text=""
FontSize="16"
/>
</VerticalStackLayout>
<VerticalStackLayout Spacing="20" VerticalOptions="FillAndExpand" HorizontalOptions="EndAndExpand">
<Label
x:Name="content1"
Text=""
FontSize="16"
/>
<Label
x:Name="content2"
Text=""
FontSize="16"
/>
<Label
x:Name="content3"
Text=""
FontSize="16"
/>
<Label
x:Name="content4"
Text=""
FontSize="16"
/>
</VerticalStackLayout>
</HorizontalStackLayout>
</Frame>
</VerticalStackLayout>
</ContentPage>
@@ -0,0 +1,85 @@
using TechTitans.Models;
using TechTitans.ViewModels;
using TechTitans.Services;
namespace TechTitans.Views.Components.Artist;
public partial class ArtistSongDashboard : ContentPage
{
public ArtistSongDashboardController service = new ();
// alt domain song type cu mai multe detalii
int songId;
ArtistSongDashboardViewModel viewModel;
public ArtistSongDashboard(SongBasicInfo song)
{
songId = song.SongId;
InitializeComponent();
populateViewModel(songId);
LoadPage();
}
private void populateViewModel(int songID)
{
viewModel = new ArtistSongDashboardViewModel() {
SongInfo = service.getSongInfo(songID),
SongDetails = service.getSongDetails(songID),
ArtistInfo = service.getArtistInfo(songID)
};
}
private void LoadPage()
{
SongImage.Source = viewModel.SongInfo.Image;
SongTitle.Text = viewModel.SongInfo.Name;
SongArtist.Text = "by " + viewModel.ArtistInfo.Name;
SongAlbum.Text = "from " + viewModel.SongInfo.Album;
// set song info panel
label1.Text = "Genre:";
content1.Text = viewModel.SongInfo.Genre;
label2.Text = "Subgenre:";
content2.Text = viewModel.SongInfo.Subgenre;
label3.Text = "Country:";
content3.Text = viewModel.SongInfo.Country;
label4.Text = "Language:";
content4.Text = viewModel.SongInfo.Language;
}
// private ArtistSongDashboardViewModel getMockedViewModel()
//{
// var mockedModel = new ArtistSongDashboardViewModel()
// {
// SongInfo = new SongBasicInfo(),
// SongDetails = new SongRecommendationDetails(),
// ArtistInfo = new AuthorDetails(),
// };
// return mockedModel;
//}
private void OnInfoClick(object sender, EventArgs e)
{
InfoBoxView.Color = Color.FromArgb("#6E6E6E");
PerformanceBoxView.Color = Color.FromArgb("#1E1E1E");
label1.Text = "Genre:";
content1.Text = viewModel.SongInfo.Genre;
label2.Text = "Subgenre:";
content2.Text = viewModel.SongInfo.Subgenre;
label3.Text = "Country:";
content3.Text = viewModel.SongInfo.Country;
label4.Text = "Language:";
content4.Text = viewModel.SongInfo.Language;
}
private void OnPerformanceCLick(object sender, EventArgs e)
{
PerformanceBoxView.Color = Color.FromArgb("#6E6E6E");
InfoBoxView.Color = Color.FromArgb("#1E1E1E");
label1.Text = "Minutes Listened:";
content1.Text = viewModel.SongDetails.Minutes_Listened.ToString();
label2.Text = "Total Plays:";
content2.Text = viewModel.SongDetails.Number_Of_Plays.ToString();
label3.Text = "Likes:";
content3.Text = viewModel.SongDetails.Likes.ToString();
label4.Text = "Dislikes:";
content4.Text = viewModel.SongDetails.Dislikes.ToString();
}
}
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.BackHomeButton">
<VerticalStackLayout>
<Button
x:Name="HomeBtn"
Text="Go Home"
Clicked="OnBackClick"
HorizontalOptions="Start"
Margin="15,0,0,0"
/>
<!--xaml e retardat ca se ia left,top,right,bottom la margin si restu in loc sa inceapa de la top ca in css-->
</VerticalStackLayout>
</ContentView>
@@ -0,0 +1,12 @@
namespace TechTitans.Views.Components;
public partial class BackHomeButton : ContentView
{
public BackHomeButton()
{
InitializeComponent();
}
private void OnBackClick(object sender, EventArgs e) => Application.Current.MainPage = new NavigationPage(new MainPage());
}
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.EndOfYearRecap.FirstScreen">
<StackLayout x:Name="Background" BackgroundColor="#0A14C8" VerticalOptions="FillAndExpand">
<Label
Text="Sounds like you had quite the 2023. Let's play it back..."
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White"/>
<StackLayout VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<Image
Source= "first_screen_1.jpg"
HeightRequest="256"
WidthRequest="256"
Aspect="Fill"
x:Name="GenericImage"
/>
</StackLayout>
</StackLayout>
</ContentView>
@@ -0,0 +1,44 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class FirstScreen : ContentView
{
public FirstScreen()
{
InitializeComponent();
ChangeImageAndBackgraound();
}
private async void ChangeImageAndBackgraound()
{
await Task.Delay(3000);
var imagesource = new FileImageSource
{
File = "first_screen_2.jpg"
};
GenericImage.Source = imagesource;
Background.BackgroundColor = new Color(200, 20, 200);
await Task.Delay(3000);
imagesource = new FileImageSource
{
File = "first_screen_3.jpg"
};
GenericImage.Source = imagesource;
Background.BackgroundColor = new Color(100, 200, 100);
await Task.Delay(3000);
imagesource = new FileImageSource
{
File = "first_screen_4.jpg"
};
GenericImage.Source = imagesource;
Background.BackgroundColor = new Color(200, 200, 20);
await Task.Delay(3000);
imagesource = new FileImageSource
{
File = "first_screen_1.jpg"
};
GenericImage.Source = imagesource;
Background.BackgroundColor = new Color(10, 20, 200);
ChangeImageAndBackgraound();
}
}
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.EndOfYearRecap.ListenerPersonalityScreen"
xmlns:local="clr-namespace:TechTitans.ViewModels">
<ContentView.BindingContext>
<local:EndOfYearRecapViewModel/>
</ContentView.BindingContext>
<StackLayout x:Name="MainContent">
<Label
x:Name="MainLabel"
VerticalOptions="Center"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White" >
</Label>
</StackLayout>
</ContentView>
@@ -0,0 +1,33 @@
using TechTitans.Enums;
using TechTitans.ViewModels;
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class ListenerPersonalityScreen : ContentView
{
public EndOfYearRecapViewModel ViewModel { get; set; }
public ListenerPersonalityScreen(EndOfYearRecapViewModel _viewModel)
{
InitializeComponent();
ViewModel = _viewModel;
switch (ViewModel.ListenerPersonality)
{
case ListenerPersonality.Vanilla:
MainContent.BackgroundColor = new Color(200, 200, 100);
MainLabel.Text = "You've been categorized as Vanilla, indicating that you've listened to very few songs. That's absolutely fine! Everyone has their own preferences when it comes to music, and there's beauty in simplicity. Whether you choose to explore more or stick to your familiar tunes, the most important thing is that music brings you joy in its own special way.";
break;
case ListenerPersonality.Casual:
MainContent.BackgroundColor = new Color(100, 200, 100);
MainLabel.Text = "You're a Casual listener, someone who enjoys music without delving too deep into it. While you may not have listened to a vast number of songs, your appreciation for the tunes you've encountered is undeniable. Keep enjoying music at your own pace, letting it add flavor to your moments without overwhelming them.";
break;
case ListenerPersonality.Melophile:
MainContent.BackgroundColor = new Color(100, 100, 100);
MainLabel.Text = "Congratulations! You've been classified as a Melophile, someone who has listened to a lot of songs. Your passion for music knows no bounds, and your love for exploring different melodies is truly commendable. Keep listening, keep discovering, and let the rhythm of life guide you.";
break;
case ListenerPersonality.Explorer:
MainContent.BackgroundColor = new Color(50, 0, 100);
MainLabel.Text = "Kudos to you! You're an Explorer in the realm of music, always eager to delve into new genres and sounds. Your adventurous spirit leads you to uncharted musical territories, expanding your horizons with each tune you encounter. Embrace the journey of discovery and let the melodies carry you to places you've never been.";
break;
}
}
}
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
x:Class="TechTitans.Views.Components.EndOfYearRecap.MinutesListenedScreen">
<StackLayout BackgroundColor="Black">
<Label
Text="{Binding MinutesListened, StringFormat='You\'ve listened to {0} minutes of music this year...'}"
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White"/>
<AbsoluteLayout VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<Image x:Name="RedHalfCircle"
Source="half_circle.svg"
HeightRequest="256"
Aspect="AspectFit">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
</Image.Behaviors>
</Image>
<Image x:Name="BlueHalfCircle"
Source="half_circle.svg"
HeightRequest="256"
Scale="0"
Aspect="AspectFit">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Blue" />
</Image.Behaviors>
</Image>
</AbsoluteLayout>
</StackLayout>
</ContentView>
@@ -0,0 +1,19 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class MinutesListenedScreen : ContentView
{
public MinutesListenedScreen()
{
InitializeComponent();
CrazyFuckingAnimation();
}
public async void CrazyFuckingAnimation()
{
await RedHalfCircle.ScaleTo(0, 1000, Easing.CubicIn);
await BlueHalfCircle.ScaleTo(1, 1000, Easing.CubicIn);
await BlueHalfCircle.ScaleTo(0, 1000, Easing.CubicIn);
await RedHalfCircle.ScaleTo(1, 1000, Easing.CubicIn);
CrazyFuckingAnimation();
}
}
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
x:Class="TechTitans.Views.Components.EndOfYearRecap.MostListenedGenresScreen">
<VerticalStackLayout>
<Label Text="Overall your music this year was..."
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White" >
</Label>
<CollectionView ItemsSource="{Binding Top5Genres}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border Stroke="#C49B33"
StrokeThickness="4"
Background="#2B0B98"
Padding="16,8"
HorizontalOptions="Center"
Margin="10">
<Border.StrokeShape>
<RoundRectangle CornerRadius="40,0,0,40" />
</Border.StrokeShape>
<Label Text="{Binding .}"
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="30"
TextColor="White"
BackgroundColor="#2B0B98"
WidthRequest="350"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
Padding="0, 20, 0, 20"/>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ContentView>
@@ -0,0 +1,9 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class MostListenedGenresScreen : ContentView
{
public MostListenedGenresScreen()
{
InitializeComponent();
}
}
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.EndOfYearRecap.MostPlayedArtistScreen"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
<StackLayout VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand">
<Image x:Name="RedHalfCircle1"
Source="half_circle.svg"
HeightRequest="128"
Aspect="AspectFit">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
</Image.Behaviors>
</Image>
<Label VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White" >
<Label.Text>
<MultiBinding StringFormat="{}Your top artist this year was {0}">
<Binding Path="MostPlayedArtistPercentile.Item1" />
</MultiBinding>
</Label.Text>
</Label>
<custom:Piechart Progress="{Binding MostPlayedArtistPercentile.Item2}"
ProgressColor="Red"
ProgressLeftColor="LightGreen"
Size="140"
TextColor="DarkGreen"
Thickness="4"
HorizontalOptions="Center"
VerticalOptions="Center"/>
<Label VerticalOptions="End"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White" >
<Label.Text>
<MultiBinding StringFormat="{}Out of all your songs, {0:F2} were by {1}">
<Binding Path="MostPlayedArtistPercentile.Item2" />
<Binding Path="MostPlayedArtistPercentile.Item1" />
</MultiBinding>
</Label.Text>
</Label>
<Image x:Name="RedHalfCircle2"
Source="half_circle.svg"
HeightRequest="128"
Aspect="AspectFit">
<Image.Behaviors>
<toolkit:IconTintColorBehavior TintColor="Red" />
</Image.Behaviors>
</Image>
</StackLayout>
</ContentView>
@@ -0,0 +1,18 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class MostPlayedArtistScreen : ContentView
{
public MostPlayedArtistScreen()
{
InitializeComponent();
AnotherCrazyAnimation();
}
public async void AnotherCrazyAnimation()
{
var t1 = RedHalfCircle1.RotateTo(36000, 200000, Easing.Linear);
var t2 = RedHalfCircle2.RotateTo(-36000, 200000, Easing.Linear);
await Task.WhenAll(t1, t2);
AnotherCrazyAnimation();
}
}
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.EndOfYearRecap.MostPlayedSongScreen"
xmlns:custom="clr-namespace:TechTitans.Views.Components">
<VerticalStackLayout>
<Label VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White" >
<Label.Text>
<MultiBinding StringFormat="{}{0} by {1} was your top track this year">
<Binding Path="MostPlayedSongPercentile.Item1.Name" />
<Binding Path="MostPlayedSongPercentile.Item1.Artist" />
</MultiBinding>
</Label.Text>
</Label>
<Image
Source="{Binding MostPlayedSongPercentile.Item1.Image}"
HeightRequest="256"
Aspect="AspectFit"
Margin="0,40,0,40"
/>
<Label Text="{Binding MostPlayedSongPercentile.Item2, StringFormat='You played it a whopping {0:F2}% of the time'}"
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White"
VerticalTextAlignment="Center"
HorizontalTextAlignment="Center"/>
<custom:Piechart Progress="{Binding MostPlayedSongPercentile.Item2}"
ProgressColor="Red"
ProgressLeftColor="LightGreen"
Size="140"
TextColor="DarkGreen"
Thickness="4"
HorizontalOptions="Center"/>
</VerticalStackLayout>
</ContentView>
@@ -0,0 +1,9 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class MostPlayedSongScreen : ContentView
{
public MostPlayedSongScreen()
{
InitializeComponent();
}
}
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.EndOfYearRecap.NewGenresScreen">
<VerticalStackLayout>
<Label Text="This year you discovered a new taste in music..."
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White" >
</Label>
<CollectionView ItemsSource="{Binding NewGenresDiscovered}">
<CollectionView.ItemTemplate>
<DataTemplate>
<Border Stroke="#C49B33"
StrokeThickness="4"
Background="#2B0B98"
Padding="16,8"
HorizontalOptions="Center"
Margin="10">
<Border.StrokeShape>
<RoundRectangle CornerRadius="40,0,0,40" />
</Border.StrokeShape>
<Label Text="{Binding .}"
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="30"
TextColor="White"
BackgroundColor="#2B0B98"
WidthRequest="350"
HorizontalTextAlignment="Center"
VerticalTextAlignment="Center"
Padding="0, 20, 0, 20"/>
</Border>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ContentView>
@@ -0,0 +1,9 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class NewGenresScreen : ContentView
{
public NewGenresScreen()
{
InitializeComponent();
}
}
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
x:Class="TechTitans.Views.Components.EndOfYearRecap.Top5SongsScreen">
<StackLayout BackgroundColor="Black">
<Label
Text="These were your top five trancks of 2023"
VerticalOptions="Start"
HorizontalOptions="Center"
FontSize="25"
Padding="20,40,20,20"
TextColor="White"/>
<CollectionView ItemsSource="{Binding Top5MostListenedSongs}">
<CollectionView.ItemTemplate>
<DataTemplate>
<custom:SongItem Padding="20,20,0,0" BindingContext="{Binding .}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</ContentView>
@@ -0,0 +1,9 @@
namespace TechTitans.Views.Components.EndOfYearRecap;
public partial class Top5SongsScreen : ContentView
{
public Top5SongsScreen()
{
InitializeComponent();
}
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView
x:Class="TechTitans.Views.Components.Piechart"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:drawables="clr-namespace:TechTitans.Views.Components"
x:Name="this">
<GraphicsView>
<GraphicsView.Drawable>
<drawables:PiechartDrawble
Progress="{Binding Progress, Source={x:Reference this}}"
Size="{Binding Size, Source={x:Reference this}}"
TextColor="{Binding TextColor, Source={x:Reference this}}"
Thickness="{Binding Thickness, Source={x:Reference this}}"
ProgressColor="{Binding ProgressColor, Source={x:Reference this}}"
ProgressLeftColor="{Binding ProgressLeftColor, Source={x:Reference this}}"/>
</GraphicsView.Drawable>
</GraphicsView>
</ContentView>
@@ -0,0 +1,63 @@
namespace TechTitans.Views.Components;
public partial class Piechart : ContentView
{
public Piechart()
{
InitializeComponent();
}
public static readonly BindableProperty ProgressProperty = BindableProperty.Create(nameof(Progress), typeof(float), typeof(Piechart));
public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(int), typeof(Piechart));
public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(int), typeof(Piechart));
public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(Piechart));
public static readonly BindableProperty ProgressLeftColorProperty = BindableProperty.Create(nameof(ProgressLeftColor), typeof(Color), typeof(Piechart));
public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(Piechart));
public float Progress
{
get { return (float)GetValue(ProgressProperty); }
set { SetValue(ProgressProperty, value); }
}
public int Size
{
get { return (int)GetValue(SizeProperty); }
set { SetValue(SizeProperty, value); }
}
public int Thickness
{
get { return (int)GetValue(ThicknessProperty); }
set { SetValue(ThicknessProperty, value); }
}
public Color ProgressColor
{
get { return (Color)GetValue(ProgressColorProperty); }
set { SetValue(ProgressColorProperty, value); }
}
public Color ProgressLeftColor
{
get { return (Color)GetValue(ProgressLeftColorProperty); }
set { SetValue(ProgressLeftColorProperty, value); }
}
public Color TextColor
{
get { return (Color)GetValue(TextColorProperty); }
set { SetValue(TextColorProperty, value); }
}
protected override void OnPropertyChanged(string propertyName = null)
{
base.OnPropertyChanged(propertyName);
if (propertyName == SizeProperty.PropertyName)
{
HeightRequest = Size;
WidthRequest = Size;
}
}
}
@@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TechTitans.Views.Components
{
public class PiechartDrawble : BindableObject, IDrawable
{
public static readonly BindableProperty ProgressProperty = BindableProperty.Create(nameof(Progress), typeof(float), typeof(PiechartDrawble));
public static readonly BindableProperty SizeProperty = BindableProperty.Create(nameof(Size), typeof(int), typeof(PiechartDrawble));
public static readonly BindableProperty ThicknessProperty = BindableProperty.Create(nameof(Thickness), typeof(int), typeof(PiechartDrawble));
public static readonly BindableProperty ProgressColorProperty = BindableProperty.Create(nameof(ProgressColor), typeof(Color), typeof(PiechartDrawble));
public static readonly BindableProperty ProgressLeftColorProperty = BindableProperty.Create(nameof(ProgressLeftColor), typeof(Color), typeof(PiechartDrawble));
public static readonly BindableProperty TextColorProperty = BindableProperty.Create(nameof(TextColor), typeof(Color), typeof(PiechartDrawble));
public float Progress
{
get => (float)GetValue(ProgressProperty);
set => SetValue(ProgressProperty, value);
}
public int Size
{
get { return (int)GetValue(SizeProperty); }
set { SetValue(SizeProperty, value); }
}
public int Thickness
{
get { return (int)GetValue(ThicknessProperty); }
set { SetValue(ThicknessProperty, value); }
}
public Color ProgressColor
{
get { return (Color)GetValue(ProgressColorProperty); }
set { SetValue(ProgressColorProperty, value); }
}
public Color ProgressLeftColor
{
get { return (Color)GetValue(ProgressLeftColorProperty); }
set { SetValue(ProgressLeftColorProperty, value); }
}
public Color TextColor
{
get { return (Color)GetValue(TextColorProperty); }
set { SetValue(TextColorProperty, value); }
}
public void Draw(ICanvas canvas, RectF dirtyRect)
{
float effectiveSize = Size - Thickness;
float x = Thickness / 2;
float y = Thickness / 2;
if (Progress < 0)
{
Progress = 0;
}
else if (Progress > 100)
{
Progress = 100;
}
if (Progress < 100)
{
float angle = GetAngle(Progress);
canvas.StrokeColor = ProgressLeftColor;
canvas.StrokeSize = Thickness;
canvas.DrawEllipse(x, y, effectiveSize, effectiveSize);
// Draw arc
canvas.StrokeColor = ProgressColor;
canvas.StrokeSize = Thickness;
canvas.DrawArc(x, y, effectiveSize, effectiveSize, 90, angle, true, false);
}
else
{
// Draw circle
canvas.StrokeColor = ProgressColor;
canvas.StrokeSize = Thickness;
canvas.DrawEllipse(x, y, effectiveSize, effectiveSize);
}
// Make the percentage always the same size in relation to the size of the progress bar
}
private float GetAngle(float progress)
{
float factor = 90f / 25f;
if (progress > 75)
{
return -180 - ((progress - 75) * factor);
}
else if (progress > 50)
{
return -90 - ((progress - 50) * factor);
}
else if (progress > 25)
{
return 0 - ((progress - 25) * factor);
}
else
{
return 90 - (progress * factor);
}
}
}
}
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.SongItem"
>
<HorizontalStackLayout>
<Image
Source="{Binding Image}"
HeightRequest="64"
Aspect="AspectFit"
/>
<VerticalStackLayout Padding="10,0">
<Label
Text="{Binding Name}"
VerticalOptions="Center"
HorizontalOptions="Start"
FontSize="24"
/>
<Label
Text="{Binding Artist}"
VerticalOptions="Center"
HorizontalOptions="Start"
FontSize="16"
/>
</VerticalStackLayout>
</HorizontalStackLayout>
</ContentView>
@@ -0,0 +1,28 @@
using TechTitans.Models;
namespace TechTitans.Views.Components;
public partial class SongItem : ContentView
{
public SongBasicInfo mockSong = new()
{
SongId = 1,
Name = "Roma",
Genre = "Manele",
Subgenre = "Trapanele",
Artist = "BDLP",
Features = new[] { "Ian" },
Language = "Romanian",
Country = "Romania",
Album = "Single",
Image = "song_img_default.png"
};
public SongItem()
{
if (BindingContext == null)
BindingContext = mockSong;
InitializeComponent();
}
}
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.Components.User.SearchSongsButton">
<VerticalStackLayout>
<Button
x:Name="Search"
Text="Search"
Clicked="OnSearchClick"
HorizontalOptions="Start"
Margin="15,0,0,0"
/>
<!--xaml e retardat ca se ia left,top,right,bottom la margin si restu in loc sa inceapa de la top ca in css-->
</VerticalStackLayout>
</ContentView>
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TechTitans.Views.Components.User
{
public partial class SearchSongsButton : ContentView
{
public SearchSongsButton()
{
InitializeComponent();
}
private void OnSearchClick(object sender, EventArgs e)
{
Navigation.PushAsync(new SearchPage());
}
}
}
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
x:Class="TechTitans.Views.Components.User.UserSongDashboard"
Title="Song Dashboard">
<VerticalStackLayout>
<VerticalStackLayout Padding="20" Spacing="10">
<Image
x:Name="SongImage"
HorizontalOptions="Start"
HeightRequest="256"
WidthRequest="256"
/>
<Label
x:Name="SongTitle"
Text=""
FontSize="32"
FontAttributes="Bold"
WidthRequest="256"
HorizontalOptions="Start"
/>
<Label
x:Name="SongArtist"
Text=""
FontSize="20"
TextColor="#6E6E6E"
Margin="0,-10,0,0"
HorizontalOptions="Start"
/>
<Label
x:Name="SongAlbum"
Text=""
FontSize="24"
HorizontalOptions="Start"
/>
</VerticalStackLayout>
<!--linie f ghetto-->
<BoxView Color="Gray" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="10, 5" />
<HorizontalStackLayout HorizontalOptions="CenterAndExpand" Spacing="10">
<VerticalStackLayout>
<Button
Text="Info"
Style="{StaticResource TabNavButton}"
TextColor="#6E6E6E"
FontAttributes="Bold"
Clicked="OnInfoClick"
/>
<BoxView x:Name="InfoBoxView" Color="#6E6E6E" HeightRequest="2" HorizontalOptions="FillAndExpand"/>
</VerticalStackLayout>
</HorizontalStackLayout>
<Frame
CornerRadius="10"
Margin="20,20,20,0"
Padding="10"
BackgroundColor="#6E6E6E"
>
<HorizontalStackLayout Spacing="40" HorizontalOptions="Center">
<VerticalStackLayout Spacing="20" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Label
x:Name="label1"
Text=""
FontSize="16"
/>
<Label
x:Name="label2"
Text=""
FontSize="16"
/>
<Label
x:Name="label3"
Text=""
FontSize="16"
/>
<Label
x:Name="label4"
Text=""
FontSize="16"
/>
</VerticalStackLayout>
<VerticalStackLayout Spacing="20" VerticalOptions="FillAndExpand" HorizontalOptions="EndAndExpand">
<Label
x:Name="content1"
Text=""
FontSize="16"
/>
<Label
x:Name="content2"
Text=""
FontSize="16"
/>
<Label
x:Name="content3"
Text=""
FontSize="16"
/>
<Label
x:Name="content4"
Text=""
FontSize="16"
/>
</VerticalStackLayout>
</HorizontalStackLayout>
</Frame>
</VerticalStackLayout>
</ContentPage>
@@ -0,0 +1,72 @@
using TechTitans.Models;
using TechTitans.ViewModels;
namespace TechTitans.Views.Components.User
{
public partial class UserSongDashboard : ContentPage
{
// alt domain song type cu mai multe detalii
int songId;
ArtistSongDashboardViewModel viewModel;
public UserSongDashboard(SongBasicInfo song)
{
// song = service.GetSongById(songId);
songId = song.SongId;
InitializeComponent();
populateViewModel();
LoadPage();
}
private void populateViewModel()
{
// viewModel = getArtistSongDashboardModel(int sondId)
viewModel = getMockedViewModel();
}
private void LoadPage()
{
SongImage.Source = viewModel.SongInfo.Image;
SongTitle.Text = viewModel.SongInfo.Name;
SongArtist.Text = "by " + viewModel.ArtistInfo.Name;
SongAlbum.Text = "from " + viewModel.SongInfo.Album;
// set song info panel
label1.Text = "Genre:";
content1.Text = viewModel.SongInfo.Genre;
label2.Text = "Subgenre:";
content2.Text = viewModel.SongInfo.Subgenre;
label3.Text = "Country:";
content3.Text = viewModel.SongInfo.Country;
label4.Text = "Language:";
content4.Text = viewModel.SongInfo.Language;
}
private SongBasicInfo getMockedSong()
{
return new SongBasicInfo();
}
private ArtistSongDashboardViewModel getMockedViewModel()
{
var mockedModel = new ArtistSongDashboardViewModel()
{
SongInfo = new SongBasicInfo(),
SongDetails = new SongRecommendationDetails(),
ArtistInfo = new AuthorDetails(),
};
return mockedModel;
}
private void OnInfoClick(object sender, EventArgs e)
{
InfoBoxView.Color = Color.FromArgb("#6E6E6E");
label1.Text = "Genre:";
content1.Text = viewModel.SongInfo.Genre;
label2.Text = "Subgenre:";
content2.Text = viewModel.SongInfo.Subgenre;
label3.Text = "Country:";
content3.Text = viewModel.SongInfo.Country;
label4.Text = "Language:";
content4.Text = viewModel.SongInfo.Language;
}
}
}
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:Screens="clr-namespace:TechTitans.Views.Components.EndOfYearRecap"
x:Class="TechTitans.Views.EndOfYearRecap"
NavigationPage.HasNavigationBar="False">
<StackLayout>
<StackLayout VerticalOptions="Start" HorizontalOptions="Center" Orientation="Horizontal">
<ProgressBar x:Name="ProgressBar1" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar2" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar3" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar4" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar5" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar6" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar7" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
<ProgressBar x:Name="ProgressBar8" VerticalOptions="Start" HorizontalOptions="Center" Margin="5,0,5,0"/>
</StackLayout>
<ContentView x:Name="MainContentWindow" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<ContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
</ContentView.GestureRecognizers>
</ContentView>
</StackLayout>
</ContentPage>
@@ -0,0 +1,166 @@
using TechTitans.Enums;
using TechTitans.Models;
using TechTitans.Services;
using TechTitans.ViewModels;
using TechTitans.Views.Components.EndOfYearRecap;
namespace TechTitans.Views;
public partial class EndOfYearRecap : ContentPage
{
private int _pageIndex = 0;
private List<ProgressBar> _progressBar;
private EndOfYearRecapViewModel _viewModel;
public EndOfYearRecap()
{
var mockSongs = new List<SongBasicInfo>()
{
new()
{
SongId = 1,
Name = "Roma1",
Genre = "Manele",
Subgenre = "Trapanele",
Artist = "BDLP",
Features = new[] {"Ian"},
Language = "Romanian",
Country = "Romania",
Album = "Single",
Image = "https://i.ytimg.com/vi/Ovbn5mPit8o/sddefault.jpg?v=64c3f573"
},
new()
{
SongId = 1,
Name = "Roma2",
Genre = "Manele",
Subgenre = "Trapanele",
Artist = "BDLP",
Features = new[] {"Ian"},
Language = "Romanian",
Country = "Romania",
Album = "Single",
Image = "https://i.ytimg.com/vi/Ovbn5mPit8o/sddefault.jpg?v=64c3f573"
},
new()
{
SongId = 1,
Name = "Roma3",
Genre = "Manele",
Subgenre = "Trapanele",
Artist = "BDLP",
Features = new[] {"Ian"},
Language = "Romanian",
Country = "Romania",
Album = "Single",
Image = "https://i.ytimg.com/vi/Ovbn5mPit8o/sddefault.jpg?v=64c3f573"
},
new()
{
SongId = 1,
Name = "Roma4",
Genre = "Manele",
Subgenre = "Trapanele",
Artist = "BDLP",
Features = new[] {"Ian"},
Language = "Romanian",
Country = "Romania",
Album = "Single",
Image = "https://i.ytimg.com/vi/Ovbn5mPit8o/sddefault.jpg?v=64c3f573"
},
new SongBasicInfo()
{
SongId = 1,
Name = "Roma5",
Genre = "Manele",
Subgenre = "Trapanele",
Artist = "BDLP",
Features = new[] {"Ian"},
Language = "Romanian",
Country = "Romania",
Album = "Single",
Image = "https://i.ytimg.com/vi/Ovbn5mPit8o/sddefault.jpg?v=64c3f573"
}
};
var viewModel = new EndOfYearRecapViewModel()
{
Top5MostListenedSongs = mockSongs,
MostPlayedSongPercentile = new Tuple<SongBasicInfo, decimal>(mockSongs.FirstOrDefault(), 0.1m),
MostPlayedArtistPercentile = new Tuple<string, decimal>("BDLP", 0.01m),
MinutesListened = 9000,
Top5Genres = ["Manele", "Trap", "Rock", "Rap", "Pop"],
NewGenresDiscovered = ["Jazz", "Populara", "Clasical", "R&B", "Country"],
ListenerPersonality = ListenerPersonality.Explorer
};
viewModel = new RecapService().GenerateEndOfYearRecap(1001);
BindingContext = viewModel;
_viewModel = viewModel;
InitializeComponent();
_progressBar = [ProgressBar1, ProgressBar2, ProgressBar3, ProgressBar4, ProgressBar5, ProgressBar6, ProgressBar7, ProgressBar8];
ChangeScreens();
}
private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e) {
await _progressBar[_pageIndex - 1].ProgressTo(1,0,Easing.Linear);
}
private async void ChangeScreens()
{
_pageIndex++;
switch (_pageIndex)
{
case 1:
MainContentWindow.Content = new FirstScreen();
break;
case 2:
MainContentWindow.Content = new MinutesListenedScreen()
{
BindingContext = BindingContext
};
break;
case 3:
MainContentWindow.Content = new Top5SongsScreen()
{
BindingContext = BindingContext
};
break;
case 4:
MainContentWindow.Content = new MostPlayedSongScreen()
{
BindingContext = BindingContext
};
break;
case 5:
MainContentWindow.Content = new MostPlayedArtistScreen()
{
BindingContext = BindingContext
};
break;
case 6:
MainContentWindow.Content = new MostListenedGenresScreen()
{
BindingContext = BindingContext
};
break;
case 7:
MainContentWindow.Content = new NewGenresScreen()
{
BindingContext = BindingContext
};
break;
case 8:
MainContentWindow.Content = new ListenerPersonalityScreen(_viewModel)
{
BindingContext = BindingContext,
};
break;
default:
await Navigation.PopAsync();
return;
}
await _progressBar[_pageIndex - 1].ProgressTo(1, 5000, Easing.Linear);
ChangeScreens();
}
}
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TechTitans.Views.MainPage">
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<Image
Source="retarded_logo.png"
HeightRequest="185"
Aspect="AspectFit"
/>
<Label
Text="Coxify"
Style="{StaticResource Headline}"
SemanticProperties.HeadingLevel="Level1"
/>
<Button
x:Name="UserBtn"
Text="User View"
Clicked="OnUserCLicked"
HorizontalOptions="Fill"
/>
<Button
x:Name="ArtistBtn"
Text="Artist View"
Clicked="OnArtistClicked"
HorizontalOptions="Fill"
/>
<Button
x:Name="AnaylstBtn"
Text="Analyst View"
Clicked="OnAnalystClicked"
HorizontalOptions="Fill"
/>
<Button
x:Name="EndOfYearRecapBtn"
Text="End Of Year Recap View"
Clicked="OnEndOfYearRecapClicked"
HorizontalOptions="Fill"
/>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
@@ -0,0 +1,73 @@
using TechTitans.Models;
using TechTitans.Repositories;
namespace TechTitans.Views;
public partial class MainPage : ContentPage
{
int count = 0;
public TestRepository Repository { get; set; }
public TestDemographicDetails RepositoryDemographic { get; set; }
public TestAuthorDetails RepositoryAuthorDetails { get; set; }
public TestSongBasicDetails RepositorySongBasicDetails { get; set; }
public TestTrends RepositoryTestTrends { get; set; }
public TestUserPlaybackBehaviour RepositoryUserPlaybackBehaviour { get; set; }
public TestAdDistributionData RepositoryAdDistributionData { get; set; }
public TestSongRecommendationDetails RepositorySongRecommendationDetails { get; set; }
public TestSongFeatures RepositorySongFeatures { get; set; }
// public TestRepositoryDemographic Repository { get; set; }
public MainPage()
{
InitializeComponent();
//Repository = new TestRepository();
//var dbData = Repository.TestMethod();
//TestId.Text = dbData.Id.ToString();
//TestName.Text = dbData.Name;
// RepositoryDemographic = new TestDemographicDetails();
// var dbDataDemographic = RepositoryDemographic.TestMethod();
// TestId.Text = dbDataDemographic.UserId.ToString();
// TestName.Text = dbDataDemographic.Name;
//RepositoryAuthorDetails = new TestAuthorDetails();
//var dbDataAuthorDetails = RepositoryAuthorDetails.TestMethod();
// RepositorySongBasicDetails = new TestSongBasicDetails();
// var dbDataSongBasicDetails = RepositorySongBasicDetails.TestMethod();
// TestId.Text = dbDataSongBasicDetails.SongId.ToString();
// TestName.Text = dbDataSongBasicDetails.Name;
// RepositoryTestTrends = new TestTrends();
// var dbDataTestTrends = RepositoryTestTrends.TestMethod();
// TestId.Text = dbDataTestTrends.SongId.ToString();
// TestName.Text = dbDataTestTrends.Genre;
// RepositoryAdDistributionData = new TestAdDistributionData();
// var dbDataAdDistributionData = RepositoryAdDistributionData.TestMethod();
// TestId.Text = dbDataAdDistributionData.SongId.ToString();
// TestName.Text = dbDataAdDistributionData.AdCampaign.ToString();
// RepositoryUserPlaybackBehaviour = new TestUserPlaybackBehaviour();
// var dbDataUserPlaybackBehaviour = RepositoryUserPlaybackBehaviour.TestMethod();
// TestId.Text = dbDataUserPlaybackBehaviour.UserId.ToString();
// TestName.Text = dbDataUserPlaybackBehaviour.EventType.ToString();
// RepositorySongRecommendationDetails = new TestSongRecommendationDetails();
// var dbDataSongRecommendationDetails = RepositorySongRecommendationDetails.TestMethod();
// TestId.Text = dbDataSongRecommendationDetails.SongId.ToString();
// TestName.Text = dbDataSongRecommendationDetails.Likes.ToString();
// RepositorySongFeatures = new TestSongFeatures();
// var dbDataSongFeatures = RepositorySongFeatures.TestMethod();
// TestId.Text = dbDataSongFeatures.SongId.ToString();
// TestName.Text = dbDataSongFeatures.ArtistId.ToString();
}
private void OnUserCLicked(object sender, EventArgs e) => Navigation.PushAsync(new UserPage());
private void OnArtistClicked(object sender, EventArgs e) => Navigation.PushAsync(new ArtistPage());
private void OnAnalystClicked(object sender, EventArgs e) => Navigation.PushAsync(new AnalystPage());
private void OnEndOfYearRecapClicked(object sender, EventArgs e) => Navigation.PushAsync(new EndOfYearRecap());
}
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom_user="clr-namespace:TechTitans.Views.Components.User"
x:Class="TechTitans.Views.SearchPage"
Title="SearchPage">
<ScrollView>
<VerticalStackLayout
Padding="30,0"
Spacing="25">
<SearchBar
Placeholder="find a song..."
TextChanged="SearchBar_TextChanged">
</SearchBar>
<VerticalStackLayout Spacing="15" Padding="10, 0">
<Grid x:Name="SongsGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using TechTitans.Views.Components.User;
using TechTitans.Views.Components;
using TechTitans.Models;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TechTitans.Models;
namespace TechTitans.Views
{
public partial class SearchPage : ContentPage
{
public SearchPage() {
InitializeComponent();
}
int rowIndex = 0;
int columnIndex = 0;
private void SearchBar_TextChanged(object sender, EventArgs e) {
//here we should search from our database with some function (in repo/service) but will do
//a mock function just for frontend development puposes
// Clear existing children from SongsGrid
SongsGrid.Children.Clear();
string song_to_find=((SearchBar)sender).Text;
var songs = new ObservableCollection<SongBasicInfo>(GetSongs(song_to_find));
SongsGrid.RowDefinitions.Add(new RowDefinition());
foreach (var song in songs)
{
var songItem = new SongItem(); // Create a new instance of SongItem
songItem.BindingContext = song; // Set the song as the binding context of the SongItem
songItem.Margin = new Thickness(0, 5, 0, 5); // Set margin as needed
// Add TapGestureRecognizer to handle tap event
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += SongItem_Tapped;
songItem.GestureRecognizers.Add(tapGestureRecognizer);
// Set the row and column of the SongItem in the grid
Grid.SetRow(songItem, rowIndex);
Grid.SetColumn(songItem, columnIndex);
// Add the SongItem to the grid
SongsGrid.Children.Add(songItem);
columnIndex++;
if (columnIndex == 2)
{
columnIndex = 0;
SongsGrid.RowDefinitions.Add(new RowDefinition());
rowIndex++;
}
}
}
public ObservableCollection<SongBasicInfo> GetSongs(string song_to_find)
{
//here a more complexe function should be implemented with the sont_to_find parameter that returns only songs that match
return new ObservableCollection<SongBasicInfo>
{
new SongBasicInfo { SongId = 0, Name = "Song 1", Artist = "Artist 1", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album"},
new SongBasicInfo { SongId = 1, Name = "Song 2", Artist = "Artist 2", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album"},
new SongBasicInfo { SongId = 2, Name = "Song 3", Artist = "Artist 3", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album" },
new SongBasicInfo {SongId = 3, Name = "Song 4", Artist = "Artist 4", Image = "song_img_default.png", Genre = "genre", Subgenre = "subgenre", Country = "country", Language = "language", Album = "album"},
new SongBasicInfo { SongId = 4, Name = "Song 5", Artist = "Artist 5", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album" },
new SongBasicInfo {SongId = 5, Name = "Song 6", Artist = "Artist 6", Image = "song_img_default.png", Genre = "genre", Subgenre = "subgenre", Country = "country", Language = "language", Album = "album"},
};
}
private void SongItem_Tapped(object sender, System.EventArgs e)
{
// open ArtistSongDashboard page with song details
var songItem = (SongItem)sender;
var songInfo = songItem.BindingContext as SongBasicInfo;
Navigation.PushAsync(new UserSongDashboard(songInfo));
}
}
}
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--import pt Components namesapace ca sa putem refolosi componente (this some DRY shit)
asta e syntaxa: xmlns:custom="clr-namespace:TechTitans.Views.Components"-->
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:custom="clr-namespace:TechTitans.Views.Components"
xmlns:custom_user="clr-namespace:TechTitans.Views.Components.User"
x:Class="TechTitans.Views.UserPage"
Title="UserPage">
<ScrollView>
<VerticalStackLayout>
<custom_user:SearchSongsButton/>
<Label
Text="Your Most Listened Songs"
VerticalOptions="Center"
HorizontalOptions="Start"
FontAttributes="Bold"
FontSize="16"
Margin="10,0,0,0"
/>
<BoxView Color="#6E6E6E" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="10,5" />
<VerticalStackLayout Spacing="15" Padding="10, 0">
<Grid x:Name="SongsGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</VerticalStackLayout>
<Label
Text="Recommended Songs"
VerticalOptions="Center"
HorizontalOptions="Start"
FontAttributes="Bold"
FontSize="16"
Margin="10,0,0,0"
/>
<BoxView Color="#6E6E6E" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="10,5"/>
<VerticalStackLayout Spacing="15" Padding="10, 0">
<Grid x:Name="SongsRecommandationGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</VerticalStackLayout>
<Label
Text="Advertised Songs"
VerticalOptions="Center"
HorizontalOptions="Start"
FontAttributes="Bold"
FontSize="16"
Margin="10,0,0,0"
/>
<BoxView Color="#6E6E6E" HeightRequest="2" HorizontalOptions="FillAndExpand" Margin="10,5"/>
<VerticalStackLayout Spacing="15" Padding="10, 0">
<Grid x:Name="SongsAdvertisedGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</ContentPage>
@@ -0,0 +1,152 @@
namespace TechTitans.Views;
using TechTitans.Views.Components.User;
using TechTitans.Views.Components;
using TechTitans.Models;
using TechTitans.Repositories;
using TechTitans.Services;
public partial class UserPage : ContentPage
{
UserService userService=new UserService();
public UserPage()
{
InitializeComponent();
LoadSongs(); //here we load the most recently played songs
LoadSongRecommandation(); //here we load song recommandation
LoadAdvertisedSongs(); //here we load song advertised
}
private void LoadSongs()
{
var songs = userService.get_recently_played(); // Get your list of most recently played songs from somewhere (e.g., database, API, local storage)
// Loop through each song and dynamically create SongItem controls
int rowIndex = 0;
int columnIndex = 0;
SongsGrid.RowDefinitions.Add(new RowDefinition());
foreach (var song in songs)
{
var songItem = new SongItem(); // Create a new instance of SongItem
songItem.BindingContext = song; // Set the song as the binding context of the SongItem
songItem.Margin = new Thickness(0, 5, 0, 5); // Set margin as needed
// Add TapGestureRecognizer to handle tap event
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += SongItem_Tapped;
songItem.GestureRecognizers.Add(tapGestureRecognizer);
// Set the row and column of the SongItem in the grid
Grid.SetRow(songItem, rowIndex);
Grid.SetColumn(songItem, columnIndex);
// Add the SongItem to the grid
SongsGrid.Children.Add(songItem);
columnIndex++;
if (columnIndex == 2)
{
columnIndex = 0;
rowIndex++;
SongsGrid.RowDefinitions.Add(new RowDefinition());
}
}
}
private void LoadAdvertisedSongs()
{
var songs = GetSongs(); // Get your list of recommended songs from somewhere (e.g., database, API, local storage)
//for now we use the same mock function for retreving songs for frontend building purposes
// Loop through each song and dynamically create SongItem controls
int rowIndex = 0;
int columnIndex = 0;
SongsAdvertisedGrid.RowDefinitions.Add(new RowDefinition());
foreach (var song in songs)
{
var songItem = new SongItem(); // Create a new instance of SongItem
songItem.BindingContext = song; // Set the song as the binding context of the SongItem
songItem.Margin = new Thickness(0, 5, 0, 5); // Set margin as needed
// Add TapGestureRecognizer to handle tap event
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += SongItem_Tapped;
songItem.GestureRecognizers.Add(tapGestureRecognizer);
// Set the row and column of the SongItem in the grid
Grid.SetRow(songItem, rowIndex);
Grid.SetColumn(songItem, columnIndex);
// Add the SongItem to the grid
SongsAdvertisedGrid.Children.Add(songItem);
columnIndex++;
if (columnIndex == 2)
{
columnIndex = 0;
rowIndex++;
SongsAdvertisedGrid.RowDefinitions.Add(new RowDefinition());
}
}
}
private void LoadSongRecommandation()
{
var songs = GetSongs(); // Get your list of recommended songs from somewhere (e.g., database, API, local storage)
//for now we use the same mock function for retreving songs for frontend building purposes
//note: we will need multiple sql commands for retriving different type of recommandations
// Loop through each song and dynamically create SongItem controls
int rowIndex = 0;
int columnIndex = 0;
SongsRecommandationGrid.RowDefinitions.Add(new RowDefinition());
foreach (var song in songs)
{
var songItem = new SongItem(); // Create a new instance of SongItem
songItem.BindingContext = song; // Set the song as the binding context of the SongItem
songItem.Margin = new Thickness(0, 5, 0, 5); // Set margin as needed
// Add TapGestureRecognizer to handle tap event
var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += SongItem_Tapped;
songItem.GestureRecognizers.Add(tapGestureRecognizer);
// Set the row and column of the SongItem in the grid
Grid.SetRow(songItem, rowIndex);
Grid.SetColumn(songItem, columnIndex);
// Add the SongItem to the grid
SongsRecommandationGrid.Children.Add(songItem);
columnIndex++;
if (columnIndex == 2)
{
columnIndex = 0;
rowIndex++;
SongsRecommandationGrid.RowDefinitions.Add(new RowDefinition());
}
}
}
private void SongItem_Tapped(object sender, System.EventArgs e)
{
// open ArtistSongDashboard page with song details
var songItem = (SongItem)sender;
var songInfo = songItem.BindingContext as SongBasicInfo;
Navigation.PushAsync(new UserSongDashboard(songInfo));
}
private List<SongBasicInfo> GetSongs()
{
// Creating a list of strings
List<string> features = new List<string>();
// Adding strings to the list
features.Add("feature1");
// mocked songs, to be replaced with actual data retrieval from db
return new List<SongBasicInfo>
{
new SongBasicInfo { SongId = 0, Name = "Song 1", Artist = "Artist 1", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album", Features=features },
new SongBasicInfo { SongId = 1, Name = "Song 2", Artist = "Artist 2", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album", Features=features },
new SongBasicInfo { SongId = 2, Name = "Song 3", Artist = "Artist 3", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album", Features=features },
new SongBasicInfo {SongId = 3, Name = "Song 4", Artist = "Artist 4", Image = "song_img_default.png", Genre = "genre", Subgenre = "subgenre", Country = "country", Language = "language", Album = "album", Features = features},
new SongBasicInfo { SongId = 4, Name = "Song 5", Artist = "Artist 5", Image = "song_img_default.png", Genre="genre", Subgenre="subgenre", Country="country", Language="language", Album="album", Features=features },
new SongBasicInfo {SongId = 5, Name = "Song 6", Artist = "Artist 6", Image = "song_img_default.png", Genre = "genre", Subgenre = "subgenre", Country = "country", Language = "language", Album = "album", Features = features},
};
}
}