mirror of
https://github.com/zoriya/Opus.git
synced 2026-06-03 06:25:31 +00:00
Solving a bug with large player.
This commit is contained in:
+50
-14
@@ -112,7 +112,6 @@ namespace MusicApp
|
||||
playToCross = GetDrawable(Resource.Drawable.PlayToCross);
|
||||
crossToPlay = GetDrawable(Resource.Drawable.CrossToPlay);
|
||||
|
||||
|
||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
|
||||
{
|
||||
NotificationManager notificationManager = (NotificationManager)GetSystemService(NotificationService);
|
||||
@@ -345,6 +344,7 @@ namespace MusicApp
|
||||
await Task.Delay(100);
|
||||
HideTabs();
|
||||
HideSearch();
|
||||
SaveInstance();
|
||||
SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, Player.NewInstance()).Commit();
|
||||
}
|
||||
|
||||
@@ -390,6 +390,7 @@ namespace MusicApp
|
||||
SaveInstance();
|
||||
SetYtTabs(e.Query, 0);
|
||||
YoutubeEngine.instances[0].focused = true;
|
||||
YoutubeEngine.instances[0].OnFocus();
|
||||
}
|
||||
e.Handled = true;
|
||||
};
|
||||
@@ -542,7 +543,7 @@ namespace MusicApp
|
||||
Navigate(e.Item.ItemId);
|
||||
}
|
||||
|
||||
public void Navigate(int layout)
|
||||
public void Navigate(int layout, bool resuming = false)
|
||||
{
|
||||
if(YoutubeEngine.instances != null)
|
||||
{
|
||||
@@ -568,7 +569,7 @@ namespace MusicApp
|
||||
switch (layout)
|
||||
{
|
||||
case Resource.Id.musicLayout:
|
||||
if (Home.instance != null && YoutubeEngine.instances != null)
|
||||
if (Home.instance != null && YoutubeEngine.instances != null && !resuming)
|
||||
{
|
||||
Home.instance.Refresh();
|
||||
return;
|
||||
@@ -582,7 +583,8 @@ namespace MusicApp
|
||||
break;
|
||||
|
||||
case Resource.Id.browseLayout:
|
||||
if (Browse.instance != null && YoutubeEngine.instances != null)
|
||||
Console.WriteLine("&Switching to browse");
|
||||
if (Browse.instance != null && YoutubeEngine.instances != null && !resuming)
|
||||
{
|
||||
Browse.instance.Refresh();
|
||||
return;
|
||||
@@ -595,7 +597,7 @@ namespace MusicApp
|
||||
break;
|
||||
|
||||
case Resource.Id.playlistLayout:
|
||||
if (Playlist.instance != null && YoutubeEngine.instances != null)
|
||||
if (Playlist.instance != null && YoutubeEngine.instances != null && !resuming)
|
||||
{
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
Playlist.instance.Refresh();
|
||||
@@ -619,12 +621,10 @@ namespace MusicApp
|
||||
|
||||
async void SetBrowseTabs(int selectedTab = 0)
|
||||
{
|
||||
if (Browse.instance != null)
|
||||
return;
|
||||
while (!canSwitch)
|
||||
await Task.Delay(10);
|
||||
|
||||
if (tab != "Browse" || Browse.instance != null)
|
||||
if (tab != "Browse")
|
||||
return;
|
||||
|
||||
canSwitch = false;
|
||||
@@ -651,6 +651,12 @@ namespace MusicApp
|
||||
|
||||
pager.Adapter = oldAdapter;
|
||||
}
|
||||
else if(Browse.instance != null)
|
||||
{
|
||||
contentRefresh.Visibility = ViewStates.Gone;
|
||||
pagerRefresh.Visibility = ViewStates.Visible;
|
||||
tabs.Visibility = ViewStates.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
contentRefresh.Visibility = ViewStates.Gone;
|
||||
@@ -710,6 +716,12 @@ namespace MusicApp
|
||||
|
||||
pager.Adapter = oldAdapter;
|
||||
}
|
||||
else if(YoutubeEngine.instances != null)
|
||||
{
|
||||
contentRefresh.Visibility = ViewStates.Gone;
|
||||
pagerRefresh.Visibility = ViewStates.Visible;
|
||||
tabs.Visibility = ViewStates.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
contentRefresh.Visibility = ViewStates.Gone;
|
||||
@@ -926,6 +938,7 @@ namespace MusicApp
|
||||
{
|
||||
HideTabs();
|
||||
HideSearch();
|
||||
SaveInstance();
|
||||
SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, Player.NewInstance()).AddToBackStack(null).Commit();
|
||||
}
|
||||
|
||||
@@ -1153,6 +1166,7 @@ namespace MusicApp
|
||||
rootView.RemoveView(Queue.instance.emptyView);
|
||||
}
|
||||
|
||||
SaveInstance();
|
||||
SupportFragmentManager.BeginTransaction().AddToBackStack(null).Replace(Resource.Id.contentView, Player.NewInstance()).Commit();
|
||||
}
|
||||
else
|
||||
@@ -1163,6 +1177,7 @@ namespace MusicApp
|
||||
Playlist.RandomPlay(playlistID, this);
|
||||
HideTabs();
|
||||
HideSearch();
|
||||
SaveInstance();
|
||||
SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, Player.NewInstance()).Commit();
|
||||
}
|
||||
else
|
||||
@@ -1260,7 +1275,7 @@ namespace MusicApp
|
||||
ResumeKiller = false;
|
||||
}
|
||||
|
||||
void SaveInstance()
|
||||
public void SaveInstance()
|
||||
{
|
||||
if (Home.instance != null)
|
||||
{
|
||||
@@ -1274,6 +1289,7 @@ namespace MusicApp
|
||||
}
|
||||
else if (Browse.instance != null && Browse.instance.focused)
|
||||
{
|
||||
Console.WriteLine("&Browse saved");
|
||||
parcelableSender = "Browse";
|
||||
parcelable = Browse.instance.ListView.OnSaveInstanceState();
|
||||
HideTabs();
|
||||
@@ -1302,26 +1318,46 @@ namespace MusicApp
|
||||
}
|
||||
}
|
||||
|
||||
void ResumeInstance()
|
||||
public void ResumeInstance()
|
||||
{
|
||||
switch (parcelableSender)
|
||||
{
|
||||
case "Home":
|
||||
Navigate(Resource.Id.musicLayout);
|
||||
Navigate(Resource.Id.musicLayout, true);
|
||||
break;
|
||||
case "Queue":
|
||||
Transition(Resource.Id.contentView, Queue.instance, false, true);
|
||||
break;
|
||||
case "Browse":
|
||||
Navigate(Resource.Id.browseLayout);
|
||||
Navigate(Resource.Id.browseLayout, true);
|
||||
break;
|
||||
case "FolderBrowse":
|
||||
Navigate(Resource.Id.browseLayout);
|
||||
Navigate(Resource.Id.browseLayout, true);
|
||||
FindViewById<ViewPager>(Resource.Id.pager).CurrentItem = 1;
|
||||
FindViewById<TabLayout>(Resource.Id.tabs).SetScrollPosition(1, 0f, true);
|
||||
break;
|
||||
case "Playlist":
|
||||
Navigate(Resource.Id.playlistLayout);
|
||||
Navigate(Resource.Id.playlistLayout, true);
|
||||
break;
|
||||
case "YoutubeEngine-All":
|
||||
SetYtTabs(YoutubeEngine.searchKeyWorld, 0);
|
||||
YoutubeEngine.instances[0].focused = true;
|
||||
YoutubeEngine.instances[0].OnFocus();
|
||||
break;
|
||||
case "YoutubeEngine-Tracks":
|
||||
SetYtTabs(YoutubeEngine.searchKeyWorld, 1);
|
||||
YoutubeEngine.instances[1].focused = true;
|
||||
YoutubeEngine.instances[1].OnFocus();
|
||||
break;
|
||||
case "YoutubeEngine-Playlists":
|
||||
SetYtTabs(YoutubeEngine.searchKeyWorld, 2);
|
||||
YoutubeEngine.instances[2].focused = true;
|
||||
YoutubeEngine.instances[2].OnFocus();
|
||||
break;
|
||||
case "YoutubeEngine-Channels":
|
||||
SetYtTabs(YoutubeEngine.searchKeyWorld, 3);
|
||||
YoutubeEngine.instances[3].focused = true;
|
||||
YoutubeEngine.instances[3].OnFocus();
|
||||
break;
|
||||
case "PlaylistTracks":
|
||||
Transition(Resource.Id.contentView, PlaylistTracks.instance, false, true);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
|
||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v7.1</TargetFrameworkVersion>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
|
||||
@@ -299,6 +299,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public static void Play(Song item)
|
||||
{
|
||||
MainActivity.instance.SaveInstance();
|
||||
Context context = Android.App.Application.Context;
|
||||
Intent intent = new Intent(context, typeof(MusicPlayer));
|
||||
intent.PutExtra("file", item.GetPath());
|
||||
|
||||
@@ -5,10 +5,13 @@ using Android.Content.PM;
|
||||
using Android.OS;
|
||||
using Android.Provider;
|
||||
using Android.Support.V4.App;
|
||||
using Java.IO;
|
||||
using Java.Net;
|
||||
using MusicApp.Resources.values;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using TagLib;
|
||||
using YoutubeExplode;
|
||||
@@ -106,14 +109,14 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
System.Console.WriteLine("&Webm Output created");
|
||||
|
||||
SetMetaData(filePath, videoInfo.Title, videoInfo.Author, videoInfo.Thumbnails.HighResUrl, file.videoID, null);
|
||||
SetMetaData(filePath, videoInfo.Title, videoInfo.Author, videoInfo.Thumbnails.HighResUrl, file.videoID);
|
||||
isDownloading = false;
|
||||
|
||||
if (queue.Count != 0)
|
||||
DownloadAudio(queue[0], path);
|
||||
}
|
||||
|
||||
private void SetMetaData(string filePath, string title, string artist, string album, string youtubeID, Android.Net.Uri artURI)
|
||||
private void SetMetaData(string filePath, string title, string artist, string album, string youtubeID)
|
||||
{
|
||||
Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.ReadWrite);
|
||||
var meta = TagLib.File.Create(new StreamFileAbstraction(filePath, stream, stream));
|
||||
@@ -123,19 +126,11 @@ namespace MusicApp.Resources.Portable_Class
|
||||
meta.Tag.Album = album;
|
||||
meta.Tag.Comment = youtubeID;
|
||||
|
||||
if (artURI != null)
|
||||
{
|
||||
IPicture[] pictures = new IPicture[1];
|
||||
|
||||
Android.Graphics.Bitmap bitmap = MediaStore.Images.Media.GetBitmap(ContentResolver, artURI);
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
bitmap.Compress(Android.Graphics.Bitmap.CompressFormat.Jpeg, 100, memoryStream);
|
||||
byte[] data = memoryStream.ToArray();
|
||||
|
||||
pictures[0] = new Picture(data);
|
||||
meta.Tag.Pictures = pictures;
|
||||
}
|
||||
|
||||
IPicture[] pictures = new IPicture[1];
|
||||
WebClient client = new WebClient();
|
||||
byte[] data = client.DownloadData(album);
|
||||
pictures[0] = new Picture(data);
|
||||
meta.Tag.Pictures = pictures;
|
||||
meta.Save();
|
||||
stream.Dispose();
|
||||
Android.Media.MediaScannerConnection.ScanFile(this, new string[] { filePath }, null, null);
|
||||
|
||||
@@ -394,6 +394,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
Activity.StartService(intent);
|
||||
MainActivity.instance.HideTabs();
|
||||
MainActivity.instance.HideSearch();
|
||||
MainActivity.instance.SaveInstance();
|
||||
MainActivity.instance.SupportFragmentManager.BeginTransaction().AddToBackStack(null).Replace(Resource.Id.contentView, Player.NewInstance()).Commit();
|
||||
}
|
||||
|
||||
|
||||
@@ -386,7 +386,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public void PlayNext()
|
||||
{
|
||||
if (CurrentID() + 1 > queue.Count - 1)
|
||||
if (CurrentID() + 1 > queue.Count - 1 || CurrentID() == -1)
|
||||
{
|
||||
Pause();
|
||||
return;
|
||||
@@ -454,7 +454,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
public static async void ParseNextSong()
|
||||
{
|
||||
if (CurrentID() + 1 > queue.Count)
|
||||
if (CurrentID() + 1 > queue.Count - 1 || CurrentID() == -1)
|
||||
return;
|
||||
|
||||
Song song = queue[CurrentID() + 1];
|
||||
@@ -466,7 +466,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
parsing = true;
|
||||
YoutubeClient client = new YoutubeClient();
|
||||
MediaStreamInfoSet mediaStreamInfo = await client.GetVideoMediaStreamInfosAsync(song.youtubeID);
|
||||
AudioStreamInfo streamInfo = mediaStreamInfo.Audio.OrderBy(s => s.Bitrate).Last();
|
||||
AudioStreamInfo streamInfo = mediaStreamInfo.Audio.Where(x => x.Container == Container.M4A).OrderBy(s => s.Bitrate).Last();
|
||||
song.SetPath(streamInfo.Url);
|
||||
song.isParsed = true;
|
||||
parsing = false;
|
||||
@@ -485,7 +485,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int) player.CurrentPosition;
|
||||
return player == null ? 0 : (int)player.CurrentPosition;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +550,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
icon = Picasso.With(Application.Context).Load(iconURI).Error(Resource.Drawable.MusicIcon).Placeholder(Resource.Drawable.MusicIcon).NetworkPolicy(NetworkPolicy.Offline).Resize(400, 400).CenterCrop().Get();
|
||||
}
|
||||
catch (System.Exception) //Can be Java.Lang.Exception
|
||||
catch (Exception)
|
||||
{
|
||||
icon = Picasso.With(Application.Context).Load(Resource.Drawable.MusicIcon).Get();
|
||||
}
|
||||
@@ -572,7 +572,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
icon = Picasso.With(Application.Context).Load(imageURI).Error(Resource.Drawable.MusicIcon).Placeholder(Resource.Drawable.MusicIcon).NetworkPolicy(NetworkPolicy.Offline).Resize(400, 400).CenterCrop().Get();
|
||||
}
|
||||
catch (System.Exception) //Can be Java.Lang.Exception
|
||||
catch (Exception)
|
||||
{
|
||||
icon = Picasso.With(Application.Context).Load(Resource.Drawable.MusicIcon).Get();
|
||||
}
|
||||
@@ -748,23 +748,13 @@ namespace MusicApp.Resources.Portable_Class
|
||||
public override void OnDestroy()
|
||||
{
|
||||
base.OnDestroy();
|
||||
|
||||
isRunning = false;
|
||||
Stop();
|
||||
instance = null;
|
||||
|
||||
if (player != null)
|
||||
player.Release();
|
||||
}
|
||||
|
||||
public void OnLoadingChanged(bool p0)
|
||||
{
|
||||
public void OnLoadingChanged(bool p0) { }
|
||||
|
||||
}
|
||||
|
||||
public void OnPlaybackParametersChanged(PlaybackParameters p0)
|
||||
{
|
||||
|
||||
}
|
||||
public void OnPlaybackParametersChanged(PlaybackParameters p0) { }
|
||||
|
||||
public void OnPlayerError(ExoPlaybackException args)
|
||||
{
|
||||
@@ -780,40 +770,19 @@ namespace MusicApp.Resources.Portable_Class
|
||||
}
|
||||
|
||||
|
||||
public void OnPositionDiscontinuity()
|
||||
{
|
||||
public void OnPositionDiscontinuity() { }
|
||||
|
||||
}
|
||||
public void OnRepeatModeChanged(int p0) { }
|
||||
|
||||
public void OnRepeatModeChanged(int p0)
|
||||
{
|
||||
public void OnTracksChanged(TrackGroupArray p0, TrackSelectionArray p1) { }
|
||||
|
||||
}
|
||||
public void OnPositionDiscontinuity(int p0) { }
|
||||
|
||||
public void OnTracksChanged(TrackGroupArray p0, TrackSelectionArray p1)
|
||||
{
|
||||
public void OnSeekProcessed() { }
|
||||
|
||||
}
|
||||
public void OnShuffleModeEnabledChanged(bool p0) { }
|
||||
|
||||
public void OnPositionDiscontinuity(int p0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnSeekProcessed()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnShuffleModeEnabledChanged(bool p0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnTimelineChanged(Timeline p0, Java.Lang.Object p1, int p2)
|
||||
{
|
||||
|
||||
}
|
||||
public void OnTimelineChanged(Timeline p0, Java.Lang.Object p1, int p2) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,11 +112,6 @@ namespace MusicApp.Resources.Portable_Class
|
||||
Picasso.With(Android.App.Application.Context).Load(current.GetAlbum()).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(imgView);
|
||||
}
|
||||
|
||||
bar = playerView.FindViewById<SeekBar>(Resource.Id.songTimer);
|
||||
MusicPlayer.SetSeekBar(bar);
|
||||
handler.PostDelayed(UpdateSeekBar, 1000);
|
||||
|
||||
|
||||
TextView NextTitle = playerView.FindViewById<TextView>(Resource.Id.nextTitle);
|
||||
TextView NextAlbum = playerView.FindViewById<TextView>(Resource.Id.nextArtist);
|
||||
Button ShowQueue = playerView.FindViewById<Button>(Resource.Id.showQueue);
|
||||
@@ -145,7 +140,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
NextAlbum.Text = next.GetName();
|
||||
ImageView nextArt = playerView.FindViewById<ImageView>(Resource.Id.nextArt);
|
||||
|
||||
if(next.GetAlbum() == null)
|
||||
if (next.GetAlbum() == null)
|
||||
{
|
||||
var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart");
|
||||
var nextAlbumArtUri = ContentUris.WithAppendedId(songCover, next.GetAlbumArt());
|
||||
@@ -166,10 +161,12 @@ namespace MusicApp.Resources.Portable_Class
|
||||
Picasso.With(Android.App.Application.Context).Load(Resource.Drawable.noAlbum).Placeholder(Resource.Drawable.MusicIcon).Resize(400, 400).CenterCrop().Into(nextArt);
|
||||
}
|
||||
|
||||
while (MusicPlayer.player.Duration < 1)
|
||||
while (MusicPlayer.player == null)
|
||||
await Task.Delay(100);
|
||||
|
||||
bar.Max = (int)MusicPlayer.player.Duration;
|
||||
bar = playerView.FindViewById<SeekBar>(Resource.Id.songTimer);
|
||||
MusicPlayer.SetSeekBar(bar);
|
||||
handler.PostDelayed(UpdateSeekBar, 1000);
|
||||
}
|
||||
|
||||
public async void RefreshPlayer()
|
||||
@@ -299,7 +296,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
private void Fab_Click(object sender, EventArgs e)
|
||||
{
|
||||
MainActivity.instance.SupportFragmentManager.PopBackStack();
|
||||
MainActivity.instance.FindViewById<BottomNavigationView>(Resource.Id.bottomView).SelectedItemId = Resource.Id.musicLayout;
|
||||
MainActivity.instance.ResumeInstance();
|
||||
//OnDestroy();
|
||||
//MainActivity.instance.FindViewById<BottomNavigationView>(Resource.Id.bottomView).SelectedItemId = Resource.Id.musicLayout;
|
||||
}
|
||||
|
||||
private void ShowQueue_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
private void ListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
|
||||
{
|
||||
Song item = tracks[e.Position];
|
||||
if (result != null)
|
||||
if (result != null && result.Count - 1 >= e.Position)
|
||||
item = result[e.Position];
|
||||
|
||||
if (!item.IsYt)
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
switch (result[position].Kind)
|
||||
{
|
||||
case YtKind.Video:
|
||||
Play(item.GetPath(), item.GetName(), item.GetArtist(), item.GetAlbum());
|
||||
Play(item.GetPath(), item.GetName(), item.GetArtist(), item.GetAlbum(), false, this);
|
||||
break;
|
||||
case YtKind.Playlist:
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
@@ -276,7 +276,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
switch (args.Which)
|
||||
{
|
||||
case 0:
|
||||
Play(item.GetPath(), item.GetName(), item.GetArtist(), item.GetAlbum());
|
||||
Play(item.GetPath(), item.GetName(), item.GetArtist(), item.GetAlbum(), false, this);
|
||||
break;
|
||||
case 1:
|
||||
PlayNext(item.GetPath(), item.GetName(), item.GetArtist(), item.GetAlbum());
|
||||
@@ -297,7 +297,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
builder.Show();
|
||||
}
|
||||
|
||||
public static async void Play(string videoID, string title, string artist, string thumbnailURL, bool skipExistVerification = false)
|
||||
public static async void Play(string videoID, string title, string artist, string thumbnailURL, bool skipExistVerification = false, YoutubeEngine instance = null)
|
||||
{
|
||||
if (!skipExistVerification && FileIsAlreadyDownloaded(videoID))
|
||||
{
|
||||
@@ -332,9 +332,14 @@ namespace MusicApp.Resources.Portable_Class
|
||||
Android.App.Application.Context.StartService(intent);
|
||||
|
||||
parseProgress.Visibility = ViewStates.Gone;
|
||||
if(instance != null)
|
||||
{
|
||||
MainActivity.parcelable = instance.ListView.GetLayoutManager().OnSaveInstanceState();
|
||||
MainActivity.parcelableSender = "YoutubeEngine" + "-" + instance.querryType;
|
||||
}
|
||||
MainActivity.instance.HideTabs();
|
||||
MainActivity.instance.HideSearch();
|
||||
MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, Player.NewInstance()).Commit();
|
||||
MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, Player.NewInstance()).AddToBackStack(null).Commit();
|
||||
}
|
||||
|
||||
public static async void PlayFiles(Song[] files, bool skipExistVerification = false)
|
||||
|
||||
@@ -1,102 +1,101 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true">
|
||||
<LinearLayout
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabTextColor="@android:color/white"
|
||||
app:tabSelectedTextColor="@android:color/white"
|
||||
app:tabIndicatorColor="?colorAccent"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
<ProgressBar
|
||||
android:layout_height="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/ytProgress"
|
||||
android:indeterminate="true"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="fill_parent">
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/pagerRefresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/contentRefresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<FrameLayout
|
||||
android:id="@+id/contentView"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent">
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:tabTextColor="@android:color/white"
|
||||
app:tabSelectedTextColor="@android:color/white"
|
||||
app:tabIndicatorColor="?colorAccent"
|
||||
app:tabGravity="fill"
|
||||
app:tabMode="fixed" />
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
<ProgressBar
|
||||
android:layout_height="4dp"
|
||||
android:layout_width="match_parent"
|
||||
android:id="@+id/ytProgress"
|
||||
android:indeterminate="true"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:paddingBottom="70dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:elevation="6dp"
|
||||
android:layout_width="wrap_content">
|
||||
<include
|
||||
layout="@layout/SmallPlayer"
|
||||
android:id="@+id/smallPlayer" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/defaultColor"
|
||||
android:elevation="12dp"
|
||||
android:layout_alignParentBottom="true" >
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/snackBar"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/bottomView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_below="@id/snackBar"
|
||||
app:itemIconTint="?colorAccent"
|
||||
app:itemTextColor="?colorAccent"
|
||||
app:menu="@menu/bottom_items" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
android:layout_width="fill_parent">
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/pagerRefresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/contentRefresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<FrameLayout
|
||||
android:id="@+id/contentView"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:paddingBottom="70dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:elevation="6dp"
|
||||
android:layout_width="wrap_content">
|
||||
<include
|
||||
layout="@layout/SmallPlayer"
|
||||
android:id="@+id/smallPlayer" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/defaultColor"
|
||||
android:elevation="12dp"
|
||||
android:layout_alignParentBottom="true">
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/snackBar"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent" />
|
||||
<android.support.design.widget.BottomNavigationView
|
||||
android:id="@+id/bottomView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="56dp"
|
||||
android:layout_below="@id/snackBar"
|
||||
app:itemIconTint="?colorAccent"
|
||||
app:itemTextColor="?colorAccent"
|
||||
app:menu="@menu/bottom_items" />
|
||||
</RelativeLayout>
|
||||
</RelativeLayout>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user