mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Solving bugs with animations when the app is in background.
This commit is contained in:
@@ -949,7 +949,7 @@ namespace Opus.Api.Services
|
|||||||
Console.WriteLine("&Song is parsed: " + song.IsParsed);
|
Console.WriteLine("&Song is parsed: " + song.IsParsed);
|
||||||
|
|
||||||
if(showPlayer)
|
if(showPlayer)
|
||||||
MainActivity.instance.ShowPlayer();
|
MainActivity.instance?.ShowPlayer();
|
||||||
|
|
||||||
if (UseCastPlayer)
|
if (UseCastPlayer)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM
|
|||||||
holder.status.Visibility = ViewStates.Visible;
|
holder.status.Visibility = ViewStates.Visible;
|
||||||
holder.status.SetTextColor(MusicPlayer.isRunning ? Color.Argb(255, 244, 81, 30) : Color.Argb(255, 66, 165, 245));
|
holder.status.SetTextColor(MusicPlayer.isRunning ? Color.Argb(255, 244, 81, 30) : Color.Argb(255, 66, 165, 245));
|
||||||
|
|
||||||
string status = MusicPlayer.isRunning ? GetString(Resource.String.playing) : GetString(Resource.String.paused);
|
string status = MusicPlayer.isRunning ? MainActivity.instance.GetString(Resource.String.playing) : MainActivity.instance.GetString(Resource.String.paused);
|
||||||
SpannableString statusText = new SpannableString(status);
|
SpannableString statusText = new SpannableString(status);
|
||||||
statusText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#8C000000")), 0, status.Length, SpanTypes.InclusiveInclusive);
|
statusText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#8C000000")), 0, status.Length, SpanTypes.InclusiveInclusive);
|
||||||
holder.status.TextFormatted = statusText;
|
holder.status.TextFormatted = statusText;
|
||||||
@@ -128,7 +128,7 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM
|
|||||||
holder.status.Visibility = ViewStates.Visible;
|
holder.status.Visibility = ViewStates.Visible;
|
||||||
holder.status.SetTextColor(Color.Argb(255, 0, 255, 255));
|
holder.status.SetTextColor(Color.Argb(255, 0, 255, 255));
|
||||||
|
|
||||||
string status = GetString(Resource.String.loading);
|
string status = MainActivity.instance.GetString(Resource.String.loading);
|
||||||
SpannableString statusText = new SpannableString(status);
|
SpannableString statusText = new SpannableString(status);
|
||||||
statusText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#8C000000")), 0, status.Length, SpanTypes.InclusiveInclusive);
|
statusText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#8C000000")), 0, status.Length, SpanTypes.InclusiveInclusive);
|
||||||
holder.status.TextFormatted = statusText;
|
holder.status.TextFormatted = statusText;
|
||||||
@@ -193,21 +193,21 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM
|
|||||||
|
|
||||||
List<BottomSheetAction> actions = new List<BottomSheetAction>
|
List<BottomSheetAction> actions = new List<BottomSheetAction>
|
||||||
{
|
{
|
||||||
new BottomSheetAction(Resource.Drawable.Play, Resources.GetString(Resource.String.play), (sender, eventArg) => { ListView_ItemClick(null, position); bottomSheet.Dismiss(); }),
|
new BottomSheetAction(Resource.Drawable.Play, MainActivity.instance.GetString(Resource.String.play), (sender, eventArg) => { ListView_ItemClick(null, position); bottomSheet.Dismiss(); }),
|
||||||
new BottomSheetAction(Resource.Drawable.Close, Resources.GetString(Resource.String.remove_from_queue), (sender, eventArg) => { MusicPlayer.RemoveFromQueue(position); bottomSheet.Dismiss(); }),
|
new BottomSheetAction(Resource.Drawable.Close, MainActivity.instance.GetString(Resource.String.remove_from_queue), (sender, eventArg) => { MusicPlayer.RemoveFromQueue(position); bottomSheet.Dismiss(); }),
|
||||||
new BottomSheetAction(Resource.Drawable.PlaylistAdd, Resources.GetString(Resource.String.add_to_playlist), (sender, eventArg) => { PlaylistManager.AddSongToPlaylistDialog(item); bottomSheet.Dismiss(); })
|
new BottomSheetAction(Resource.Drawable.PlaylistAdd, MainActivity.instance.GetString(Resource.String.add_to_playlist), (sender, eventArg) => { PlaylistManager.AddSongToPlaylistDialog(item); bottomSheet.Dismiss(); })
|
||||||
};
|
};
|
||||||
|
|
||||||
if (item.IsYt)
|
if (item.IsYt)
|
||||||
{
|
{
|
||||||
actions.AddRange(new BottomSheetAction[]
|
actions.AddRange(new BottomSheetAction[]
|
||||||
{
|
{
|
||||||
new BottomSheetAction(Resource.Drawable.PlayCircle, Resources.GetString(Resource.String.create_mix_from_song), (sender, eventArg) =>
|
new BottomSheetAction(Resource.Drawable.PlayCircle, MainActivity.instance.GetString(Resource.String.create_mix_from_song), (sender, eventArg) =>
|
||||||
{
|
{
|
||||||
YoutubeManager.CreateMixFromSong(item);
|
YoutubeManager.CreateMixFromSong(item);
|
||||||
bottomSheet.Dismiss();
|
bottomSheet.Dismiss();
|
||||||
}),
|
}),
|
||||||
new BottomSheetAction(Resource.Drawable.Download, Resources.GetString(Resource.String.download), (sender, eventArg) =>
|
new BottomSheetAction(Resource.Drawable.Download, MainActivity.instance.GetString(Resource.String.download), (sender, eventArg) =>
|
||||||
{
|
{
|
||||||
YoutubeManager.Download(new[] { item });
|
YoutubeManager.Download(new[] { item });
|
||||||
bottomSheet.Dismiss();
|
bottomSheet.Dismiss();
|
||||||
@@ -216,7 +216,7 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
actions.Add(new BottomSheetAction(Resource.Drawable.Edit, Resources.GetString(Resource.String.edit_metadata), (sender, eventArg) =>
|
actions.Add(new BottomSheetAction(Resource.Drawable.Edit, MainActivity.instance.GetString(Resource.String.edit_metadata), (sender, eventArg) =>
|
||||||
{
|
{
|
||||||
LocalManager.EditMetadata(item);
|
LocalManager.EditMetadata(item);
|
||||||
bottomSheet.Dismiss();
|
bottomSheet.Dismiss();
|
||||||
|
|||||||
@@ -481,6 +481,9 @@ namespace Opus
|
|||||||
|
|
||||||
public void OnGenerated(Palette palette)
|
public void OnGenerated(Palette palette)
|
||||||
{
|
{
|
||||||
|
if (MainActivity.instance == null || IsDetached)
|
||||||
|
return;
|
||||||
|
|
||||||
List<Palette.Swatch> swatches = palette.Swatches.OrderBy(x => x.Population).ToList();
|
List<Palette.Swatch> swatches = palette.Swatches.OrderBy(x => x.Population).ToList();
|
||||||
int i = swatches.Count - 1;
|
int i = swatches.Count - 1;
|
||||||
Palette.Swatch swatch = palette.MutedSwatch;
|
Palette.Swatch swatch = palette.MutedSwatch;
|
||||||
@@ -529,12 +532,15 @@ namespace Opus
|
|||||||
if (prepared)
|
if (prepared)
|
||||||
{
|
{
|
||||||
View spReveal = MainActivity.instance.FindViewById<View>(Resource.Id.spReveal);
|
View spReveal = MainActivity.instance.FindViewById<View>(Resource.Id.spReveal);
|
||||||
Animator spAnim = ViewAnimationUtils.CreateCircularReveal(spReveal, playNext == false ? spReveal.Width : 0, spReveal.Height / 2, 0, spReveal.Width);
|
if (spReveal != null && spReveal.IsAttachedToWindow)
|
||||||
spAnim.AnimationStart += (sender, e) => { spReveal.SetBackgroundColor(background); };
|
{
|
||||||
spAnim.AnimationEnd += (sender, e) => { MainActivity.instance.FindViewById(Resource.Id.playersHolder).SetBackgroundColor(background); };
|
Animator spAnim = ViewAnimationUtils.CreateCircularReveal(spReveal, playNext == false ? spReveal.Width : 0, spReveal.Height / 2, 0, spReveal.Width);
|
||||||
spAnim.SetDuration(500);
|
spAnim.AnimationStart += (sender, e) => { spReveal.SetBackgroundColor(background); };
|
||||||
spAnim.StartDelay = 10;
|
spAnim.AnimationEnd += (sender, e) => { MainActivity.instance.FindViewById(Resource.Id.playersHolder).SetBackgroundColor(background); };
|
||||||
spAnim.Start();
|
spAnim.SetDuration(500);
|
||||||
|
spAnim.StartDelay = 10;
|
||||||
|
spAnim.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user