Use bitwise ops on caching strategy in ListViewAdapter.cs (#1149)
This commit is contained in:
Родитель
4cfdbabb58
Коммит
d0da0c8bfa
|
@ -218,7 +218,7 @@ namespace Xamarin.Forms.Platform.Android
|
||||||
else
|
else
|
||||||
layout = new ConditionalFocusLayout(_context) { Orientation = Orientation.Vertical };
|
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;
|
var boxedCell = convertView as INativeElementView;
|
||||||
if (boxedCell == null)
|
if (boxedCell == null)
|
||||||
|
@ -321,7 +321,8 @@ namespace Xamarin.Forms.Platform.Android
|
||||||
return leftOver > 0;
|
return leftOver > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((IListViewController)list).CachingStrategy == ListViewCachingStrategy.RecycleElement)
|
var strategy = ((IListViewController)list).CachingStrategy;
|
||||||
|
if ((strategy & ListViewCachingStrategy.RecycleElement) != 0)
|
||||||
{
|
{
|
||||||
if (_enabledCheckCell == null)
|
if (_enabledCheckCell == null)
|
||||||
_enabledCheckCell = GetCellForPosition(position);
|
_enabledCheckCell = GetCellForPosition(position);
|
||||||
|
@ -375,7 +376,7 @@ namespace Xamarin.Forms.Platform.Android
|
||||||
{
|
{
|
||||||
Cell cell = null;
|
Cell cell = null;
|
||||||
|
|
||||||
if (Controller.CachingStrategy == ListViewCachingStrategy.RecycleElement)
|
if ((Controller.CachingStrategy & ListViewCachingStrategy.RecycleElement) != 0)
|
||||||
{
|
{
|
||||||
AView cellOwner = view;
|
AView cellOwner = view;
|
||||||
var layout = cellOwner as ConditionalFocusLayout;
|
var layout = cellOwner as ConditionalFocusLayout;
|
||||||
|
@ -461,7 +462,8 @@ namespace Xamarin.Forms.Platform.Android
|
||||||
if (global == position || cells.Count > 0)
|
if (global == position || cells.Count > 0)
|
||||||
{
|
{
|
||||||
//Always create a new cell if we are using the RecycleElement strategy
|
//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);
|
cells.Add(headerCell);
|
||||||
|
|
||||||
if (cells.Count == take)
|
if (cells.Count == take)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче