summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2017-03-08 11:30:08 +0000
committerGitHub <noreply@github.com>2017-03-08 11:30:08 +0000
commit1ad18e33eb6b6ac02551d14d39f267968d044068 (patch)
tree5e63cca1a054ff2a3224cfeabf25eff1e4faaa5b
parent1b39d02dfa11ac53efb3a8f7668640e03a10194c (diff)
downloadxamarin-forms-1ad18e33eb6b6ac02551d14d39f267968d044068.tar.gz
xamarin-forms-1ad18e33eb6b6ac02551d14d39f267968d044068.tar.bz2
xamarin-forms-1ad18e33eb6b6ac02551d14d39f267968d044068.zip
[Android] Small performance fixes to ListViewRenderer, PlatformSpecific IsFastScrollEnabled (#797)
* [Android] Enable fast scroll by default * [Android] Cache count for Listview * [Android] Add IsFastScrollEnabled AndroidSpecific and sample * [Android] Use count cache on GetCellsFromPosition * [Android] Fix default for platform specific IsFastScrollEnabled * [Docs]Fix docs * [Android] Don't used cached listCount when getting cell
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs180
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/ListView.cs30
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj1
-rw-r--r--Xamarin.Forms.CustomAttributes/TestAttributes.cs3
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs35
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs11
-rw-r--r--docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration.AndroidSpecific/ListView.xml116
-rw-r--r--docs/Xamarin.Forms.Core/index.xml45
8 files changed, 327 insertions, 94 deletions
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs
index ab3f1815..d6bb8ac2 100644
--- a/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/ListViewCoreGalleryPage.cs
@@ -9,9 +9,12 @@ using System.Threading;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
+using Xamarin.Forms.PlatformConfiguration;
+using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
+
namespace Xamarin.Forms.Controls
{
- [Preserve (AllMembers = true)]
+ [Preserve(AllMembers = true)]
internal class ListViewCoreGalleryPage : CoreGalleryPage<ListView>
{
internal class Employee : INotifyPropertyChanged
@@ -22,10 +25,11 @@ namespace Xamarin.Forms.Controls
get { return _name; }
set
{
- if (value != null && value != _name) {
+ if (value != null && value != _name)
+ {
_name = value;
- OnPropertyChanged ();
- }
+ OnPropertyChanged();
+ }
}
}
@@ -35,10 +39,11 @@ namespace Xamarin.Forms.Controls
get { return _daysWorked; }
set
{
- if (value != null && value != _daysWorked) {
+ if (value != null && value != _daysWorked)
+ {
_daysWorked = value;
- OnPropertyChanged ();
- }
+ OnPropertyChanged();
+ }
}
}
@@ -48,14 +53,15 @@ namespace Xamarin.Forms.Controls
get { return _rowHeight; }
set
{
- if (value != null && value != _rowHeight) {
+ if (value != null && value != _rowHeight)
+ {
_rowHeight = value;
- OnPropertyChanged ();
+ OnPropertyChanged();
}
}
}
- public Employee (string name, TimeSpan daysWorked, int rowHeight)
+ public Employee(string name, TimeSpan daysWorked, int rowHeight)
{
_name = name;
_daysWorked = daysWorked;
@@ -64,61 +70,65 @@ namespace Xamarin.Forms.Controls
public event PropertyChangedEventHandler PropertyChanged;
- protected virtual void OnPropertyChanged ([CallerMemberName] string propertyName = null)
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
- handler (this, new PropertyChangedEventArgs (propertyName));
+ handler(this, new PropertyChangedEventArgs(propertyName));
}
}
- [Preserve (AllMembers = true)]
+ [Preserve(AllMembers = true)]
internal class Grouping<K, T> : ObservableCollection<T>
{
public K Key { get; private set; }
- public Grouping (K key, IEnumerable<T> items)
+ public Grouping(K key, IEnumerable<T> items)
{
Key = key;
- foreach (T item in items) {
- Items.Add (item);
+ foreach (T item in items)
+ {
+ Items.Add(item);
}
}
}
- [Preserve (AllMembers = true)]
+ [Preserve(AllMembers = true)]
public class HeaderCell : ViewCell
{
- public HeaderCell ()
+ public HeaderCell()
{
Height = 60;
- var title = new Label {
+ var title = new Label
+ {
HeightRequest = 60,
BackgroundColor = Color.Navy,
TextColor = Color.White
};
- title.SetBinding (Label.TextProperty, new Binding ("Key"));
+ title.SetBinding(Label.TextProperty, new Binding("Key"));
- View = new StackLayout {
+ View = new StackLayout
+ {
BackgroundColor = Color.Pink,
Children = { title }
};
}
}
- [Preserve (AllMembers = true)]
+ [Preserve(AllMembers = true)]
class UnevenCell : ViewCell
{
- public UnevenCell ()
+ public UnevenCell()
{
-
- SetBinding (HeightProperty, new Binding("RowHeight"));
- var label = new Label ();
- label.SetBinding (Label.TextProperty, new Binding("Name"));
+ SetBinding(HeightProperty, new Binding("RowHeight"));
- var layout = new StackLayout {
+ var label = new Label();
+ label.SetBinding(Label.TextProperty, new Binding("Name"));
+
+ var layout = new StackLayout
+ {
BackgroundColor = Color.Red,
Children = {
label
@@ -129,17 +139,17 @@ namespace Xamarin.Forms.Controls
}
}
- [Preserve (AllMembers = true)]
+ [Preserve(AllMembers = true)]
internal class ListViewViewModel
{
public ObservableCollection<Grouping<string, Employee>> CategorizedEmployees { get; private set; }
- public ObservableCollection<Employee> Employees { get; private set; }
+ public ObservableCollection<Employee> Employees { get; private set; }
- public ListViewViewModel ()
+ public ListViewViewModel()
{
CategorizedEmployees = new ObservableCollection<Grouping<string, Employee>> {
new Grouping<string, Employee> (
- "Engineer",
+ "Engineer",
new [] {
new Employee ("Seth", TimeSpan.FromDays (10), 60),
new Employee ("Jason", TimeSpan.FromDays (100), 100),
@@ -147,7 +157,7 @@ namespace Xamarin.Forms.Controls
}
),
new Grouping<string, Employee> (
- "Sales",
+ "Sales",
new [] {
new Employee ("Andrew 1", TimeSpan.FromDays (10), 160),
new Employee ("Andrew 2", TimeSpan.FromDays (100), 100),
@@ -165,7 +175,7 @@ namespace Xamarin.Forms.Controls
new Employee ("Andrew 3", TimeSpan.FromDays (1000), 60),
};
- Enumerable.Range (0, 9000).Select (e => new Employee (e.ToString (), TimeSpan.FromDays (1), 60)).ForEach (e => Employees.Add (e));
+ Enumerable.Range(0, 9000).Select(e => new Employee(e.ToString(), TimeSpan.FromDays(1), 60)).ForEach(e => Employees.Add(e));
}
}
@@ -174,96 +184,102 @@ namespace Xamarin.Forms.Controls
get { return false; }
}
- protected override void InitializeElement (ListView element)
+ protected override void InitializeElement(ListView element)
{
element.HeightRequest = 350;
element.RowHeight = 60;
- var viewModel = new ListViewViewModel ();
+ var viewModel = new ListViewViewModel();
element.BindingContext = viewModel;
element.ItemsSource = viewModel.Employees;
- var template = new DataTemplate (typeof(TextCell));
- template.SetBinding (TextCell.TextProperty, "Name");
- template.SetBinding (TextCell.DetailProperty, new Binding("DaysWorked", converter: new GenericValueConverter (time => time.ToString ())));
+ var template = new DataTemplate(typeof(TextCell));
+ template.SetBinding(TextCell.TextProperty, "Name");
+ template.SetBinding(TextCell.DetailProperty, new Binding("DaysWorked", converter: new GenericValueConverter(time => time.ToString())));
element.ItemTemplate = template;
}
- protected override void Build (StackLayout stackLayout)
+ protected override void Build(StackLayout stackLayout)
{
- base.Build (stackLayout);
+ base.Build(stackLayout);
- var viewModel = new ListViewViewModel ();
+ var viewModel = new ListViewViewModel();
- var groupDisplayBindingContainer = new ViewContainer<ListView> (Test.ListView.GroupDisplayBinding, new ListView ());
- InitializeElement (groupDisplayBindingContainer.View);
+ var groupDisplayBindingContainer = new ViewContainer<ListView>(Test.ListView.GroupDisplayBinding, new ListView());
+ InitializeElement(groupDisplayBindingContainer.View);
groupDisplayBindingContainer.View.ItemsSource = viewModel.CategorizedEmployees;
groupDisplayBindingContainer.View.IsGroupingEnabled = true;
- groupDisplayBindingContainer.View.GroupDisplayBinding = new Binding ("Key");
+ groupDisplayBindingContainer.View.GroupDisplayBinding = new Binding("Key");
- var groupHeaderTemplateContainer = new ViewContainer<ListView> (Test.ListView.GroupHeaderTemplate, new ListView ());
- InitializeElement (groupHeaderTemplateContainer.View);
+ var groupHeaderTemplateContainer = new ViewContainer<ListView>(Test.ListView.GroupHeaderTemplate, new ListView());
+ InitializeElement(groupHeaderTemplateContainer.View);
groupHeaderTemplateContainer.View.ItemsSource = viewModel.CategorizedEmployees;
groupHeaderTemplateContainer.View.IsGroupingEnabled = true;
- groupHeaderTemplateContainer.View.GroupHeaderTemplate = new DataTemplate (typeof (HeaderCell));
+ groupHeaderTemplateContainer.View.GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell));
- var groupShortNameContainer = new ViewContainer<ListView> (Test.ListView.GroupShortNameBinding, new ListView ());
- InitializeElement (groupShortNameContainer.View);
+ var groupShortNameContainer = new ViewContainer<ListView>(Test.ListView.GroupShortNameBinding, new ListView());
+ InitializeElement(groupShortNameContainer.View);
groupShortNameContainer.View.ItemsSource = viewModel.CategorizedEmployees;
groupShortNameContainer.View.IsGroupingEnabled = true;
groupShortNameContainer.View.GroupShortNameBinding = new Binding("Key");
// TODO - not sure how to do this
- var hasUnevenRowsContainer = new ViewContainer<ListView> (Test.ListView.HasUnevenRows, new ListView ());
- InitializeElement (hasUnevenRowsContainer.View);
+ var hasUnevenRowsContainer = new ViewContainer<ListView>(Test.ListView.HasUnevenRows, new ListView());
+ InitializeElement(hasUnevenRowsContainer.View);
hasUnevenRowsContainer.View.HasUnevenRows = true;
- hasUnevenRowsContainer.View.ItemTemplate = new DataTemplate (typeof(UnevenCell));
+ hasUnevenRowsContainer.View.ItemTemplate = new DataTemplate(typeof(UnevenCell));
- var isGroupingEnabledContainer = new StateViewContainer<ListView> (Test.ListView.IsGroupingEnabled, new ListView ());
- InitializeElement (isGroupingEnabledContainer.View);
+ var isGroupingEnabledContainer = new StateViewContainer<ListView>(Test.ListView.IsGroupingEnabled, new ListView());
+ InitializeElement(isGroupingEnabledContainer.View);
isGroupingEnabledContainer.View.ItemsSource = viewModel.CategorizedEmployees;
isGroupingEnabledContainer.View.IsGroupingEnabled = true;
isGroupingEnabledContainer.StateChangeButton.Clicked += (sender, args) => isGroupingEnabledContainer.View.IsGroupingEnabled = !isGroupingEnabledContainer.View.IsGroupingEnabled;
- var itemAppearingContainer = new EventViewContainer<ListView> (Test.ListView.ItemAppearing, new ListView ());
- InitializeElement (itemAppearingContainer.View);
- itemAppearingContainer.View.ItemAppearing += (sender, args) => itemAppearingContainer.EventFired ();
+ var itemAppearingContainer = new EventViewContainer<ListView>(Test.ListView.ItemAppearing, new ListView());
+ InitializeElement(itemAppearingContainer.View);
+ itemAppearingContainer.View.ItemAppearing += (sender, args) => itemAppearingContainer.EventFired();
- var itemDisappearingContainer = new EventViewContainer<ListView> (Test.ListView.ItemDisappearing, new ListView ());
- InitializeElement (itemDisappearingContainer.View);
- itemDisappearingContainer.View.ItemDisappearing += (sender, args) => itemDisappearingContainer.EventFired ();
+ var itemDisappearingContainer = new EventViewContainer<ListView>(Test.ListView.ItemDisappearing, new ListView());
+ InitializeElement(itemDisappearingContainer.View);
+ itemDisappearingContainer.View.ItemDisappearing += (sender, args) => itemDisappearingContainer.EventFired();
- var itemSelectedContainer = new EventViewContainer<ListView> (Test.ListView.ItemSelected, new ListView ());
- InitializeElement (itemSelectedContainer.View);
- itemSelectedContainer.View.ItemSelected += (sender, args) => itemSelectedContainer.EventFired ();
+ var itemSelectedContainer = new EventViewContainer<ListView>(Test.ListView.ItemSelected, new ListView());
+ InitializeElement(itemSelectedContainer.View);
+ itemSelectedContainer.View.ItemSelected += (sender, args) => itemSelectedContainer.EventFired();
- var itemTappedContainer = new EventViewContainer<ListView> (Test.ListView.ItemTapped, new ListView ());
- InitializeElement (itemTappedContainer.View);
- itemTappedContainer.View.ItemTapped += (sender, args) => itemTappedContainer.EventFired ();
+ var itemTappedContainer = new EventViewContainer<ListView>(Test.ListView.ItemTapped, new ListView());
+ InitializeElement(itemTappedContainer.View);
+ itemTappedContainer.View.ItemTapped += (sender, args) => itemTappedContainer.EventFired();
// TODO
- var rowHeightContainer = new ViewContainer<ListView> (Test.ListView.RowHeight, new ListView ());
- InitializeElement (rowHeightContainer.View);
+ var rowHeightContainer = new ViewContainer<ListView>(Test.ListView.RowHeight, new ListView());
+ InitializeElement(rowHeightContainer.View);
- var selectedItemContainer = new ViewContainer<ListView> (Test.ListView.SelectedItem, new ListView ());
- InitializeElement (selectedItemContainer.View);
+ var selectedItemContainer = new ViewContainer<ListView>(Test.ListView.SelectedItem, new ListView());
+ InitializeElement(selectedItemContainer.View);
selectedItemContainer.View.SelectedItem = viewModel.Employees[2];
- Add (groupDisplayBindingContainer);
- Add (groupHeaderTemplateContainer);
- Add (groupShortNameContainer);
- Add (hasUnevenRowsContainer);
- Add (isGroupingEnabledContainer);
- Add (itemAppearingContainer);
- Add (itemDisappearingContainer);
- Add (itemSelectedContainer);
- Add (itemTappedContainer);
- Add (rowHeightContainer);
- Add (selectedItemContainer);
+ var fastScrollItemContainer = new ViewContainer<ListView>(Test.ListView.FastScroll, new ListView());
+ InitializeElement(fastScrollItemContainer.View);
+ fastScrollItemContainer.View.On<Android>().SetIsFastScrollEnabled(true);
+ fastScrollItemContainer.View.ItemsSource = viewModel.CategorizedEmployees;
+
+ Add(groupDisplayBindingContainer);
+ Add(groupHeaderTemplateContainer);
+ Add(groupShortNameContainer);
+ Add(hasUnevenRowsContainer);
+ Add(isGroupingEnabledContainer);
+ Add(itemAppearingContainer);
+ Add(itemDisappearingContainer);
+ Add(itemSelectedContainer);
+ Add(itemTappedContainer);
+ Add(rowHeightContainer);
+ Add(selectedItemContainer);
+ Add(fastScrollItemContainer);
}
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/ListView.cs b/Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/ListView.cs
new file mode 100644
index 00000000..f1b9b7c3
--- /dev/null
+++ b/Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/ListView.cs
@@ -0,0 +1,30 @@
+namespace Xamarin.Forms.PlatformConfiguration.AndroidSpecific
+{
+ using FormsElement = Forms.ListView;
+
+ public static class ListView
+ {
+ public static readonly BindableProperty IsFastScrollEnabledProperty = BindableProperty.Create("IsFastScrollEnabled", typeof(bool), typeof(ListView), false);
+
+ public static bool GetIsFastScrollEnabled(BindableObject element)
+ {
+ return (bool)element.GetValue(IsFastScrollEnabledProperty);
+ }
+
+ public static void SetIsFastScrollEnabled(BindableObject element, bool value)
+ {
+ element.SetValue(IsFastScrollEnabledProperty, value);
+ }
+
+ public static bool IsFastScrollEnabled(this IPlatformElementConfiguration<Android, FormsElement> config)
+ {
+ return GetIsFastScrollEnabled(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Android, FormsElement> SetIsFastScrollEnabled(this IPlatformElementConfiguration<Android, FormsElement> config, bool value)
+ {
+ SetIsFastScrollEnabled(config.Element, value);
+ return config;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 5d9cc1c8..5e001cdc 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -455,6 +455,7 @@
<Compile Include="PlatformConfiguration\macOSSpecific\TabbedPage.cs" />
<Compile Include="PlatformConfiguration\macOSSpecific\TabsStyle.cs" />
<Compile Include="FontElement.cs" />
+ <Compile Include="PlatformConfiguration\AndroidSpecific\ListView.cs" />
<Compile Include="ITextElement.cs" />
<Compile Include="TextElement.cs" />
</ItemGroup>
diff --git a/Xamarin.Forms.CustomAttributes/TestAttributes.cs b/Xamarin.Forms.CustomAttributes/TestAttributes.cs
index bebd78ac..5c2827b0 100644
--- a/Xamarin.Forms.CustomAttributes/TestAttributes.cs
+++ b/Xamarin.Forms.CustomAttributes/TestAttributes.cs
@@ -414,7 +414,8 @@ namespace Xamarin.Forms.CustomAttributes
IsGroupingEnabled,
GroupDisplayBinding,
GroupShortNameBinding,
- ScrollTo
+ ScrollTo,
+ FastScroll
}
public enum TableView
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs
index 1ff11f4a..5c23fd2e 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs
@@ -26,6 +26,7 @@ namespace Xamarin.Forms.Platform.Android
readonly AListView _realListView;
readonly Dictionary<DataTemplate, int> _templateToId = new Dictionary<DataTemplate, int>();
int _dataTemplateIncrementer = 2; // lets start at not 0 because
+ int _listCount = -1; // -1 we need to get count from the list
Cell _enabledCheckCell;
bool _fromNative;
@@ -57,22 +58,27 @@ namespace Xamarin.Forms.Platform.Android
MessagingCenter.Subscribe<AppCompat.Platform>(this, AppCompat.Platform.CloseContextActionsSignalName, p => CloseContextActions());
else
MessagingCenter.Subscribe<Platform>(this, Platform.CloseContextActionsSignalName, p => CloseContextActions());
+ InvalidateCount();
}
public override int Count
{
get
{
- var templatedItems = TemplatedItemsView.TemplatedItems;
- int count = templatedItems.Count;
-
- if (_listView.IsGroupingEnabled)
+ if (_listCount == -1)
{
- for (var i = 0; i < templatedItems.Count; i++)
- count += templatedItems.GetGroup(i).Count;
- }
+ var templatedItems = TemplatedItemsView.TemplatedItems;
+ int count = templatedItems.Count;
- return count;
+ if (_listView.IsGroupingEnabled)
+ {
+ for (var i = 0; i < templatedItems.Count; i++)
+ count += templatedItems.GetGroup(i).Count;
+ }
+
+ _listCount = count;
+ }
+ return _listCount;
}
}
@@ -371,7 +377,7 @@ namespace Xamarin.Forms.Platform.Android
if (position < 0 || position >= Count)
return;
- if(_lastSelected != view)
+ if (_lastSelected != view)
_fromNative = true;
Select(position, view);
Controller.NotifyRowTapped(position, cell);
@@ -386,11 +392,12 @@ namespace Xamarin.Forms.Platform.Android
return cells;
var templatedItems = TemplatedItemsView.TemplatedItems;
+ var templatedItemsCount = templatedItems.Count;
if (!_listView.IsGroupingEnabled)
{
for (var x = 0; x < take; x++)
{
- if (position + x >= templatedItems.Count)
+ if (position + x >= templatedItemsCount)
return cells;
cells.Add(templatedItems[x + position]);
@@ -401,7 +408,7 @@ namespace Xamarin.Forms.Platform.Android
var i = 0;
var global = 0;
- for (; i < templatedItems.Count; i++)
+ for (; i < templatedItemsCount; i++)
{
var group = templatedItems.GetGroup(i);
@@ -446,6 +453,7 @@ namespace Xamarin.Forms.Platform.Android
void OnDataChanged()
{
+ InvalidateCount();
if (ActionModeContext != null && !TemplatedItemsView.TemplatedItems.Contains(ActionModeContext))
CloseContextActions();
@@ -586,5 +594,10 @@ namespace Xamarin.Forms.Platform.Android
Row,
Header
}
+
+ void InvalidateCount()
+ {
+ _listCount = -1;
+ }
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs
index fa83b25b..a0906915 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewRenderer.cs
@@ -6,6 +6,8 @@ using Android.Views;
using AListView = Android.Widget.ListView;
using AView = Android.Views.View;
using Xamarin.Forms.Internals;
+using System;
+using Xamarin.Forms.PlatformConfiguration.AndroidSpecific;
namespace Xamarin.Forms.Platform.Android
{
@@ -147,6 +149,7 @@ namespace Xamarin.Forms.Platform.Android
UpdateHeader();
UpdateFooter();
UpdateIsSwipeToRefreshEnabled();
+ UpdateFastScrollEnabled();
}
}
@@ -166,6 +169,8 @@ namespace Xamarin.Forms.Platform.Android
UpdateIsRefreshing();
else if (e.PropertyName == ListView.SeparatorColorProperty.PropertyName || e.PropertyName == ListView.SeparatorVisibilityProperty.PropertyName)
_adapter.NotifyDataSetChanged();
+ else if (e.PropertyName == PlatformConfiguration.AndroidSpecific.ListView.IsFastScrollEnabledProperty.PropertyName)
+ UpdateFastScrollEnabled();
}
protected override void OnLayout(bool changed, int l, int t, int r, int b)
@@ -328,6 +333,12 @@ namespace Xamarin.Forms.Platform.Android
_refresh.Enabled = Element.IsPullToRefreshEnabled && (Element as IListViewController).RefreshAllowed;
}
+ void UpdateFastScrollEnabled()
+ {
+ if (Control != null)
+ Control.FastScrollEnabled = Element.OnThisPlatform().IsFastScrollEnabled();
+ }
+
internal class Container : ViewGroup
{
IVisualElementRenderer _child;
diff --git a/docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration.AndroidSpecific/ListView.xml b/docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration.AndroidSpecific/ListView.xml
new file mode 100644
index 00000000..ed7ef762
--- /dev/null
+++ b/docs/Xamarin.Forms.Core/Xamarin.Forms.PlatformConfiguration.AndroidSpecific/ListView.xml
@@ -0,0 +1,116 @@
+<Type Name="ListView" FullName="Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ListView">
+ <TypeSignature Language="C#" Value="public static class ListView" />
+ <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit ListView extends System.Object" />
+ <AssemblyInfo>
+ <AssemblyName>Xamarin.Forms.Core</AssemblyName>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <Base>
+ <BaseTypeName>System.Object</BaseTypeName>
+ </Base>
+ <Interfaces />
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ <Members>
+ <Member MemberName="GetIsFastScrollEnabled">
+ <MemberSignature Language="C#" Value="public static bool GetIsFastScrollEnabled (Xamarin.Forms.BindableObject element);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool GetIsFastScrollEnabled(class Xamarin.Forms.BindableObject element) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="element" Type="Xamarin.Forms.BindableObject" />
+ </Parameters>
+ <Docs>
+ <param name="element">To be added.</param>
+ <summary>To be added.</summary>
+ <returns>To be added.</returns>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="IsFastScrollEnabled">
+ <MemberSignature Language="C#" Value="public static bool IsFastScrollEnabled (this Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt; config);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsFastScrollEnabled(class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.ListView&gt; config) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="config" Type="Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt;" RefType="this" />
+ </Parameters>
+ <Docs>
+ <param name="config">To be added.</param>
+ <summary>To be added.</summary>
+ <returns>To be added.</returns>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="IsFastScrollEnabledProperty">
+ <MemberSignature Language="C#" Value="public static readonly Xamarin.Forms.BindableProperty IsFastScrollEnabledProperty;" />
+ <MemberSignature Language="ILAsm" Value=".field public static initonly class Xamarin.Forms.BindableProperty IsFastScrollEnabledProperty" />
+ <MemberType>Field</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.BindableProperty</ReturnType>
+ </ReturnValue>
+ <Docs>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="SetIsFastScrollEnabled">
+ <MemberSignature Language="C#" Value="public static void SetIsFastScrollEnabled (Xamarin.Forms.BindableObject element, bool value);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetIsFastScrollEnabled(class Xamarin.Forms.BindableObject element, bool value) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>System.Void</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="element" Type="Xamarin.Forms.BindableObject" />
+ <Parameter Name="value" Type="System.Boolean" />
+ </Parameters>
+ <Docs>
+ <param name="element">To be added.</param>
+ <param name="value">To be added.</param>
+ <summary>To be added.</summary>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ <Member MemberName="SetIsFastScrollEnabled">
+ <MemberSignature Language="C#" Value="public static Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt; SetIsFastScrollEnabled (this Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt; config, bool value);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.ListView&gt; SetIsFastScrollEnabled(class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.ListView&gt; config, bool value) cil managed" />
+ <MemberType>Method</MemberType>
+ <AssemblyInfo>
+ <AssemblyVersion>2.0.0.0</AssemblyVersion>
+ </AssemblyInfo>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt;</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="config" Type="Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt;" RefType="this" />
+ <Parameter Name="value" Type="System.Boolean" />
+ </Parameters>
+ <Docs>
+ <param name="config">To be added.</param>
+ <param name="value">To be added.</param>
+ <summary>To be added.</summary>
+ <returns>To be added.</returns>
+ <remarks>To be added.</remarks>
+ </Docs>
+ </Member>
+ </Members>
+</Type>
diff --git a/docs/Xamarin.Forms.Core/index.xml b/docs/Xamarin.Forms.Core/index.xml
index 9a4e1fc9..83827e21 100644
--- a/docs/Xamarin.Forms.Core/index.xml
+++ b/docs/Xamarin.Forms.Core/index.xml
@@ -496,6 +496,7 @@
</Namespace>
<Namespace Name="Xamarin.Forms.PlatformConfiguration.AndroidSpecific">
<Type Name="Application" Kind="Class" />
+ <Type Name="ListView" Kind="Class" />
<Type Name="TabbedPage" Kind="Class" />
<Type Name="WindowSoftInputModeAdjust" Kind="Enumeration" />
</Namespace>
@@ -1737,6 +1738,50 @@
<Targets>
<Target Type="T:Xamarin.Forms.IPlatformElementConfiguration`2" />
</Targets>
+ <Member MemberName="IsFastScrollEnabled">
+ <MemberSignature Language="C#" Value="public static bool IsFastScrollEnabled (this Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt; config);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool IsFastScrollEnabled(class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.ListView&gt; config) cil managed" />
+ <MemberType>ExtensionMethod</MemberType>
+ <ReturnValue>
+ <ReturnType>System.Boolean</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="config" Type="Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt;" RefType="this" />
+ </Parameters>
+ <Docs>
+ <param name="config">To be added.</param>
+ <summary>To be added.</summary>
+ </Docs>
+ <Link Type="Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ListView" Member="M:Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ListView.IsFastScrollEnabled(Xamarin.Forms.IPlatformElementConfiguration{Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView})" />
+ </Member>
+ </ExtensionMethod>
+ <ExtensionMethod>
+ <Targets>
+ <Target Type="T:Xamarin.Forms.IPlatformElementConfiguration`2" />
+ </Targets>
+ <Member MemberName="SetIsFastScrollEnabled">
+ <MemberSignature Language="C#" Value="public static Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt; SetIsFastScrollEnabled (this Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt; config, bool value);" />
+ <MemberSignature Language="ILAsm" Value=".method public static hidebysig class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.ListView&gt; SetIsFastScrollEnabled(class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.ListView&gt; config, bool value) cil managed" />
+ <MemberType>ExtensionMethod</MemberType>
+ <ReturnValue>
+ <ReturnType>Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt;</ReturnType>
+ </ReturnValue>
+ <Parameters>
+ <Parameter Name="config" Type="Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView&gt;" RefType="this" />
+ <Parameter Name="value" Type="System.Boolean" />
+ </Parameters>
+ <Docs>
+ <param name="config">To be added.</param>
+ <param name="value">To be added.</param>
+ <summary>To be added.</summary>
+ </Docs>
+ <Link Type="Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ListView" Member="M:Xamarin.Forms.PlatformConfiguration.AndroidSpecific.ListView.SetIsFastScrollEnabled(Xamarin.Forms.IPlatformElementConfiguration{Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.ListView},System.Boolean)" />
+ </Member>
+ </ExtensionMethod>
+ <ExtensionMethod>
+ <Targets>
+ <Target Type="T:Xamarin.Forms.IPlatformElementConfiguration`2" />
+ </Targets>
<Member MemberName="DisableSwipePaging">
<MemberSignature Language="C#" Value="public static Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.TabbedPage&gt; DisableSwipePaging (this Xamarin.Forms.IPlatformElementConfiguration&lt;Xamarin.Forms.PlatformConfiguration.Android,Xamarin.Forms.TabbedPage&gt; config);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.TabbedPage&gt; DisableSwipePaging(class Xamarin.Forms.IPlatformElementConfiguration`2&lt;class Xamarin.Forms.PlatformConfiguration.Android, class Xamarin.Forms.TabbedPage&gt; config) cil managed" />