mirror of
https://github.com/zoriya/Opus.git
synced 2026-06-05 23:31:52 +00:00
Downloader now work and resolving playlist bug
This commit is contained in:
+35
-41
@@ -75,6 +75,7 @@ namespace MusicApp
|
||||
public GoogleApiClient googleClient;
|
||||
private bool canAsk;
|
||||
private bool waitingForYoutube;
|
||||
private bool ResumeKiller;
|
||||
|
||||
public event EventHandler<PaddingChange> OnPaddingChanged;
|
||||
|
||||
@@ -203,12 +204,18 @@ namespace MusicApp
|
||||
silentLog.SetResultCallback(this);
|
||||
}
|
||||
else if (canAsk)
|
||||
{
|
||||
ResumeKiller = true;
|
||||
StartActivityForResult(Auth.GoogleSignInApi.GetSignInIntent(googleClient), 1598);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if(canAsk)
|
||||
if (canAsk)
|
||||
{
|
||||
ResumeKiller = true;
|
||||
StartActivityForResult(Auth.GoogleSignInApi.GetSignInIntent(googleClient), 1598);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
|
||||
@@ -234,6 +241,7 @@ namespace MusicApp
|
||||
}
|
||||
else if(canAsk)
|
||||
{
|
||||
ResumeKiller = true;
|
||||
StartActivityForResult(Auth.GoogleSignInApi.GetSignInIntent(googleClient), 1598);
|
||||
}
|
||||
}
|
||||
@@ -381,6 +389,7 @@ namespace MusicApp
|
||||
{
|
||||
SaveInstance();
|
||||
SetYtTabs(e.Query, 0);
|
||||
YoutubeEngine.instances[0].focused = true;
|
||||
}
|
||||
e.Handled = true;
|
||||
};
|
||||
@@ -742,13 +751,13 @@ namespace MusicApp
|
||||
else
|
||||
FolderBrowse.instance.ListView.SmoothScrollToPosition(0);
|
||||
}
|
||||
//else if (Playlist.instance != null)
|
||||
//{
|
||||
// if (Playlist.instance.focused)
|
||||
// Playlist.instance.ListView.SmoothScrollToPosition(0);
|
||||
// else
|
||||
// YtPlaylist.instance.ListView.SmoothScrollToPosition(0);
|
||||
//}
|
||||
foreach(YoutubeEngine instance in YoutubeEngine.instances)
|
||||
{
|
||||
if (instance.focused)
|
||||
{
|
||||
instance.ListView.SmoothScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async void CanSwitchDelay()
|
||||
@@ -766,34 +775,6 @@ namespace MusicApp
|
||||
|
||||
public void OnPageSelected(int position)
|
||||
{
|
||||
//if (YoutubeEngine.instance != null)
|
||||
//{
|
||||
// if (position == 0)
|
||||
// {
|
||||
// if (Playlist.instance.isEmpty)
|
||||
// Playlist.instance.AddEmptyView();
|
||||
// if (YtPlaylist.instance.isEmpty)
|
||||
// YtPlaylist.instance.RemoveEmptyView();
|
||||
|
||||
// Playlist.instance.focused = true;
|
||||
// YtPlaylist.instance.focused = false;
|
||||
|
||||
// Playlist.instance.ListView.SmoothScrollToPosition(0);
|
||||
// }
|
||||
// if (position == 1)
|
||||
// {
|
||||
// if (Playlist.instance.isEmpty)
|
||||
// Playlist.instance.RemoveEmptyView();
|
||||
// if (YtPlaylist.instance.isEmpty)
|
||||
// YtPlaylist.instance.AddEmptyView();
|
||||
|
||||
// Playlist.instance.focused = false;
|
||||
// YtPlaylist.instance.focused = true;
|
||||
|
||||
// YtPlaylist.instance.ListView.SmoothScrollToPosition(0);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (Browse.instance != null)
|
||||
{
|
||||
if(!FolderBrowse.instance.populated)
|
||||
@@ -814,6 +795,17 @@ namespace MusicApp
|
||||
Browse.instance.ListView.SmoothScrollToPosition(0);
|
||||
}
|
||||
}
|
||||
else if (YoutubeEngine.instances != null)
|
||||
{
|
||||
foreach(YoutubeEngine instance in YoutubeEngine.instances)
|
||||
{
|
||||
if (instance.focused)
|
||||
instance.OnUnfocus();
|
||||
instance.focused = false;
|
||||
}
|
||||
YoutubeEngine.instances[position].focused = true;
|
||||
YoutubeEngine.instances[position].OnFocus();
|
||||
}
|
||||
}
|
||||
|
||||
public void HideTabs()
|
||||
@@ -890,7 +882,7 @@ namespace MusicApp
|
||||
prepared = true;
|
||||
|
||||
SwipeDismissBehavior behavior = new SwipeDismissBehavior();
|
||||
behavior.SetSwipeDirection(SwipeDismissBehavior.SwipeDirectionAny);
|
||||
behavior.SetSwipeDirection(SwipeDismissBehavior.SwipeDirectionStartToEnd);
|
||||
behavior.SetListener(this);
|
||||
|
||||
CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) smallPlayer.FindViewById<CardView>(Resource.Id.cardPlayer).LayoutParameters;
|
||||
@@ -901,11 +893,10 @@ namespace MusicApp
|
||||
|
||||
public void OnDismiss(View view)
|
||||
{
|
||||
HideSmallPlayer();
|
||||
|
||||
Intent intent = new Intent(this, typeof(MusicPlayer));
|
||||
intent.SetAction("Stop");
|
||||
StartService(intent);
|
||||
view.Alpha = 1;
|
||||
}
|
||||
|
||||
public void OnDragStateChanged(int state) { }
|
||||
@@ -969,7 +960,7 @@ namespace MusicApp
|
||||
}
|
||||
else if(requestCode == 2659)
|
||||
{
|
||||
System.Console.WriteLine("&Write permission authorized");
|
||||
Console.WriteLine("&Write permission authorized");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1255,7 +1246,7 @@ namespace MusicApp
|
||||
{
|
||||
base.OnResume();
|
||||
|
||||
if(parcelableSender != null)
|
||||
if(parcelableSender != null && !ResumeKiller)
|
||||
{
|
||||
var searchView = menu.FindItem(Resource.Id.search).ActionView.JavaCast<SearchView>();
|
||||
menu.FindItem(Resource.Id.search).CollapseActionView();
|
||||
@@ -1264,6 +1255,9 @@ namespace MusicApp
|
||||
searchView.SetQuery("", false);
|
||||
ResumeInstance();
|
||||
}
|
||||
|
||||
if (ResumeKiller)
|
||||
ResumeKiller = false;
|
||||
}
|
||||
|
||||
void SaveInstance()
|
||||
|
||||
@@ -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>
|
||||
@@ -96,8 +96,8 @@
|
||||
<Reference Include="Google.Apis.Core, Version=1.33.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Apis.Core.1.33.0\lib\netstandard1.3\Google.Apis.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Google.Apis.YouTube.v3, Version=1.33.0.1202, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Apis.YouTube.v3.1.33.0.1202\lib\netstandard1.3\Google.Apis.YouTube.v3.dll</HintPath>
|
||||
<Reference Include="Google.Apis.YouTube.v3, Version=1.33.0.1215, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Apis.YouTube.v3.1.33.0.1215\lib\netstandard1.3\Google.Apis.YouTube.v3.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Java.Interop" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -199,9 +199,6 @@
|
||||
<Reference Include="Xamarin.Android.Support.Vector.Drawable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.27.0.2\lib\MonoAndroid81\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.FFmpeg, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.FFmpeg.1.0.4\lib\Xamarin.FFmpeg.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.GooglePlayServices.Auth, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.GooglePlayServices.Auth.60.1142.1\lib\MonoAndroid80\Xamarin.GooglePlayServices.Auth.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -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>
|
||||
@@ -40,8 +40,8 @@
|
||||
<EnableLLVM>false</EnableLLVM>
|
||||
<BundleAssemblies>false</BundleAssemblies>
|
||||
<Debugger>Xamarin</Debugger>
|
||||
<AndroidSupportedAbis />
|
||||
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
|
||||
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
|
||||
<AndroidEnableMultiDex>false</AndroidEnableMultiDex>
|
||||
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@@ -96,8 +96,8 @@
|
||||
<Reference Include="Google.Apis.Core, Version=1.33.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Apis.Core.1.33.0\lib\netstandard1.3\Google.Apis.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Google.Apis.YouTube.v3, Version=1.33.0.1202, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Apis.YouTube.v3.1.33.0.1202\lib\netstandard1.3\Google.Apis.YouTube.v3.dll</HintPath>
|
||||
<Reference Include="Google.Apis.YouTube.v3, Version=1.33.0.1215, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Apis.YouTube.v3.1.33.0.1215\lib\netstandard1.3\Google.Apis.YouTube.v3.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Java.Interop" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -199,9 +199,6 @@
|
||||
<Reference Include="Xamarin.Android.Support.Vector.Drawable, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.Android.Support.Vector.Drawable.27.0.2\lib\MonoAndroid81\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.FFmpeg, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.FFmpeg.1.0.4\lib\Xamarin.FFmpeg.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.GooglePlayServices.Auth, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.GooglePlayServices.Auth.60.1142.1\lib\MonoAndroid80\Xamarin.GooglePlayServices.Auth.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -227,7 +224,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Fragments\DownloadFragment.cs" />
|
||||
<Compile Include="Resources\Fragments\EmptyFragment.cs" />
|
||||
<Compile Include="Resources\Portable Class\AccountPreference.cs" />
|
||||
<Compile Include="Resources\Portable Class\Adapter.cs" />
|
||||
@@ -267,6 +263,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\values\ChannelHolder.cs" />
|
||||
<Compile Include="Resources\values\DownloadFile.cs" />
|
||||
<Compile Include="Resources\values\EmptyCategoryHolder.cs" />
|
||||
<Compile Include="Resources\values\Folder.cs" />
|
||||
<Compile Include="Resources\values\FolderHolder.cs" />
|
||||
<Compile Include="Resources\values\Holder.cs" />
|
||||
@@ -292,9 +289,6 @@
|
||||
<AndroidResource Include="Resources\layout\BrowseLayout.axml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
<AndroidResource Include="Resources\layout\DownloadLayout.axml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml">
|
||||
@@ -536,14 +530,6 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\ic_filter_list_white_24dp.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\youtubeLayout.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</AndroidResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\menu\ytSearch.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\drawable\FlatButtonBorder.xml" />
|
||||
</ItemGroup>
|
||||
@@ -553,6 +539,12 @@
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\LogOutButton.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\EmptyListCategory.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\EmptyYoutubeSearch.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -48,7 +48,7 @@ public class AccountPreference : Preference, IResultCallback
|
||||
else
|
||||
{
|
||||
log.Text = "Log Out";
|
||||
Picasso.With(Android.App.Application.Context).Load(MainActivity.account.PhotoUrl).Into(view.FindViewById<ImageView>(Android.Resource.Id.Icon));
|
||||
Picasso.With(Android.App.Application.Context).Load(MainActivity.account.PhotoUrl).Transform(new CircleTransformation()).Into(view.FindViewById<ImageView>(Android.Resource.Id.Icon));
|
||||
log.SetTextColor(Android.Graphics.Color.Red);
|
||||
log.Click += logOut;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public class AccountPreference : Preference, IResultCallback
|
||||
{
|
||||
Button log = (Button)view.FindViewById(Resource.Id.logButton);
|
||||
log.Text = "Log Out";
|
||||
Picasso.With(Android.App.Application.Context).Load(MainActivity.account.PhotoUrl).Into(view.FindViewById<ImageView>(Android.Resource.Id.Icon));
|
||||
Picasso.With(Android.App.Application.Context).Load(MainActivity.account.PhotoUrl).Transform(new CircleTransformation()).Into(view.FindViewById<ImageView>(Android.Resource.Id.Icon));
|
||||
log.SetTextColor(Android.Graphics.Color.Red);
|
||||
log.Click -= logIn;
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
int listPadding = 0;
|
||||
if (adapter != null)
|
||||
listPadding = adapter.listPadding;
|
||||
adapter = new Adapter(Android.App.Application.Context, Resource.Layout.SongList, musicList)
|
||||
adapter = new Adapter(Android.App.Application.Context, Resource.Layout.SongList, result)
|
||||
{
|
||||
listPadding = listPadding
|
||||
};
|
||||
|
||||
@@ -14,7 +14,6 @@ using TagLib;
|
||||
using YoutubeExplode;
|
||||
using YoutubeExplode.Models;
|
||||
using YoutubeExplode.Models.MediaStreams;
|
||||
using FFMpeg.Xamarin;
|
||||
using File = System.IO.File;
|
||||
|
||||
namespace MusicApp.Resources.Portable_Class
|
||||
@@ -87,7 +86,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
YoutubeClient client = new YoutubeClient();
|
||||
Video videoInfo = await client.GetVideoAsync(file.videoID);
|
||||
MediaStreamInfoSet mediaStreamInfo = await client.GetVideoMediaStreamInfosAsync(file.videoID);
|
||||
AudioStreamInfo streamInfo = mediaStreamInfo.Audio.OrderBy(s => s.Bitrate).Last();
|
||||
AudioStreamInfo streamInfo = mediaStreamInfo.Audio.Where(x => x.Container == Container.M4A).OrderBy(s => s.Bitrate).Last();
|
||||
|
||||
System.Console.WriteLine("&" + streamInfo.Url);
|
||||
//With Where container == Container.M4A, output file should be a m4a file, so ffmpeg is usless
|
||||
|
||||
string fileExtension = streamInfo.Container.GetFileExtension();
|
||||
string fileName = $"{videoInfo.Title}.{fileExtension}";
|
||||
@@ -104,12 +106,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
System.Console.WriteLine("&Webm Output created");
|
||||
|
||||
string outputPath = Path.Combine(path, videoInfo.Title + ".mp3");
|
||||
await FFmpegLibrary.Run(Application.Context, "-y -i " + filePath + " -vn -ar 44100 -ac 2 -b:a 256k -f mp3 " + outputPath);
|
||||
|
||||
System.Console.WriteLine("&Mp3 output created");
|
||||
|
||||
SetMetaData(outputPath, videoInfo.Title, videoInfo.Author, videoInfo.Thumbnails.HighResUrl, file.videoID, null);
|
||||
SetMetaData(filePath, videoInfo.Title, videoInfo.Author, videoInfo.Thumbnails.HighResUrl, file.videoID, null);
|
||||
isDownloading = false;
|
||||
|
||||
if (queue.Count != 0)
|
||||
|
||||
@@ -15,7 +15,6 @@ using Com.Google.Android.Exoplayer2.Extractor;
|
||||
using Com.Google.Android.Exoplayer2.Source;
|
||||
using Com.Google.Android.Exoplayer2.Trackselection;
|
||||
using Com.Google.Android.Exoplayer2.Upstream;
|
||||
using Java.Lang;
|
||||
using MusicApp.Resources.values;
|
||||
using Square.Picasso;
|
||||
using System;
|
||||
@@ -689,6 +688,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
if (isRunning)
|
||||
player.Stop();
|
||||
player.Release();
|
||||
player = null;
|
||||
StopForeground(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,16 +92,11 @@ namespace MusicApp.Resources.Portable_Class
|
||||
HeaderHolder holder = (HeaderHolder)viewHolder;
|
||||
holder.headerText.Text = "Youtube Playlists";
|
||||
}
|
||||
else if(position == 1 && playlistsName[1].StartsWith("EMPTY - "))
|
||||
else if (position == 1 && playlistsName[1].StartsWith("EMPTY - "))
|
||||
{
|
||||
EmptyCategoryHolder holder = (EmptyCategoryHolder)viewHolder;
|
||||
holder.text.Text = playlistsName[1].Substring(8);
|
||||
}
|
||||
else if(position - playlistsName.Count == 1 && ytPlaylists[1].GetName() == "EMPTY")
|
||||
{
|
||||
EmptyCategoryHolder holder = (EmptyCategoryHolder)viewHolder;
|
||||
holder.text.Text = ytPlaylists[1].GetArtist();
|
||||
}
|
||||
else if (playlistsName.Count >= position)
|
||||
{
|
||||
TwoLineHolder holder = (TwoLineHolder) viewHolder;
|
||||
@@ -142,7 +137,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
holder.more.LayoutParameters = layoutParams;
|
||||
}
|
||||
}
|
||||
else
|
||||
else if(position > playlistsName.Count)
|
||||
{
|
||||
RecyclerHolder holder = (RecyclerHolder)viewHolder;
|
||||
Song song = ytPlaylists[position - playlistsName.Count];
|
||||
@@ -219,7 +214,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
return 0;
|
||||
else if (playlistsName.Count >= position && (playlistsName.Count > 2 || !playlistsName[1].StartsWith("EMPTY - ")))
|
||||
return 1;
|
||||
else if(ytPlaylists.Count > 1 && (ytPlaylists.Count > 2 || ytPlaylists[1].GetName() != "EMPTY"))
|
||||
else if(position > playlistsName.Count && (ytPlaylists.Count > 2 || ytPlaylists[1].GetName() != "EMPTY"))
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
|
||||
@@ -29,12 +29,14 @@ namespace MusicApp.Resources.Portable_Class
|
||||
public static YouTubeService youtubeService;
|
||||
public static string searchKeyWorld;
|
||||
public string querryType;
|
||||
public bool focused = false;
|
||||
public RecyclerView ListView;
|
||||
public List<YtFile> result;
|
||||
|
||||
private RecyclerView ListView;
|
||||
private YtAdapter adapter;
|
||||
public View emptyView;
|
||||
public static View loadingView;
|
||||
private bool searching;
|
||||
private string[] actions = new string[] { "Play", "Play Next", "Play Last", "Add To Playlist", "Download" };
|
||||
|
||||
public override void OnActivityCreated(Bundle savedInstanceState)
|
||||
@@ -53,6 +55,28 @@ namespace MusicApp.Resources.Portable_Class
|
||||
adapter.listPadding = (int)(8 * MainActivity.instance.Resources.DisplayMetrics.Density + 0.5f);
|
||||
}
|
||||
|
||||
public void OnFocus()
|
||||
{
|
||||
if (searching)
|
||||
{
|
||||
adapter = null;
|
||||
ListView.SetAdapter(null);
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
rootView.RemoveView(loadingView);
|
||||
loadingView = LayoutInflater.Inflate(Resource.Layout.EmptyLoadingLayout, null);
|
||||
Activity.AddContentView(loadingView, ListView.LayoutParameters);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnUnfocus()
|
||||
{
|
||||
if (searching)
|
||||
{
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
rootView.RemoveView(loadingView);
|
||||
}
|
||||
}
|
||||
|
||||
public static Fragment[] NewInstances(string searchQuery)
|
||||
{
|
||||
searchKeyWorld = searchQuery;
|
||||
@@ -89,9 +113,10 @@ namespace MusicApp.Resources.Portable_Class
|
||||
if (search == null || search == "")
|
||||
return;
|
||||
|
||||
searching = true;
|
||||
searchKeyWorld = search;
|
||||
|
||||
if (loadingBar)
|
||||
if (loadingBar && focused)
|
||||
{
|
||||
adapter = null;
|
||||
ListView.SetAdapter(null);
|
||||
@@ -105,7 +130,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
|
||||
SearchResource.ListRequest searchResult = youtubeService.Search.List("snippet");
|
||||
searchResult.Fields = "items(id/videoId,id/kind,snippet/title,snippet/thumbnails/default/url,snippet/channelTitle)";
|
||||
searchResult.Q = search;
|
||||
searchResult.Q = search.Replace(" ", "+-");
|
||||
searchResult.Type = "video";
|
||||
switch (querryType)
|
||||
{
|
||||
@@ -154,7 +179,7 @@ namespace MusicApp.Resources.Portable_Class
|
||||
result.Add(new YtFile(videoInfo, kind));
|
||||
}
|
||||
|
||||
if (loadingBar)
|
||||
if (loadingBar && focused)
|
||||
{
|
||||
ViewGroup rootView = Activity.FindViewById<ViewGroup>(Android.Resource.Id.Content);
|
||||
rootView.RemoveView(loadingView);
|
||||
@@ -167,8 +192,9 @@ namespace MusicApp.Resources.Portable_Class
|
||||
adapter.ItemClick += ListView_ItemClick;
|
||||
adapter.ItemLongCLick += ListView_ItemLongClick;
|
||||
ListView.SetAdapter(adapter);
|
||||
searching = false;
|
||||
|
||||
if(adapter == null || adapter.ItemCount == 0)
|
||||
if (adapter == null || adapter.ItemCount == 0)
|
||||
{
|
||||
emptyView = LayoutInflater.Inflate(Resource.Layout.EmptyYoutubeSearch, null);
|
||||
|
||||
|
||||
Generated
+101
-103
@@ -28,8 +28,6 @@ namespace MusicApp
|
||||
{
|
||||
global::PCLCrypto.Resource.String.ApplicationName = global::MusicApp.Resource.String.ApplicationName;
|
||||
global::PCLCrypto.Resource.String.Hello = global::MusicApp.Resource.String.Hello;
|
||||
global::Xamarin.FFmpeg.Resource.String.ApplicationName = global::MusicApp.Resource.String.ApplicationName;
|
||||
global::Xamarin.FFmpeg.Resource.String.Hello = global::MusicApp.Resource.String.Hello;
|
||||
}
|
||||
|
||||
public partial class Animation
|
||||
@@ -4204,107 +4202,107 @@ namespace MusicApp
|
||||
public partial class String
|
||||
{
|
||||
|
||||
// aapt resource value: 0x7f070012
|
||||
public const int ApplicationName = 2131165202;
|
||||
// aapt resource value: 0x7f07003b
|
||||
public const int ApplicationName = 2131165243;
|
||||
|
||||
// aapt resource value: 0x7f070011
|
||||
public const int Hello = 2131165201;
|
||||
// aapt resource value: 0x7f07003a
|
||||
public const int Hello = 2131165242;
|
||||
|
||||
// aapt resource value: 0x7f070013
|
||||
public const int abc_action_bar_home_description = 2131165203;
|
||||
|
||||
// aapt resource value: 0x7f070014
|
||||
public const int abc_action_bar_up_description = 2131165204;
|
||||
|
||||
// aapt resource value: 0x7f070015
|
||||
public const int abc_action_bar_home_description = 2131165205;
|
||||
public const int abc_action_menu_overflow_description = 2131165205;
|
||||
|
||||
// aapt resource value: 0x7f070016
|
||||
public const int abc_action_bar_up_description = 2131165206;
|
||||
public const int abc_action_mode_done = 2131165206;
|
||||
|
||||
// aapt resource value: 0x7f070017
|
||||
public const int abc_action_menu_overflow_description = 2131165207;
|
||||
public const int abc_activity_chooser_view_see_all = 2131165207;
|
||||
|
||||
// aapt resource value: 0x7f070018
|
||||
public const int abc_action_mode_done = 2131165208;
|
||||
public const int abc_activitychooserview_choose_application = 2131165208;
|
||||
|
||||
// aapt resource value: 0x7f070019
|
||||
public const int abc_activity_chooser_view_see_all = 2131165209;
|
||||
public const int abc_capital_off = 2131165209;
|
||||
|
||||
// aapt resource value: 0x7f07001a
|
||||
public const int abc_activitychooserview_choose_application = 2131165210;
|
||||
|
||||
// aapt resource value: 0x7f07001b
|
||||
public const int abc_capital_off = 2131165211;
|
||||
|
||||
// aapt resource value: 0x7f07001c
|
||||
public const int abc_capital_on = 2131165212;
|
||||
|
||||
// aapt resource value: 0x7f070027
|
||||
public const int abc_font_family_body_1_material = 2131165223;
|
||||
|
||||
// aapt resource value: 0x7f070028
|
||||
public const int abc_font_family_body_2_material = 2131165224;
|
||||
|
||||
// aapt resource value: 0x7f070029
|
||||
public const int abc_font_family_button_material = 2131165225;
|
||||
|
||||
// aapt resource value: 0x7f07002a
|
||||
public const int abc_font_family_caption_material = 2131165226;
|
||||
|
||||
// aapt resource value: 0x7f07002b
|
||||
public const int abc_font_family_display_1_material = 2131165227;
|
||||
|
||||
// aapt resource value: 0x7f07002c
|
||||
public const int abc_font_family_display_2_material = 2131165228;
|
||||
|
||||
// aapt resource value: 0x7f07002d
|
||||
public const int abc_font_family_display_3_material = 2131165229;
|
||||
|
||||
// aapt resource value: 0x7f07002e
|
||||
public const int abc_font_family_display_4_material = 2131165230;
|
||||
|
||||
// aapt resource value: 0x7f07002f
|
||||
public const int abc_font_family_headline_material = 2131165231;
|
||||
|
||||
// aapt resource value: 0x7f070030
|
||||
public const int abc_font_family_menu_material = 2131165232;
|
||||
|
||||
// aapt resource value: 0x7f070031
|
||||
public const int abc_font_family_subhead_material = 2131165233;
|
||||
|
||||
// aapt resource value: 0x7f070032
|
||||
public const int abc_font_family_title_material = 2131165234;
|
||||
|
||||
// aapt resource value: 0x7f07001d
|
||||
public const int abc_search_hint = 2131165213;
|
||||
|
||||
// aapt resource value: 0x7f07001e
|
||||
public const int abc_searchview_description_clear = 2131165214;
|
||||
|
||||
// aapt resource value: 0x7f07001f
|
||||
public const int abc_searchview_description_query = 2131165215;
|
||||
|
||||
// aapt resource value: 0x7f070020
|
||||
public const int abc_searchview_description_search = 2131165216;
|
||||
|
||||
// aapt resource value: 0x7f070021
|
||||
public const int abc_searchview_description_submit = 2131165217;
|
||||
|
||||
// aapt resource value: 0x7f070022
|
||||
public const int abc_searchview_description_voice = 2131165218;
|
||||
|
||||
// aapt resource value: 0x7f070023
|
||||
public const int abc_shareactionprovider_share_with = 2131165219;
|
||||
|
||||
// aapt resource value: 0x7f070024
|
||||
public const int abc_shareactionprovider_share_with_application = 2131165220;
|
||||
public const int abc_capital_on = 2131165210;
|
||||
|
||||
// aapt resource value: 0x7f070025
|
||||
public const int abc_toolbar_collapse_description = 2131165221;
|
||||
public const int abc_font_family_body_1_material = 2131165221;
|
||||
|
||||
// aapt resource value: 0x7f070026
|
||||
public const int abc_font_family_body_2_material = 2131165222;
|
||||
|
||||
// aapt resource value: 0x7f070027
|
||||
public const int abc_font_family_button_material = 2131165223;
|
||||
|
||||
// aapt resource value: 0x7f070028
|
||||
public const int abc_font_family_caption_material = 2131165224;
|
||||
|
||||
// aapt resource value: 0x7f070029
|
||||
public const int abc_font_family_display_1_material = 2131165225;
|
||||
|
||||
// aapt resource value: 0x7f07002a
|
||||
public const int abc_font_family_display_2_material = 2131165226;
|
||||
|
||||
// aapt resource value: 0x7f07002b
|
||||
public const int abc_font_family_display_3_material = 2131165227;
|
||||
|
||||
// aapt resource value: 0x7f07002c
|
||||
public const int abc_font_family_display_4_material = 2131165228;
|
||||
|
||||
// aapt resource value: 0x7f07002d
|
||||
public const int abc_font_family_headline_material = 2131165229;
|
||||
|
||||
// aapt resource value: 0x7f07002e
|
||||
public const int abc_font_family_menu_material = 2131165230;
|
||||
|
||||
// aapt resource value: 0x7f07002f
|
||||
public const int abc_font_family_subhead_material = 2131165231;
|
||||
|
||||
// aapt resource value: 0x7f070030
|
||||
public const int abc_font_family_title_material = 2131165232;
|
||||
|
||||
// aapt resource value: 0x7f07001b
|
||||
public const int abc_search_hint = 2131165211;
|
||||
|
||||
// aapt resource value: 0x7f07001c
|
||||
public const int abc_searchview_description_clear = 2131165212;
|
||||
|
||||
// aapt resource value: 0x7f07001d
|
||||
public const int abc_searchview_description_query = 2131165213;
|
||||
|
||||
// aapt resource value: 0x7f07001e
|
||||
public const int abc_searchview_description_search = 2131165214;
|
||||
|
||||
// aapt resource value: 0x7f07001f
|
||||
public const int abc_searchview_description_submit = 2131165215;
|
||||
|
||||
// aapt resource value: 0x7f070020
|
||||
public const int abc_searchview_description_voice = 2131165216;
|
||||
|
||||
// aapt resource value: 0x7f070021
|
||||
public const int abc_shareactionprovider_share_with = 2131165217;
|
||||
|
||||
// aapt resource value: 0x7f070022
|
||||
public const int abc_shareactionprovider_share_with_application = 2131165218;
|
||||
|
||||
// aapt resource value: 0x7f070023
|
||||
public const int abc_toolbar_collapse_description = 2131165219;
|
||||
|
||||
// aapt resource value: 0x7f070031
|
||||
public const int appbar_scrolling_view_behavior = 2131165233;
|
||||
|
||||
// aapt resource value: 0x7f070032
|
||||
public const int bottom_sheet_behavior = 2131165234;
|
||||
|
||||
// aapt resource value: 0x7f070033
|
||||
public const int appbar_scrolling_view_behavior = 2131165235;
|
||||
|
||||
// aapt resource value: 0x7f070034
|
||||
public const int bottom_sheet_behavior = 2131165236;
|
||||
|
||||
// aapt resource value: 0x7f070035
|
||||
public const int character_counter_pattern = 2131165237;
|
||||
public const int character_counter_pattern = 2131165235;
|
||||
|
||||
// aapt resource value: 0x7f070001
|
||||
public const int common_google_play_services_enable_button = 2131165185;
|
||||
@@ -4390,32 +4388,32 @@ namespace MusicApp
|
||||
// aapt resource value: 0x7f070046
|
||||
public const int exo_controls_stop_description = 2131165254;
|
||||
|
||||
// aapt resource value: 0x7f070034
|
||||
public const int password_toggle_content_description = 2131165236;
|
||||
|
||||
// aapt resource value: 0x7f070035
|
||||
public const int path_password_eye = 2131165237;
|
||||
|
||||
// aapt resource value: 0x7f070036
|
||||
public const int password_toggle_content_description = 2131165238;
|
||||
public const int path_password_eye_mask_strike_through = 2131165238;
|
||||
|
||||
// aapt resource value: 0x7f070037
|
||||
public const int path_password_eye = 2131165239;
|
||||
public const int path_password_eye_mask_visible = 2131165239;
|
||||
|
||||
// aapt resource value: 0x7f070038
|
||||
public const int path_password_eye_mask_strike_through = 2131165240;
|
||||
public const int path_password_strike_through = 2131165240;
|
||||
|
||||
// aapt resource value: 0x7f070024
|
||||
public const int search_menu_title = 2131165220;
|
||||
|
||||
// aapt resource value: 0x7f070039
|
||||
public const int path_password_eye_mask_visible = 2131165241;
|
||||
public const int status_bar_notification_info_overflow = 2131165241;
|
||||
|
||||
// aapt resource value: 0x7f07003a
|
||||
public const int path_password_strike_through = 2131165242;
|
||||
// aapt resource value: 0x7f070011
|
||||
public const int v7_preference_off = 2131165201;
|
||||
|
||||
// aapt resource value: 0x7f070026
|
||||
public const int search_menu_title = 2131165222;
|
||||
|
||||
// aapt resource value: 0x7f07003b
|
||||
public const int status_bar_notification_info_overflow = 2131165243;
|
||||
|
||||
// aapt resource value: 0x7f070013
|
||||
public const int v7_preference_off = 2131165203;
|
||||
|
||||
// aapt resource value: 0x7f070014
|
||||
public const int v7_preference_on = 2131165204;
|
||||
// aapt resource value: 0x7f070012
|
||||
public const int v7_preference_on = 2131165202;
|
||||
|
||||
static String()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="70dp"
|
||||
android:elevation="6dp"
|
||||
android:background="?attr/defaultColor"
|
||||
android:id="@+id/smallPlayer" >
|
||||
<android.support.v7.widget.CardView
|
||||
android:layout_width="fill_parent"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<package id="Google.Apis" version="1.33.0" targetFramework="monoandroid81" />
|
||||
<package id="Google.Apis.Auth" version="1.33.0" targetFramework="monoandroid81" />
|
||||
<package id="Google.Apis.Core" version="1.33.0" targetFramework="monoandroid81" />
|
||||
<package id="Google.Apis.YouTube.v3" version="1.33.0.1202" targetFramework="monoandroid81" />
|
||||
<package id="Google.Apis.YouTube.v3" version="1.33.0.1215" targetFramework="monoandroid81" />
|
||||
<package id="Microsoft.CSharp" version="4.4.1" targetFramework="monoandroid81" />
|
||||
<package id="Microsoft.NETCore.Platforms" version="2.0.2" targetFramework="monoandroid81" />
|
||||
<package id="NETStandard.Library" version="2.0.2" targetFramework="monoandroid81" />
|
||||
@@ -88,7 +88,6 @@
|
||||
<package id="Xamarin.Android.Support.v7.RecyclerView" version="27.0.2" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.Android.Support.Vector.Drawable" version="27.0.2" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.Build.Download" version="0.4.10" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.FFmpeg" version="1.0.4" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.GooglePlayServices.Auth" version="60.1142.1" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.GooglePlayServices.Auth.Api.Phone" version="60.1142.1" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.GooglePlayServices.Auth.Base" version="60.1142.1" targetFramework="monoandroid81" />
|
||||
|
||||
Reference in New Issue
Block a user