From bd3af8e5d86fff0fc48c2977fbf87a41ebf661a1 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Fri, 1 Nov 2019 20:58:47 +0000 Subject: [PATCH] =?utf8?q?[Android]=C2=A0Fix=20API21=20usage=20on=20shell?= =?utf8?q?=20(#8335)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * [Android] Fix API21 usage * [Android] Remove extra usings --- .../Renderers/ShellItemRenderer.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs index 4721ea5..0402577 100644 --- a/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs +++ b/Xamarin.Forms.Platform.Android/Renderers/ShellItemRenderer.cs @@ -140,7 +140,12 @@ namespace Xamarin.Forms.Platform.Android protected virtual Drawable CreateItemBackgroundDrawable() { var stateList = ColorStateList.ValueOf(Color.Black.MultiplyAlpha(0.2).ToAndroid()); - return new RippleDrawable(stateList, new ColorDrawable(AColor.White), null); + var colorDrawable = new ColorDrawable(AColor.White); + + if (Forms.IsLollipopOrNewer) + return new RippleDrawable(stateList, colorDrawable, null); + + return colorDrawable; } protected virtual BottomSheetDialog CreateMoreBottomSheet(Action selectCallback) @@ -186,11 +191,14 @@ namespace Xamarin.Forms.Platform.Android image.LayoutParameters = lp; lp.Dispose(); - image.ImageTintList = ColorStateList.ValueOf(Color.Black.MultiplyAlpha(0.6).ToAndroid()); ShellContext.ApplyDrawableAsync(shellContent, ShellSection.IconProperty, icon => { if (!image.IsDisposed()) + { + var color = Color.Black.MultiplyAlpha(0.6).ToAndroid(); + icon.SetTint(color); image.SetImageDrawable(icon); + } }); innerLayout.AddView(image); -- 2.7.4