mirror of
https://github.com/zoriya/Opus.git
synced 2026-06-05 15:24:26 +00:00
Releasing v1.9
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
Version: 1.8.0
|
||||
Version: 1.9.0
|
||||
Link: https://github.com/AnonymusRaccoon/MusicApp/releases/download/1.8/MusicApp.v1.8.apk
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.musicapp.android" android:installLocation="preferExternal" android:versionCode="10" android:versionName="1.8">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.musicapp.android" android:installLocation="preferExternal" android:versionCode="11" android:versionName="1.9">
|
||||
<uses-sdk android:minSdkVersion="21" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
@@ -459,6 +459,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
MainActivity.parcelable = null;
|
||||
MainActivity.parcelableSender = null;
|
||||
}
|
||||
|
||||
adapterItems[0].recycler?.GetAdapter()?.NotifyDataSetChanged();
|
||||
if (MusicPlayer.CurrentID() != -1 && MusicPlayer.CurrentID() <= MusicPlayer.queue.Count)
|
||||
adapterItems[0].recycler?.ScrollToPosition(MusicPlayer.CurrentID());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,16 +69,30 @@ namespace MusicApp.Resources.Portable_Class
|
||||
LineSongHolder holder = (LineSongHolder)viewHolder;
|
||||
holder.title.Text = items[position].SectionTitle;
|
||||
holder.recycler.SetLayoutManager(new LinearLayoutManager(MainActivity.instance, LinearLayoutManager.Horizontal, false));
|
||||
holder.recycler.SetAdapter(new LineAdapter(items[position].contentValue.GetRange(0, items[position].contentValue.Count > 20 ? 20 : items[position].contentValue.Count), holder.recycler));
|
||||
holder.more.Click += (sender, e) =>
|
||||
if (items[position].SectionTitle == "Queue")
|
||||
{
|
||||
MainActivity.instance.SupportActionBar.SetHomeButtonEnabled(true);
|
||||
MainActivity.instance.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
|
||||
MainActivity.instance.SupportActionBar.Title = items[position].SectionTitle;
|
||||
MainActivity.instance.contentRefresh.Refresh -= Home.instance.OnRefresh;
|
||||
Home.instance = null;
|
||||
MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, PlaylistTracks.NewInstance(items[position].contentValue, items[position].SectionTitle)).AddToBackStack(null).Commit();
|
||||
};
|
||||
holder.recycler.SetAdapter(new LineAdapter(holder.recycler));
|
||||
holder.more.Click += (sender, e) =>
|
||||
{
|
||||
Intent intent = new Intent(MainActivity.instance, typeof(Queue));
|
||||
MainActivity.instance.StartActivity(intent);
|
||||
};
|
||||
if(MusicPlayer.CurrentID() != -1 && MusicPlayer.CurrentID() <= MusicPlayer.queue.Count)
|
||||
holder.recycler.ScrollToPosition(MusicPlayer.CurrentID());
|
||||
}
|
||||
else
|
||||
{
|
||||
holder.recycler.SetAdapter(new LineAdapter(items[position].contentValue.GetRange(0, items[position].contentValue.Count > 20 ? 20 : items[position].contentValue.Count), holder.recycler));
|
||||
holder.more.Click += (sender, e) =>
|
||||
{
|
||||
MainActivity.instance.SupportActionBar.SetHomeButtonEnabled(true);
|
||||
MainActivity.instance.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
|
||||
MainActivity.instance.SupportActionBar.Title = items[position].SectionTitle;
|
||||
MainActivity.instance.contentRefresh.Refresh -= Home.instance.OnRefresh;
|
||||
Home.instance = null;
|
||||
MainActivity.instance.SupportFragmentManager.BeginTransaction().Replace(Resource.Id.contentView, PlaylistTracks.NewInstance(items[position].contentValue, items[position].SectionTitle)).AddToBackStack(null).Commit();
|
||||
};
|
||||
}
|
||||
|
||||
if (MainActivity.Theme == 1)
|
||||
holder.ItemView.SetBackgroundColor(Color.Argb(255, 62, 62, 62));
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
{
|
||||
public RecyclerView recycler;
|
||||
public int listPadding = 0;
|
||||
private bool useQueue = false;
|
||||
private List<Song> songList;
|
||||
|
||||
private readonly string[] actions = new string[] { "Play", "Play Next", "Play Last", "Add To Playlist" };
|
||||
@@ -24,6 +25,15 @@ namespace MusicApp.Resources.Portable_Class
|
||||
this.recycler = recycler;
|
||||
this.songList = songList;
|
||||
}
|
||||
/*
|
||||
* Use this method if the songList is the queue
|
||||
*/
|
||||
public LineAdapter(RecyclerView recycler)
|
||||
{
|
||||
this.recycler = recycler;
|
||||
useQueue = true;
|
||||
songList = MusicPlayer.queue;
|
||||
}
|
||||
|
||||
public override void OnBindViewHolder(RecyclerView.ViewHolder viewHolder, int position)
|
||||
{
|
||||
@@ -53,7 +63,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
void OnClick(int position)
|
||||
{
|
||||
if (!songList[position].IsYt)
|
||||
if (useQueue && MusicPlayer.instance != null)
|
||||
MusicPlayer.instance.SwitchQueue(songList[position]);
|
||||
else if (!songList[position].IsYt)
|
||||
Browse.Play(songList[position], recycler.GetLayoutManager().FindViewByPosition(position).FindViewById<ImageView>(Resource.Id.albumArt));
|
||||
else
|
||||
YoutubeEngine.Play(songList[position].youtubeID, songList[position].Title, songList[position].Artist, songList[position].Album);
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
private bool generating = false;
|
||||
public static int currentID = -1;
|
||||
public static bool repeat = false;
|
||||
public static bool useAutoPlay = true;
|
||||
public static bool useAutoPlay = false;
|
||||
|
||||
private Notification notification;
|
||||
private const int notificationID = 1000;
|
||||
@@ -431,81 +431,58 @@ namespace MusicApp.Resources.Portable_Class
|
||||
}
|
||||
}
|
||||
|
||||
async void GenerateNext(int number)
|
||||
/*async*/ void GenerateNext(int number)
|
||||
{
|
||||
if (generating == true)
|
||||
return;
|
||||
|
||||
generating = true;
|
||||
|
||||
string youtubeID = null;
|
||||
if (MainActivity.HasInternet())
|
||||
{
|
||||
int i = 1;
|
||||
while (youtubeID == null)
|
||||
{
|
||||
if (queue.Count >= i)
|
||||
{
|
||||
youtubeID = queue[queue.Count - i].youtubeID;
|
||||
i++;
|
||||
}
|
||||
else
|
||||
youtubeID = "local";
|
||||
}
|
||||
}
|
||||
else
|
||||
youtubeID = "local";
|
||||
//string youtubeID = null;
|
||||
//if (MainActivity.HasInternet())
|
||||
//{
|
||||
// int i = 1;
|
||||
// while (youtubeID == null)
|
||||
// {
|
||||
// if (queue.Count >= i)
|
||||
// {
|
||||
// youtubeID = queue[queue.Count - i].youtubeID;
|
||||
// i++;
|
||||
// }
|
||||
// else
|
||||
// youtubeID = "local";
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
// youtubeID = "local";
|
||||
|
||||
if (youtubeID != "local" && MainActivity.HasInternet() && !await MainActivity.instance.WaitForYoutube())
|
||||
{
|
||||
//if (number < 4)
|
||||
//{
|
||||
// SearchResource.ListRequest searchResult = YoutubeEngine.youtubeService.Search.List("snippet");
|
||||
// searchResult.Fields = "items(id/videoId,snippet/title,snippet/thumbnails/high/url,snippet/channelTitle)";
|
||||
// searchResult.Type = "video";
|
||||
// searchResult.MaxResults = number + 2;
|
||||
// searchResult.RelatedToVideoId = youtubeID;
|
||||
//if (youtubeID != "local" && !await MainActivity.instance.WaitForYoutube())
|
||||
//{
|
||||
// YoutubeClient client = new YoutubeClient();
|
||||
// Video video = await client.GetVideoAsync(youtubeID);
|
||||
|
||||
// var ytPlaylistRequest = YoutubeEngine.youtubeService.PlaylistItems.List("snippet, contentDetails");
|
||||
// ytPlaylistRequest.PlaylistId = video.GetVideoMixPlaylistId();
|
||||
// ytPlaylistRequest.MaxResults = number + 2;
|
||||
|
||||
// List<Song> songs = new List<Song>();
|
||||
// Google.Apis.YouTube.v3.Data.SearchListResponse response = await searchResult.ExecuteAsync();
|
||||
// foreach (Google.Apis.YouTube.v3.Data.SearchResult video in response.Items)
|
||||
// {
|
||||
// Song song = new Song(video.Snippet.Title, video.Snippet.ChannelTitle, video.Snippet.Thumbnails.High.Url, video.Id.VideoId, -1, -1, null, true, false);
|
||||
// songs.Add(song);
|
||||
// }
|
||||
// songs = songs.Except(songs.Where(x => queue.Exists(y => x.youtubeID == y.youtubeID))).ToList();
|
||||
// if(songs.Count > 0)
|
||||
// PlayLastInQueue(songs[0]);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
YoutubeClient client = new YoutubeClient();
|
||||
Video video = await client.GetVideoAsync(youtubeID);
|
||||
// var ytPlaylist = await ytPlaylistRequest.ExecuteAsync();
|
||||
|
||||
var ytPlaylistRequest = YoutubeEngine.youtubeService.PlaylistItems.List("snippet, contentDetails");
|
||||
ytPlaylistRequest.PlaylistId = video.GetVideoMixPlaylistId();
|
||||
ytPlaylistRequest.MaxResults = number + 2;
|
||||
|
||||
var ytPlaylist = await ytPlaylistRequest.ExecuteAsync();
|
||||
|
||||
foreach (var item in ytPlaylist.Items)
|
||||
{
|
||||
if (item.Snippet.Title != "[Deleted video]" && item.Snippet.Title != "Private video" && item.Snippet.Title != "Deleted video" && item.ContentDetails.VideoId != MusicPlayer.queue[MusicPlayer.CurrentID()].youtubeID)
|
||||
{
|
||||
Song song = new Song(item.Snippet.Title, "", item.Snippet.Thumbnails.Default__.Url, item.ContentDetails.VideoId, -1, -1, item.ContentDetails.VideoId, true, false);
|
||||
if(!queue.Exists(x => x.youtubeID == song.youtubeID))
|
||||
{
|
||||
PlayLastInQueue(song);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
ParseNextSong();
|
||||
}
|
||||
else
|
||||
{
|
||||
// foreach (var item in ytPlaylist.Items)
|
||||
// {
|
||||
// if (item.Snippet.Title != "[Deleted video]" && item.Snippet.Title != "Private video" && item.Snippet.Title != "Deleted video" && item.ContentDetails.VideoId != MusicPlayer.queue[MusicPlayer.CurrentID()].youtubeID)
|
||||
// {
|
||||
// Song song = new Song(item.Snippet.Title, "", item.Snippet.Thumbnails.Default__.Url, item.ContentDetails.VideoId, -1, -1, item.ContentDetails.VideoId, true, false);
|
||||
// if(!queue.Exists(x => x.youtubeID == song.youtubeID))
|
||||
// {
|
||||
// PlayLastInQueue(song);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ParseNextSong();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
Uri musicUri = MediaStore.Audio.Media.ExternalContentUri;
|
||||
|
||||
List<Song> allSongs = new List<Song>();
|
||||
@@ -544,7 +521,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
List<Song> songList = allSongs.OrderBy(x => r.Next()).ToList();
|
||||
for (int i = 0; i < (number > songList.Count ? songList.Count : number); i++)
|
||||
PlayLastInQueue(songList[i]);
|
||||
}
|
||||
//}
|
||||
|
||||
Queue.instance?.Refresh();
|
||||
generating = false;
|
||||
@@ -669,7 +646,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
Song next = queue[CurrentID() + 1];
|
||||
SwitchQueue(next);
|
||||
|
||||
if (CurrentID() + 3 > queue.Count)
|
||||
if (useAutoPlay && CurrentID() + 3 > queue.Count)
|
||||
{
|
||||
GenerateNext(1);
|
||||
}
|
||||
@@ -842,7 +819,8 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
if (CurrentID() + 1 > queue.Count - 1)
|
||||
{
|
||||
instance.GenerateNext(1);
|
||||
if(useAutoPlay)
|
||||
instance.GenerateNext(1);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -408,6 +408,8 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
for (int i = 1; i < files.Length; i++)
|
||||
MusicPlayer.instance.AddToQueue(files[i]);
|
||||
|
||||
Player.instance?.UpdateNext();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user