1.Adding AlbumView, AlbumDetailView and related classes. 31/261031/3
authorshivamv <shivam.v2@samsung.com>
Thu, 8 Jul 2021 16:49:16 +0000 (22:19 +0530)
committershivamv <shivam.v2@samsung.com>
Fri, 9 Jul 2021 16:28:43 +0000 (21:58 +0530)
2.Modifying some files to remove redundancy.

Change-Id: Ief6afe9a0bb2b61f17742117f135541bbd7fa0d7
Signed-off-by: shivamv <shivam.v2@samsung.com>
22 files changed:
MediaContent/AlbumContents.cs
Models/Album.cs [new file with mode: 0755]
Models/AlbumDataProvider.cs [new file with mode: 0755]
Models/PlayerModel.cs
Models/Track.cs
Models/TrackDataProvider.cs
ViewModels/AlbumDetailViewModel.cs [new file with mode: 0755]
ViewModels/AlbumViewModel.cs [new file with mode: 0755]
ViewModels/ListViewModel.cs [new file with mode: 0755]
ViewModels/PlayerViewModel.cs
ViewModels/PlayingListViewModel.cs
ViewModels/TrackListViewModel.cs [deleted file]
ViewModels/TrackViewModel.cs
Views/AlbumDetailLayout.cs [new file with mode: 0755]
Views/AlbumDetailView.cs [new file with mode: 0755]
Views/AlbumView.cs [new file with mode: 0755]
Views/BaseContentView.cs
Views/BaseView.cs
Views/ListItemLayout.cs [new file with mode: 0755]
Views/PlayingListView.cs
Views/TrackLayout.cs [deleted file]
Views/TrackView.cs

index 2c32f06357a5581eaaa086bfc7ac2b73be8dbb6d..92fdbfe5facd4f4233aad26bf32a30acb9927fad 100755 (executable)
@@ -28,5 +28,20 @@ namespace MusicPlayer.Media
         {\r
             return albumInfo.CountMember(albumId);\r
         }\r
+\r
+        public static OrderedDictionary GetAlbumMemberList(int albumId)\r
+        {\r
+            OrderedDictionary mediaList = new OrderedDictionary();\r
+            MediaDataReader<MediaInfo> dataReader = albumInfo.SelectMember(albumId);\r
+\r
+            while (dataReader.Read())\r
+            {\r
+                MediaInfo info = dataReader.Current;\r
+                mediaList.Add(info.Id, info);\r
+            }\r
+            Tizen.Log.Debug(AppConstants.LogTag, "Total track retrived from currentAlbum: " + mediaList.Count);\r
+            dataReader.Dispose();\r
+            return mediaList;\r
+        }\r
     }\r
 }\r
diff --git a/Models/Album.cs b/Models/Album.cs
new file mode 100755 (executable)
index 0000000..c448602
--- /dev/null
@@ -0,0 +1,59 @@
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Models\r
+{\r
+    class MusicAlbum : PropertyNotifier\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
+        }\r
+\r
+        private string albumName;\r
+\r
+        public string AlbumName\r
+        {\r
+            get => albumName;\r
+            set\r
+            {\r
+                string text = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+                SetProperty(ref albumName, text);\r
+            }\r
+        }\r
+\r
+        private string artistName;\r
+\r
+        public string ArtistName\r
+        {\r
+            get => artistName;\r
+            set\r
+            {\r
+                string text = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+                SetProperty(ref artistName, text);\r
+            }\r
+        }\r
+\r
+        private int id;\r
+\r
+        public int Id\r
+        {\r
+            get => id;\r
+            set => id = value;\r
+        }\r
+\r
+        private string albumArtPath;\r
+\r
+        public string AlbumArtPath\r
+        {\r
+            get => albumArtPath;\r
+            set\r
+            {\r
+                string thumb = string.IsNullOrEmpty(value) ? Resources.GetImagePath() + "thumbnail.png" : value;\r
+                SetProperty(ref albumArtPath, thumb);\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/Models/AlbumDataProvider.cs b/Models/AlbumDataProvider.cs
new file mode 100755 (executable)
index 0000000..ed21e6c
--- /dev/null
@@ -0,0 +1,41 @@
+using System.Collections.Specialized;\r
+using MusicPlayer.Media;\r
+\r
+namespace MusicPlayer.Models\r
+{\r
+    public static class AlbumDataProvider\r
+    {\r
+        private static OrderedDictionary albumsList;\r
+\r
+        static AlbumDataProvider()\r
+        {\r
+            albumsList = Contents.GetAlbumList();\r
+            Contents.MusicItemUpdate += OnMusicItemUpdate;\r
+            Contents.MusicDBUpdate += OnMusicDatabaseUpdate;\r
+        }\r
+\r
+        private static void OnMusicDatabaseUpdate(object sender, MusicDBUpdateEventArgs e)\r
+        {\r
+            albumsList = Contents.GetAlbumList();\r
+            // TODO implement database update event handler\r
+            return;\r
+        }\r
+\r
+        private static void OnMusicItemUpdate(object sender, MusicItemUpdateEventArgs e)\r
+        {\r
+            // TODO implement database item update event handler\r
+            return;\r
+        }\r
+\r
+        public static OrderedDictionary CurrentAlbumList()\r
+        {\r
+            return albumsList;\r
+        }\r
+\r
+        public static OrderedDictionary GetAlbumTrackList(int albumId)\r
+        {\r
+            OrderedDictionary albumMediaList= Contents.GetAlbumMemberList(albumId);\r
+            return albumMediaList;\r
+        }\r
+    }\r
+}\r
index 383f42e1a62bae1063d50f9bf8be24593353326c..f5335a0a8599c0a05459a6fa3c42ec505746d103 100755 (executable)
@@ -19,7 +19,7 @@ namespace MusicPlayer.Models
                 currentTrack = value;
                 TrackName = currentTrack.TrackTitle;
                 TrackArtist = currentTrack.ArtistName;
-                TrackLength = TimeSpan.FromMilliseconds(currentTrack.Duration).ToString(AppConstants.TimeFormat);
+                TrackLength = currentTrack.Duration;
                 PlayingTime = TimeSpan.FromMilliseconds(0).ToString(AppConstants.TimeFormat);
                 ThumbnailPath = currentTrack.ThumbnailPath;
                 PlayingStatus = PlayingStatus.None;
index de4d2ffd2604d8ea52459670ab5966fdab2b1a0a..a685449fa2dc9b71877ad4a6f423466d0da2a312 100755 (executable)
@@ -1,63 +1,80 @@
-using MusicPlayer.Common;\r
+using System;\r
+using MusicPlayer.Common;\r
 \r
 namespace MusicPlayer.Models\r
 {\r
     class Track : PropertyNotifier\r
     {\r
-        private string title;\r
-        private string album;\r
-        private string id;\r
-        private string artist;\r
-        private int duration;\r
-        private string thumbnailPath;\r
-        private string filePath;\r
-\r
         public Track(Tizen.Content.MediaContent.AudioInfo audioInfo)\r
         {\r
             TrackTitle = audioInfo.Title;\r
             AlbumName = audioInfo.Album;\r
             Id = audioInfo.Id;\r
             ArtistName = audioInfo.Artist;\r
-            Duration = audioInfo.Duration;\r
+            DurationInMS = audioInfo.Duration;\r
+            Duration = TimeSpan.FromMilliseconds(audioInfo.Duration).ToString(AppConstants.TimeFormat);\r
             ThumbnailPath = audioInfo.ThumbnailPath;\r
             FilePath = audioInfo.Path;\r
         }\r
 \r
+        private string trackTitle;\r
+\r
         public string TrackTitle\r
         {\r
-            get => title;\r
-            set => SetProperty(ref title, value);\r
+            get => trackTitle;\r
+            set => SetProperty(ref trackTitle, value);\r
         }\r
 \r
+        private string albumName;\r
+\r
         public string AlbumName\r
         {\r
-            get => album;\r
+            get => albumName;\r
             set\r
             {\r
                 string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
-                SetProperty(ref album, name);\r
+                SetProperty(ref albumName, name);\r
             }\r
         }\r
+\r
+        private string artistName;\r
+\r
         public string ArtistName\r
         {\r
-            get => artist;\r
+            get => artistName;\r
             set\r
             {\r
                 string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
-                SetProperty(ref artist, name);\r
+                SetProperty(ref artistName, name);\r
             }\r
         }\r
+\r
+        private string id;\r
+\r
         public string Id\r
         {\r
             get => id;\r
-            set { id = value; }\r
+            set => id = value;\r
         }\r
-        // TODO create new property of duration in string\r
-        public int Duration\r
+\r
+        private string duration;\r
+\r
+        public string Duration\r
         {\r
             get => duration;\r
-            set { duration = value; }\r
+            set => SetProperty(ref duration, value);\r
+        }\r
+\r
+        private int durationInMS;\r
+\r
+        public int DurationInMS\r
+        {\r
+            get =>  durationInMS;\r
+            set => SetProperty(ref  durationInMS, value);\r
         }\r
+\r
+        private string thumbnailPath;\r
+\r
         public string ThumbnailPath\r
         {\r
             get => thumbnailPath;\r
@@ -68,6 +85,8 @@ namespace MusicPlayer.Models
             }\r
         }\r
 \r
+        private string filePath;\r
+\r
         public string FilePath\r
         {\r
             get => filePath;\r
index a37db2a24a0daead2eb175dba28349cd5251d147..18090088138b2203b932a4d3cb20626d59b7a82f 100755 (executable)
@@ -20,15 +20,16 @@ namespace MusicPlayer.Models
             // TODO implement database update event handler\r
             return;\r
         }\r
+\r
         private static void OnMusicItemUpdate(object sender, MusicItemUpdateEventArgs e)\r
         {\r
             // TODO implement database item update event handler\r
             return;\r
         }\r
+\r
         public static OrderedDictionary CurrentTrackList()\r
         {\r
             return tracksList;\r
         }\r
-\r
     }\r
 }\r
diff --git a/ViewModels/AlbumDetailViewModel.cs b/ViewModels/AlbumDetailViewModel.cs
new file mode 100755 (executable)
index 0000000..5117bc8
--- /dev/null
@@ -0,0 +1,88 @@
+using System.Collections.Specialized;\r
+using MusicPlayer.Models;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.ViewModels\r
+{\r
+    using AudioInfo = Tizen.Content.MediaContent.AudioInfo;\r
+    class AlbumDetailViewModel : PropertyNotifier\r
+    {\r
+        public AlbumDetailViewModel(MusicAlbum album)\r
+        {\r
+            Id = album.Id;\r
+            AlbumName = album.AlbumName;\r
+            ArtistName = album.ArtistName;\r
+            AlbumArtPath = album.AlbumArtPath;\r
+            OrderedDictionary trackList = AlbumDataProvider.GetAlbumTrackList(album.Id);\r
+            listViewModel = new ListViewModel<Track>();\r
+            listViewModel.CreateData<AudioInfo>(trackList);\r
+            listViewModel.CollectionChanged += OnAlbumDetailListChanges;\r
+            TotalTracks = listViewModel.Count.ToString();\r
+        }\r
+\r
+        private void OnAlbumDetailListChanges(object sender, NotifyCollectionChangedEventArgs e)\r
+        {\r
+            //TODO\r
+            TotalTracks = listViewModel.Count.ToString();\r
+        }\r
+\r
+        private int id;\r
+\r
+        public int Id\r
+        {\r
+            get => id;\r
+            set => id = value;\r
+        }\r
+\r
+        private string albumName;\r
+\r
+        public string AlbumName\r
+        {\r
+            get => albumName;\r
+            set\r
+            {\r
+                string text = string.Equals(value,"Unknown") ? null : value;\r
+                SetProperty(ref albumName, text);\r
+            }\r
+        }\r
+\r
+        private string artistName;\r
+\r
+        public string ArtistName\r
+        {\r
+            get => artistName;\r
+            set\r
+            {\r
+                string text = string.Equals(value, "Unknown") ? null : value;\r
+                SetProperty(ref artistName, text);\r
+            }\r
+        }\r
+\r
+        private string albumArtPath;\r
+\r
+        public string AlbumArtPath\r
+        {\r
+            get => albumArtPath;\r
+            set => SetProperty(ref albumArtPath, value);\r
+        }\r
+\r
+        private ListViewModel<Track> listViewModel;\r
+\r
+        public ListViewModel<Track> ListViewModel\r
+        {\r
+            get => listViewModel;\r
+        }\r
+\r
+        private string totalTracks;\r
+\r
+        public string TotalTracks\r
+        {\r
+            get => totalTracks;\r
+            set\r
+            {\r
+                string text = string.Equals(value, "1") ? " Track" : " Tracks";\r
+                SetProperty(ref totalTracks, value + text);\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/ViewModels/AlbumViewModel.cs b/ViewModels/AlbumViewModel.cs
new file mode 100755 (executable)
index 0000000..722126d
--- /dev/null
@@ -0,0 +1,54 @@
+using System.Collections.Specialized;\r
+using MusicPlayer.Models;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.ViewModels\r
+{\r
+    using Album = Tizen.Content.MediaContent.Album;\r
+    class AlbumViewModel : PropertyNotifier\r
+    {\r
+        private AlbumDetailViewModel albumDetailViewModel;\r
+\r
+        public AlbumViewModel()\r
+        {\r
+            OrderedDictionary albumList = AlbumDataProvider.CurrentAlbumList();\r
+            listViewModel = new ListViewModel<MusicAlbum>();\r
+            listViewModel.CreateData<Album>(albumList);\r
+            listViewModel.CollectionChanged += OnAlbumListChanges;\r
+            AlbumCount = listViewModel.Count.ToString();\r
+        }\r
+\r
+        private void OnAlbumListChanges(object sender, NotifyCollectionChangedEventArgs e)\r
+        {\r
+            AlbumCount = listViewModel.Count.ToString();\r
+        }\r
+\r
+        public AlbumDetailViewModel getDetailViewModel(MusicAlbum musicAlbum)\r
+        {\r
+            if(!albumDetailViewModel)\r
+                albumDetailViewModel = new AlbumDetailViewModel(musicAlbum);\r
+            else if (albumDetailViewModel.Id != musicAlbum.Id)\r
+                albumDetailViewModel = new AlbumDetailViewModel(musicAlbum);\r
+            return albumDetailViewModel;\r
+        }\r
+\r
+        private ListViewModel<MusicAlbum> listViewModel;\r
+\r
+        public ListViewModel<MusicAlbum> ListViewModel\r
+        {\r
+            get => listViewModel;\r
+        }\r
+\r
+        private string albumCount;\r
+\r
+        public string AlbumCount\r
+        {\r
+            get => albumCount;\r
+            set\r
+            {\r
+                string text = string.Equals(value, "1") ? " album" : " albums";\r
+                SetProperty(ref albumCount, value + text);\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/ViewModels/ListViewModel.cs b/ViewModels/ListViewModel.cs
new file mode 100755 (executable)
index 0000000..cb70383
--- /dev/null
@@ -0,0 +1,26 @@
+using System.Collections;\r
+using System.Collections.Specialized;\r
+using System.Collections.ObjectModel;\r
+using MusicPlayer.Models;\r
+using Tizen.Content.MediaContent;\r
+using MusicPlayer.Common;\r
+using System;\r
+\r
+namespace MusicPlayer.ViewModels\r
+{\r
+    class ListViewModel<T> : ObservableCollection<T> where T : new()\r
+    {\r
+        public ListViewModel()\r
+        {\r
+        }\r
+\r
+        public void CreateData<U>(OrderedDictionary dict)\r
+        {\r
+            foreach (DictionaryEntry item in dict)\r
+            {\r
+                Add((T)Activator.CreateInstance(typeof(T), new object[] { (U)item.Value }));\r
+            }\r
+            Tizen.Log.Debug(AppConstants.LogTag, "Observable list item count: " + this.Count);\r
+        }\r
+    }\r
+}\r
index 170258485d445998d416dc4dc4a45f8b5a34e975..c497ae9ba9cd6483e86274ee8a12884c62de40bd 100755 (executable)
@@ -36,12 +36,14 @@ namespace MusicPlayer.ViewModels
         }
 
         internal PlayingListViewModel playingListViewModel;
+
         public PlayingListViewModel CurrentPlayingListViewModel
         {
             get => playingListViewModel;
         }
 
         private string playPauseUrl;
+
         public string PlayPauseUrl
         {
             get => playPauseUrl;
@@ -72,7 +74,7 @@ namespace MusicPlayer.ViewModels
             set => SetProperty(ref hasNextTrack, value);
         }
 
-        public void SetPlayingList(TrackListViewModel trackListVM)
+        public void SetPlayingList(ListViewModel<Track> trackListVM)
         {
             playingListViewModel.SetTrackListViewModel(trackListVM);
         }
index c058bfe886f8cfb0da9d931629db32c2d23f286f..84c0c5ffae04538870df31cbcde21c3f14f14834 100755 (executable)
@@ -6,6 +6,7 @@ using System.Text;
 using MusicPlayer.ViewModels;
 using System.Threading;
 using MusicPlayer.Common;
+using MusicPlayer.Models;
 
 namespace MusicPlayer.ViewModels
 {
@@ -37,7 +38,7 @@ namespace MusicPlayer.ViewModels
 
     class PlayingListViewModel : PropertyNotifier
     {
-        private TrackListViewModel tracklistViewModel;
+        private ListViewModel<Track> tracklistViewModel;
         private List<int> shuffleList;
         private int currentIndex;
         private RepeatMode repeatMode;
@@ -66,7 +67,7 @@ namespace MusicPlayer.ViewModels
             ItemsSourceChanged?.Invoke(this, eventArgs);
         }
 
-        public void SetTrackListViewModel(TrackListViewModel trackListVM)
+        public void SetTrackListViewModel(ListViewModel<Track> trackListVM)
         {
             // Need to check for same VM and in case same VM just update the playing track
             Tizen.Log.Info(AppConstants.LogTag, "Setting Current Playing list");
@@ -77,7 +78,7 @@ namespace MusicPlayer.ViewModels
             OnItemsSourceChanged(new EventArgs());
         }
 
-        public TrackListViewModel TrackListVM
+        public ListViewModel<Track> TrackListVM
         {
             get => tracklistViewModel;
         }
diff --git a/ViewModels/TrackListViewModel.cs b/ViewModels/TrackListViewModel.cs
deleted file mode 100755 (executable)
index 8670d35..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Collections;\r
-using System.Collections.Specialized;\r
-using System.Collections.ObjectModel;\r
-using MusicPlayer.Models;\r
-using Tizen.Content.MediaContent;\r
-using MusicPlayer.Common;\r
-\r
-namespace MusicPlayer.ViewModels\r
-{\r
-    class TrackListViewModel : ObservableCollection<Track>\r
-    {\r
-        public TrackListViewModel()\r
-        {\r
-        }\r
-\r
-        public void CreateData(OrderedDictionary dict)\r
-        {\r
-            foreach(DictionaryEntry item in dict)\r
-            {\r
-                Add(new Track((AudioInfo)item.Value));\r
-            }\r
-            Tizen.Log.Debug(AppConstants.LogTag, "Observable list item count: " + this.Count);\r
-        }\r
-    }\r
-}\r
index 4fcf53c57e78ae550b052dd72ee9dcfc39e76aa5..833545ff18c31d981e3c1a972d513442e461baa4 100755 (executable)
@@ -4,16 +4,14 @@ using MusicPlayer.Common;
 \r
 namespace MusicPlayer.ViewModels\r
 {\r
+    using AudioInfo = Tizen.Content.MediaContent.AudioInfo;\r
     class TrackViewModel : PropertyNotifier\r
     {\r
-        private string trackCount;\r
-        private TrackListViewModel listViewModel;\r
-\r
         public TrackViewModel()\r
         {\r
             OrderedDictionary trackList = TrackDataProvider.CurrentTrackList();\r
-            listViewModel = new TrackListViewModel();\r
-            listViewModel.CreateData(trackList);\r
+            listViewModel = new ListViewModel<Track>();\r
+            listViewModel.CreateData<AudioInfo>(trackList);\r
             listViewModel.CollectionChanged += OnTrackListChanges;\r
             TrackCount = listViewModel.Count.ToString();\r
         }\r
@@ -23,15 +21,23 @@ namespace MusicPlayer.ViewModels
             TrackCount = listViewModel.Count.ToString();\r
         }\r
 \r
-        public TrackListViewModel ListViewModel\r
+        private ListViewModel<Track> listViewModel;\r
+\r
+        public ListViewModel<Track> ListViewModel\r
         {\r
             get => listViewModel;\r
         }\r
 \r
+        private string trackCount;\r
+\r
         public string TrackCount\r
         {\r
             get => trackCount;\r
-            set => SetProperty(ref trackCount, value + " tracks");\r
+            set\r
+            {\r
+                string text = string.Equals(value, "1") ? " track" : " tracks";\r
+                SetProperty(ref trackCount, value + text);\r
+            }\r
         }\r
     }\r
 }\r
diff --git a/Views/AlbumDetailLayout.cs b/Views/AlbumDetailLayout.cs
new file mode 100755 (executable)
index 0000000..cb549af
--- /dev/null
@@ -0,0 +1,142 @@
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class AlbumDetailLayout : RecyclerViewItem\r
+    {\r
+        private View itemSeperator;\r
+        private TextLabel titleLabel;\r
+        private TextLabel subtitleLabel;\r
+        private TextLabel additionalLabel;\r
+\r
+        private const int LayoutMargin = 16;\r
+        private const int LayoutPadding = 32;\r
+        private const int SeperatorHeight = 1;\r
+        private const int LeftPadding = 64;\r
+        private const int X = 0;\r
+\r
+        public AlbumDetailLayout(int width = 832, int height = 108) : base()\r
+        {\r
+            base.OnInitialize();\r
+            base.IsCreateByXaml = true;\r
+            WidthSpecification = width;\r
+            HeightSpecification = height;\r
+\r
+            // to show the rounded rect of the bg\r
+            BackgroundColor = Color.Transparent;\r
+\r
+            titleLabel = CreateTitleLabel();\r
+            subtitleLabel = CreateSubTitleLabel();\r
+            additionalLabel = CreateAdditionalLabel(width);\r
+            itemSeperator = CreateItemSeparator(width, height);\r
+            IsCreateByXaml = true;\r
+        }\r
+\r
+        private TextLabel CreateTitleLabel()\r
+        {\r
+            TextLabel titleLabel = new TextLabel()\r
+            {\r
+                Size2D = new Size2D(596, 40),\r
+                TextColor = UIColors.HEX001447,\r
+                PixelSize = 32,\r
+                FontFamily = "BreezeSans",\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                Padding=new Extents(LayoutPadding,0,0,0),\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D(X , LayoutMargin),\r
+            };\r
+            base.Add(titleLabel);\r
+            return titleLabel;\r
+        }\r
+\r
+        private TextLabel CreateSubTitleLabel()\r
+        {\r
+            TextLabel subtitleLabel = new TextLabel()\r
+            {\r
+                Size2D= new Size2D(596,36),\r
+                TextColor = UIColors.HEX001447,\r
+                PixelSize = 28,\r
+                FontFamily = "BreezeSans",\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                Padding = new Extents(LayoutPadding, 0, 0, 0),\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D(X , LayoutMargin + 40)\r
+            };\r
+            base.Add(subtitleLabel);\r
+            return subtitleLabel;\r
+        }\r
+\r
+        private TextLabel CreateAdditionalLabel(int width)\r
+        {\r
+            TextLabel additionalLabel = new TextLabel()\r
+            {\r
+                Size2D= new Size2D(108,36),\r
+                TextColor = UIColors.HEX001447,\r
+                PixelSize = 28,\r
+                FontFamily = "BreezeSans",\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                HorizontalAlignment =HorizontalAlignment.End,\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D(width-LayoutPadding-LeftPadding-108, 36)\r
+            };\r
+            base.Add(additionalLabel);\r
+            return additionalLabel;\r
+        }\r
+\r
+        private View CreateItemSeparator(int width, int height)\r
+        {\r
+            View itemSeperator = new View()\r
+            {\r
+                Size2D = new Size2D(width, SeperatorHeight),\r
+                ExcludeLayouting = true,\r
+                Position2D = new Position2D(X , height - SeperatorHeight),\r
+                BackgroundColor = UIColors.ItemSeperator,\r
+            };\r
+            base.Add(itemSeperator);\r
+            return itemSeperator;\r
+        }\r
+\r
+        public TextLabel TitleLabel\r
+        {\r
+            get => titleLabel;\r
+        }\r
+        public TextLabel SubtitleLabel\r
+        {\r
+            get => subtitleLabel;\r
+        }\r
+        public TextLabel AdditionalLabel\r
+        {\r
+            get => additionalLabel;\r
+        }\r
+\r
+        protected override void Dispose(DisposeTypes type)\r
+        {\r
+            if (Disposed)\r
+            {\r
+                return;\r
+            }\r
+            if (type == DisposeTypes.Explicit)\r
+            {\r
+                base.Remove(itemSeperator);\r
+                itemSeperator?.Dispose();\r
+                itemSeperator = null;\r
+\r
+                base.Remove(titleLabel);\r
+                titleLabel?.Dispose();\r
+                titleLabel = null;\r
+\r
+                base.Remove(subtitleLabel);\r
+                subtitleLabel?.Dispose();\r
+                subtitleLabel = null;\r
+\r
+                base.Remove(additionalLabel);\r
+                additionalLabel?.Dispose();\r
+                additionalLabel = null;\r
+            }\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}\r
diff --git a/Views/AlbumDetailView.cs b/Views/AlbumDetailView.cs
new file mode 100755 (executable)
index 0000000..3c6ba3f
--- /dev/null
@@ -0,0 +1,243 @@
+using MusicPlayer.ViewModels;\r
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+using Tizen.NUI.Binding;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class AlbumDetailView : View\r
+    {\r
+        private const int LayoutPadding = 64;\r
+        private const int IconSize = 48;\r
+        private const int AlbumArtSize = 520;\r
+        private const int ControlViewWidth = 960;\r
+        private const int ControlViewHeight = 60;\r
+        private const int ControlViewMargin = 6;\r
+\r
+        private BaseView baseView;\r
+        private View contentView;\r
+        private View leftView;\r
+        private View rightView;\r
+        private ImageView albumArtIcon;\r
+        private TextLabel albumNameLabel;\r
+        private TextLabel albumArtistLabel;\r
+        private View controlsView;\r
+        private TextLabel trackCountLabel;\r
+        private Button playAllIcon; // TODO need to implement playall feature\r
+        private Button shuffleAndPlayAllIcon; // TODO need to implement playlist manager\r
+        private CollectionView collectionView;\r
+\r
+        private AlbumDetailViewModel viewModel;\r
+        public AlbumDetailView(AlbumDetailViewModel viewModel) : base()\r
+        {\r
+            this.viewModel = viewModel;\r
+            BindingContext = viewModel;\r
+            BackgroundColor = UIColors.HEXEEEFF1;\r
+            WidthResizePolicy = ResizePolicyType.FillToParent;\r
+            HeightResizePolicy = ResizePolicyType.FillToParent;\r
+\r
+            //TODO need to change this part after implementation of Command Interface\r
+            baseView = new BaseView()\r
+            {\r
+                Title = viewModel.AlbumName,\r
+                BackButton = true,\r
+                MoreButton = true,\r
+                SearchButton = true,\r
+                BackgroundColor = UIColors.HEXEEEFF1,\r
+            };\r
+            base.Add(baseView);\r
+            contentView = new View()\r
+            {\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 876,\r
+                Layout = new FlexLayout()\r
+                {\r
+                    Direction = FlexLayout.FlexDirection.Row,\r
+                    ItemsAlignment = FlexLayout.AlignmentType.FlexStart,\r
+                    Justification = FlexLayout.FlexJustification.FlexStart,\r
+                },\r
+            };\r
+            baseView.SetContent = contentView;\r
+\r
+            leftView = CreateLeftView();\r
+            rightView = CreateRightView();\r
+            controlsView = AddControlView();\r
+            AddControlElements();\r
+            collectionView = AddCollectionView();\r
+            AddAlbumArt();\r
+            AddAlbumInfo();\r
+        }\r
+\r
+        private void OnTrackSelection(object sender, SelectionChangedEventArgs e)\r
+        {\r
+\r
+        }\r
+\r
+        private Button CreatButton(string url, int x, int y)\r
+        {\r
+            ButtonStyle buttonStyle = new ButtonStyle()\r
+            {\r
+                Icon = new ImageViewStyle()\r
+                {\r
+                    ResourceUrl = url,\r
+                },\r
+                IsSelectable = false,\r
+                IsEnabled = true,\r
+            };\r
+\r
+            Button button = new Button(buttonStyle)\r
+            {\r
+                Size2D = new Size2D(IconSize, IconSize),\r
+                Position2D = new Position2D(x, y),\r
+            };\r
+            return button;\r
+        }\r
+\r
+        private View CreateLeftView()\r
+        {\r
+            View leftView = new View()\r
+            {\r
+                BackgroundColor = UIColors.HEXEEEFF1,\r
+                Size2D = new Size2D(Window.Instance.WindowSize.Width / 2, 752),\r
+                Position2D = new Position2D(0, 0),\r
+                Layout = new FlexLayout\r
+                {\r
+                    Direction = FlexLayout.FlexDirection.Column,\r
+                    ItemsAlignment = FlexLayout.AlignmentType.Center,\r
+                    Justification = FlexLayout.FlexJustification.FlexStart,\r
+                },\r
+                Padding = new Extents(0, 0, ControlViewHeight, 42),\r
+            };\r
+            contentView.Add(leftView);\r
+            return leftView;\r
+        }\r
+\r
+        private View CreateRightView()\r
+        {\r
+            View rightView = new View()\r
+            {\r
+                BackgroundColor = UIColors.HEXEEEFF1,\r
+                Size2D = new Size2D(Window.Instance.WindowSize.Width / 2, 752),\r
+                Position2D = new Position2D(Window.Instance.WindowSize.Width / 2, 0),\r
+                Layout = new FlexLayout\r
+                {\r
+                    Direction = FlexLayout.FlexDirection.Column,\r
+                    ItemsAlignment = FlexLayout.AlignmentType.Center,\r
+                    Justification = FlexLayout.FlexJustification.FlexStart,\r
+                },\r
+            };\r
+            contentView.Add(rightView);\r
+            return rightView;\r
+        }\r
+\r
+        private void AddAlbumArt()\r
+        {\r
+            albumArtIcon = new ImageView()\r
+            {\r
+                BackgroundColor = UIColors.HEXEEEFF1,\r
+                Size2D = new Size2D(AlbumArtSize, AlbumArtSize),\r
+            };\r
+            albumArtIcon.SetBinding(ImageView.ResourceUrlProperty, "AlbumArtPath");\r
+            leftView.Add(albumArtIcon);\r
+        }\r
+        private void AddAlbumInfo()\r
+        {\r
+            albumNameLabel = new TextLabel()\r
+            {\r
+                Text = "ALBUM NAME",\r
+                Size2D = new Size2D(640, 48),\r
+                PixelSize = 36,\r
+                Margin = new Extents(0, 0, 32, 0),\r
+                FontFamily = "BreezeSans",\r
+                TextColor = UIColors.HEX001447,\r
+                HorizontalAlignment = HorizontalAlignment.Center,\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                Ellipsis = true,\r
+            };\r
+            albumNameLabel.SetBinding(TextLabel.TextProperty, "AlbumName");\r
+            leftView.Add(albumNameLabel);\r
+            albumArtistLabel = new TextLabel()\r
+            {\r
+                Text = "ARTIST NAME",\r
+                Size2D = new Size2D(640, 36),\r
+                PixelSize = 28,\r
+                Margin = new Extents(0, 0, 14, 0),\r
+                FontFamily = "BreezeSans",\r
+                TextColor = UIColors.HEX000209,\r
+                HorizontalAlignment = HorizontalAlignment.Center,\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                Ellipsis = true,\r
+            };\r
+            albumArtistLabel.SetBinding(TextLabel.TextProperty, "ArtistName");\r
+            leftView.Add(albumArtistLabel);\r
+\r
+        }\r
+        private View AddControlView()\r
+        {\r
+            View controlsView = new View()\r
+            {\r
+                BackgroundColor = UIColors.HEXEEEFF1,\r
+                Size2D = new Size2D(ControlViewWidth, ControlViewHeight),\r
+                Padding = new Extents(LayoutPadding, LayoutPadding, ControlViewMargin, ControlViewMargin),\r
+            };\r
+            rightView.Add(controlsView);\r
+            return controlsView;\r
+        }\r
+\r
+        private void AddControlElements()\r
+        {\r
+            trackCountLabel = new TextLabel()\r
+            {\r
+                Text = "TRACK COUNT",\r
+                Size2D = new Size2D(664, 36),\r
+                Position2D = new Position2D(LayoutPadding, 12),\r
+                PixelSize = 28,\r
+                Margin = new Extents(0, 0, ControlViewMargin, ControlViewMargin),\r
+                FontFamily = "BreezeSans",\r
+                TextColor = UIColors.HEX001447,\r
+                HorizontalAlignment = HorizontalAlignment.Begin,\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+            };\r
+            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.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
+            playAllIcon.Margin = new Extents(32, 0, 0, 0);\r
+            controlsView.Add(shuffleAndPlayAllIcon);\r
+\r
+        }\r
+\r
+        private CollectionView AddCollectionView()\r
+        {\r
+            CollectionView collectionView = new CollectionView()\r
+            {\r
+                Size2D = new Size2D(832, 108),\r
+                BackgroundImage = Resources.GetImagePath() + "list_view_bg.png",\r
+                ItemsLayouter = new LinearLayouter(),\r
+                ItemTemplate = new DataTemplate(() =>\r
+                {\r
+                    AlbumDetailLayout layout = new AlbumDetailLayout();\r
+                    layout.TitleLabel.SetBinding(TextLabel.TextProperty, "TrackTitle");\r
+                    layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "ArtistName");\r
+                    layout.AdditionalLabel.SetBinding(TextLabel.TextProperty, "Duration");\r
+                    return layout;\r
+                }),\r
+                ScrollingDirection = ScrollableBase.Direction.Vertical,\r
+                HeightSpecification = LayoutParamPolicies.WrapContent,\r
+                SelectionMode = ItemSelectionMode.Single,\r
+            };\r
+            rightView.Add(collectionView);\r
+            FlexLayout.SetFlexGrow(collectionView, 1);\r
+            FlexLayout.SetFlexShrink(collectionView, 1);\r
+            collectionView.ItemsSource = viewModel.ListViewModel;\r
+            collectionView.SelectionChanged += OnTrackSelection;\r
+            return collectionView;\r
+        }\r
+    }\r
+}\r
diff --git a/Views/AlbumView.cs b/Views/AlbumView.cs
new file mode 100755 (executable)
index 0000000..16bddc9
--- /dev/null
@@ -0,0 +1,72 @@
+using MusicPlayer.ViewModels;\r
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+using Tizen.NUI.Binding;\r
+using MusicPlayer.Common;\r
+using MusicPlayer.Models;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class AlbumView : BaseContentView\r
+    {\r
+        private AlbumViewModel viewModel;\r
+        private TextLabel albumCountLabel;\r
+\r
+        public AlbumView(AlbumViewModel viewModel)\r
+        {\r
+            this.viewModel = viewModel;\r
+            BindingContext = viewModel;\r
+            collectionView.ItemsSource = viewModel.ListViewModel;\r
+            collectionView.ItemTemplate = new DataTemplate(() =>\r
+            {\r
+                ListItemLayout layout = new ListItemLayout();\r
+                layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "AlbumArtPath");\r
+                layout.TitleLabel.SetBinding(TextLabel.TextProperty, "AlbumName");\r
+                layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "ArtistName");\r
+                return layout;\r
+            });\r
+            collectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;\r
+            collectionView.WidthSpecification = LayoutParamPolicies.WrapContent;\r
+            collectionView.SelectionMode = ItemSelectionMode.Single;\r
+            collectionView.SelectionChanged += OnAlbumSelection;\r
+\r
+            albumCountLabel = new TextLabel()\r
+            {\r
+                PixelSize = 28,\r
+                Text = "ALBUM COUNT",\r
+                TextColor = UIColors.HEX001447,\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                FontFamily = "BreezeSans",\r
+                IsCreateByXaml = true,\r
+            };\r
+            titleView.Add(albumCountLabel);\r
+            albumCountLabel.SetBinding(TextLabel.TextProperty, "AlbumCount");\r
+            RelativeLayout.SetLeftTarget(albumCountLabel, titleView);\r
+            RelativeLayout.SetLeftRelativeOffset(albumCountLabel, 1.0f);\r
+            RelativeLayout.SetRightRelativeOffset(albumCountLabel, 0.0f);\r
+            RelativeLayout.SetFillHorizontal(albumCountLabel, true);\r
+        }\r
+        private void OnAlbumSelection(object sender, SelectionChangedEventArgs e)\r
+        {\r
+            MusicAlbum currentAlbum= (MusicAlbum)collectionView.SelectedItem;\r
+            // viewModel.getDetailViewModel(currentAlbum) => need to replace direct function call on viewModel class with command interface\r
+            AlbumDetailView view = new AlbumDetailView(viewModel.getDetailViewModel(currentAlbum));\r
+            Window.Instance.Add(view);\r
+        }\r
+        protected override void Dispose(DisposeTypes type)\r
+        {\r
+            if (Disposed)\r
+            {\r
+                return;\r
+            }\r
+            if (type == DisposeTypes.Explicit)\r
+            {\r
+                titleView.Remove(albumCountLabel);\r
+                albumCountLabel.Dispose();\r
+                albumCountLabel = null;\r
+            }\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}\r
index d62b178e47abef84b60b50e535c8d55fa215dd55..1de2b3c5accac2348eb61ad30995cf1412506dd3 100755 (executable)
@@ -1,7 +1,6 @@
 using MusicPlayer.Common;\r
 using Tizen.NUI;\r
 using Tizen.NUI.BaseComponents;\r
-using Tizen.NUI.Binding;\r
 using Tizen.NUI.Components;\r
 \r
 namespace MusicPlayer.Views\r
@@ -39,14 +38,6 @@ namespace MusicPlayer.Views
                 Margin = new Extents(0, 0, 0, 2),\r
                 BackgroundImage = Resources.GetImagePath() + "list_view_bg.png",\r
                 ItemsLayouter = new LinearLayouter(),\r
-                ItemTemplate = new DataTemplate(() =>\r
-                {\r
-                    TrackLayout layout = new TrackLayout();\r
-                    layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "ThumbnailPath");\r
-                    layout.TitleLabel.SetBinding(TextLabel.TextProperty, "TrackTitle");\r
-                    layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "ArtistName");\r
-                    return layout;\r
-                }),\r
                 ScrollingDirection = ScrollableBase.Direction.Vertical,\r
                 WidthSpecification = LayoutParamPolicies.MatchParent,\r
                 HeightSpecification = LayoutParamPolicies.WrapContent,\r
index e78f0f63e4c744fb11d9d8049c2d8e11f3b990c9..ffc439635ea3561687722fb3ba67531b1069d5f6 100755 (executable)
@@ -2,6 +2,7 @@
 using Tizen.NUI;\r
 using Tizen.NUI.BaseComponents;\r
 using Tizen.NUI.Components;\r
+using Tizen.NUI.Binding;\r
 using MusicPlayer.Common;\r
 \r
 namespace MusicPlayer.Views\r
@@ -59,6 +60,7 @@ namespace MusicPlayer.Views
                 Ellipsis = true,\r
             };\r
             topView.Add(titleLabel);\r
+            titleLabel.SetBinding(TextLabel.TextProperty, "Title");\r
             RelativeLayout.SetLeftTarget(titleLabel, topView);\r
             RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f);\r
             RelativeLayout.SetRightTarget(titleLabel, topView);\r
@@ -133,7 +135,7 @@ namespace MusicPlayer.Views
                     backButton = new Button(buttonStyle)\r
                     {\r
                         Size2D = new Size2D(48, 48),\r
-                        Margin = new Extents(0, 32, 6, 6),\r
+                        Margin = new Extents(0, 24, 6, 6),\r
                     };\r
                     topView.Add(backButton);\r
 \r
@@ -165,7 +167,7 @@ namespace MusicPlayer.Views
                     moreButton = new Button(buttonStyle)\r
                     {\r
                         Size2D = new Size2D(48, 48),\r
-                        Margin = new Extents(24, 0, 6, 6),\r
+                        Margin = new Extents(32, 0, 6, 6),\r
                     };\r
                     topView.Add(moreButton);\r
                     RelativeLayout.SetLeftRelativeOffset(moreButton, 1.0f);\r
@@ -197,7 +199,7 @@ namespace MusicPlayer.Views
                     {\r
                         Size2D = new Size2D(96, 60),\r
                         BackgroundImage = Resources.GetImagePath() + "search_button_bg.png",\r
-                        Margin = new Extents(0, 32, 0, 0),\r
+                        Margin = new Extents(24, 0, 0, 0),\r
                     };\r
                     topView.Add(searchButton);\r
                     RelativeLayout.SetRightTarget(searchButton, moreButton);\r
diff --git a/Views/ListItemLayout.cs b/Views/ListItemLayout.cs
new file mode 100755 (executable)
index 0000000..1c070d1
--- /dev/null
@@ -0,0 +1,124 @@
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class ListItemLayout : RecyclerViewItem\r
+    {\r
+        private static int Width = 1792;\r
+        private static int Height = 108;\r
+\r
+        private const int IconSize = 64;\r
+        private const int LayoutMargin = 16;\r
+        private const int LayoutPadding = 32;\r
+        private const int SeperatorHeight = 1;\r
+        private const int LeftPadding = 64;\r
+        private const int x = 0;\r
+\r
+        private View itemSeperator;\r
+        private TextLabel titleLabel;\r
+        private TextLabel subtitleLabel;\r
+        private ImageView icon;\r
+\r
+        public ListItemLayout(int width = 1792, int height = 108) : base()\r
+        {\r
+            base.OnInitialize();\r
+            base.IsCreateByXaml = true;\r
+            Width = width;\r
+            Height = height;\r
+            WidthSpecification = Width;\r
+            HeightSpecification = Height;\r
+\r
+            // to show the rounded rect of the bg\r
+            BackgroundColor = Color.Transparent;\r
+\r
+            icon = new ImageView()\r
+            {\r
+                WidthSpecification = IconSize,\r
+                HeightSpecification = IconSize,\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D(x, ((Height / 2) - (IconSize / 2))),\r
+            };\r
+            base.Add(icon);\r
+\r
+            itemSeperator = new View()\r
+            {\r
+                WidthSpecification = (Width - (2 * LeftPadding)),\r
+                HeightSpecification = SeperatorHeight,\r
+                ExcludeLayouting = true,\r
+                Position2D = new Position2D(x, Height - SeperatorHeight),\r
+                BackgroundColor = UIColors.ItemSeperator,\r
+            };\r
+            base.Add(itemSeperator);\r
+\r
+            titleLabel = new TextLabel()\r
+            {\r
+                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - LayoutPadding),\r
+                HeightSpecification = 40,\r
+                TextColor = Color.Blue,\r
+                PixelSize = 32,\r
+                FontFamily = "BreezeSans",\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D((x + IconSize + LayoutPadding), LayoutMargin),\r
+            };\r
+            base.Add(titleLabel);\r
+\r
+            subtitleLabel = new TextLabel()\r
+            {\r
+                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - LayoutPadding),\r
+                HeightSpecification = 36,\r
+                TextColor = Color.Black,\r
+                PixelSize = 28,\r
+                FontFamily = "BreezeSans",\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D((x + IconSize + LayoutPadding), LayoutMargin + 40)\r
+            };\r
+            base.Add(subtitleLabel);\r
+            IsCreateByXaml = true;\r
+        }\r
+        public ImageView Icon\r
+        {\r
+            get => icon;\r
+        }\r
+        public TextLabel TitleLabel\r
+        {\r
+            get => titleLabel;\r
+        }\r
+        public TextLabel SubtitleLabel\r
+        {\r
+            get => subtitleLabel;\r
+        }\r
+\r
+        protected override void Dispose(DisposeTypes type)\r
+        {\r
+            if(Disposed)\r
+            {\r
+                return;\r
+            }\r
+            if (type == DisposeTypes.Explicit)\r
+            {\r
+                base.Remove(itemSeperator);\r
+                itemSeperator?.Dispose();\r
+                itemSeperator = null;\r
+\r
+                base.Remove(icon);\r
+                icon?.Dispose();\r
+                icon = null;\r
+\r
+                base.Remove(titleLabel);\r
+                titleLabel?.Dispose();\r
+                titleLabel = null;\r
+\r
+                base.Remove(subtitleLabel);\r
+                subtitleLabel?.Dispose();\r
+                subtitleLabel = null;\r
+            }\r
+\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}\r
index 893b67c309677f892364c629d7b313c5159cce73..cab9516f1c8269e1191a257399b62d1bf19e3c1b 100755 (executable)
@@ -25,7 +25,7 @@ namespace MusicPlayer.Views
                 ItemsLayouter = new LinearLayouter(),
                 ItemTemplate = new DataTemplate(() =>
                 {
-                    TrackLayout layout = new TrackLayout(832, 108);
+                    ListItemLayout layout = new ListItemLayout(832, 108);
                     layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "ThumbnailPath");
                     layout.TitleLabel.SetBinding(TextLabel.TextProperty, "TrackTitle");
                     layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "ArtistName");
diff --git a/Views/TrackLayout.cs b/Views/TrackLayout.cs
deleted file mode 100755 (executable)
index a3fe758..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-using Tizen.NUI.Components;\r
-using Tizen.NUI.BaseComponents;\r
-using Tizen.NUI;\r
-using MusicPlayer.Common;\r
-\r
-namespace MusicPlayer.Views\r
-{\r
-    class TrackLayout : RecyclerViewItem\r
-    {\r
-        private static int Width = 1792;\r
-        private static int Height = 108;\r
-\r
-        private const int IconSize = 64;\r
-        private const int LayoutMargin = 16;\r
-        private const int LayoutPadding = 32;\r
-        private const int SeperatorHeight = 1;\r
-        private const int LeftPadding = 64;\r
-        private const int x = 0;\r
-\r
-        private View itemSeperator;\r
-        private TextLabel titleLabel;\r
-        private TextLabel subtitleLabel;\r
-        private ImageView icon;\r
-\r
-        public TrackLayout(int width = 1792, int height = 108) : base()\r
-        {\r
-            base.OnInitialize();\r
-            base.IsCreateByXaml = true;\r
-            Width = width;\r
-            Height = height;\r
-            WidthSpecification = Width;\r
-            HeightSpecification = Height;\r
-\r
-            // to show the rounded rect of the bg\r
-            BackgroundColor = Color.Transparent;\r
-\r
-            icon = new ImageView()\r
-            {\r
-                WidthSpecification = IconSize,\r
-                HeightSpecification = IconSize,\r
-                IsCreateByXaml = true,\r
-                Position2D = new Position2D(x, ((Height / 2) - (IconSize / 2))),\r
-            };\r
-            base.Add(icon);\r
-\r
-            itemSeperator = new View()\r
-            {\r
-                WidthSpecification = (Width - (2 * LeftPadding)),\r
-                HeightSpecification = SeperatorHeight,\r
-                ExcludeLayouting = true,\r
-                Position2D = new Position2D(x, Height - SeperatorHeight),\r
-                BackgroundColor = UIColors.ItemSeperator,\r
-            };\r
-            base.Add(itemSeperator);\r
-\r
-            titleLabel = new TextLabel()\r
-            {\r
-                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - LayoutPadding),\r
-                HeightSpecification = 40,\r
-                TextColor = Color.Blue,\r
-                PixelSize = 32,\r
-                FontFamily = "BreezeSans",\r
-                VerticalAlignment = VerticalAlignment.Center,\r
-                IsCreateByXaml = true,\r
-                Position2D = new Position2D((x + IconSize + LayoutPadding), LayoutMargin),\r
-            };\r
-            base.Add(titleLabel);\r
-\r
-            subtitleLabel = new TextLabel()\r
-            {\r
-                WidthSpecification = (Width - (2 * LeftPadding) - IconSize - LayoutPadding),\r
-                HeightSpecification = 36,\r
-                TextColor = Color.Black,\r
-                PixelSize = 28,\r
-                FontFamily = "BreezeSans",\r
-                VerticalAlignment = VerticalAlignment.Center,\r
-                IsCreateByXaml = true,\r
-                Position2D = new Position2D((x + IconSize + LayoutPadding), LayoutMargin + 40)\r
-            };\r
-            base.Add(subtitleLabel);\r
-            IsCreateByXaml = true;\r
-        }\r
-        public ImageView Icon\r
-        {\r
-            get => icon;\r
-        }\r
-        public TextLabel TitleLabel\r
-        {\r
-            get => titleLabel;\r
-        }\r
-        public TextLabel SubtitleLabel\r
-        {\r
-            get => subtitleLabel;\r
-        }\r
-\r
-        protected override void Dispose(DisposeTypes type)\r
-        {\r
-            if(Disposed)\r
-            {\r
-                return;\r
-            }\r
-            if (type == DisposeTypes.Explicit)\r
-            {\r
-                base.Remove(itemSeperator);\r
-                itemSeperator?.Dispose();\r
-                itemSeperator = null;\r
-\r
-                base.Remove(icon);\r
-                icon?.Dispose();\r
-                icon = null;\r
-\r
-                base.Remove(titleLabel);\r
-                titleLabel?.Dispose();\r
-                titleLabel = null;\r
-\r
-                base.Remove(subtitleLabel);\r
-                subtitleLabel?.Dispose();\r
-                subtitleLabel = null;\r
-            }\r
-\r
-            base.Dispose(type);\r
-        }\r
-    }\r
-}\r
index a6aa3f10752f98c4f2ffc83098aa84947ab31a50..95467e5b27f0d58a50ee9cdb40c0ccc15a161a23 100755 (executable)
@@ -18,6 +18,14 @@ namespace MusicPlayer.Views
             this.viewModel = viewModel;\r
             BindingContext = viewModel;\r
             collectionView.ItemsSource = viewModel.ListViewModel;\r
+            collectionView.ItemTemplate= new DataTemplate(()=>\r
+            {\r
+                ListItemLayout layout = new ListItemLayout();\r
+                layout.Icon.SetBinding(ImageView.ResourceUrlProperty, "ThumbnailPath");\r
+                layout.TitleLabel.SetBinding(TextLabel.TextProperty, "TrackTitle");\r
+                layout.SubtitleLabel.SetBinding(TextLabel.TextProperty, "ArtistName");\r
+                return layout;\r
+            });\r
             collectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;\r
             collectionView.WidthSpecification = LayoutParamPolicies.WrapContent;\r
             collectionView.SelectionMode = ItemSelectionMode.Single;\r
@@ -42,7 +50,7 @@ namespace MusicPlayer.Views
 \r
         private void OnTrackSelection(object sender, SelectionChangedEventArgs e)\r
         {\r
-\r
+            //TODO\r
         }\r
 \r
         protected override void Dispose(DisposeTypes type)\r