diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2017-03-03 04:28:44 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-03-03 11:28:44 +0000 |
commit | caf2e814120b3abce2050b588c66cfd3589035d3 (patch) | |
tree | 04ea64e60177b82473118c55008ea86b49d614a6 /Xamarin.Forms.Controls.Issues | |
parent | d9ef5525b441375b8d127b6b006b97615b37dcdf (diff) | |
download | xamarin-forms-caf2e814120b3abce2050b588c66cfd3589035d3.tar.gz xamarin-forms-caf2e814120b3abce2050b588c66cfd3589035d3.tar.bz2 xamarin-forms-caf2e814120b3abce2050b588c66cfd3589035d3.zip |
Fix for Android Visibility/Opacity crash (#785)
* Repro
* Fix for UI test
* Cache the Alpha value and queue up restoration after the visibility is changed
* Fix issue with negative height/width in UpdateLayout
* Clean up usings
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
2 files changed, 66 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51238.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51238.cs new file mode 100644 index 00000000..4bce76a0 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla51238.cs @@ -0,0 +1,65 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 51238, + "Transparent Grid causes Java.Lang.IllegalStateException: Unable to create layer for Platform_DefaultRenderer", + PlatformAffected.Android)] + public class Bugzilla51238 : TestContentPage + { +#if UITEST + [Test] + public void Issue1Test() + { + RunningApp.WaitForElement("Tap Me!"); + RunningApp.Tap("Tap Me!"); // Crashes the app if the issue isn't fixed + RunningApp.WaitForElement("Tap Me!"); + } +#endif + + protected override void Init() + { + var grid = new Grid(); + grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); + grid.RowDefinitions.Add(new RowDefinition { Height = 50 }); + + var transparentLayer = new Grid(); + transparentLayer.IsVisible = false; + transparentLayer.BackgroundColor = Color.Lime; + transparentLayer.Opacity = 0.5; + + var label = new Label + { + Text = "Foo", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center + }; + + Grid.SetRow(label, 0); + Grid.SetRow(transparentLayer, 0); + + var button = new Button + { + Text = "Tap Me!", + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center + }; + + Grid.SetRow(button, 1); + + button.Clicked += (sender, args) => { transparentLayer.IsVisible = !transparentLayer.IsVisible; }; + + grid.Children.Add(label); + grid.Children.Add(transparentLayer); + grid.Children.Add(button); + + Content = grid; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 26f5bcbf..1093f1b0 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -171,6 +171,7 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla47923.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla48236.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla47971.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51238.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla51642.xaml.cs"> <DependentUpon>Bugzilla51642.xaml</DependentUpon> <SubType>Code</SubType> |