From 61ccd13bee300a57fe19fc0b83641d2d0dcce1af Mon Sep 17 00:00:00 2001 From: Anonymus Raccoon <32224410+AnonymusRaccoon@users.noreply.github.com> Date: Wed, 26 Jun 2019 22:02:25 +0200 Subject: [PATCH] Solving a bug in the playlist screen for older versions of android. --- Opus/Code/UI/Adapter/PlaylistAdapter.cs | 16 ++++++++++++++-- Opus/Code/UI/Views/Player.cs | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Opus/Code/UI/Adapter/PlaylistAdapter.cs b/Opus/Code/UI/Adapter/PlaylistAdapter.cs index 3a3dd32..89099dd 100644 --- a/Opus/Code/UI/Adapter/PlaylistAdapter.cs +++ b/Opus/Code/UI/Adapter/PlaylistAdapter.cs @@ -1,6 +1,7 @@ using Android.App; using Android.Content.Res; using Android.Graphics; +using Android.OS; using Android.Support.V7.Widget; using Android.Text; using Android.Util; @@ -80,7 +81,13 @@ namespace Opus.Adapter else if (position < LocalPlaylists.Count && LocalPlaylists[position].Name == "Error" && LocalPlaylists[position].LocalID == -1) { EmptyHolder holder = (EmptyHolder)viewHolder; - holder.text.TextFormatted = Html.FromHtml(LocalPlaylists[position].Owner, FromHtmlOptions.OptionUseCssColors); + + if(Build.VERSION.SdkInt >= BuildVersionCodes.N) + holder.text.TextFormatted = Html.FromHtml(LocalPlaylists[position].Owner, FromHtmlOptions.OptionUseCssColors); + else +#pragma warning disable CS0618 // Type or member is obsolete + holder.text.TextFormatted = Html.FromHtml(LocalPlaylists[position].Owner); +#pragma warning restore CS0618 // Type or member is obsolete if (!holder.text.HasOnClickListeners) { @@ -93,7 +100,12 @@ namespace Opus.Adapter else if(position >= LocalPlaylists.Count && YoutubePlaylists[position - LocalPlaylists.Count].Name == "Error" && YoutubePlaylists[position - LocalPlaylists.Count].YoutubeID == null) { EmptyHolder holder = (EmptyHolder)viewHolder; - holder.text.TextFormatted = Html.FromHtml(YoutubePlaylists[position - LocalPlaylists.Count].Owner, FromHtmlOptions.OptionUseCssColors); + if (Build.VERSION.SdkInt >= BuildVersionCodes.N) + holder.text.TextFormatted = Html.FromHtml(YoutubePlaylists[position - LocalPlaylists.Count].Owner, FromHtmlOptions.OptionUseCssColors); + else +#pragma warning disable CS0618 // Type or member is obsolete + holder.text.TextFormatted = Html.FromHtml(YoutubePlaylists[position - LocalPlaylists.Count].Owner); +#pragma warning restore CS0618 // Type or member is obsolete if (!holder.text.HasOnClickListeners) { diff --git a/Opus/Code/UI/Views/Player.cs b/Opus/Code/UI/Views/Player.cs index 81bfd46..204af22 100644 --- a/Opus/Code/UI/Views/Player.cs +++ b/Opus/Code/UI/Views/Player.cs @@ -191,7 +191,11 @@ namespace Opus //The width of the view in pixel (we'll multiply this by 0.75f because the drawer has a width of 75%) int width = (int)(albumArt.Width * (float)drawable.Height / albumArt.Height); int dX = (int)((drawable.Width - width) * 0.5f); + Console.WriteLine("&Drawable Info: Width: " + drawable.Width + " Height: " + drawable.Height); + Console.WriteLine("&AlbumArt Info: Width: " + albumArt.Width + " Height: " + albumArt.Height); + Console.WriteLine("&Blur Creation: Width: " + width + " dX: " + dX); Bitmap blured = Bitmap.CreateBitmap(drawable, dX, 0, (int)(width * 0.75f), drawable.Height); + Console.WriteLine("&BLured bitmap created"); RenderScript rs = RenderScript.Create(MainActivity.instance); Allocation input = Allocation.CreateFromBitmap(rs, blured);