forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] fixes redraw element when changing renderer (xamarin#5233)
fixes xamarin#1760
- Loading branch information
Pavel Yakovlev
authored and
Alexey Maltsev
committed
Jun 15, 2019
1 parent
8e6ec05
commit df113d9
Showing
7 changed files
with
285 additions
and
12 deletions.
There are no files selected for viewing
73 changes: 73 additions & 0 deletions
73
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1332.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve (AllMembers=true)] | ||
[Issue (IssueTracker.Github, 1332, "Frame inside frame does not resize after visibility changed", PlatformAffected.Android)] | ||
public class Issue1332: TestContentPage | ||
{ | ||
protected override void Init() | ||
{ | ||
double layoutWidth = 0.6; | ||
double layoutHeight = 150; | ||
|
||
var red = new Frame | ||
{ | ||
BackgroundColor = Color.Red, | ||
Content = new Frame | ||
{ | ||
BorderColor = Color.Black, | ||
HeightRequest = layoutHeight, | ||
BackgroundColor = Color.Transparent | ||
} | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(red, new Rectangle(0, 0, layoutWidth, layoutHeight)); | ||
AbsoluteLayout.SetLayoutFlags(red, AbsoluteLayoutFlags.XProportional | AbsoluteLayoutFlags.WidthProportional); | ||
|
||
var stack = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
new Button | ||
{ | ||
Text = "visibility", | ||
Padding = 10, | ||
Command = new Command(() => red.IsVisible = !red.IsVisible) | ||
}, | ||
new Button | ||
{ | ||
Text = "width", | ||
Padding = 10, | ||
Command = new Command(() => { | ||
layoutWidth = layoutWidth == 0.3 ? 0.6 : 0.3; | ||
red.IsVisible = false; | ||
AbsoluteLayout.SetLayoutBounds(red, new Rectangle(0, 0, layoutWidth, 150)); | ||
red.IsVisible = true; | ||
}) | ||
} | ||
} | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(stack, new Rectangle(1, 0, layoutWidth / 2, 1)); | ||
AbsoluteLayout.SetLayoutFlags(stack, AbsoluteLayoutFlags.All); | ||
|
||
var desc = new Label | ||
{ | ||
Text = "Click on Visibility, then click on Width button few times." + | ||
"The layout of the second frame must be updated to match the first." | ||
}; | ||
AbsoluteLayout.SetLayoutBounds(desc, new Rectangle(0, 0.5, 1, 0.5)); | ||
AbsoluteLayout.SetLayoutFlags(desc, AbsoluteLayoutFlags.All); | ||
|
||
Content = new AbsoluteLayout | ||
{ | ||
Children = | ||
{ | ||
red, | ||
stack, | ||
desc | ||
} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1760_1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
#if UITEST | ||
using NUnit.Framework; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 1760, "Content set after an await is not visible", PlatformAffected.Android, issueTestNumber: 1)] | ||
public class Issue1760_1 : TestMasterDetailPage | ||
{ | ||
protected override void Init() | ||
{ | ||
Master = new Issue1760._1760Master(false); | ||
Detail = new Issue1760._1760TestPage(false); | ||
IsPresented = true; | ||
} | ||
|
||
#if UITEST && __ANDROID__ | ||
[Test] | ||
public void Issue1760_1Test() | ||
{ | ||
RunningApp.WaitForElement(Issue1760.Before); | ||
RunningApp.WaitForElement(Issue1760.After); | ||
|
||
RunningApp.Tap("Test Page 1"); | ||
RunningApp.WaitForElement(Issue1760.Before); | ||
RunningApp.WaitForElement(Issue1760.After); | ||
} | ||
#endif | ||
} | ||
} |
98 changes: 98 additions & 0 deletions
98
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue5184.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
using System.Collections.Generic; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
public class ListViewEntry | ||
{ | ||
public int Number { get; set; } | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class ListViewGroup : List<ListViewEntry> | ||
{ | ||
public string Heading { get; set; } | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
public class MainPageViewModel | ||
{ | ||
List<ListViewGroup> _groups = new List<ListViewGroup>(); | ||
|
||
public MainPageViewModel() | ||
{ | ||
for (int i = 0; i < 20; ++i) | ||
{ | ||
var group = new ListViewGroup | ||
{ | ||
Heading = $"Group {i * 5} - {(i + 1) * 5 - 1}" | ||
}; | ||
|
||
for (int j = 0; j < 5; ++j) | ||
{ | ||
group.Add(new ListViewEntry { Number = i * 5 + j }); | ||
} | ||
|
||
_groups.Add(group); | ||
} | ||
} | ||
|
||
public IReadOnlyList<ListViewGroup> Groups | ||
{ | ||
get { return _groups; } | ||
} | ||
} | ||
|
||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 5184, "Items get mixed up when fast scrolling", PlatformAffected.Android)] | ||
public class Issue5184 : TestContentPage | ||
{ | ||
protected override void Init() | ||
{ | ||
BindingContext = new MainPageViewModel(); | ||
var listView = new ListView | ||
{ | ||
Margin = 20, | ||
IsGroupingEnabled = true, | ||
GroupHeaderTemplate = new DataTemplate(() => | ||
{ | ||
var label = new Label(); | ||
label.SetBinding(Label.TextProperty, nameof(ListViewGroup.Heading)); | ||
var grid = new Grid { | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
ColumnDefinitions = new ColumnDefinitionCollection { | ||
new ColumnDefinition { Width = GridLength.Star } | ||
}, | ||
Children = { label } | ||
}; | ||
return new ViewCell { View = grid }; | ||
}), | ||
ItemTemplate = new DataTemplate(() => | ||
{ | ||
var label = new Label(); | ||
label.SetBinding(Label.TextProperty, nameof(ListViewEntry.Number)); | ||
var grid = new Grid | ||
{ | ||
HorizontalOptions = LayoutOptions.FillAndExpand, | ||
ColumnDefinitions = new ColumnDefinitionCollection { | ||
new ColumnDefinition { Width = GridLength.Star } | ||
}, | ||
Children = { label } | ||
}; | ||
return new ViewCell { View = grid }; | ||
}) | ||
}; | ||
listView.SetBinding(ListView.ItemsSourceProperty, nameof(MainPageViewModel.Groups)); | ||
|
||
Content = new StackLayout | ||
{ | ||
Children = { | ||
new Label { Text = "Quickly scroll down and back. Check that all items are correct." }, | ||
listView | ||
} | ||
}; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters