private async void CheckIfSongIsPlaying() { if (!shouldCheck || !MiscTools.IsInForeground()) { return; } if (notificationSong.Normal.Id == previousNtfSong.Normal.Id) { return; } Log(Type.Event, "Song playing is different, updating..."); nowPlayingMode = true; songInfo = notificationSong; previousNtfSong = notificationSong; bool autoUpdate = Prefs.GetBoolean("auto_update_page", false); if (autoUpdate && nowPlayingMode) { shouldCheck = false; LoadSong(); } else if (nowPlayingMode) { shouldCheck = false; Android.Views.Animations.Animation anim = Animations.BlinkingAnimation(700, 3); npTxt.StartAnimation(anim); Log(Type.Event, "Playing animation on npTxt"); } else if (!nowPlayingMode) { shouldCheck = false; Android.Views.Animations.Animation anim = Animations.BlinkingImageAnimation(500, 4); shineView.Visibility = ViewStates.Visible; shineView.StartAnimation(anim); Log(Type.Event, "Playing animation on shineView"); } }
private async void HandleChosenSong(Song chosen) { if (chosen.Likeness >= MaxLikeness) { Log(Type.Info, $"Selected song {chosen.Title} by {chosen.Artist} with likeness {chosen.Likeness} is too unlikely.\n Song not found."); ntfManager.Cancel(NotificationId); } else if (string.IsNullOrEmpty(chosen.Title)) { Log(Type.Info, "Song not found!"); ntfManager.Cancel(NotificationId); } else if (chosen.Likeness <= MaxLikeness) { Log(Type.Event, $"Selected song is {chosen.Title} by {chosen.Artist} with likeness {chosen.Likeness}."); if (!MiscTools.IsInForeground()) { CreateNotification(new SongBundle(chosen, new RomanizedSong())); } } }