summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
authorkingces95 <kingces95@users.noreply.github.com>2017-09-19 17:47:12 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-09-19 17:55:29 (GMT)
commit78b8be17aa0f428df9d1440e0536027574741a2e (patch)
tree050b006e5cb740d79300d053f325252f3da3a84a /Xamarin.Forms.Platform.Android
parent009245626bcfddbe6266eddf73795763c24eb383 (diff)
downloadxamarin-forms-78b8be17aa0f428df9d1440e0536027574741a2e.zip
xamarin-forms-78b8be17aa0f428df9d1440e0536027574741a2e.tar.gz
xamarin-forms-78b8be17aa0f428df9d1440e0536027574741a2e.tar.bz2
Use bitwise ops on caching strategy in ListViewAdapter.cs (#1149)
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r--Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs b/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs
index b2279c2..bf67823 100644
--- a/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs
+++ b/Xamarin.Forms.Platform.Android/Renderers/ListViewAdapter.cs
@@ -218,7 +218,7 @@ namespace Xamarin.Forms.Platform.Android
else
layout = new ConditionalFocusLayout(_context) { Orientation = Orientation.Vertical };
- if (cachingStrategy == ListViewCachingStrategy.RecycleElement && convertView != null)
+ if (((cachingStrategy & ListViewCachingStrategy.RecycleElement) != 0) && convertView != null)
{
var boxedCell = convertView as INativeElementView;
if (boxedCell == null)
@@ -321,7 +321,8 @@ namespace Xamarin.Forms.Platform.Android
return leftOver > 0;
}
- if (((IListViewController)list).CachingStrategy == ListViewCachingStrategy.RecycleElement)
+ var strategy = ((IListViewController)list).CachingStrategy;
+ if ((strategy & ListViewCachingStrategy.RecycleElement) != 0)
{
if (_enabledCheckCell == null)
_enabledCheckCell = GetCellForPosition(position);
@@ -375,7 +376,7 @@ namespace Xamarin.Forms.Platform.Android
{
Cell cell = null;
- if (Controller.CachingStrategy == ListViewCachingStrategy.RecycleElement)
+ if ((Controller.CachingStrategy & ListViewCachingStrategy.RecycleElement) != 0)
{
AView cellOwner = view;
var layout = cellOwner as ConditionalFocusLayout;
@@ -461,7 +462,8 @@ namespace Xamarin.Forms.Platform.Android
if (global == position || cells.Count > 0)
{
//Always create a new cell if we are using the RecycleElement strategy
- var headerCell = _listView.CachingStrategy == ListViewCachingStrategy.RecycleElement ? GetNewGroupHeaderCell(group) : group.HeaderContent;
+ var recycleElement = (_listView.CachingStrategy & ListViewCachingStrategy.RecycleElement) != 0;
+ var headerCell = recycleElement ? GetNewGroupHeaderCell(group) : group.HeaderContent;
cells.Add(headerCell);
if (cells.Count == take)