Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit df1ba62

Browse files
nicolasdeoryPureWeen
authored andcommitted
Fixed #4090
1 parent c419953 commit df1ba62

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using Xamarin.Forms.CustomAttributes;
2+
using Xamarin.Forms.Internals;
3+
using System.Collections.Generic;
4+
5+
#if UITEST
6+
using Xamarin.Forms.Core.UITests;
7+
using Xamarin.UITest;
8+
using NUnit.Framework;
9+
#endif
10+
11+
namespace Xamarin.Forms.Controls.Issues
12+
{
13+
#if UITEST
14+
[Category(UITestCategories.ManualReview)]
15+
#endif
16+
[Preserve(AllMembers = true)]
17+
[Issue(IssueTracker.Github, 4090, "Talkback reports incorrect number of list items", PlatformAffected.Android)]
18+
public class Issue4090 : TestContentPage // or TestMasterDetailPage, etc ...
19+
{
20+
protected override void Init()
21+
{
22+
// Initialize ui here instead of ctor
23+
24+
List<string> menuItems = new List<string>
25+
{
26+
"Browse","About"
27+
};
28+
29+
StackLayout stack = new StackLayout();
30+
31+
ListView ListViewMenu = new ListView();
32+
ListViewMenu.ItemsSource = menuItems;
33+
34+
ListViewMenu.SelectedItem = menuItems[0];
35+
36+
Label label = new Label();
37+
label.Text = "When clicking 'Browse' or 'About', Talkback should report that the element is in list of 2 items";
38+
stack.Children.Add(label);
39+
stack.Children.Add(ListViewMenu);
40+
Content = stack;
41+
42+
43+
BindingContext = new ViewModelIssue4090();
44+
}
45+
}
46+
47+
[Preserve(AllMembers = true)]
48+
public class ViewModelIssue4090
49+
{
50+
public ViewModelIssue4090()
51+
{
52+
53+
}
54+
}
55+
56+
[Preserve(AllMembers = true)]
57+
public class ModelIssue4090
58+
{
59+
public ModelIssue4090()
60+
{
61+
62+
}
63+
}
64+
}

Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
<Compile Include="$(MSBuildThisFileDirectory)Issue11311.cs" />
5151
<Compile Include="$(MSBuildThisFileDirectory)Issue8291.cs" />
5252
<Compile Include="$(MSBuildThisFileDirectory)Issue2674.cs" />
53+
<Compile Include="$(MSBuildThisFileDirectory)Issue4090.cs" />
5354
<Compile Include="$(MSBuildThisFileDirectory)Issue6484.cs" />
5455
<Compile Include="$(MSBuildThisFileDirectory)Issue6187.cs" />
5556
<Compile Include="$(MSBuildThisFileDirectory)Issue3228.xaml.cs">
@@ -2276,4 +2277,10 @@
22762277
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
22772278
</EmbeddedResource>
22782279
</ItemGroup>
2279-
</Project>
2280+
<ItemGroup>
2281+
<EmbeddedResource Include="$(MSBuildThisFileDirectory)ShellFlyoutItemIsVisible.xaml">
2282+
<SubType>Designer</SubType>
2283+
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
2284+
</EmbeddedResource>
2285+
</ItemGroup>
2286+
</Project>

Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,15 @@ void UpdateFooter()
359359
}
360360

361361
if (footer == null)
362+
{
363+
if (_footerView.ChildCount == 0)
364+
{
365+
AListView nativeListView = Control;
366+
nativeListView.RemoveFooterView(_adapter.FooterView);
367+
}
362368
return;
369+
}
370+
363371

364372
if (_footerRenderer != null)
365373
_footerRenderer.SetElement(footer);
@@ -391,7 +399,15 @@ void UpdateHeader()
391399
}
392400

393401
if (header == null)
402+
{
403+
if (_headerView.ChildCount == 0)
404+
{
405+
AListView nativeListView = Control;
406+
nativeListView.RemoveHeaderView(_adapter.HeaderView);
407+
}
394408
return;
409+
}
410+
395411

396412
if (_headerRenderer != null)
397413
_headerRenderer.SetElement(header);

0 commit comments

Comments
 (0)