Removing the undo snackbar of the remove song from playlist.

This commit is contained in:
Anonymus Raccoon
2019-06-18 20:18:19 +02:00
parent e8ebec6081
commit a7dfdb86dd
2 changed files with 15 additions and 13 deletions

View File

@@ -569,20 +569,22 @@ namespace Opus.Api
{
if (song.TrackID == null)
song = await CompleteItem(song, item.YoutubeID);
RemoveFromYoutubePlaylist(song.TrackID);
}
RemovedCallback?.Invoke();
RemoveTrackFromPlaylistCallback callback = new RemoveTrackFromPlaylistCallback(song, item.LocalID, position);
Snackbar snackBar = Snackbar.Make(MainActivity.instance.FindViewById(Resource.Id.snackBar), (song.Title.Length > 20 ? song.Title.Substring(0, 17) + "..." : song.Title) + MainActivity.instance.GetString(Resource.String.removed_from_playlist), Snackbar.LengthLong)
.SetAction(MainActivity.instance.GetString(Resource.String.undo), (v) =>
{
callback.canceled = true;
UndoCallback?.Invoke();
});
snackBar.AddCallback(callback);
snackBar.View.FindViewById<TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
snackBar.Show();
//RemoveTrackFromPlaylistCallback callback = new RemoveTrackFromPlaylistCallback(song, item.LocalID, position);
//Snackbar snackBar = Snackbar.Make(MainActivity.instance.FindViewById(Resource.Id.snackBar), (song.Title.Length > 20 ? song.Title.Substring(0, 17) + "..." : song.Title) + MainActivity.instance.GetString(Resource.String.removed_from_playlist), Snackbar.LengthLong)
// .SetAction(MainActivity.instance.GetString(Resource.String.undo), (v) =>
// {
// callback.canceled = true;
// UndoCallback?.Invoke();
// });
//snackBar.AddCallback(callback);
//snackBar.View.FindViewById<TextView>(Resource.Id.snackbar_text).SetTextColor(Color.White);
//snackBar.Show();
})
.SetNegativeButton(Resource.String.no, (sender, e) => { CancelledCallback?.Invoke(); })
.Create();
@@ -1317,7 +1319,8 @@ namespace Opus.Api
ContentValues value = new ContentValues();
value.Put(Playlists.Members.AudioId, item.LocalID);
value.Put(Playlists.Members.PlayOrder, position);
resolver.Insert(Playlists.Members.GetContentUri("external", LocalID), value);
var info = resolver.Insert(Playlists.Members.GetContentUri("external", LocalID), value);
Console.WriteLine("&Add info: " + info + " - item localID: " + item.LocalID);
}
}
}

View File

@@ -20,10 +20,8 @@ namespace Opus.Others
public override void OnDismissed(Java.Lang.Object transientBottomBar, int @event)
{
base.OnDismissed(transientBottomBar, @event);
if(canceled)
{
MainActivity.instance.SupportFragmentManager.PopBackStack();
if (LocalPlaylistID != 0)
PlaylistManager.InsertToLocalPlaylist(LocalPlaylistID, song, position);
}
@@ -32,6 +30,7 @@ namespace Opus.Others
if (song.TrackID != null)
PlaylistManager.RemoveFromYoutubePlaylist(song.TrackID);
}
base.OnDismissed(transientBottomBar, @event);
}
public override void OnShown(Java.Lang.Object transientBottomBar)