Solving a bug in the playlist screen for older versions of android.

This commit is contained in:
Anonymus Raccoon
2019-06-26 22:02:25 +02:00
parent 8721e7c731
commit 61ccd13bee
2 changed files with 18 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
using Android.App; using Android.App;
using Android.Content.Res; using Android.Content.Res;
using Android.Graphics; using Android.Graphics;
using Android.OS;
using Android.Support.V7.Widget; using Android.Support.V7.Widget;
using Android.Text; using Android.Text;
using Android.Util; using Android.Util;
@@ -80,7 +81,13 @@ namespace Opus.Adapter
else if (position < LocalPlaylists.Count && LocalPlaylists[position].Name == "Error" && LocalPlaylists[position].LocalID == -1) else if (position < LocalPlaylists.Count && LocalPlaylists[position].Name == "Error" && LocalPlaylists[position].LocalID == -1)
{ {
EmptyHolder holder = (EmptyHolder)viewHolder; 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) 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) else if(position >= LocalPlaylists.Count && YoutubePlaylists[position - LocalPlaylists.Count].Name == "Error" && YoutubePlaylists[position - LocalPlaylists.Count].YoutubeID == null)
{ {
EmptyHolder holder = (EmptyHolder)viewHolder; 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) if (!holder.text.HasOnClickListeners)
{ {

View File

@@ -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%) //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 width = (int)(albumArt.Width * (float)drawable.Height / albumArt.Height);
int dX = (int)((drawable.Width - width) * 0.5f); 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); Bitmap blured = Bitmap.CreateBitmap(drawable, dX, 0, (int)(width * 0.75f), drawable.Height);
Console.WriteLine("&BLured bitmap created");
RenderScript rs = RenderScript.Create(MainActivity.instance); RenderScript rs = RenderScript.Create(MainActivity.instance);
Allocation input = Allocation.CreateFromBitmap(rs, blured); Allocation input = Allocation.CreateFromBitmap(rs, blured);