diff options
author | Rui Marinho <me@ruimarinho.net> | 2017-03-08 11:30:08 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-08 11:30:08 +0000 |
commit | 1ad18e33eb6b6ac02551d14d39f267968d044068 (patch) | |
tree | 5e63cca1a054ff2a3224cfeabf25eff1e4faaa5b /Xamarin.Forms.Core | |
parent | 1b39d02dfa11ac53efb3a8f7668640e03a10194c (diff) | |
download | xamarin-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
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r-- | Xamarin.Forms.Core/PlatformConfiguration/AndroidSpecific/ListView.cs | 30 | ||||
-rw-r--r-- | Xamarin.Forms.Core/Xamarin.Forms.Core.csproj | 1 |
2 files changed, 31 insertions, 0 deletions
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> |