From: Rui Marinho Date: Fri, 1 Nov 2019 20:58:47 +0000 (+0000) Subject: [Android] Fix API21 usage on shell (#8335) X-Git-Tag: accepted/tizen/5.5/unified/20200421.150457~81^2~1^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd3af8e5d86fff0fc48c2977fbf87a41ebf661a1;p=platform%2Fcore%2Fcsapi%2Fxsf.git [Android] Fix API21 usage on shell (#8335) * [Android] Fix API21 usage * [Android] Remove extra usings --- 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);