mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Adding playlist count on synced playlists.
This commit is contained in:
@@ -616,7 +616,7 @@ namespace Opus.Api
|
||||
List<PlaylistItem> syncedPlaylists = new List<PlaylistItem>();
|
||||
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<PlaylistItem>();
|
||||
|
||||
syncedPlaylists = db.Table<PlaylistItem>().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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user