1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-22 11:35:21 +01:00

testing list page perf

This commit is contained in:
Kyle Spearrin 2016-05-18 21:45:13 -04:00
parent c4161ac5a5
commit 9cd4145217
3 changed files with 70 additions and 1 deletions

View File

@ -82,6 +82,7 @@
<Compile Include="Pages\LoginNavigationPage.cs" />
<Compile Include="Pages\MainPage.cs" />
<Compile Include="Pages\SettingsEditFolderPage.cs" />
<Compile Include="Pages\TestListPage.cs" />
<Compile Include="Pages\SyncPage.cs" />
<Compile Include="Pages\SettingsPage.cs" />
<Compile Include="Pages\SettingsListFoldersPage.cs" />

View File

@ -126,7 +126,7 @@ namespace Bit.App.Pages
private void TouchIdCell_Tapped(object sender, EventArgs e)
{
Navigation.PushAsync(new TestListPage());
}
private void FoldersCell_Tapped(object sender, EventArgs e)

View File

@ -0,0 +1,68 @@
using System;
using Xamarin.Forms;
using Bit.App.Utilities;
using System.Collections.Generic;
namespace Bit.App.Pages
{
public class TestListPage : ContentPage
{
public TestListPage()
{
var textCell = new TextCell();
textCell.SetBinding<Bar>(TextCell.TextProperty, s => s.BarName);
var listView = new ListView
{
IsGroupingEnabled = true,
GroupDisplayBinding = new Binding("FooName"),
ItemsSource = Items,
ItemTemplate = new DataTemplate(() => textCell),
HasUnevenRows = true,
SeparatorColor = Color.FromHex("d2d6de")
};
Content = listView;
}
public ExtendedObservableCollection<Foo> Items { get; private set; } = new ExtendedObservableCollection<Foo>();
protected override void OnAppearing()
{
base.OnAppearing();
var foos = new List<Foo>();
foos.Add(new Foo("Foo 1", MakeBars()));
foos.Add(new Foo("Foo 2", MakeBars()));
foos.Add(new Foo("Foo 3", MakeBars()));
foos.Add(new Foo("Foo 4", MakeBars()));
Items.Reset(foos);
}
private IEnumerable<Bar> MakeBars()
{
var numbers = new List<Bar>();
for(int i = 0; i < 100; i++)
{
numbers.Add(new Bar { BarName = i.ToString() });
}
return numbers;
}
public class Foo : List<Bar>
{
public Foo(string name, IEnumerable<Bar> bars)
{
FooName = name;
AddRange(bars);
}
public string FooName { get; set; }
}
public class Bar
{
public string BarName { get; set; }
}
}
}