Solving some bugs.

This commit is contained in:
Anonymous Raccoon
2018-06-10 13:28:42 +02:00
parent 6af1af7db1
commit 10c27542e5
5 changed files with 13 additions and 29 deletions
+2 -2
View File
@@ -228,8 +228,8 @@
<Reference Include="Xamarin.GooglePlayServices.Tasks, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Xamarin.GooglePlayServices.Tasks.60.1142.1\lib\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.dll</HintPath>
</Reference>
<Reference Include="YoutubeExplode, Version=4.2.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\YoutubeExplode.4.2.5\lib\netstandard2.0\YoutubeExplode.dll</HintPath>
<Reference Include="YoutubeExplode, Version=4.2.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\YoutubeExplode.4.2.7\lib\netstandard2.0\YoutubeExplode.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -180,10 +180,10 @@ namespace MusicApp.Resources.Portable_Class
if(Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
AudioFocusRequestClass focusRequest = new AudioFocusRequestClass.Builder(AudioFocus.Gain)
.SetAudioAttributes(attributes)
.SetAcceptsDelayedFocusGain(true)
.SetOnAudioFocusChangeListener(this)
.Build();
.SetAudioAttributes(attributes)
.SetAcceptsDelayedFocusGain(true)
.SetOnAudioFocusChangeListener(this)
.Build();
AudioFocusRequest audioFocus = audioManager.RequestAudioFocus(focusRequest);
if (audioFocus != AudioFocusRequest.Granted)
@@ -228,29 +228,11 @@ namespace MusicApp.Resources.Portable_Class
CreateNotification(song.GetName(), song.GetArtist(), song.GetAlbumArt(), song.GetAlbum());
if(addToQueue)
if (addToQueue)
AddToQueue(song);
Player.instance?.RefreshPlayer();
ParseNextSong();
//CoordinatorLayout smallPlayer = MainActivity.instance.FindViewById<CoordinatorLayout>(Resource.Id.smallPlayer);
//smallPlayer.FindViewById<TextView>(Resource.Id.spTitle).Text = song.GetName();
//smallPlayer.FindViewById<TextView>(Resource.Id.spArtist).Text = song.GetArtist();
//smallPlayer.FindViewById<ImageView>(Resource.Id.spPlay).SetImageResource(Resource.Drawable.ic_pause_black_24dp);
//ImageView art = smallPlayer.FindViewById<ImageView>(Resource.Id.spArt);
//if (!song.IsYt)
//{
// var songCover = Uri.Parse("content://media/external/audio/albumart");
// var nextAlbumArtUri = ContentUris.WithAppendedId(songCover, song.GetAlbumArt());
// Picasso.With(Application.Context).Load(nextAlbumArtUri).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(art);
//}
//else
//{
// Picasso.With(Application.Context).Load(song.GetAlbum()).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(art);
//}
}
public void Play(Song song, bool addToQueue = true, long progress = -1)
@@ -897,7 +879,6 @@ namespace MusicApp.Resources.Portable_Class
private void SleepPause()
{
//Pause();
Stop();
}
@@ -210,6 +210,9 @@ namespace MusicApp.Resources.Portable_Class
while (MusicPlayer.CurrentID() == -1)
await Task.Delay(100);
if (playerView == null)
return;
TextView title = playerView.FindViewById<TextView>(Resource.Id.playerTitle);
TextView artist = playerView.FindViewById<TextView>(Resource.Id.playerArtist);
imgView = playerView.FindViewById<ImageView>(Resource.Id.playerAlbum);
@@ -411,12 +411,12 @@ namespace MusicApp.Resources.Portable_Class
Browse.Play(songs[0]);
songs.RemoveAt(0);
songs.Reverse();
while (MusicPlayer.instance == null)
await Task.Delay(10);
foreach(Song song in songs)
foreach (Song song in songs)
{
MusicPlayer.instance.AddToQueue(song);
}
+1 -1
View File
@@ -95,5 +95,5 @@
<package id="Xamarin.GooglePlayServices.Base" version="60.1142.1" targetFramework="monoandroid81" />
<package id="Xamarin.GooglePlayServices.Basement" version="60.1142.1" targetFramework="monoandroid81" />
<package id="Xamarin.GooglePlayServices.Tasks" version="60.1142.1" targetFramework="monoandroid81" />
<package id="YoutubeExplode" version="4.2.5" targetFramework="monoandroid81" />
<package id="YoutubeExplode" version="4.2.7" targetFramework="monoandroid81" />
</packages>