diff --git a/Opus/Code/Api/PlaylistManager.cs b/Opus/Code/Api/PlaylistManager.cs index 44bd624..999453e 100644 --- a/Opus/Code/Api/PlaylistManager.cs +++ b/Opus/Code/Api/PlaylistManager.cs @@ -616,7 +616,7 @@ namespace Opus.Api List syncedPlaylists = new List(); await Task.Run(() => { - SQLiteConnection db = new SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "SyncedPlaylists.sqlite")); + SQLiteConnection db = new SQLiteConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "SyncedPlaylists.sqlite")); db.CreateTable(); syncedPlaylists = db.Table().ToList(); @@ -627,6 +627,7 @@ namespace Opus.Api PlaylistItem local = localPlaylists?.Find(x => x.LocalID == synced.LocalID); if (local != null) { + synced.Count = local.Count; localPlaylists.Remove(local); //This playlist is a synced one, we don't want to display it in the "local" collumn but in the youtube one. //Set sync state of the playlist (SyncState can't be false since we take the playlist in the synced database) diff --git a/Opus/Code/DataStructure/PlaylistItem.cs b/Opus/Code/DataStructure/PlaylistItem.cs index 10ef731..f5041a8 100644 --- a/Opus/Code/DataStructure/PlaylistItem.cs +++ b/Opus/Code/DataStructure/PlaylistItem.cs @@ -13,7 +13,7 @@ namespace Opus.DataStructure [PrimaryKey, Unique] public long LocalID { get; set; } public string YoutubeID { get; set; } - public int Count; + public int Count = -1; public Google.Apis.YouTube.v3.Data.Playlist Snippet; public string Owner { get; set; } public string ImageURL { get; set; } @@ -23,14 +23,14 @@ namespace Opus.DataStructure public PlaylistItem() { } - public PlaylistItem(string Name, long LocalID, int Count = 0) + public PlaylistItem(string Name, long LocalID, int Count = -1) { this.Name = Name; this.LocalID = LocalID; this.Count = Count; } - public PlaylistItem(string Name, string YoutubeID, Google.Apis.YouTube.v3.Data.Playlist Snippet = null, int Count = 0) + public PlaylistItem(string Name, string YoutubeID, Google.Apis.YouTube.v3.Data.Playlist Snippet = null, int Count = -1) { this.Name = Name; LocalID = -1; diff --git a/Opus/Code/UI/Fragments/Home.cs b/Opus/Code/UI/Fragments/Home.cs index 8db1493..0d78d39 100644 --- a/Opus/Code/UI/Fragments/Home.cs +++ b/Opus/Code/UI/Fragments/Home.cs @@ -54,7 +54,10 @@ namespace Opus.Fragments ListView.SetLayoutManager(new LinearLayoutManager(Android.App.Application.Context)); if (adapter != null) + { ListView.SetAdapter(adapter); + view.FindViewById(Resource.Id.loading).Visibility = ViewStates.Gone; + } else PopulateView(); return view;