Following changes have been made 64/264464/2
authoraman.jeph <aman.jeph@samsung.com>
Wed, 22 Sep 2021 07:52:19 +0000 (13:22 +0530)
committeraman.jeph <aman.jeph@samsung.com>
Wed, 22 Sep 2021 09:08:02 +0000 (14:38 +0530)
1. Fixed album detail view back buton crash
2. Fixed visibility issue in artist detail view
3. Implemented dispose for PlaylistView

Change-Id: I1f5cec06568e6631f9fea24402b4a43b4858537e
Signed-off-by: aman.jeph <aman.jeph@samsung.com>
music-player/ViewModels/ArtistDetailViewModel.cs
music-player/Views/AlbumDetailView.cs
music-player/Views/ArtistDetailView.cs
music-player/Views/BaseContentView.cs
music-player/Views/BaseSubContentView.cs
music-player/Views/PlaylistView.cs
music-player/music-player.csproj
packaging/org.tizen.MusicPlayer-1.0.0.tpk

index cdc0a38ef49d67afccdc51041e42c0552491f410..0668ddcb95f7ad8f909e10f015e459e7f72dad08 100755 (executable)
@@ -20,6 +20,8 @@ namespace MusicPlayer.ViewModels
             albumListViewModel = new ListViewModel<MusicAlbum>();
             trackListViewModel = new ListViewModel<Track>();
             groupListViewModel = new ListViewModel<ArtistDetailAlbum>();
+
+            UpdateArtistDetailView();
         }
 
         private string artistName;
@@ -41,7 +43,7 @@ namespace MusicPlayer.ViewModels
         // TODO do we really need this ?
         public void OnViewDeleted()
         {
-            ArtistDataProvider.ArtistDataChanged += OnArtistDetailChanged;
+            ArtistDataProvider.ArtistDataChanged -= OnArtistDetailChanged;
             trackListViewModel.Clear();
             albumListViewModel.Clear();
             groupListViewModel.Clear();
@@ -86,10 +88,10 @@ namespace MusicPlayer.ViewModels
             string text = string.Equals(ArtistName, "Unknown") ? "" : ArtistName;
 
             List<Album> albumList = ArtistDataProvider.GetArtistAlbumList(text);
-            albumListViewModel.CreateData<Album>(albumList);
+            albumListViewModel.CreateData(albumList);
 
             List<AudioInfo> trackList = ArtistDataProvider.GetArtistTrackList(text);
-            trackListViewModel.CreateData<AudioInfo>(trackList);
+            trackListViewModel.CreateData(trackList);
 
             foreach (MusicAlbum album in albumListViewModel)
             {
@@ -98,7 +100,9 @@ namespace MusicPlayer.ViewModels
                 ListViewModel<Track> albumTrackListViewModel = new ListViewModel<Track>();
                 albumTrackListViewModel.CreateData(albumTrackList);
                 foreach (Track track in albumTrackListViewModel)
+                {
                     artistAlbum.Add(track);
+                }
                 groupListViewModel.Add(artistAlbum);
             }
         }
index 28b7976edc5f9aa6072ae08019f99244e24e8401..bcbf1cfdb46b946a989cccf1b0b3b960932b0943 100755 (executable)
@@ -55,8 +55,39 @@ namespace MusicPlayer.Views
 \r
         public override void DeleteSubView()\r
         {\r
-            base.DeleteSubView();\r
             viewModel.OnViewDeleted();\r
+            base.DeleteSubView();\r
+        }\r
+\r
+        protected override void Dispose(DisposeTypes type)\r
+        {\r
+            if(Disposed)\r
+            {\r
+                return;\r
+            }\r
+            if(type == DisposeTypes.Explicit)\r
+            {\r
+                rightView?.Remove(listContainer);\r
+                if (leftView != null)\r
+                {\r
+                    leftView.Remove(albumArtIcon);\r
+                    leftView.Remove(albumNameLabel);\r
+                    leftView.Remove(albumArtistLabel);\r
+                }\r
+                albumArtIcon?.Dispose();\r
+                albumArtIcon = null;\r
+                albumNameLabel?.Dispose();\r
+                albumNameLabel = null;\r
+                albumArtistLabel?.Dispose();\r
+                albumArtistLabel = null;\r
+                Remove(leftView);\r
+                Remove(rightView);\r
+                leftView?.Dispose();\r
+                leftView = null;\r
+                rightView?.Dispose();\r
+                rightView = null;\r
+            }\r
+            base.Dispose(type);\r
         }\r
 \r
         protected override void OnPlayAllClicked()\r
index 28dab12f16ed371611328a2c31250700c23309b3..3f42b617ca6452466d1c09dccf38141e64e84a93 100755 (executable)
@@ -20,6 +20,11 @@ namespace MusicPlayer.Views
             Add(listContainer);
         }
 
+        public override string GetTitleText()
+        {
+            return viewModel.ArtistName;
+        }
+
         public override void UpdateSubContentMoreButtonItems(Menu moreMenu)
         {
             var addtoPlaylist = new MenuItem { Text = "Add to playlist" };
@@ -83,10 +88,6 @@ namespace MusicPlayer.Views
                 return group;
             });
             collectionView.IsGrouped = true;
-            collectionView.ScrollingDirection = ScrollableBase.Direction.Vertical;
-            collectionView.HeightSpecification = LayoutParamPolicies.WrapContent;
-            collectionView.SelectionMode = ItemSelectionMode.Single;
-
             collectionView.ItemsSource = viewModel.GroupListViewModel;
             collectionView.SelectionChanged += OnTrackSelection;
         }
index 34f78f58f0b9e630a0ae56982e6656dc257fdd27..0169c3441e0054d68240587230141526185e6961 100755 (executable)
-using System;\r
-using Tizen.NUI;\r
-using Tizen.NUI.BaseComponents;\r
-using Tizen.NUI.Components;\r
-using MusicPlayer.Common;\r
-using MusicPlayer.Views.Utils;\r
-\r
-namespace MusicPlayer.Views\r
-{\r
-    class BaseContentView : View, IViewStatus, IMoreButtonItems\r
-    {\r
-        protected BaseSubContentView subcontentView;\r
-        protected View titleView;\r
-        protected CollectionView collectionView;\r
-        protected View subContentViewContainer;\r
-        protected View contentViewContainer;\r
-\r
-        protected Menu moreMenu = null;\r
-\r
-        public event EventHandler<SubContentViewAddEventArgs> SubContentViewAdded;\r
-\r
-        public event EventHandler<OperationViewAddEventArgs> OperationViewAdded;\r
-\r
-        public BaseContentView() : base()\r
-        {\r
-            ThemeChangeSensitive = true;\r
-            WidthResizePolicy = ResizePolicyType.FillToParent;\r
-            HeightResizePolicy = ResizePolicyType.FillToParent;\r
-            contentViewContainer = new View()\r
-            {\r
-                WidthResizePolicy = ResizePolicyType.FillToParent,\r
-                HeightResizePolicy = ResizePolicyType.FillToParent,\r
-                HeightSpecification = LayoutParamPolicies.MatchParent,\r
-                WidthSpecification = LayoutParamPolicies.MatchParent,\r
-                Layout = new FlexLayout()\r
-                {\r
-                    Direction = FlexLayout.FlexDirection.Column,\r
-                    Padding = new Extents(64, 64, 0, 0),\r
-                },\r
-            };\r
-            base.Add(contentViewContainer);\r
-\r
-            titleView = new View()\r
-            {\r
-                ThemeChangeSensitive = true,\r
-                WidthSpecification = LayoutParamPolicies.MatchParent,\r
-                HeightSpecification = 60,\r
-                Layout = new RelativeLayout()\r
-                {\r
-                    Padding = new Extents(0, 0, 6, 6),\r
-                },\r
-            };\r
-            contentViewContainer.Add(titleView);\r
-            FlexLayout.SetFlexGrow(titleView, 0);\r
-            FlexLayout.SetFlexShrink(titleView, 0);\r
-\r
-            collectionView = new CollectionView()\r
-            {\r
-                ThemeChangeSensitive = true,\r
-                Size2D = new Size2D(1792, 108),\r
-                Margin = new Extents(0, 0, 0, 2),\r
-                BackgroundImage = GetBackgroundImagePath(ThemeManager.PlatformThemeId),\r
-                ItemsLayouter = new LinearLayouter(),\r
-                ScrollingDirection = ScrollableBase.Direction.Vertical,\r
-                WidthSpecification = LayoutParamPolicies.MatchParent,\r
-                HeightSpecification = LayoutParamPolicies.WrapContent,\r
-                SelectionMode = ItemSelectionMode.Single,\r
-            };\r
-            contentViewContainer.Add(collectionView);\r
-            FlexLayout.SetFlexGrow(collectionView, 1);\r
-            FlexLayout.SetFlexShrink(collectionView, 1);\r
-\r
-            subContentViewContainer = new View()\r
-            {\r
-                WidthResizePolicy = ResizePolicyType.FillToParent,\r
-                HeightResizePolicy = ResizePolicyType.FillToParent,\r
-            };\r
-            base.Add(subContentViewContainer);\r
-            subContentViewContainer.Hide();\r
-            subcontentView = null;\r
-            IsSubViewAdded = false;\r
-        }\r
-        public bool IsSubViewAdded { get; private set; }\r
-\r
-        public void AddSubContentView(BaseSubContentView baseSubContentView)\r
-        {\r
-            if (baseSubContentView == null)\r
-            {\r
-                Tizen.Log.Error(AppConstants.LogTag, "SubContentView object is null");\r
-                return;\r
-            }\r
-            if(subcontentView != null)\r
-            {\r
-                Tizen.Log.Error(AppConstants.LogTag, "subcontent view already added , remove it first");\r
-                return;\r
-            }\r
-            subContentViewContainer.Show();\r
-            subContentViewContainer.Add(baseSubContentView);\r
-            subcontentView = baseSubContentView;\r
-            subcontentView.SubContentOperationViewAdd += OnSubContentOperationViewAdd;\r
-            IsSubViewAdded = true;\r
-        }\r
-\r
-        public void RemoveSubContentView()\r
-        {\r
-            if (subcontentView == null)\r
-            {\r
-                Tizen.Log.Error(AppConstants.LogTag, "SubContentView object is null");\r
-                return;\r
-            }\r
-            subContentViewContainer.Remove(subcontentView);\r
-            subContentViewContainer.Hide();\r
-            subcontentView.SubContentOperationViewAdd -= OnSubContentOperationViewAdd;\r
-            subcontentView.DeleteSubView();\r
-            subcontentView = null;\r
-            IsSubViewAdded = false;\r
-        }\r
-\r
-        public virtual void ShowView()\r
-        {\r
-            titleView.Show();\r
-            collectionView.Show();\r
-            contentViewContainer.Show();\r
-            Show();\r
-        }\r
-\r
-        public virtual void HideView()\r
-        {\r
-            titleView.Hide();\r
-            collectionView.Hide();\r
-            contentViewContainer.Hide();\r
-            Hide();\r
-        }\r
-\r
-        public void UpdateButtonMoreItems(Menu moreMenu)\r
-        {\r
-            this.moreMenu = moreMenu;\r
-            if(subcontentView != null)\r
-            {\r
-                subcontentView.UpdateSubContentMoreButtonItems(moreMenu);\r
-                return;\r
-            }\r
-            UpdateContentMoreButtonItems(moreMenu);\r
-        }\r
-\r
-        public string GetSubContentTitle()\r
-        {\r
-            if(IsSubViewAdded)\r
-            {\r
-                return subcontentView.GetTitleText();\r
-            }\r
-            return string.Empty;\r
-        }\r
-\r
-        protected virtual void UpdateContentMoreButtonItems(Menu moreMenu)\r
-        {\r
-\r
-        }\r
-\r
-        protected void DismissMoreMenu()\r
-        {\r
-            if (moreMenu == null)\r
-            {\r
-                Tizen.Log.Error(AppConstants.LogTag, "Moremenu object is null");\r
-                return;\r
-            }\r
-            moreMenu.Dismiss();\r
-            moreMenu = null;\r
-        }\r
-\r
-        protected void OnSubViewAdd(SubContentViewAddEventArgs args)\r
-        {\r
-            SubContentViewAdded?.Invoke(this, args);\r
-        }\r
-\r
-        protected void OnOperationViewAdd(OperationViewAddEventArgs args)\r
-        {\r
-            OperationViewAdded?.Invoke(this, args);\r
-        }\r
-\r
-        protected override void OnThemeChanged(object sender, ThemeChangedEventArgs e)\r
-        {\r
-            base.OnThemeChanged(sender, e);\r
-            if(e.IsPlatformThemeChanged)\r
-            {\r
-                collectionView.BackgroundImage = GetBackgroundImagePath(e.PlatformThemeId);\r
-            }\r
-        }\r
-\r
-        protected override void Dispose(DisposeTypes type)\r
-        {\r
-            if (type == DisposeTypes.Explicit)\r
-            {\r
-                base.Remove(contentViewContainer);\r
-                contentViewContainer.Remove(titleView);\r
-                titleView.Dispose();\r
-                titleView = null;\r
-\r
-                contentViewContainer.Remove(collectionView);\r
-                collectionView.Dispose();\r
-                collectionView = null;\r
-\r
-                contentViewContainer.Dispose();\r
-                contentViewContainer = null;\r
-\r
-                base.Remove(subContentViewContainer);\r
-                subContentViewContainer.Dispose();\r
-                subContentViewContainer = null;\r
-\r
-                subcontentView = null;\r
-\r
-                moreMenu?.Dismiss();\r
-                moreMenu = null;\r
-            }\r
-            base.Dispose(type);\r
-        }\r
-\r
-        private string GetBackgroundImagePath(string platformThemeId)\r
-        {\r
-            if (platformThemeId.Equals(AppConstants.DarkPlatformThemeId))\r
-            {\r
-                return Resources.GetImagePath() + "dark/list_view_bg.png";\r
-            }\r
-            else\r
-            {\r
-                return Resources.GetImagePath() + "light/list_view_bg.png";\r
-            }\r
-        }\r
-        private void OnSubContentOperationViewAdd(object sender, OperationViewAddEventArgs e)\r
-        {\r
-            DismissMoreMenu();\r
-            OnOperationViewAdd(e);\r
-        }\r
-    }\r
-}\r
+using System;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using MusicPlayer.Common;
+using MusicPlayer.Views.Utils;
+
+namespace MusicPlayer.Views
+{
+    class BaseContentView : View, IViewStatus, IMoreButtonItems
+    {
+        protected BaseSubContentView subcontentView;
+        protected View titleView;
+        protected CollectionView collectionView;
+        protected View subContentViewContainer;
+        protected View contentViewContainer;
+
+        protected Menu moreMenu = null;
+
+        public event EventHandler<SubContentViewAddEventArgs> SubContentViewAdded;
+
+        public event EventHandler<OperationViewAddEventArgs> OperationViewAdded;
+
+        public BaseContentView() : base()
+        {
+            ThemeChangeSensitive = true;
+            WidthResizePolicy = ResizePolicyType.FillToParent;
+            HeightResizePolicy = ResizePolicyType.FillToParent;
+            contentViewContainer = new View()
+            {
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HeightResizePolicy = ResizePolicyType.FillToParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                Layout = new FlexLayout()
+                {
+                    Direction = FlexLayout.FlexDirection.Column,
+                    Padding = new Extents(64, 64, 0, 0),
+                },
+            };
+            base.Add(contentViewContainer);
+
+            titleView = new View()
+            {
+                ThemeChangeSensitive = true,
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = 60,
+                Layout = new RelativeLayout()
+                {
+                    Padding = new Extents(0, 0, 6, 6),
+                },
+            };
+            contentViewContainer.Add(titleView);
+            FlexLayout.SetFlexGrow(titleView, 0);
+            FlexLayout.SetFlexShrink(titleView, 0);
+
+            collectionView = new CollectionView()
+            {
+                ThemeChangeSensitive = true,
+                Size2D = new Size2D(1792, 108),
+                Margin = new Extents(0, 0, 0, 2),
+                BackgroundImage = GetBackgroundImagePath(ThemeManager.PlatformThemeId),
+                ItemsLayouter = new LinearLayouter(),
+                ScrollingDirection = ScrollableBase.Direction.Vertical,
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.WrapContent,
+                SelectionMode = ItemSelectionMode.Single,
+            };
+            contentViewContainer.Add(collectionView);
+            FlexLayout.SetFlexGrow(collectionView, 1);
+            FlexLayout.SetFlexShrink(collectionView, 1);
+
+            subContentViewContainer = new View()
+            {
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                HeightResizePolicy = ResizePolicyType.FillToParent,
+            };
+            base.Add(subContentViewContainer);
+            subContentViewContainer.Hide();
+            subcontentView = null;
+            IsSubViewAdded = false;
+        }
+        public bool IsSubViewAdded { get; private set; }
+
+        public void AddSubContentView(BaseSubContentView baseSubContentView)
+        {
+            if (baseSubContentView == null)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "SubContentView object is null");
+                return;
+            }
+            if(subcontentView != null)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "subcontent view already added , remove it first");
+                return;
+            }
+            subContentViewContainer.Show();
+            subContentViewContainer.Add(baseSubContentView);
+            subcontentView = baseSubContentView;
+            subcontentView.SubContentOperationViewAdd += OnSubContentOperationViewAdd;
+            IsSubViewAdded = true;
+        }
+
+        public void RemoveSubContentView()
+        {
+            if (subcontentView == null)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "SubContentView object is null");
+                return;
+            }
+            subContentViewContainer.Remove(subcontentView);
+            subContentViewContainer.Hide();
+            subcontentView.SubContentOperationViewAdd -= OnSubContentOperationViewAdd;
+            subcontentView.DeleteSubView();
+            subcontentView = null;
+            IsSubViewAdded = false;
+        }
+
+        public virtual void ShowView()
+        {
+            titleView.Show();
+            collectionView.Show();
+            contentViewContainer.Show();
+            Show();
+        }
+
+        public virtual void HideView()
+        {
+            titleView.Hide();
+            collectionView.Hide();
+            contentViewContainer.Hide();
+            Hide();
+        }
+
+        public void UpdateButtonMoreItems(Menu moreMenu)
+        {
+            this.moreMenu = moreMenu;
+            if(subcontentView != null)
+            {
+                subcontentView.UpdateSubContentMoreButtonItems(moreMenu);
+                return;
+            }
+            UpdateContentMoreButtonItems(moreMenu);
+        }
+
+        public string GetSubContentTitle()
+        {
+            if(IsSubViewAdded)
+            {
+                return subcontentView.GetTitleText();
+            }
+            return string.Empty;
+        }
+
+        protected virtual void UpdateContentMoreButtonItems(Menu moreMenu)
+        {
+
+        }
+
+        protected void DismissMoreMenu()
+        {
+            if (moreMenu == null)
+            {
+                Tizen.Log.Error(AppConstants.LogTag, "Moremenu object is null");
+                return;
+            }
+            moreMenu.Dismiss();
+            moreMenu = null;
+        }
+
+        protected void OnSubViewAdd(SubContentViewAddEventArgs args)
+        {
+            SubContentViewAdded?.Invoke(this, args);
+        }
+
+        protected void OnOperationViewAdd(OperationViewAddEventArgs args)
+        {
+            OperationViewAdded?.Invoke(this, args);
+        }
+
+        protected override void OnThemeChanged(object sender, ThemeChangedEventArgs e)
+        {
+            base.OnThemeChanged(sender, e);
+            if(e.IsPlatformThemeChanged)
+            {
+                collectionView.BackgroundImage = GetBackgroundImagePath(e.PlatformThemeId);
+            }
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if(Disposed)
+            {
+                return;
+            }
+            if (type == DisposeTypes.Explicit)
+            {
+                base.Remove(contentViewContainer);
+                contentViewContainer.Remove(titleView);
+                titleView.Dispose();
+                titleView = null;
+
+                contentViewContainer.Remove(collectionView);
+                collectionView.Dispose();
+                collectionView = null;
+
+                contentViewContainer.Dispose();
+                contentViewContainer = null;
+
+                base.Remove(subContentViewContainer);
+                subContentViewContainer.Dispose();
+                subContentViewContainer = null;
+
+                subcontentView = null;
+
+                moreMenu?.Dismiss();
+                moreMenu = null;
+            }
+            base.Dispose(type);
+        }
+
+        private string GetBackgroundImagePath(string platformThemeId)
+        {
+            if (platformThemeId.Equals(AppConstants.DarkPlatformThemeId))
+            {
+                return Resources.GetImagePath() + "dark/list_view_bg.png";
+            }
+            else
+            {
+                return Resources.GetImagePath() + "light/list_view_bg.png";
+            }
+        }
+        private void OnSubContentOperationViewAdd(object sender, OperationViewAddEventArgs e)
+        {
+            DismissMoreMenu();
+            OnOperationViewAdd(e);
+        }
+    }
+}
index 046da7ac496f9b74f252e44647c23b9de0f811a5..ab82a774a7891cdf811a5e75aef274f44f5ccce9 100755 (executable)
@@ -157,6 +157,10 @@ namespace MusicPlayer.Views
 
         protected override void Dispose(DisposeTypes type)
         {
+            if(Disposed)
+            {
+                return;
+            }
             if (type == DisposeTypes.Explicit)
             {
                 topView.Remove(countLabel);
index 671b3fecaa2ac9cc1777e73f2e830166e8bd7713..4d905ad63da7a74eb72c4b434187231faa075261 100755 (executable)
@@ -66,6 +66,24 @@ namespace MusicPlayer.Views
             playlistCreateButton.Clicked += OnPlaylistCreate;
         }
 
+        protected override void Dispose(DisposeTypes type)
+        {
+            if(Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                titleView?.Remove(playlistCountLabel);
+                playlistCountLabel?.Dispose();
+                playlistCountLabel = null;
+                titleView?.Remove(playlistCreateButton);
+                playlistCreateButton?.Dispose();
+                playlistCreateButton = null;
+            }
+            base.Dispose(type);
+        }
+
         protected override void UpdateContentMoreButtonItems(Menu moreMenu)
         {
             var delete = new MenuItem { Text = "Delete" };
index 6b507964d6c015f8734e361c884d5abb1ebf1a47..10a6880950e4545f9f1e59866f7be4e54bdff172 100755 (executable)
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
-    <Folder Include="lib\" />\r
     <Folder Include="res\images\" />\r
   </ItemGroup>\r
 \r
   <ItemGroup>\r
-    <PackageReference Include="Tizen.NET" Version="9.0.0.16707">\r
+    <PackageReference Include="Tizen.NET" Version="9.0.0.16715">\r
       <ExcludeAssets>Runtime</ExcludeAssets>\r
     </PackageReference>\r
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.6" />\r
-</ItemGroup>\r
+  </ItemGroup>\r
 \r
 </Project>\r
index a542c52434fb507637eebd82be97fb6ed3cfb309..cd9a4e4cecef48d3e181777788a6e261184e9c69 100755 (executable)
Binary files a/packaging/org.tizen.MusicPlayer-1.0.0.tpk and b/packaging/org.tizen.MusicPlayer-1.0.0.tpk differ