mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Solving some bugs with player stop method.
This commit is contained in:
@@ -1517,12 +1517,16 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public void Stop(bool SaveQueue)
|
||||
{
|
||||
Console.WriteLine("&Stopping with SaveQueue = " + SaveQueue);
|
||||
if (noisyRegistered)
|
||||
UnregisterReceiver(noisyReceiver);
|
||||
|
||||
if (SaveQueue)
|
||||
{
|
||||
ISharedPreferences pref = PreferenceManager.GetDefaultSharedPreferences(Application.Context);
|
||||
ISharedPreferencesEditor editor = pref.Edit();
|
||||
editor.PutInt("currentID", currentID);
|
||||
editor.Apply();
|
||||
|
||||
if (player != null && CurrentPosition != 0)
|
||||
SaveTimer(CurrentPosition);
|
||||
}
|
||||
@@ -1535,6 +1539,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
queue = new List<Song>();
|
||||
UpdateQueueDataBase();
|
||||
currentID = -1;
|
||||
|
||||
MainActivity.instance?.HideSmallPlayer();
|
||||
if (Home.adapterItems?.Count > 0 && Home.adapterItems[0]?.SectionTitle == "Queue")
|
||||
@@ -1548,7 +1553,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
noisyReceiver = null;
|
||||
noisyRegistered = false;
|
||||
isRunning = false;
|
||||
currentID = -1;
|
||||
if (player != null)
|
||||
{
|
||||
player.Release();
|
||||
|
||||
@@ -727,7 +727,7 @@ namespace MusicApp
|
||||
else if(newState == BottomSheetBehavior.StateHidden)
|
||||
{
|
||||
movement = SheetMovement.Unknow;
|
||||
if (MainActivity.instance.SkipStop)
|
||||
if (!MainActivity.instance.SkipStop)
|
||||
{
|
||||
Intent intent = new Intent(context, typeof(MusicPlayer));
|
||||
intent.SetAction("Stop");
|
||||
|
||||
@@ -933,9 +933,11 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public static async void CreateMix(Song item)
|
||||
{
|
||||
bool AddItemToQueue = true;
|
||||
if(MusicPlayer.queue.Count == 0)
|
||||
{
|
||||
Play(item.YoutubeID, item.Title, item.Artist, item.Album, true, true);
|
||||
AddItemToQueue = false;
|
||||
}
|
||||
|
||||
ProgressBar parseProgress = MainActivity.instance.FindViewById<ProgressBar>(Resource.Id.ytProgress);
|
||||
@@ -983,6 +985,8 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
Random r = new Random();
|
||||
tracks = tracks.OrderBy(x => r.Next()).ToList();
|
||||
if(AddItemToQueue)
|
||||
tracks.Add(item);
|
||||
|
||||
Intent intent = new Intent(MainActivity.instance, typeof(MusicPlayer));
|
||||
MainActivity.instance.StartService(intent);
|
||||
|
||||
Reference in New Issue
Block a user