From 6db5ac6b25052dc3b7611641b860a44f2b0d4471 Mon Sep 17 00:00:00 2001
From: Tristan Roux
Date: Mon, 29 Apr 2019 19:11:55 +0200
Subject: [PATCH] Solving some display bugs.
---
Opus/Code/UI/Fragments/Playlist.cs | 2 +-
Opus/Code/UI/Fragments/YoutubeSearch.cs | 24 ++++++++++++++++++------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/Opus/Code/UI/Fragments/Playlist.cs b/Opus/Code/UI/Fragments/Playlist.cs
index 0ae6d8a..7676cd8 100644
--- a/Opus/Code/UI/Fragments/Playlist.cs
+++ b/Opus/Code/UI/Fragments/Playlist.cs
@@ -488,7 +488,7 @@ namespace Opus.Fragments
{
for (int i = 1; i < YoutubePlaylists.Count; i++)
{
- if (YoutubePlaylists[i].SyncState != SyncState.False && Downloader.queue.Find(x => x.playlist == YoutubePlaylists[i].Name && (x.State == DownloadState.Downloading || x.State == DownloadState.Initialization || x.State == DownloadState.MetaData || x.State == DownloadState.None)) == null)
+ if (YoutubePlaylists[i].SyncState != SyncState.False && YoutubePlaylists[i].SyncState != SyncState.Error && Downloader.queue.Find(x => x.playlist == YoutubePlaylists[i].Name && (x.State == DownloadState.Downloading || x.State == DownloadState.Initialization || x.State == DownloadState.MetaData || x.State == DownloadState.None)) == null)
{
YoutubePlaylists[i].SyncState = SyncState.True;
PlaylistHolder holder = (PlaylistHolder)ListView.GetChildViewHolder(ListView.GetChildAt(LocalPlaylists.Count + i));
diff --git a/Opus/Code/UI/Fragments/YoutubeSearch.cs b/Opus/Code/UI/Fragments/YoutubeSearch.cs
index 8119e12..eb770bc 100644
--- a/Opus/Code/UI/Fragments/YoutubeSearch.cs
+++ b/Opus/Code/UI/Fragments/YoutubeSearch.cs
@@ -406,7 +406,7 @@ namespace Opus.Fragments
bottomSheet.Show();
}
- public void PlaylistMore(PlaylistItem item)
+ public async void PlaylistMore(PlaylistItem item)
{
BottomSheetDialog bottomSheet = new BottomSheetDialog(MainActivity.instance);
View bottomView = MainActivity.instance.LayoutInflater.Inflate(Resource.Layout.BottomSheet, null);
@@ -432,11 +432,6 @@ namespace Opus.Fragments
PlaylistManager.AddToQueue(item);
bottomSheet.Dismiss();
}),
- new BottomSheetAction(Resource.Drawable.LibraryAdd, MainActivity.instance.Resources.GetString(Resource.String.add_to_library), (sender, eventArg) =>
- {
- PlaylistManager.ForkPlaylist(item);
- bottomSheet.Dismiss();
- }),
new BottomSheetAction(Resource.Drawable.Download, MainActivity.instance.Resources.GetString(Resource.String.download), (sender, eventArg) =>
{
YoutubeManager.DownloadPlaylist(item.Name, item.YoutubeID);
@@ -444,6 +439,23 @@ namespace Opus.Fragments
})
};
+ if(await PlaylistManager.IsForked(item))
+ {
+ actions.Add(new BottomSheetAction(Resource.Drawable.Delete, MainActivity.instance.Resources.GetString(Resource.String.unfork), (sender, eventArg) =>
+ {
+ PlaylistManager.Unfork(item);
+ bottomSheet.Dismiss();
+ }));
+ }
+ else
+ {
+ actions.Add(new BottomSheetAction(Resource.Drawable.LibraryAdd, MainActivity.instance.Resources.GetString(Resource.String.add_to_library), (sender, eventArg) =>
+ {
+ PlaylistManager.ForkPlaylist(item);
+ bottomSheet.Dismiss();
+ }));
+ }
+
bottomSheet.FindViewById(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, actions);
bottomSheet.Show();
}