mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Solving bugs.
This commit is contained in:
@@ -150,7 +150,6 @@ namespace Opus
|
||||
inte.PutExtra("file", intent.Data.ToString());
|
||||
StartService(inte);
|
||||
|
||||
ShowSmallPlayer();
|
||||
ShowPlayer();
|
||||
}
|
||||
else if (intent.Action == Intent.ActionSend)
|
||||
|
||||
@@ -462,6 +462,12 @@ namespace Opus.Resources.Portable_Class
|
||||
QueueAdapter?.NotifyItemInserted(position);
|
||||
}
|
||||
|
||||
public void NotifyQueueChanged(int position, Java.Lang.Object payload)
|
||||
{
|
||||
if (adapterItems.Count > 0)
|
||||
QueueAdapter?.NotifyItemChanged(position, payload);
|
||||
}
|
||||
|
||||
public void NotifyQueueRemoved(int position)
|
||||
{
|
||||
if (adapterItems.Count > 0)
|
||||
|
||||
@@ -83,8 +83,10 @@ namespace Opus.Resources.Portable_Class
|
||||
|
||||
if (song.AlbumArt == -1 || song.IsYt)
|
||||
{
|
||||
var songAlbumArtUri = Uri.Parse(song.Album);
|
||||
Picasso.With(Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
if(song.Album != null)
|
||||
Picasso.With(Application.Context).Load(song.Album).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
else
|
||||
Picasso.With(Application.Context).Load(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -96,12 +98,31 @@ namespace Opus.Resources.Portable_Class
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position, IList<Java.Lang.Object> payloads)
|
||||
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position, IList<Java.Lang.Object> payloads)
|
||||
{
|
||||
if (payloads.Count > 0 && payloads[0].ToString() == ((RecyclerHolder)holder).Title.Text)
|
||||
return;
|
||||
if (payloads.Count > 0)
|
||||
{
|
||||
RecyclerHolder holder = (RecyclerHolder)viewHolder;
|
||||
|
||||
base.OnBindViewHolder(holder, position, payloads);
|
||||
if(payloads[0].ToString() == holder.Title.Text)
|
||||
return;
|
||||
|
||||
if (payloads[0].ToString() != null)
|
||||
{
|
||||
Song song = MusicPlayer.queue[position];
|
||||
|
||||
if (holder.Title.Text == "" || holder.Title.Text == null)
|
||||
holder.Title.Text = song.Title;
|
||||
|
||||
if (song.IsYt)
|
||||
{
|
||||
Picasso.With(Application.Context).Load(song.Album).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnBindViewHolder(viewHolder, position, payloads);
|
||||
}
|
||||
|
||||
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
|
||||
|
||||
@@ -345,7 +345,6 @@ namespace Opus.Resources.Portable_Class
|
||||
SaveQueueSlot();
|
||||
Player.instance?.RefreshPlayer();
|
||||
Home.instance?.AddQueue();
|
||||
Queue.instance?.Refresh();
|
||||
ParseNextSong();
|
||||
if (useAutoPlay)
|
||||
GenerateAutoPlay(false);
|
||||
@@ -517,17 +516,29 @@ namespace Opus.Resources.Portable_Class
|
||||
if (position != -1)
|
||||
Queue.instance?.NotifyItemChanged(position, Resource.Drawable.PublicIcon);
|
||||
|
||||
if (startPlaybackWhenPosible)
|
||||
if (startPlaybackWhenPosible && song.Album != null)
|
||||
{
|
||||
instance.Play(song, -1, position == -1);
|
||||
startPlaybackWhenPosible = false;
|
||||
}
|
||||
|
||||
Video video = await client.GetVideoAsync(song.YoutubeID);
|
||||
song.Title = video.Title;
|
||||
song.Artist = video.Author;
|
||||
song.Album = await MainActivity.GetBestThumb(new string[] { video.Thumbnails.MaxResUrl, video.Thumbnails.StandardResUrl, video.Thumbnails.HighResUrl });
|
||||
Player.instance?.RefreshPlayer();
|
||||
|
||||
if (position != -1)
|
||||
Queue.instance?.NotifyItemChanged(position, song.Artist);
|
||||
if (startPlaybackWhenPosible)
|
||||
{
|
||||
instance.Play(song, -1, position == -1);
|
||||
|
||||
if (position != -1)
|
||||
{
|
||||
Queue.instance?.NotifyItemChanged(position, song.Artist);
|
||||
Home.instance?.NotifyQueueChanged(position, song.Artist);
|
||||
}
|
||||
}
|
||||
|
||||
Player.instance?.RefreshPlayer();
|
||||
|
||||
if (!song.IsLiveStream)
|
||||
song.ExpireDate = mediaStreamInfo.ValidUntil;
|
||||
@@ -563,7 +574,7 @@ namespace Opus.Resources.Portable_Class
|
||||
if(showPlayer)
|
||||
MainActivity.instance.ShowPlayer();
|
||||
|
||||
Song song = new Song(title, artist, thumbnailURL, videoID, -1, -1, null, true, false);
|
||||
Song song = new Song(title ?? "", artist ?? "", thumbnailURL, videoID, -1, -1, null, true, false);
|
||||
queue.Clear();
|
||||
autoPlay.Clear();
|
||||
queue.Add(song);
|
||||
|
||||
@@ -90,7 +90,10 @@ namespace Opus
|
||||
await Task.Delay(100);
|
||||
|
||||
Song current = await MusicPlayer.GetItem();
|
||||
|
||||
|
||||
if (current.IsYt && current.Album == null)
|
||||
return;
|
||||
|
||||
FrameLayout smallPlayer = MainActivity.instance.FindViewById<FrameLayout>(Resource.Id.smallPlayer);
|
||||
smallPlayer.FindViewById<TextView>(Resource.Id.spTitle).Text = current.Title;
|
||||
smallPlayer.FindViewById<TextView>(Resource.Id.spArtist).Text = current.Artist;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Opus.Resources.Portable_Class
|
||||
if (MusicPlayer.useAutoPlay)
|
||||
{
|
||||
MusicPlayer.repeat = false;
|
||||
Queue.instance.menu.FindItem(Resource.Id.repeat).Icon.ClearColorFilter();
|
||||
//Queue.instance.menu.FindItem(Resource.Id.repeat).Icon.ClearColorFilter();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -172,8 +172,10 @@ namespace Opus.Resources.Portable_Class
|
||||
|
||||
if (song.AlbumArt == -1 || song.IsYt)
|
||||
{
|
||||
var songAlbumArtUri = Android.Net.Uri.Parse(song.Album);
|
||||
Picasso.With(Application.Context).Load(songAlbumArtUri).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
if(song.Album != null)
|
||||
Picasso.With(Application.Context).Load(song.Album).Placeholder(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
else
|
||||
Picasso.With(Application.Context).Load(Resource.Color.background_material_dark).Transform(new RemoveBlackBorder(true)).Into(holder.AlbumArt);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -298,11 +300,17 @@ namespace Opus.Resources.Portable_Class
|
||||
return;
|
||||
}
|
||||
|
||||
if (payloads[0].ToString() != null && (holder.Artist.Text == "" || holder.Artist.Text == null))
|
||||
if (payloads[0].ToString() != null)
|
||||
{
|
||||
holder.Artist.Text = payloads[0].ToString();
|
||||
Song song = MusicPlayer.queue[position - 1];
|
||||
|
||||
if (holder.Title.Text == "" || holder.Title.Text == null)
|
||||
{
|
||||
SpannableString titleText = new SpannableString(song.Title);
|
||||
titleText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#8C000000")), 0, song.Title.Length, SpanTypes.InclusiveInclusive);
|
||||
holder.Title.TextFormatted = titleText;
|
||||
}
|
||||
|
||||
if (song.IsYt)
|
||||
{
|
||||
var songAlbumArtUri = Android.Net.Uri.Parse(song.Album);
|
||||
|
||||
Reference in New Issue
Block a user