{
listItemView.IconResourceUrl = listItemData.IconResourceUrl;
listItemView.IconSize2D = listItemData.IconSize2D;
- listItemView.IconPosition2D = new Position2D(listItemData.IconPosition2D.X, (listItemView.Size2D.Height - listItemView.IconSize2D.Height) / 2);
+ if (listItemView.IconSize2D != null)
+ {
+ listItemView.IconPosition2D = new Position2D(listItemData.IconPosition2D.X, (listItemView.Size2D.Height - listItemView.IconSize2D.Height) / 2);
+ }
}
if (listItemData.CheckImageResourceUrl != null)
{
listItemView.CheckResourceUrl = listItemData.CheckImageResourceUrl;
listItemView.CheckImageSize2D = listItemData.CheckImageSize2D;
- listItemView.CheckPosition2D = new Position2D(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize2D.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize2D.Height) / 2);
+ if (listItemView.CheckImageSize2D != null)
+ {
+ listItemView.CheckPosition2D = new Position2D(listItemView.Size2D.Width - listItemData.CheckImageRightSpace - listItemView.CheckImageSize2D.Width, (listItemView.Size2D.Height - listItemView.CheckImageSize2D.Height) / 2);
+ }
}
listItemView.IsSelected = listItemData.IsSelected;
}
FlexibleView.ViewHolder anchorChild = FindFirstCompleteVisibleItemView();
+ if (anchorChild != null)
+ {
+ return false;
+ }
anchorInfo.Position = anchorChild.LayoutPosition;
anchorInfo.Coordinate = mOrientationHelper.GetViewHolderStart(anchorChild);
FlexibleView.ViewHolder child = GetChildClosestToEnd();
//Log.Fatal("TV.FLUX.Component", $"==========> child:{child.LayoutGroupIndex}-{child.LayoutItemIndex} childEnd:{orientationHelper.GetItemEnd(child)} # {orientationHelper.GetEnd()}");
- if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderEnd(child) + scrolled < mOrientationHelper.GetEnd())
+ if (child != null)
{
- layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
- layoutState.Extra = 0;
- layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
- layoutState.Recycle = false;
- Fill(recycler, layoutState, true, immediate);
+ if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderEnd(child) + scrolled < mOrientationHelper.GetEnd())
+ {
+ layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
+ layoutState.Extra = 0;
+ layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ layoutState.Recycle = false;
+ Fill(recycler, layoutState, true, immediate);
+ }
}
}
else
{
FlexibleView.ViewHolder child = GetChildClosestToStart();
- if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderStart(child) + scrolled > 0)
+ if (child != null)
{
- layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
- layoutState.Extra = 0;
- layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
- layoutState.Recycle = false;
- Fill(recycler, layoutState, true, immediate);
+ if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderStart(child) + scrolled > 0)
+ {
+ layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
+ layoutState.Extra = 0;
+ layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
+ layoutState.Recycle = false;
+ Fill(recycler, layoutState, true, immediate);
+ }
}
}
}
{
mLayoutState.Extra = 0;
mLayoutState.LayoutDirection = layoutDirection;
- float scrollingOffset;
+ float scrollingOffset = 0.0f;
if (layoutDirection == LayoutState.LAYOUT_END)
{
mLayoutState.Extra += mOrientationHelper.GetEndPadding();
// get the first child in the direction we are going
FlexibleView.ViewHolder child = GetChildClosestToEnd();
- // the direction in which we are traversing children
- mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD
- : LayoutState.ITEM_DIRECTION_TAIL;
- mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
- mLayoutState.Offset = mOrientationHelper.GetViewHolderEnd(child);
- // calculate how much we can scroll without adding new children (independent of layout)
- scrollingOffset = mOrientationHelper.GetViewHolderEnd(child)
- - mOrientationHelper.GetEndAfterPadding();
+ if (child != null)
+ {
+ // the direction in which we are traversing children
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD
+ : LayoutState.ITEM_DIRECTION_TAIL;
+ mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
+ mLayoutState.Offset = mOrientationHelper.GetViewHolderEnd(child);
+ // calculate how much we can scroll without adding new children (independent of layout)
+ scrollingOffset = mOrientationHelper.GetViewHolderEnd(child)
+ - mOrientationHelper.GetEndAfterPadding();
+ }
}
else
{
mLayoutState.Extra += mOrientationHelper.GetStartAfterPadding();
FlexibleView.ViewHolder child = GetChildClosestToStart();
- mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL
- : LayoutState.ITEM_DIRECTION_HEAD;
- mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
- mLayoutState.Offset = mOrientationHelper.GetViewHolderStart(child);
- scrollingOffset = -mOrientationHelper.GetViewHolderStart(child)
- + mOrientationHelper.GetStartAfterPadding();
+ if (child != null)
+ {
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL
+ : LayoutState.ITEM_DIRECTION_HEAD;
+ mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
+ mLayoutState.Offset = mOrientationHelper.GetViewHolderStart(child);
+ scrollingOffset = -mOrientationHelper.GetViewHolderStart(child)
+ + mOrientationHelper.GetStartAfterPadding();
+ }
}
mLayoutState.Available = requiredSpace;
if (canUseExistingSpace)
if (null != value)
{
CreateBackgroundAttributes();
- if (null == toastAttributes.BackgroundImageAttributes?.ResourceUrl)
- {
- toastAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
- }
-
- toastAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
- SetToastBackground();
+ if (toastAttributes.BackgroundImageAttributes != null)
+ {
+ if (null == toastAttributes.BackgroundImageAttributes?.ResourceUrl)
+ {
+ toastAttributes.BackgroundImageAttributes.ResourceUrl = new StringSelector();
+ }
+
+ toastAttributes.BackgroundImageAttributes.ResourceUrl.All = value;
+ SetToastBackground();
+ }
}
}
}
if (null != value)
{
CreateBackgroundAttributes();
- if (null == toastAttributes.BackgroundImageAttributes.Border)
+ if (toastAttributes.BackgroundImageAttributes != null)
{
- toastAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
+ if (null == toastAttributes.BackgroundImageAttributes.Border)
+ {
+ toastAttributes.BackgroundImageAttributes.Border = new RectangleSelector();
+ }
+ toastAttributes.BackgroundImageAttributes.Border.All = value;
+ SetToastBackground();
}
- toastAttributes.BackgroundImageAttributes.Border.All = value;
- SetToastBackground();
}
}
}
private void SetToastText()
{
- for (int i = 0; i < textLabels?.Length; i++)
+ if (textLabels != null)
{
- if (null != textLabels[i])
+ for (int i = 0; i < textLabels?.Length; i++)
{
- this.Remove(textLabels[i]);
- textLabels[i].Dispose();
- textLabels[i] = null;
+ if (null != textLabels[i])
+ {
+ this.Remove(textLabels[i]);
+ textLabels[i].Dispose();
+ textLabels[i] = null;
+ }
}
}
textLabels = new TextLabel[textArray.Length];
- for (int i = 0; i < textArray.Length; i++)
+ if (textLabels != null)
{
- textLabels[i] = new TextLabel();
- textLabels[i].Text = textArray[i];
- textLabels[i].BackgroundColor = Color.Blue;
- this.Add(textLabels[i]);
+ for (int i = 0; i < textArray.Length; i++)
+ {
+ textLabels[i] = new TextLabel();
+ textLabels[i].Text = textArray[i];
+ textLabels[i].BackgroundColor = Color.Blue;
+ this.Add(textLabels[i]);
+ }
}
}