1. Adding Artist View and related classes. 66/262266/5
authorshivamv <shivam.v2@samsung.com>
Thu, 5 Aug 2021 10:39:49 +0000 (16:09 +0530)
committershivamv <shivam.v2@samsung.com>
Wed, 11 Aug 2021 09:20:04 +0000 (14:50 +0530)
2. Adding Artist : Details View and related classes.
3. Modifying MediaContent classes.

Change-Id: I66dcf5d5ca6156fac07e4fd6e71e1ce40242b558
Signed-off-by: shivamv <shivam.v2@samsung.com>
16 files changed:
MediaContent/AlbumContents.cs
MediaContent/ArtistContents.cs
Models/Album.cs
Models/AlbumDataProvider.cs
Models/Artist.cs [new file with mode: 0755]
Models/ArtistDataProvider.cs [new file with mode: 0755]
Models/ArtistDetailAlbum.cs [new file with mode: 0755]
Models/Track.cs
ViewModels/AlbumViewModel.cs
ViewModels/ArtistDetailViewModel.cs [new file with mode: 0755]
ViewModels/ArtistViewModel.cs [new file with mode: 0755]
Views/AlbumDetailView.cs
Views/ArtistDetailGroupLayout.cs [new file with mode: 0755]
Views/ArtistDetailItemLayout.cs [new file with mode: 0755]
Views/ArtistDetailView.cs [new file with mode: 0755]
Views/ArtistView.cs [new file with mode: 0755]

index 92fdbfe5facd4f4233aad26bf32a30acb9927fad..2e86e50f1274d43bca2b4f6b22fbc3933526122a 100755 (executable)
@@ -11,13 +11,16 @@ namespace MusicPlayer.Media
         {\r
             OrderedDictionary albumList = new OrderedDictionary();\r
 \r
-            SelectArguments arguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
-            MediaDataReader<Album> dataReader = albumInfo.Select(arguments);\r
+            SelectArguments albumSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<Album> dataReader = albumInfo.Select(albumSelectArguments);\r
 \r
             while (dataReader.Read())\r
             {\r
                 Album info = dataReader.Current;\r
-                albumList.Add(info.Id, info);\r
+                SelectArguments audioSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);\r
+                MediaDataReader<MediaInfo> albumDataReader = albumInfo.SelectMember(info.Id, audioSelectArguments);\r
+                if (albumDataReader.Read())\r
+                    albumList.Add(info.Id, info);\r
             }\r
             Tizen.Log.Debug(AppConstants.LogTag, "Total album retrived from database: " + albumList.Count);\r
             dataReader.Dispose();\r
@@ -32,7 +35,8 @@ namespace MusicPlayer.Media
         public static OrderedDictionary GetAlbumMemberList(int albumId)\r
         {\r
             OrderedDictionary mediaList = new OrderedDictionary();\r
-            MediaDataReader<MediaInfo> dataReader = albumInfo.SelectMember(albumId);\r
+            SelectArguments audioSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<MediaInfo> dataReader = albumInfo.SelectMember(albumId, audioSelectArguments);\r
 \r
             while (dataReader.Read())\r
             {\r
@@ -43,5 +47,20 @@ namespace MusicPlayer.Media
             dataReader.Dispose();\r
             return mediaList;\r
         }\r
+\r
+        public static string GetAlbumArtPath(int albumId)\r
+        {\r
+            string path = "";\r
+            SelectArguments audioSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<MediaInfo> dataReader = albumInfo.SelectMember(albumId, audioSelectArguments);\r
+            while (dataReader.Read())\r
+            {\r
+                MediaInfo info = dataReader.Current;\r
+                if (!string.IsNullOrEmpty(info.ThumbnailPath))\r
+                    path = info.ThumbnailPath;\r
+            }\r
+            dataReader.Dispose();\r
+            return path;\r
+        }\r
     }\r
 }\r
index e9e2b6659574904a6d1090999fa755b7557d0cee..f6da163ab156577fb643f3b26730028742ff385f 100755 (executable)
@@ -13,8 +13,8 @@ namespace MusicPlayer.Media
         {\r
             List<string> artistList = new List<string>();\r
 \r
-            SelectArguments arguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Artist + MEDIA_SORT_ORDER_ASC);\r
-            MediaDataReader<string> dataReader = mediaInfo.SelectGroupBy(MediaInfoColumnKey.Artist, arguments);\r
+            SelectArguments artistSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Artist + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<string> dataReader = mediaInfo.SelectGroupBy(MediaInfoColumnKey.Artist, artistSelectArguments);\r
 \r
             while (dataReader.Read())\r
             {\r
@@ -30,26 +30,97 @@ namespace MusicPlayer.Media
         {\r
             OrderedDictionary albumList = new OrderedDictionary();\r
             string expression = MEDIA_STORAGE_TYPE_QUERY + "AND " + AlbumColumns.Artist + "=\"" + artistName + "\"";\r
-            SelectArguments arguments = CreateSelectArgument(expression, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
-            MediaDataReader<Album> dataReader = albumInfo.Select(arguments);\r
+            SelectArguments albumSelectArguments = CreateSelectArgument(expression, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<Album> dataReader = albumInfo.Select(albumSelectArguments);\r
 \r
             while (dataReader.Read())\r
             {\r
                 Album info = dataReader.Current;\r
-                albumList.Add(info.Id, info);\r
+                SelectArguments audioSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);\r
+                MediaDataReader<MediaInfo> albumDataReader = albumInfo.SelectMember(info.Id, audioSelectArguments);\r
+                if(albumDataReader.Read())\r
+                    albumList.Add(info.Id, info);\r
             }\r
             dataReader.Dispose();\r
+            Tizen.Log.Debug(AppConstants.LogTag, "Total Albums retrived from Artist: " + albumList.Count);\r
             return albumList;\r
         }\r
 \r
-        public static int GetAlblumCountForArtist(string artistName)\r
+        public static OrderedDictionary GetTrackListForArtist(string artistName)\r
+        {\r
+            OrderedDictionary mediaList = new OrderedDictionary();\r
+            string expression = MEDIA_STORAGE_TYPE_QUERY + "AND " + AlbumColumns.Artist + "=\"" + artistName + "\"";\r
+            SelectArguments albumSelectArguments = CreateSelectArgument(expression, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<Album> dataReader = albumInfo.Select(albumSelectArguments);\r
+\r
+            while (dataReader.Read())\r
+            {\r
+                Album info = dataReader.Current;\r
+                SelectArguments audioSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);\r
+                MediaDataReader<MediaInfo> albumDataReader = albumInfo.SelectMember(info.Id, audioSelectArguments);\r
+\r
+                while (albumDataReader.Read())\r
+                {\r
+                    MediaInfo mediaInfo = albumDataReader.Current;\r
+                    mediaList.Add(mediaInfo.Id, mediaInfo);\r
+                }\r
+                albumDataReader.Dispose();\r
+            }\r
+            dataReader.Dispose();\r
+            Tizen.Log.Debug(AppConstants.LogTag, "Total track retrived from Artist: " + mediaList.Count);\r
+            return mediaList;\r
+        }\r
+\r
+        public static string GetAlbumArtPathForArtist(string artistName)\r
+        {\r
+            string expression = MEDIA_STORAGE_TYPE_QUERY + "AND " + AlbumColumns.Artist + "=\"" + artistName + "\"";\r
+            SelectArguments albumSelectArguments = CreateSelectArgument(expression, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<Album> dataReader = albumInfo.Select(albumSelectArguments);\r
+            string albumArtPath = "";\r
+\r
+            while (dataReader.Read())\r
+            {\r
+                Album info = dataReader.Current;\r
+                string path = "";\r
+                if (!string.IsNullOrEmpty(info.AlbumArtPath))\r
+                    path = info.AlbumArtPath;\r
+                else\r
+                    path = GetAlbumArtPath(info.Id);\r
+                if (!string.IsNullOrEmpty(path))\r
+                    albumArtPath = path;\r
+            }\r
+            dataReader.Dispose();\r
+            return albumArtPath;\r
+        }\r
+\r
+        public static int GetAlbumCountForArtist(string artistName)\r
         {\r
             string expression = MEDIA_STORAGE_TYPE_QUERY + "AND " + AlbumColumns.Artist + "=\"" + artistName+"\"";\r
-            CountArguments arguments = CreateCountArgument(expression);\r
+            int count = 0;\r
+\r
+            SelectArguments albumSelectArguments = CreateSelectArgument(expression, AlbumColumns.Name + MEDIA_SORT_ORDER_ASC);\r
+            MediaDataReader<Album> dataReader = albumInfo.Select(albumSelectArguments);\r
+\r
+            while (dataReader.Read())\r
+            {\r
+                Album info = dataReader.Current;\r
+                SelectArguments audioSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);\r
+                MediaDataReader<MediaInfo> albumDataReader = albumInfo.SelectMember(info.Id, audioSelectArguments);\r
+                if (albumDataReader.Read())\r
+                    count++;\r
+            }\r
+            dataReader.Dispose();\r
+            return count;\r
+        }\r
+\r
+        public static int GetMediaCountForArtist(string artistName)\r
+        {\r
+            string expression = MEDIA_STORAGE_TYPE_QUERY + "AND " + MediaInfoColumns.Artist + "=\"" + artistName+"\"";\r
+            CountArguments audioCountArguments = CreateCountArgument(expression);\r
             int count = 0;\r
             try\r
             {\r
-                count = albumInfo.Count(arguments);\r
+                count = mediaInfo.CountMedia(audioCountArguments);\r
             }\r
             catch (ObjectDisposedException ex)\r
             {\r
index c4486028bdada9aa1c51ec03188d1057f927d206..455e32db175d76c2c85b247244f60caaff661a64 100755 (executable)
@@ -4,12 +4,22 @@ namespace MusicPlayer.Models
 {\r
     class MusicAlbum : PropertyNotifier\r
     {\r
+        public MusicAlbum()\r
+        {\r
+            //this is required for Activator.CreateInstance in ListViewModel\r
+        }\r
+\r
         public MusicAlbum(Tizen.Content.MediaContent.Album album)\r
         {\r
             AlbumName = album.Name;\r
             ArtistName = album.Artist;\r
             Id = album.Id;\r
-            AlbumArtPath = album.AlbumArtPath;\r
+            string text = album.AlbumArtPath;\r
+            if (string.IsNullOrEmpty(album.AlbumArtPath))\r
+            {\r
+                text = AlbumDataProvider.GetAlbumArtFromTracks(album.Id);\r
+            }\r
+            AlbumArtPath = text;\r
         }\r
 \r
         private string albumName;\r
index ed21e6c2cca4b1e233a19033af4cbce9ff58650c..9116246874547ef278a6fe6ba21245e77cd6d7b9 100755 (executable)
@@ -34,8 +34,12 @@ namespace MusicPlayer.Models
 \r
         public static OrderedDictionary GetAlbumTrackList(int albumId)\r
         {\r
-            OrderedDictionary albumMediaList= Contents.GetAlbumMemberList(albumId);\r
-            return albumMediaList;\r
+            return Contents.GetAlbumMemberList(albumId);\r
+        }\r
+\r
+        public static string GetAlbumArtFromTracks(int albumId)\r
+        {\r
+            return Contents.GetAlbumArtPath(albumId);\r
         }\r
     }\r
 }\r
diff --git a/Models/Artist.cs b/Models/Artist.cs
new file mode 100755 (executable)
index 0000000..20e9ff4
--- /dev/null
@@ -0,0 +1,78 @@
+using System;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.Models
+{
+    class Artist : PropertyNotifier
+    {
+        public Artist()
+        {
+            //this is required for Activator.CreateInstance in ListViewModel
+        }
+
+        public Artist(string artistName)
+        {
+            ArtistName = artistName;
+            AlbumCount = ArtistDataProvider.GetArtistAlbumCount(artistName).ToString();
+            TrackCount = ArtistDataProvider.GetArtistTrackCount(artistName).ToString();
+            TotalCount = AlbumCount + " / " + TrackCount;
+            AlbumArtPath = ArtistDataProvider.GetArtistAlbumArtPath(artistName);
+        }
+
+        private string artistName;
+
+        public string ArtistName
+        {
+            get => artistName;
+            set
+            {
+                string text = string.IsNullOrEmpty(value) ? "Unknown" : value;
+                SetProperty(ref artistName, text);
+            }
+        }
+
+        private string albumCount;
+
+        public string AlbumCount
+        {
+            get => albumCount;
+            set
+            {
+                string text = string.Equals(value, "1") ? " album" : " albums";
+                SetProperty(ref albumCount, value + text);
+            }
+        }
+
+        private string trackCount;
+
+        public string TrackCount
+        {
+            get => trackCount;
+            set
+            {
+                string text = string.Equals(value, "1") ? " track" : " tracks";
+                SetProperty(ref trackCount, value + text);
+            }
+        }
+
+        private string totalCount;
+
+        public string TotalCount
+        {
+            get => totalCount;
+            set => SetProperty(ref totalCount, value);
+        }
+
+        private string albumArtPath;
+
+        public string AlbumArtPath
+        {
+            get => albumArtPath;
+            set
+            {
+                string thumb = string.IsNullOrEmpty(value) ? Resources.GetImagePath() + "thumbnail.png" : value;
+                SetProperty(ref albumArtPath, thumb);
+            }
+        }
+    }
+}
diff --git a/Models/ArtistDataProvider.cs b/Models/ArtistDataProvider.cs
new file mode 100755 (executable)
index 0000000..3bd29d1
--- /dev/null
@@ -0,0 +1,61 @@
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using MusicPlayer.Media;
+
+namespace MusicPlayer.Models
+{
+    public static class ArtistDataProvider
+    {
+        private static List<string> artistsList;
+
+        static ArtistDataProvider()
+        {
+            artistsList = Contents.GetArtistList();
+            Contents.MusicItemUpdate += OnMusicItemUpdate;
+            Contents.MusicDBUpdate += OnMusicDatabaseUpdate;
+        }
+
+        private static void OnMusicDatabaseUpdate(object sender, MusicDBUpdateEventArgs e)
+        {
+            artistsList = Contents.GetArtistList();
+            // TODO implement database update event handler
+            return;
+        }
+
+        private static void OnMusicItemUpdate(object sender, MusicItemUpdateEventArgs e)
+        {
+            // TODO implement database item update event handler
+            return;
+        }
+
+        public static List<string> CurrentArtistList()
+        {
+            return artistsList;
+        }
+
+        public static int GetArtistTrackCount(string artistName)
+        {
+           return Contents.GetMediaCountForArtist(artistName);
+        }
+
+        public static int GetArtistAlbumCount(string artistName)
+        {
+            return Contents.GetAlbumCountForArtist(artistName);
+        }
+
+        public static string GetArtistAlbumArtPath(string artistName)
+        {
+            return Contents.GetAlbumArtPathForArtist(artistName);
+        }
+
+        public static OrderedDictionary GetArtistAlbumList(string artistName)
+        {
+            return Contents.GetAlbumListForArtist(artistName);
+        }
+
+        public static OrderedDictionary GetArtistTrackList(string artistName)
+        {
+            return Contents.GetTrackListForArtist(artistName);
+        }
+    }
+}
\ No newline at end of file
diff --git a/Models/ArtistDetailAlbum.cs b/Models/ArtistDetailAlbum.cs
new file mode 100755 (executable)
index 0000000..696549b
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using MusicPlayer.Common;
+using System.Collections.ObjectModel;
+
+namespace MusicPlayer.Models
+{
+    class ArtistDetailAlbum: ObservableCollection <Track>
+    {
+        public ArtistDetailAlbum()
+        {
+            //this is required for Activator.CreateInstance in ListViewModel
+        }
+
+        public ArtistDetailAlbum(MusicAlbum album)
+        {
+            AlbumArtPath = album.AlbumArtPath;
+            AlbumName = album.AlbumName;
+        }
+
+        public string AlbumName { get; set; }
+
+        public string AlbumArtPath { get; set; }
+    }
+}
index a685449fa2dc9b71877ad4a6f423466d0da2a312..1435eb8ae5016ab80ddb08b452a576030ec431ae 100755 (executable)
@@ -5,6 +5,11 @@ namespace MusicPlayer.Models
 {\r
     class Track : PropertyNotifier\r
     {\r
+        public Track()\r
+        {\r
+            //this is required for Activator.CreateInstance in ListViewModel\r
+        }\r
+\r
         public Track(Tizen.Content.MediaContent.AudioInfo audioInfo)\r
         {\r
             TrackTitle = audioInfo.Title;\r
index 722126d5bb9dc9afc6e06f667d378a831b50d5eb..a3960764d0914b2f955b506580a58cd21a5cdc55 100755 (executable)
@@ -25,7 +25,7 @@ namespace MusicPlayer.ViewModels
 \r
         public AlbumDetailViewModel getDetailViewModel(MusicAlbum musicAlbum)\r
         {\r
-            if(!albumDetailViewModel)\r
+            if(albumDetailViewModel == null)\r
                 albumDetailViewModel = new AlbumDetailViewModel(musicAlbum);\r
             else if (albumDetailViewModel.Id != musicAlbum.Id)\r
                 albumDetailViewModel = new AlbumDetailViewModel(musicAlbum);\r
diff --git a/ViewModels/ArtistDetailViewModel.cs b/ViewModels/ArtistDetailViewModel.cs
new file mode 100755 (executable)
index 0000000..6d09ba3
--- /dev/null
@@ -0,0 +1,65 @@
+using System.Collections.Specialized;
+using MusicPlayer.Models;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.ViewModels
+{
+    using Album = Tizen.Content.MediaContent.Album;
+    using AudioInfo = Tizen.Content.MediaContent.AudioInfo;
+    class ArtistDetailViewModel : PropertyNotifier
+    {
+
+        public ArtistDetailViewModel(Artist artist)
+        {
+            ArtistName = artist.ArtistName;
+            TotalCount = artist.TotalCount;
+            string text = string.Equals(ArtistName, "Unknown") ? "" : ArtistName;
+
+            OrderedDictionary albumList = ArtistDataProvider.GetArtistAlbumList(text);
+            albumListViewModel = new ListViewModel<MusicAlbum>();
+            albumListViewModel.CreateData<Album>(albumList);
+
+            OrderedDictionary trackList = ArtistDataProvider.GetArtistTrackList(text);
+            trackListViewModel = new ListViewModel<Track>();
+            trackListViewModel.CreateData<AudioInfo>(trackList);
+
+            groupListViewModel = new ListViewModel<ArtistDetailAlbum>();
+
+            foreach(MusicAlbum album in albumListViewModel)
+            {
+                ArtistDetailAlbum artistAlbum = new ArtistDetailAlbum(album);
+                OrderedDictionary albumTrackList = AlbumDataProvider.GetAlbumTrackList(album.Id);
+                ListViewModel<Track> albumTrackListViewModel = new ListViewModel<Track>();
+                albumTrackListViewModel.CreateData<AudioInfo>(albumTrackList);
+                foreach (Track track in albumTrackListViewModel)
+                    artistAlbum.Add(track);
+                groupListViewModel.Add(artistAlbum);
+            }
+        }
+
+        private string artistName;
+
+        public string ArtistName
+        {
+            get => artistName;
+            set => SetProperty(ref artistName, value);
+        }
+
+        private string totalCount;
+
+        public string TotalCount
+        {
+            get => totalCount;
+            set => SetProperty(ref totalCount, value);
+        }
+
+        private readonly ListViewModel<ArtistDetailAlbum> groupListViewModel;
+        public ListViewModel<ArtistDetailAlbum> GroupListViewModel => groupListViewModel;
+
+        private readonly ListViewModel<MusicAlbum> albumListViewModel;
+        public ListViewModel<MusicAlbum> AlbumListViewModel => albumListViewModel;
+
+        private readonly ListViewModel<Track> trackListViewModel;
+        public ListViewModel<Track> TrackListViewModel => trackListViewModel;
+    }
+}
diff --git a/ViewModels/ArtistViewModel.cs b/ViewModels/ArtistViewModel.cs
new file mode 100755 (executable)
index 0000000..49d1092
--- /dev/null
@@ -0,0 +1,54 @@
+using System.Collections.Specialized;
+using System.Collections.Generic;
+using MusicPlayer.Models;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.ViewModels
+{
+    class ArtistViewModel : PropertyNotifier
+    {
+        private ArtistDetailViewModel artistDetailViewModel;
+
+        public ArtistViewModel()
+        {
+            List<string> artistList = ArtistDataProvider.CurrentArtistList();
+            listViewModel = new ListViewModel<Artist>();
+            listViewModel.CreateData<string>(artistList);
+            listViewModel.CollectionChanged += OnArtistListChanges;
+            ArtistCount = listViewModel.Count.ToString();
+        }
+
+        private void OnArtistListChanges(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            artistCount = listViewModel.Count.ToString();
+        }
+
+        public ArtistDetailViewModel getDetailViewModel(Artist artist)
+        {
+            if (artistDetailViewModel == null)
+                artistDetailViewModel = new ArtistDetailViewModel(artist);
+            else if (artistDetailViewModel.ArtistName != artist.ArtistName)
+                artistDetailViewModel = new ArtistDetailViewModel(artist);
+            return artistDetailViewModel;
+        }
+
+        private ListViewModel<Artist> listViewModel;
+
+        public ListViewModel<Artist> ListViewModel
+        {
+            get => listViewModel;
+        }
+
+        private string artistCount;
+
+        public string ArtistCount
+        {
+            get => artistCount;
+            set
+            {
+                string text = string.Equals(value, "1") ? " artist" : " artists";
+                SetProperty(ref artistCount, value + text);
+            }
+        }
+    }
+}
\ No newline at end of file
index 3c6ba3f88f7a17e8e3c862297181b5720eb88afd..b39e11f94bbc8d0c1456a32cb9278422d586651e 100755 (executable)
@@ -75,7 +75,7 @@ namespace MusicPlayer.Views
 \r
         }\r
 \r
-        private Button CreatButton(string url, int x, int y)\r
+        private Button CreateButton(string url, int x, int y)\r
         {\r
             ButtonStyle buttonStyle = new ButtonStyle()\r
             {\r
@@ -203,11 +203,11 @@ namespace MusicPlayer.Views
             trackCountLabel.SetBinding(TextLabel.TextProperty, "TotalTracks");\r
             controlsView.Add(trackCountLabel);\r
 \r
-            playAllIcon = CreatButton(Resources.GetImagePath() + "playing_queue.png", Window.Instance.WindowSize.Width / 2 - LayoutPadding - IconSize, ControlViewMargin); // The required png waas not available. So temporarily using this.\r
+            playAllIcon = CreateButton(Resources.GetImagePath() + "playlist_active.png.png", Window.Instance.WindowSize.Width / 2 - LayoutPadding - IconSize, ControlViewMargin);\r
             playAllIcon.Margin = new Extents(40, 0, 0, 0);\r
             controlsView.Add(playAllIcon);\r
 \r
-            shuffleAndPlayAllIcon = CreatButton(Resources.GetImagePath() + "shuffle_on.png", Window.Instance.WindowSize.Width / 2 - LayoutPadding - 2 * IconSize - 40, ControlViewMargin);\r
+            shuffleAndPlayAllIcon = CreateButton(Resources.GetImagePath() + "shuffle_on.png", Window.Instance.WindowSize.Width / 2 - LayoutPadding - 2 * IconSize - 40, ControlViewMargin);\r
             playAllIcon.Margin = new Extents(32, 0, 0, 0);\r
             controlsView.Add(shuffleAndPlayAllIcon);\r
 \r
diff --git a/Views/ArtistDetailGroupLayout.cs b/Views/ArtistDetailGroupLayout.cs
new file mode 100755 (executable)
index 0000000..4d1e63c
--- /dev/null
@@ -0,0 +1,118 @@
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.Views
+{
+    class ArtistDetailGroupLayout : RecyclerViewItem
+    {
+        private static int Width = 1792;
+        private static int Height = 108;
+
+        private const int IconSize = 64;
+        private const int LayoutPadding = 32;
+        private const int SeperatorHeight = 1;
+        private const int LeftPadding = 64;
+        private const int x = 0;
+
+        private View itemSeperator;
+        private TextLabel titleLabel;
+        private ImageView icon;
+
+        public ArtistDetailGroupLayout(int width = 1792, int height = 108) : base()
+        {
+            base.OnInitialize();
+            base.IsCreateByXaml = true;
+            Width = width;
+            Height = height;
+            WidthSpecification = Width;
+            HeightSpecification = Height;
+
+            // to show the rounded rect of the bg
+            BackgroundColor = Color.Transparent;
+
+            icon = CreateIcon();
+            titleLabel = CreateTitleLabel();
+            itemSeperator = CreateItemSeparator();
+            IsCreateByXaml = true;
+        }
+
+        private ImageView CreateIcon()
+        {
+            ImageView icon = new ImageView()
+            {
+                WidthSpecification = IconSize,
+                HeightSpecification = IconSize,
+                IsCreateByXaml = true,
+                Position2D = new Position2D(x, (Height / 2) - (IconSize / 2)),
+            };
+            base.Add(icon);
+            return icon;
+        }
+
+        private View CreateItemSeparator()
+        {
+            View itemSeperator = new View()
+            {
+                WidthSpecification = (Width - (2 * LeftPadding)),
+                HeightSpecification = SeperatorHeight,
+                ExcludeLayouting = true,
+                Position2D = new Position2D(x, Height - SeperatorHeight),
+                BackgroundColor = UIColors.ItemSeperator,
+            };
+            base.Add(itemSeperator);
+            return itemSeperator;
+        }
+
+        private TextLabel CreateTitleLabel()
+        {
+            TextLabel titleLabel = new TextLabel()
+            {
+                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - LayoutPadding),
+                HeightSpecification = 40,
+                TextColor = UIColors.HEX001447,
+                PixelSize = 32,
+                FontFamily = "BreezeSans",
+                VerticalAlignment = VerticalAlignment.Center,
+                IsCreateByXaml = true,
+                Position2D = new Position2D(x + IconSize + LayoutPadding, 34),
+            };
+            base.Add(titleLabel);
+            return titleLabel;
+        }
+
+        public ImageView Icon
+        {
+            get => icon;
+        }
+
+        public TextLabel TitleLabel
+        {
+            get => titleLabel;
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (Disposed)
+            {
+                return;
+            }
+            if (type == DisposeTypes.Explicit)
+            {
+                base.Remove(itemSeperator);
+                itemSeperator?.Dispose();
+                itemSeperator = null;
+
+                base.Remove(icon);
+                icon?.Dispose();
+                icon = null;
+
+                base.Remove(titleLabel);
+                titleLabel?.Dispose();
+                titleLabel = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/Views/ArtistDetailItemLayout.cs b/Views/ArtistDetailItemLayout.cs
new file mode 100755 (executable)
index 0000000..95907ba
--- /dev/null
@@ -0,0 +1,122 @@
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using MusicPlayer.Common;
+
+namespace MusicPlayer.Views
+{
+    class ArtistDetailItemLayout : RecyclerViewItem
+    {
+        private static int Width = 1792;
+        private static int Height = 108;
+
+        private const int LayoutPadding = 32;
+        private const int SeperatorHeight = 1;
+        private const int LeftPadding = 64;
+        private const int x = 0;
+
+        private View itemSeperator;
+        private TextLabel titleLabel;
+        private TextLabel extraLabel;
+
+        public ArtistDetailItemLayout(int width = 1792, int height = 108) : base()
+        {
+            base.OnInitialize();
+            base.IsCreateByXaml = true;
+            Width = width;
+            Height = height;
+            WidthSpecification = Width;
+            HeightSpecification = Height;
+
+            // to show the rounded rect of the bg
+            BackgroundColor = Color.Transparent;
+
+            titleLabel = CreateTitleLabel();
+            extraLabel = CreateExtraLabel();
+            itemSeperator = CreateItemSeparator();
+            IsCreateByXaml = true;
+        }
+
+        private View CreateItemSeparator()
+        {
+            View itemSeperator = new View()
+            {
+                WidthSpecification = (Width - (2 * LeftPadding)),
+                HeightSpecification = SeperatorHeight,
+                ExcludeLayouting = true,
+                Position2D = new Position2D(x, Height - SeperatorHeight),
+                BackgroundColor = UIColors.ItemSeperator,
+            };
+            base.Add(itemSeperator);
+            return itemSeperator;
+        }
+
+        private TextLabel CreateTitleLabel()
+        {
+            TextLabel titleLabel = new TextLabel()
+            {
+                WidthSpecification = 1272,
+                HeightSpecification = 40,
+                TextColor = UIColors.HEX001447,
+                PixelSize = 32,
+                FontFamily = "BreezeSans",
+                VerticalAlignment = VerticalAlignment.Center,
+                IsCreateByXaml = true,
+                Position2D = new Position2D(x, 34),
+            };
+            base.Add(titleLabel);
+            return titleLabel;
+        }
+
+        private TextLabel CreateExtraLabel()
+        {
+            TextLabel extraLabel = new TextLabel()
+            {
+                WidthSpecification = 360,
+                HeightSpecification = 36,
+                TextColor = UIColors.HEX001447,
+                PixelSize = 28,
+                FontFamily = "BreezeSans",
+                VerticalAlignment = VerticalAlignment.Center,
+                HorizontalAlignment = HorizontalAlignment.End,
+                IsCreateByXaml = true,
+                Position2D = new Position2D((x + 1272 + LayoutPadding), 36)
+            };
+            base.Add(extraLabel);
+            return extraLabel;
+        }
+
+        public TextLabel TitleLabel
+        {
+            get => titleLabel;
+        }
+
+        public TextLabel ExtraLabel
+        {
+            get => extraLabel;
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (Disposed)
+            {
+                return;
+            }
+            if (type == DisposeTypes.Explicit)
+            {
+                base.Remove(itemSeperator);
+                itemSeperator?.Dispose();
+                itemSeperator = null;
+
+                base.Remove(titleLabel);
+                titleLabel?.Dispose();
+                titleLabel = null;
+
+                base.Remove(extraLabel);
+                extraLabel?.Dispose();
+                extraLabel = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/Views/ArtistDetailView.cs b/Views/ArtistDetailView.cs
new file mode 100755 (executable)
index 0000000..91a143a
--- /dev/null
@@ -0,0 +1,160 @@
+using MusicPlayer.ViewModels;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using MusicPlayer.Common;
+using MusicPlayer.Models;
+
+namespace MusicPlayer.Views
+{
+    class ArtistDetailView : View //BaseContentView
+    {
+        private const int LayoutPadding = 64;
+        private const int IconSize = 48;
+
+        private BaseView baseView;
+        private View contentView;
+        private View topView;
+        private TextLabel totalCountLabel;
+        private Button playAllIcon; // TODO need to implement playall feature
+        private Button shuffleAndPlayAllIcon; // TODO need to implement playlist manager
+        private CollectionView collectionView;
+
+        private ArtistDetailViewModel viewModel;
+
+        public ArtistDetailView(ArtistDetailViewModel viewModel) : base()
+        {
+            this.viewModel = viewModel;
+            BindingContext = viewModel;
+            BackgroundColor = UIColors.HEXEEEFF1;
+            WidthResizePolicy = ResizePolicyType.FillToParent;
+            HeightResizePolicy = ResizePolicyType.FillToParent;
+
+            //TODO need to change this part after implementation of Command Interface
+            baseView = new BaseView()
+            {
+                Title = viewModel.ArtistName,
+                BackButton = true,
+                MoreButton = true,
+                SearchButton = true,
+                BackgroundColor = UIColors.HEXEEEFF1,
+            };
+            base.Add(baseView);
+            contentView = new View()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = 876,
+                Layout = new FlexLayout()
+                {
+                    Direction = FlexLayout.FlexDirection.Column,
+                    Padding = new Extents(LayoutPadding, LayoutPadding, 0, 0),
+                },
+            };
+            baseView.SetContent = contentView;
+
+            topView = CreateTopView();
+            AddTitle();
+            AddButtons();
+            collectionView = AddCollectionView();
+        }
+
+        private void OnTrackSelection(object sender, SelectionChangedEventArgs e)
+        {
+
+        }
+
+        private Button CreateButton(string url, int x, int y)
+        {
+            ButtonStyle buttonStyle = new ButtonStyle()
+            {
+                Icon = new ImageViewStyle()
+                {
+                    ResourceUrl = url,
+                },
+                IsSelectable = false,
+                IsEnabled = true,
+            };
+
+            Button button = new Button(buttonStyle)
+            {
+                Size2D = new Size2D(IconSize, IconSize),
+                Position2D = new Position2D(x, y),
+            };
+            return button;
+        }
+
+        private View CreateTopView()
+        {
+            View topView = new View()
+            {
+                BackgroundColor = UIColors.HEXEEEFF1,
+                Size2D = new Size2D(Window.Instance.WindowSize.Width - 2 * LayoutPadding, 60),
+            };
+            contentView.Add(topView);
+            return topView;
+        }
+
+        private void AddTitle()
+        {
+            totalCountLabel = new TextLabel()
+            {
+                Size2D = new Size2D(1624, 36),
+                Position2D = new Position2D(0, 12),
+                PixelSize = 28,
+                Text = "TOTAL COUNT",
+                TextColor = UIColors.HEX001447,
+                VerticalAlignment = VerticalAlignment.Center,
+                FontFamily = "BreezeSans",
+                IsCreateByXaml = true,
+            };
+            topView.Add(totalCountLabel);
+            totalCountLabel.SetBinding(TextLabel.TextProperty, "TotalCount");
+        }
+
+        private void AddButtons()
+        {
+            playAllIcon = CreateButton(Resources.GetImagePath() + "playlist_active.png", Window.Instance.WindowSize.Width - 2 * LayoutPadding - IconSize, 6);
+            playAllIcon.Margin = new Extents(40, 0, 0, 0);
+            topView.Add(playAllIcon);
+
+            shuffleAndPlayAllIcon = CreateButton(Resources.GetImagePath() + "shuffle_on.png", Window.Instance.WindowSize.Width - 2 * LayoutPadding - 2 * IconSize - 40, 6);
+            playAllIcon.Margin = new Extents(32, 0, 0, 0);
+            topView.Add(shuffleAndPlayAllIcon);
+        }
+
+        private CollectionView AddCollectionView()
+        {
+            CollectionView collectionView = new CollectionView()
+            {
+                Size2D = new Size2D(1792, 108),
+                BackgroundImage = Resources.GetImagePath() + "list_view_bg.png",
+                ItemsLayouter = new LinearLayouter(),
+                ItemTemplate = new DataTemplate(() =>
+                {
+                    ArtistDetailItemLayout layout = new ArtistDetailItemLayout();
+                    layout.TitleLabel.SetBinding(TextLabel.TextProperty, "TrackTitle");
+                    layout.ExtraLabel.SetBinding(TextLabel.TextProperty, "Duration");
+                    return layout;
+                }),
+                GroupHeaderTemplate = new DataTemplate(() =>
+                {
+                    ArtistDetailGroupLayout group = new ArtistDetailGroupLayout();
+                    group.Icon.SetBinding(ImageView.ResourceUrlProperty, "AlbumArtPath");
+                    group.TitleLabel.SetBinding(TextLabel.TextProperty, "AlbumName");
+                    return group;
+                }),
+                IsGrouped = true,
+                ScrollingDirection = ScrollableBase.Direction.Vertical,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                SelectionMode = ItemSelectionMode.Single,
+            };
+            contentView.Add(collectionView);
+            FlexLayout.SetFlexGrow(collectionView, 1);
+            FlexLayout.SetFlexShrink(collectionView, 1);
+            collectionView.ItemsSource = viewModel.GroupListViewModel;
+            collectionView.SelectionChanged += OnTrackSelection;
+            return collectionView;
+        }
+    }
+}
diff --git a/Views/ArtistView.cs b/Views/ArtistView.cs
new file mode 100755 (executable)
index 0000000..f74e075
--- /dev/null
@@ -0,0 +1,71 @@
+using MusicPlayer.ViewModels;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using MusicPlayer.Common;
+using MusicPlayer.Models;
+
+namespace MusicPlayer.Views
+{
+    class ArtistView : BaseContentView
+    {
+        private ArtistViewModel viewModel;
+        private TextLabel artistCountLabel;
+
+        public ArtistView(ArtistViewModel viewModel)
+        {
+            this.viewModel = viewModel;
+            BindingContext = viewModel;
+            collectionView.ItemsSource = viewModel.ListViewModel;
+            collectionView.ItemTemplate = new DataTemplate(() =>
+            {
+                ListItemLayout layout = new ListItemLayout();
+                layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "AlbumArtPath");
+                layout.TitleLabel.SetBinding(TextLabel.TextProperty, "ArtistName");
+                layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "TotalCount");
+                return layout;
+            });
+            collectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
+            collectionView.WidthSpecification = LayoutParamPolicies.WrapContent;
+            collectionView.SelectionMode = ItemSelectionMode.Single;
+            collectionView.SelectionChanged += OnArtistSelection;
+
+            artistCountLabel = new TextLabel()
+            {
+                PixelSize = 28,
+                Text = "ARTIST COUNT",
+                TextColor = UIColors.HEX001447,
+                VerticalAlignment = VerticalAlignment.Center,
+                FontFamily = "BreezeSans",
+                IsCreateByXaml = true,
+            };
+            titleView.Add(artistCountLabel);
+            artistCountLabel.SetBinding(TextLabel.TextProperty, "ArtistCount");
+            RelativeLayout.SetLeftTarget(artistCountLabel, titleView);
+            RelativeLayout.SetLeftRelativeOffset(artistCountLabel, 1.0f);
+            RelativeLayout.SetRightRelativeOffset(artistCountLabel, 0.0f);
+            RelativeLayout.SetFillHorizontal(artistCountLabel, true);
+        }
+        private void OnArtistSelection(object sender, SelectionChangedEventArgs e)
+        {
+            Artist currentArtist = (Artist)collectionView.SelectedItem;
+            ArtistDetailView view = new ArtistDetailView(viewModel.getDetailViewModel(currentArtist));
+            Window.Instance.Add(view);
+        }
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (Disposed)
+            {
+                return;
+            }
+            if (type == DisposeTypes.Explicit)
+            {
+                titleView.Remove(artistCountLabel);
+                artistCountLabel.Dispose();
+                artistCountLabel = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
\ No newline at end of file