Adding base layout and trackview classes 11/259111/4
authoraman.jeph <aman.jeph@samsung.com>
Tue, 1 Jun 2021 07:25:51 +0000 (12:55 +0530)
committeraman.jeph <aman.jeph@samsung.com>
Fri, 4 Jun 2021 03:49:45 +0000 (09:19 +0530)
Change-Id: I9242ea28821262489605bcc566c545603c2519f0
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
15 files changed:
Common/PropertyNotifier.cs [new file with mode: 0755]
MediaContent/AlbumContents.cs [changed mode: 0644->0755]
MediaContent/ArtistContents.cs [changed mode: 0644->0755]
MediaContent/PlaylistContents.cs [changed mode: 0644->0755]
MediaContent/TrackContents.cs [changed mode: 0644->0755]
Models/Track.cs [new file with mode: 0755]
Models/TrackDataProvider.cs [new file with mode: 0755]
MusicPlayer.cs
ViewModels/TrackListViewModel.cs [new file with mode: 0755]
ViewModels/TrackViewModel.cs [new file with mode: 0755]
Views/BaseContentView.cs [new file with mode: 0755]
Views/BaseView.cs [new file with mode: 0755]
Views/TrackLayout.cs [new file with mode: 0755]
Views/TrackView.cs [new file with mode: 0755]
music-player.csproj [changed mode: 0644->0755]

diff --git a/Common/PropertyNotifier.cs b/Common/PropertyNotifier.cs
new file mode 100755 (executable)
index 0000000..de87064
--- /dev/null
@@ -0,0 +1,30 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using System.ComponentModel;\r
+using System.Runtime.CompilerServices;\r
+\r
+namespace MusicPlayer.Common\r
+{\r
+    class PropertyNotifier : INotifyPropertyChanged\r
+    {\r
+        public event PropertyChangedEventHandler PropertyChanged;\r
+\r
+        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)\r
+        {\r
+            if (Equals(storage, value))\r
+            {\r
+                return false;\r
+            }\r
+\r
+            storage = value;\r
+            OnPropertyChanged(propertyName);\r
+            return true;\r
+        }\r
+\r
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)\r
+        {\r
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));\r
+        }\r
+    }\r
+}\r
old mode 100644 (file)
new mode 100755 (executable)
index 50ca286..312cf28
@@ -1,7 +1,7 @@
 using System;\r
 using System.Collections.Specialized;\r
 using Tizen.Content.MediaContent;\r
-using System.Text;\r
+using MusicPlayer.Common;\r
 \r
 namespace MusicPlayer.Media\r
 {\r
@@ -19,7 +19,7 @@ namespace MusicPlayer.Media
                 Album info = dataReader.Current;\r
                 albumList.Add(info.Id, info);\r
             }\r
-            Tizen.Log.Debug("MUSIC_PLAYER", "Total album retrived from database: " + albumList.Count);\r
+            Tizen.Log.Debug(Constants.LogTag, "Total album retrived from database: " + albumList.Count);\r
             dataReader.Dispose();\r
             return albumList;\r
         }\r
old mode 100644 (file)
new mode 100755 (executable)
index 4814bdb..b0bc7be
@@ -1,8 +1,9 @@
-using System;\r
-using System.Collections.Specialized;\r
+using System.Collections.Specialized;\r
 using System.Collections.Generic;\r
-using System.Text;\r
 using Tizen.Content.MediaContent;\r
+using System;\r
+using MusicPlayer.Common;\r
+\r
 \r
 namespace MusicPlayer.Media\r
 {\r
@@ -20,7 +21,7 @@ namespace MusicPlayer.Media
                 string info = (string)dataReader.Current;\r
                 artistList.Add(info);\r
             }\r
-            Tizen.Log.Debug("MUSIC_PLAYER", "Total artists retrived from database: " + artistList.Count);\r
+            Tizen.Log.Debug(Constants.LogTag, "Total artists retrived from database: " + artistList.Count);\r
             dataReader.Dispose();\r
             return artistList;\r
         }\r
@@ -52,19 +53,19 @@ namespace MusicPlayer.Media
             }\r
             catch (ObjectDisposedException ex)\r
             {\r
-                Tizen.Log.Error("MUSIC_PLAYER", "ObjectDisposedException: " + ex.Message);\r
+                Tizen.Log.Error(Constants.LogTag, "ObjectDisposedException: " + ex.Message);\r
             }\r
             catch (InvalidOperationException ex)\r
             {\r
-                Tizen.Log.Error("MUSIC_PLAYER", "InvalidOperationException: " + ex.Message);\r
+                Tizen.Log.Error(Constants.LogTag, "InvalidOperationException: " + ex.Message);\r
             }\r
             catch (MediaDatabaseException ex)\r
             {\r
-                Tizen.Log.Error("MUSIC_PLAYER", "MediaDatabaseException: " + ex.Message);\r
+                Tizen.Log.Error(Constants.LogTag, "MediaDatabaseException: " + ex.Message);\r
             }\r
             catch (Exception ex)\r
             {\r
-                Tizen.Log.Error("MUSIC_PLAYER", "Unknown Exception: " + ex.Message);\r
+                Tizen.Log.Error(Constants.LogTag, "Unknown Exception: " + ex.Message);\r
             }\r
 \r
             return count;\r
old mode 100644 (file)
new mode 100755 (executable)
index 677f574..d7f9f34
@@ -1,7 +1,6 @@
-using System;\r
-using System.Collections.Generic;\r
-using System.Text;\r
+using System.Collections.Generic;\r
 using Tizen.Content.MediaContent;\r
+using MusicPlayer.Common;\r
 \r
 namespace MusicPlayer.Media\r
 {\r
@@ -18,7 +17,7 @@ namespace MusicPlayer.Media
                 Playlist playlist = dataReader.Current;\r
                 playlists.Add(playlist);\r
             }\r
-            Tizen.Log.Debug("MUSIC_PLAYER", "PlayLists Count : " + playlists.Count);\r
+            Tizen.Log.Debug(Constants.LogTag, "PlayLists Count : " + playlists.Count);\r
             return playlists;\r
         }\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index d9b57cf..1ce5290
@@ -1,5 +1,6 @@
 using System.Collections.Specialized;\r
 using Tizen.Content.MediaContent;\r
+using MusicPlayer.Common;\r
 \r
 namespace MusicPlayer.Media\r
 {\r
@@ -17,7 +18,7 @@ namespace MusicPlayer.Media
                 MediaInfo info = dataReader.Current;\r
                 mediaList.Add(info.Id, info);\r
             }\r
-            Tizen.Log.Debug("MUSIC_PLAYER", "Total track retrived from database: " + mediaList.Count);\r
+            Tizen.Log.Debug(Constants.LogTag, "Total track retrived from database: " + mediaList.Count);\r
             dataReader.Dispose();\r
             return mediaList;\r
         }\r
diff --git a/Models/Track.cs b/Models/Track.cs
new file mode 100755 (executable)
index 0000000..c92dcae
--- /dev/null
@@ -0,0 +1,86 @@
+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
+            ThumbnailPath = audioInfo.ThumbnailPath;\r
+            FilePath = audioInfo.Path;\r
+        }\r
+\r
+        public string TrackTitle\r
+        {\r
+            get => title;\r
+            set => SetProperty(ref title, value);\r
+        }\r
+\r
+        public string AlbumName\r
+        {\r
+            get => album;\r
+            set\r
+            {\r
+                string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+                SetProperty(ref album, name);\r
+            }\r
+        }\r
+        public string ArtistName\r
+        {\r
+            get => artist;\r
+            set\r
+            {\r
+                string name = string.IsNullOrEmpty(value) ? "Unknown" : value;\r
+                SetProperty(ref artist, name);\r
+            }\r
+        }\r
+        public string Id\r
+        {\r
+            get => id;\r
+            set\r
+            {\r
+                id = value;\r
+            }\r
+        }\r
+        // TODO create new property of duration in string\r
+        public int Duration\r
+        {\r
+            get => duration;\r
+            set\r
+            {\r
+                duration = value;\r
+            }\r
+        }\r
+        public string ThumbnailPath\r
+        {\r
+            get => thumbnailPath;\r
+            set\r
+            {\r
+                string thumb = string.IsNullOrEmpty(value) ? Resources.GetImagePath() + "thumbnail.png" : value;\r
+                SetProperty(ref thumbnailPath, thumb);\r
+            }\r
+        }\r
+\r
+        public string FilePath\r
+        {\r
+            get => filePath;\r
+            set\r
+            {\r
+                filePath = value;\r
+            }\r
+        }\r
+    }\r
+}\r
diff --git a/Models/TrackDataProvider.cs b/Models/TrackDataProvider.cs
new file mode 100755 (executable)
index 0000000..a37db2a
--- /dev/null
@@ -0,0 +1,34 @@
+using System.Collections.Specialized;\r
+using MusicPlayer.Media;\r
+\r
+namespace MusicPlayer.Models\r
+{\r
+    public static class TrackDataProvider\r
+    {\r
+        private static OrderedDictionary tracksList;\r
+\r
+        static TrackDataProvider()\r
+        {\r
+            tracksList = Contents.GetTrackList();\r
+            Contents.MusicItemUpdate += OnMusicItemUpdate;\r
+            Contents.MusicDBUpdate += OnMusicDatabaseUpdate;\r
+        }\r
+\r
+        private static void OnMusicDatabaseUpdate(object sender, MusicDBUpdateEventArgs e)\r
+        {\r
+            tracksList = Contents.GetTrackList();\r
+            // TODO implement database update event handler\r
+            return;\r
+        }\r
+        private static void OnMusicItemUpdate(object sender, MusicItemUpdateEventArgs e)\r
+        {\r
+            // TODO implement database item update event handler\r
+            return;\r
+        }\r
+        public static OrderedDictionary CurrentTrackList()\r
+        {\r
+            return tracksList;\r
+        }\r
+\r
+    }\r
+}\r
index 0da2306f6437612e2e6079467481ac6655f28f9c..4ea8ee9a9a88cba246839abff9f3100ffddd6a80 100755 (executable)
@@ -9,13 +9,13 @@ namespace MusicPlayer
     {
         protected override void OnCreate()
         {
-            Tizen.Log.Info("MUSIC_PLAYER", "OnCreate statrted");
+            Tizen.Log.Info(Constants.LogTag, "OnCreate statrted");
             base.OnCreate();
             Window window = Window.Instance;
             window.BackgroundColor = Color.White;
             window.KeyEvent += OnKeyEvent;
             Size2D size = window.Size;
-            Tizen.Log.Info("MUSIC_PLAYER", "Window Size: " + size.Width + "x" + size.Height);
+            Tizen.Log.Info(Constants.LogTag, "Window Size: " + size.Width + "x" + size.Height);
 
             ViewManager manager = new ViewManager(Window.Instance);
         }
@@ -30,10 +30,10 @@ namespace MusicPlayer
 
         static void Main(string[] args)
         {
-            Tizen.Log.Info("MUSIC_PLAYER", "Main statrted");
+            Tizen.Log.Info(Constants.LogTag, "Main statrted");
             var app = new Application();
             app.Run(args);
-            Tizen.Log.Info("MUSIC_PLAYER", "Main finished");
+            Tizen.Log.Info(Constants.LogTag, "Main finished");
         }
     }
 }
diff --git a/ViewModels/TrackListViewModel.cs b/ViewModels/TrackListViewModel.cs
new file mode 100755 (executable)
index 0000000..5b40008
--- /dev/null
@@ -0,0 +1,25 @@
+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(Constants.LogTag, "Observable list item count: " + this.Count);\r
+        }\r
+    }\r
+}\r
diff --git a/ViewModels/TrackViewModel.cs b/ViewModels/TrackViewModel.cs
new file mode 100755 (executable)
index 0000000..38ed6cb
--- /dev/null
@@ -0,0 +1,37 @@
+using System.Collections.Specialized;\r
+using MusicPlayer.Models;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.ViewModels\r
+{\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.CollectionChanged += OnTrackListChanges;\r
+            TrackCount = listViewModel.Count.ToString();\r
+        }\r
+\r
+        private void OnTrackListChanges(object sender, NotifyCollectionChangedEventArgs e)\r
+        {\r
+            TrackCount = listViewModel.Count.ToString();\r
+        }\r
+\r
+        public TrackListViewModel ListViewModel\r
+        {\r
+            get => listViewModel;\r
+        }\r
+\r
+        public string TrackCount\r
+        {\r
+            get => trackCount;\r
+            set => SetProperty(ref trackCount, value);\r
+        }\r
+    }\r
+}\r
diff --git a/Views/BaseContentView.cs b/Views/BaseContentView.cs
new file mode 100755 (executable)
index 0000000..3514758
--- /dev/null
@@ -0,0 +1,75 @@
+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
+{\r
+    class BaseContentView : View\r
+    {\r
+        protected View titleView;\r
+        protected CollectionView collectionView;\r
+        public BaseContentView() : base()\r
+        {\r
+            WidthResizePolicy = ResizePolicyType.FillToParent;\r
+            HeightResizePolicy = ResizePolicyType.FillToParent;\r
+            Layout = new FlexLayout()\r
+            {\r
+                Direction = FlexLayout.FlexDirection.Column,\r
+                Padding = new Extents(64, 64, 0, 0),\r
+            };\r
+            titleView = new View()\r
+            {\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 60,\r
+                Layout = new RelativeLayout()\r
+                {\r
+                    Padding = new Extents(0, 0, 13, 13),\r
+                },\r
+                IsCreateByXaml = true,\r
+            };\r
+            base.Add(titleView);\r
+            FlexLayout.SetFlexGrow(titleView, 0);\r
+            FlexLayout.SetFlexShrink(titleView, 0);\r
+\r
+            collectionView = new CollectionView()\r
+            {\r
+                Size2D = new Size2D(1792, 108),\r
+                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.Thumbnail.SetBinding(ImageView.ResourceUrlProperty, "ThumbnailPath");\r
+                    layout.TitleText.SetBinding(TextLabel.TextProperty, "TrackTitle");\r
+                    layout.SubtitletText.SetBinding(TextLabel.TextProperty, "ArtistName");\r
+                    return layout;\r
+                }),\r
+                ScrollingDirection = ScrollableBase.Direction.Vertical,\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = LayoutParamPolicies.WrapContent,\r
+                SelectionMode = ItemSelectionMode.Single,\r
+            };\r
+            base.Add(collectionView);\r
+            FlexLayout.SetFlexGrow(collectionView, 1);\r
+            FlexLayout.SetFlexShrink(collectionView, 1);\r
+        }\r
+\r
+        protected override void Dispose(DisposeTypes type)\r
+        {\r
+            if (type == DisposeTypes.Explicit)\r
+            {\r
+                base.Remove(titleView);\r
+                titleView.Dispose();\r
+                titleView = null;\r
+\r
+                base.Remove(collectionView);\r
+                collectionView.Dispose();\r
+                collectionView = null;\r
+            }\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}\r
diff --git a/Views/BaseView.cs b/Views/BaseView.cs
new file mode 100755 (executable)
index 0000000..6ed379e
--- /dev/null
@@ -0,0 +1,267 @@
+using System.Collections.Generic;\r
+using Tizen.NUI;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI.Components;\r
+using MusicPlayer.Common;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class BaseView : View\r
+    {\r
+        private View topView;\r
+        private View bottomView; // TODO Used this for MiniController UI\r
+        private View contentView;\r
+        private TextLabel titleLabel;\r
+        private Button backButton;\r
+        private Button moreButton;\r
+        private Button searchButton;\r
+        private Tab tabs;\r
+\r
+        //  TODO these name strings are temporary...once the po files are added\r
+        // need to use Translatable names.\r
+        private static string[] TabNames = new string[]\r
+        {\r
+            "Playlists",\r
+            "Tracks",\r
+            "Albums",\r
+            "Artists",\r
+        };\r
+        public BaseView() : base()\r
+        {\r
+            WidthSpecification = LayoutParamPolicies.MatchParent;\r
+            HeightSpecification = LayoutParamPolicies.MatchParent;\r
+            Layout = new FlexLayout()\r
+            {\r
+                Direction = FlexLayout.FlexDirection.Column,\r
+                ItemsAlignment = FlexLayout.AlignmentType.FlexStart,\r
+                Justification = FlexLayout.FlexJustification.FlexStart,\r
+            };\r
+            topView = new View()\r
+            {\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 120,\r
+                Layout = new RelativeLayout()\r
+                {\r
+                    Padding = new Extents(64, 64, 30, 30),\r
+                },\r
+            };\r
+            base.Add(topView);\r
+            FlexLayout.SetFlexGrow(topView, 0);\r
+            FlexLayout.SetFlexShrink(topView, 0);\r
+            titleLabel = new TextLabel()\r
+            {\r
+                Text = "Music",\r
+                PixelSize = 40,\r
+                FontFamily = "BreezeSans",\r
+                TextColor = new Color(0.0f, 0.0078f, 0.0353f, 1.0f),\r
+                HorizontalAlignment = HorizontalAlignment.Begin,\r
+                Margin = new Extents(0, 0, 6, 6),\r
+                Ellipsis = true,\r
+            };\r
+            topView.Add(titleLabel);\r
+            RelativeLayout.SetLeftTarget(titleLabel, topView);\r
+            RelativeLayout.SetLeftRelativeOffset(titleLabel, 0.0f);\r
+            RelativeLayout.SetRightTarget(titleLabel, topView);\r
+            RelativeLayout.SetRightRelativeOffset(titleLabel, 1.0f);\r
+            RelativeLayout.SetFillHorizontal(titleLabel, true);\r
+\r
+            contentView = new View()\r
+            {\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 876,\r
+            };\r
+            base.Add(contentView);\r
+            FlexLayout.SetFlexGrow(contentView, 1);\r
+            FlexLayout.SetFlexShrink(contentView, 1);\r
+\r
+            tabs = new Tab()\r
+            {\r
+                Size2D = new Size2D(Window.Instance.Size.Width, 84),\r
+                WidthSpecification = LayoutParamPolicies.MatchParent,\r
+                HeightSpecification = 84,\r
+                UnderLineBackgroundColor = Color.Blue,\r
+                UnderLineSize = new Size2D(1, 3),\r
+                PointSize = 25,\r
+                BackgroundColor = Color.White,\r
+            };\r
+            tabs.TextColorSelector = new ColorSelector\r
+            {\r
+                Normal = Color.Black,\r
+                Selected = Color.Magenta,\r
+            };\r
+            base.Add(tabs);\r
+            for(int i = 0; i<4; ++i)\r
+            {\r
+                Tab.TabItemData item = new Tab.TabItemData();\r
+                item.Text = TabNames[i];\r
+                tabs.AddItem(item);\r
+            }\r
+            tabs.SelectedItemIndex = 1;\r
+\r
+            backButton = null;\r
+            moreButton = null;\r
+            searchButton = null;\r
+        }\r
+\r
+        public Tab Tabs\r
+        {\r
+            get\r
+            {\r
+                return tabs;\r
+            }\r
+        }\r
+\r
+        public string Title\r
+        {\r
+            set\r
+            {\r
+                titleLabel.Text = value;\r
+            }\r
+            get\r
+            {\r
+                return titleLabel.Text;\r
+            }\r
+        }\r
+\r
+        public bool BackButton\r
+        {\r
+            set\r
+            {\r
+                if (value)\r
+                {\r
+                    ButtonStyle buttonStyle = new ButtonStyle()\r
+                    {\r
+                        Icon = new ImageViewStyle()\r
+                        {\r
+                            ResourceUrl = Resources.GetImagePath() + "back_button.png",\r
+                        },\r
+                        IsSelectable = false,\r
+                        IsEnabled = true,\r
+                    };\r
+\r
+                    backButton = new Button(buttonStyle)\r
+                    {\r
+                        Size2D = new Size2D(48, 48),\r
+                        Margin = new Extents(0, 32, 6, 6),\r
+                    };\r
+                    topView.Add(backButton);\r
+\r
+                    RelativeLayout.SetLeftRelativeOffset(backButton, 0.0f);\r
+                    RelativeLayout.SetRightRelativeOffset(backButton, 0.0f);\r
+                    RelativeLayout.SetHorizontalAlignment(backButton, RelativeLayout.Alignment.Start);\r
+\r
+                    RelativeLayout.SetLeftTarget(titleLabel, backButton);\r
+                    RelativeLayout.SetLeftRelativeOffset(titleLabel, 1.0f);\r
+                }\r
+            }\r
+        }\r
+\r
+        public bool MoreButton\r
+        {\r
+            set\r
+            {\r
+                if (value)\r
+                {\r
+                    ButtonStyle buttonStyle = new ButtonStyle()\r
+                    {\r
+                        Icon = new ImageViewStyle()\r
+                        {\r
+                            ResourceUrl = Resources.GetImagePath() + "more_button.png",\r
+                        },\r
+                        IsSelectable = false,\r
+                        IsEnabled = true,\r
+                    };\r
+                    moreButton = new Button(buttonStyle)\r
+                    {\r
+                        Size2D = new Size2D(48, 48),\r
+                        Margin = new Extents(24, 0, 6, 6),\r
+                    };\r
+                    topView.Add(moreButton);\r
+                    RelativeLayout.SetLeftRelativeOffset(moreButton, 1.0f);\r
+                    RelativeLayout.SetRightRelativeOffset(moreButton, 1.0f);\r
+                    RelativeLayout.SetHorizontalAlignment(moreButton, RelativeLayout.Alignment.End);\r
+\r
+                    RelativeLayout.SetRightTarget(titleLabel, moreButton);\r
+                    RelativeLayout.SetRightRelativeOffset(titleLabel, 0.0f);\r
+                }\r
+            }\r
+        }\r
+\r
+        public bool SearchButton\r
+        {\r
+            set\r
+            {\r
+                if (value)\r
+                {\r
+                    ButtonStyle buttonStyle = new ButtonStyle()\r
+                    {\r
+                        Icon = new ImageViewStyle()\r
+                        {\r
+                            ResourceUrl = Resources.GetImagePath() + "search_icon.png",\r
+                        },\r
+                        IsSelectable = false,\r
+                        IsEnabled = true,\r
+                    };\r
+                    searchButton = new Button(buttonStyle)\r
+                    {\r
+                        Size2D = new Size2D(96, 60),\r
+                        BackgroundImage = Resources.GetImagePath() + "search_button_bg.png",\r
+                        Margin = new Extents(0, 32, 0, 0),\r
+                    };\r
+                    topView.Add(searchButton);\r
+                    RelativeLayout.SetRightTarget(searchButton, moreButton);\r
+                    RelativeLayout.SetRightRelativeOffset(searchButton, 0.0f);\r
+                    RelativeLayout.SetHorizontalAlignment(searchButton, RelativeLayout.Alignment.End);\r
+\r
+                    RelativeLayout.SetLeftTarget(titleLabel, RelativeLayout.GetLeftTarget(titleLabel));\r
+                    RelativeLayout.SetLeftRelativeOffset(titleLabel, RelativeLayout.GetLeftRelativeOffset(titleLabel));\r
+                    RelativeLayout.SetRightTarget(titleLabel, searchButton);\r
+                    RelativeLayout.SetRightRelativeOffset(titleLabel, 0.0f);\r
+                }\r
+            }\r
+        }\r
+\r
+        public View SetContent\r
+        {\r
+            set\r
+            {\r
+                contentView.Add(value);\r
+            }\r
+        }\r
+\r
+        protected override void Dispose(DisposeTypes type)\r
+        {\r
+            if (Disposed)\r
+            {\r
+                return;\r
+            }\r
+            if (type == DisposeTypes.Explicit)\r
+            {\r
+                List<View> children = topView?.Children;\r
+                foreach (View child in children)\r
+                {\r
+                    topView.Remove(child);\r
+                    child?.Dispose();\r
+                }\r
+                base.Remove(topView);\r
+                topView?.Dispose();\r
+                topView = null;\r
+\r
+                // Do not delete the children of contentview as they are not owned by BaseView\r
+                base.Remove(contentView);\r
+                contentView?.Dispose();\r
+                contentView = null;\r
+\r
+                base.Remove(tabs);\r
+                tabs?.Dispose();\r
+                tabs = null;\r
+\r
+                base.Remove(bottomView);\r
+                bottomView?.Dispose();\r
+                bottomView = null;\r
+            }\r
+\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}
\ No newline at end of file
diff --git a/Views/TrackLayout.cs b/Views/TrackLayout.cs
new file mode 100755 (executable)
index 0000000..a84b827
--- /dev/null
@@ -0,0 +1,132 @@
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class TrackLayout : RecyclerViewItem\r
+    {\r
+        private View itemSeperator;\r
+        private TextLabel titleLabel;\r
+        private TextLabel artistAndTimeLabel;\r
+        private ImageView icon;\r
+\r
+        private static int WIDTH = 1792;\r
+        private static int HEIGHT = 108;\r
+\r
+        private const int ICON_SIZE = 64;\r
+        private const int MARGIN = 16;\r
+        private const int PADDING = 32;\r
+        private const int SEPERATOR_HEIGHT = 1;\r
+        private const int LEFT_PADDING = 64;\r
+        private const int X = 0;\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 = ICON_SIZE,\r
+                HeightSpecification = ICON_SIZE,\r
+                IsCreateByXaml = true,\r
+                Position2D = new Position2D(X, ((HEIGHT / 2) - (ICON_SIZE / 2))),\r
+            };\r
+            base.Add(icon);\r
+\r
+            itemSeperator = new View()\r
+            {\r
+                WidthSpecification = (WIDTH - (2 * LEFT_PADDING)),\r
+                HeightSpecification = SEPERATOR_HEIGHT,\r
+                ExcludeLayouting = true,\r
+                Position2D = new Position2D(X, HEIGHT - SEPERATOR_HEIGHT),\r
+                BackgroundColor = new Color(0.75f, 0.79f, 0.82f, 1.0f)\r
+            };\r
+            base.Add(itemSeperator);\r
+\r
+            titleLabel = new TextLabel()\r
+            {\r
+                WidthSpecification = (WIDTH - (2 * LEFT_PADDING) - ICON_SIZE - PADDING),\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 + ICON_SIZE + PADDING), MARGIN),\r
+            };\r
+            base.Add(titleLabel);\r
+\r
+            artistAndTimeLabel = new TextLabel()\r
+            {\r
+                WidthSpecification = (WIDTH - (2 * LEFT_PADDING) - ICON_SIZE - PADDING),\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 + ICON_SIZE + PADDING), MARGIN + 40)\r
+            };\r
+            base.Add(artistAndTimeLabel);\r
+            IsCreateByXaml = true;\r
+        }\r
+        public ImageView Thumbnail\r
+        {\r
+            get\r
+            {\r
+                return icon;\r
+            }\r
+        }\r
+        public TextLabel TitleText\r
+        {\r
+            get\r
+            {\r
+                return titleLabel;\r
+            }\r
+        }\r
+        public TextLabel SubtitletText\r
+        {\r
+            get\r
+            {\r
+                return artistAndTimeLabel;\r
+            }\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(artistAndTimeLabel);\r
+                artistAndTimeLabel?.Dispose();\r
+                artistAndTimeLabel = null;\r
+            }\r
+\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}\r
diff --git a/Views/TrackView.cs b/Views/TrackView.cs
new file mode 100755 (executable)
index 0000000..7fa3141
--- /dev/null
@@ -0,0 +1,70 @@
+using MusicPlayer.ViewModels;\r
+using Tizen.NUI.Components;\r
+using Tizen.NUI.BaseComponents;\r
+using Tizen.NUI;\r
+using Tizen.NUI.Binding;\r
+\r
+namespace MusicPlayer.Views\r
+{\r
+    class TrackView : BaseContentView\r
+    {\r
+        private TrackViewModel viewModel;\r
+        private TextLabel trackCountLabel;\r
+        private Button playAllIcon; // TODO need to implement playall feature\r
+        private Button addToPlaylistIcon; // TODO need to implement playlist manager\r
+        public TrackView(TrackViewModel viewModel)\r
+        {\r
+            this.viewModel = viewModel;\r
+            collectionView.ItemsSource = viewModel.ListViewModel;\r
+            collectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;\r
+            collectionView.WidthSpecification = LayoutParamPolicies.WrapContent;\r
+            collectionView.SelectionMode = ItemSelectionMode.Single;\r
+            collectionView.SelectionChanged += OnTrackSelection;\r
+\r
+            trackCountLabel = new TextLabel()\r
+            {\r
+                PixelSize = 28,\r
+                Text = "TRACK COUNT",\r
+                TextColor = new Color(0.0f, 0.0784f, 0.2754f, 1.0f),\r
+                VerticalAlignment = VerticalAlignment.Center,\r
+                FontFamily = "BreezeSans",\r
+                IsCreateByXaml = true,\r
+            };\r
+            titleView.Add(trackCountLabel);\r
+            trackCountLabel.SetBinding(TextLabel.TextProperty, "TrackCount");\r
+            RelativeLayout.SetLeftTarget(trackCountLabel, titleView);\r
+            RelativeLayout.SetLeftRelativeOffset(trackCountLabel, 1.0f);\r
+            RelativeLayout.SetRightRelativeOffset(trackCountLabel, 0.0f);\r
+            RelativeLayout.SetFillHorizontal(trackCountLabel, true);\r
+        }\r
+\r
+        private void OnTrackSelection(object sender, SelectionChangedEventArgs e)\r
+        {\r
+\r
+        }\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(trackCountLabel);\r
+                trackCountLabel.Dispose();\r
+                trackCountLabel = null;\r
+\r
+                // TODO Uncomment after implementation is completed\r
+                //titleView.Remove(playAllIcon);\r
+                //playAllIcon.Dispose();\r
+                //playAllIcon = null;\r
+\r
+                //titleView.Remove(addToPlaylistIcon);\r
+                //addToPlaylistIcon.Dispose();\r
+                //addToPlaylistIcon = null;\r
+            }\r
+            base.Dispose(type);\r
+        }\r
+    }\r
+}\r
old mode 100644 (file)
new mode 100755 (executable)
index 6209aa5..782f6b6
@@ -26,7 +26,7 @@
   </ItemGroup>\r
   \r
     <ItemGroup>\r
-      <PackageReference Include="Tizen.NET" Version="9.0.0.16239" />\r
+      <PackageReference Include="Tizen.NET" Version="9.0.0.16249" />\r
       <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />\r
       <PackageReference Include="Tizen.NUI.XamlBuild" Version="1.0.11" />\r
     </ItemGroup>\r