return;
}
DropDownItemView listItemView = holder.ItemView as DropDownItemView;
+ if (listItemView == null)
+ {
+ return;
+ }
listItemView.Name = "Item" + position;
if (listItemData.Size != null)
{
{
PointStateType state = e.Touch.GetState(0);
DropDownItemView touchedView = sender as DropDownItemView;
+ if (touchedView == null)
+ {
+ return true;
+ }
touchedView.OnTouch(e.Touch); // Handle control state change
}
set
{
- paginationStyle.IndicatorSpacing = value;
- UpdateVisual();
+ if (paginationStyle != null)
+ {
+ paginationStyle.IndicatorSpacing = value;
+ UpdateVisual();
+ }
}
}
private void UpdateVisual()
{
- if (null == paginationStyle.IndicatorSize) return;
- if (null == paginationStyle.IndicatorImageUrl) return;
+ if (null == paginationStyle?.IndicatorSize) return;
+ if (null == paginationStyle?.IndicatorImageUrl) return;
if (indicatorCount < 0) return;
for (int i = 0; i < indicatorList.Count; i++)
{
bool result = false;
View list = Container.GetParent() as View;
-
+ if (list == null)
+ {
+ return result;
+ }
Vector2 visibleArea = new Vector2(Math.Abs(scrollPosition),
Math.Abs(scrollPosition) + (LayoutOrientation == Orientation.Vertical ?
list.Size.Width : list.Size.Height)
{
RecycleItem item = Container.Children[i] as RecycleItem;
- if (previousItem != null)
+ if (previousItem != null && item != null)
{
item.Position = LayoutOrientation == Orientation.Vertical ?
new Position(
for (int i = 0; i < itemInGroup; i++)
{
RecycleItem target = Container.Children[0] as RecycleItem;
- target.DataIndex = target.DataIndex + Container.Children.Count;
- target.SiblingOrder = Container.Children.Count - 1;
+ if (target != null)
+ {
+ target.DataIndex = target.DataIndex + Container.Children.Count;
+ target.SiblingOrder = Container.Children.Count - 1;
- result.Add(target);
+ result.Add(target);
+ }
}
}
}
for (int i = 0; i < itemInGroup; i++)
{
RecycleItem prevFirstItem = Container.Children[itemInGroup] as RecycleItem;
-
RecycleItem target = Container.Children[Container.Children.Count - 1] as RecycleItem;
- target.Position = new Position(
- LayoutOrientation == Orientation.Vertical ? (prevFirstItem.Position.X - target.Size.Width) : prevFirstItem.Position.X,
- LayoutOrientation == Orientation.Vertical ? prevFirstItem.Position.Y : (prevFirstItem.Position.Y - target.Size.Height)
- );
- target.DataIndex = target.DataIndex - Container.Children.Count;
- target.SiblingOrder = 0;
-
- result.Add(target);
+ if (prevFirstItem != null && target != null)
+ {
+ target.Position = new Position(
+ LayoutOrientation == Orientation.Vertical ? (prevFirstItem.Position.X - target.Size.Width) : prevFirstItem.Position.X,
+ LayoutOrientation == Orientation.Vertical ? prevFirstItem.Position.Y : (prevFirstItem.Position.Y - target.Size.Height)
+ );
+ target.DataIndex = target.DataIndex - Container.Children.Count;
+ target.SiblingOrder = 0;
+
+ result.Add(target);
+ }
}
}
}
if(targetSibling > -1 && targetSibling < Container.Children.Count)
{
RecycleItem candidate = Container.Children[targetSibling] as RecycleItem;
- if(candidate.DataIndex >= 0 && candidate.DataIndex < DataCount)
+ if(candidate != null && candidate.DataIndex >= 0 && candidate.DataIndex < DataCount)
{
nextFocusedView = candidate;
}
{
bool result = false;
View list = Container.GetParent() as View;
+ if (list == null)
+ {
+ return result;
+ }
Vector2 visibleArea = new Vector2( Math.Abs(scrollPosition),
Math.Abs(scrollPosition) + (LayoutOrientation == Orientation.Horizontal?
{
RecycleItem item = Container.Children[i] as RecycleItem;
- if(previousItem != null)
+ if(previousItem != null && item != null)
{
item.Position = LayoutOrientation == Orientation.Horizontal?
new Position(
{
// Too many item is in front!!! move first item to back!!!!
RecycleItem target = Container.Children[0] as RecycleItem;
- target.DataIndex = target.DataIndex + Container.Children.Count;
- target.SiblingOrder = Container.Children.Count - 1;
+ if (target != null)
+ {
+ target.DataIndex = target.DataIndex + Container.Children.Count;
+ target.SiblingOrder = Container.Children.Count - 1;
- result.Add(target);
+ result.Add(target);
+ }
}
}
else
if(lastVisibleItemIndex < Container.Children.Count - 3)
{
RecycleItem prevFirstItem = Container.Children[0] as RecycleItem;
-
RecycleItem target = Container.Children[Container.Children.Count - 1] as RecycleItem;
- target.Position = new Position(
- LayoutOrientation == Orientation.Horizontal ? (prevFirstItem.Position.X - target.Size.Width) : prevFirstItem.Position.X,
- LayoutOrientation == Orientation.Horizontal ? prevFirstItem.Position.Y : (prevFirstItem.Position.Y - target.Size.Height)
- );
- target.DataIndex = target.DataIndex - Container.Children.Count;
- target.SiblingOrder = 0;
-
- result.Add(target);
+ if (prevFirstItem != null && target != null)
+ {
+ target.Position = new Position(
+ LayoutOrientation == Orientation.Horizontal ? (prevFirstItem.Position.X - target.Size.Width) : prevFirstItem.Position.X,
+ LayoutOrientation == Orientation.Horizontal ? prevFirstItem.Position.Y : (prevFirstItem.Position.Y - target.Size.Height)
+ );
+ target.DataIndex = target.DataIndex - Container.Children.Count;
+ target.SiblingOrder = 0;
+
+ result.Add(target);
+ }
}
}
if(targetSibling > -1 && targetSibling < Container.Children.Count)
{
RecycleItem candidate = Container.Children[targetSibling] as RecycleItem;
- if(candidate.DataIndex >= 0 && candidate.DataIndex < DataCount)
+ if(candidate != null && candidate.DataIndex >= 0 && candidate.DataIndex < DataCount)
{
nextFocusedView = candidate;
}
else
{
// If this is not first focus, request next focus to LayoutManager
- nextFocusedView = LayoutManager.RequestNextFocusableView(currentFocusedView, direction, loopEnabled);
+ if (LayoutManager != null)
+ {
+ nextFocusedView = LayoutManager.RequestNextFocusableView(currentFocusedView, direction, loopEnabled);
+ }
}
if (nextFocusedView)
}
focusedView = nextFocusedView;
- prevFocusedDataIndex = (nextFocusedView as RecycleItem).DataIndex;
-
+ if ((nextFocusedView as RecycleItem) != null)
+ {
+ prevFocusedDataIndex = (nextFocusedView as RecycleItem).DataIndex;
+ }
+
ScrollTo(targetPosition, true);
}
else
Direction scrollingDirection = Direction.Vertical;
ScrollableBase scrollableBase = this.Owner as ScrollableBase;
- if (scrollableBase)
+ if (scrollableBase != null)
{
scrollingDirection = scrollableBase.ScrollingDirection;
}
return;
}
- ThemeMap[key].AddStyleWithoutClone(component.FullName, (Activator.CreateInstance(style) as StyleBase).GetViewStyle());
+ if (Activator.CreateInstance(style) as StyleBase != null)
+ {
+ ThemeMap[key].AddStyleWithoutClone(component.FullName, (Activator.CreateInstance(style) as StyleBase).GetViewStyle());
+ }
}
/// <summary>
public override void Layout(float scrollPosition)
{
RecycleItem centerItem = Container.Children[FocusedIndex] as RecycleItem;
+ if (centerItem == null)
+ {
+ return;
+ }
+
float centerItemPosition = LayoutOrientation == Orientation.Horizontal ? centerItem.Position.X : centerItem.Position.Y;
Vector2 stepRange = new Vector2(-scrollPosition - StepSize + 1.0f, -scrollPosition + StepSize - 1.0f);
for (int i = FocusedIndex - 1; i > -1; i--)
{
RecycleItem target = Container.Children[i] as RecycleItem;
+ if (target == null)
+ {
+ continue;
+ }
float prevItemPosition = LayoutOrientation == Orientation.Horizontal ? prevItem.Position.X : prevItem.Position.Y;
float prevItemSize = (LayoutOrientation == Orientation.Horizontal ? prevItem.Size.Width : prevItem.Size.Height);
for (int i = FocusedIndex + 1; i < Container.Children.Count; i++)
{
RecycleItem target = Container.Children[i] as RecycleItem;
+ if (target == null)
+ {
+ continue;
+ }
float prevItemPosition = LayoutOrientation == Orientation.Horizontal ? prevItem.Position.X : prevItem.Position.Y;
float prevItemSize = (LayoutOrientation == Orientation.Horizontal ? prevItem.Size.Width : prevItem.Size.Height);
if (!isBack && FocusedIndex < 6)
{
RecycleItem target = Container.Children[Container.Children.Count - 1] as RecycleItem;
+ if (target != null)
+ {
+ int previousSiblingOrder = target.SiblingOrder;
+ target.SiblingOrder = 0;
+ target.DataIndex = target.DataIndex - Container.Children.Count;
+ target.Position = new Position(0, Math.Abs(scrollPosition) - 360);
+ target.Scale = new Vector3(0, 0, 0);
- int previousSiblingOrder = target.SiblingOrder;
- target.SiblingOrder = 0;
- target.DataIndex = target.DataIndex - Container.Children.Count;
- target.Position = new Position(0, Math.Abs(scrollPosition) - 360);
- target.Scale = new Vector3(0, 0, 0);
-
- result.Add(target);
+ result.Add(target);
- FocusedIndex++;
+ FocusedIndex++;
+ }
}
else if (isBack && FocusedIndex > 8)
{
RecycleItem target = Container.Children[0] as RecycleItem;
+ if (target != null)
+ {
+ int previousSiblingOrder = target.SiblingOrder;
+ target.SiblingOrder = Container.Children.Count - 1;
+ target.DataIndex = target.DataIndex + Container.Children.Count;
+ target.Position = new Position(0, Math.Abs(scrollPosition) + 360);
+ target.Scale = new Vector3(0, 0, 0);
- int previousSiblingOrder = target.SiblingOrder;
- target.SiblingOrder = Container.Children.Count - 1;
- target.DataIndex = target.DataIndex + Container.Children.Count;
- target.Position = new Position(0, Math.Abs(scrollPosition) + 360);
- target.Scale = new Vector3(0, 0, 0);
-
- result.Add(target);
+ result.Add(target);
- FocusedIndex--;
+ FocusedIndex--;
+ }
}
PrevScrollPosition = scrollPosition;
if (!(selectOutIndicator is ImageVisual visual)) return;
if (isCurrentIndicatorCentered)
{
- visual.URL = circularPaginationStyle.CenterIndicatorImageURL.Normal;
+ visual.URL = circularPaginationStyle?.CenterIndicatorImageURL?.Normal;
}
else
{
- visual.URL = circularPaginationStyle.IndicatorImageURL.Normal;
+ visual.URL = circularPaginationStyle?.IndicatorImageURL?.Normal;
}
visual.Opacity = 0.5f;
}
if (!(selectInIndicator is ImageVisual visual)) return;
if (isCurrentIndicatorCentered)
{
- visual.URL = circularPaginationStyle.CenterIndicatorImageURL.Selected;
+ visual.URL = circularPaginationStyle?.CenterIndicatorImageURL?.Selected;
}
else
{
- visual.URL = circularPaginationStyle.IndicatorImageURL.Selected;
+ visual.URL = circularPaginationStyle?.IndicatorImageURL?.Selected;
}
visual.Opacity = 1.0f;
}
// The parameter, index, is for the index of either oddArray or evenArray.
private void CreateIndicator(int index)
{
- if (circularPaginationStyle == null)
+ if (circularPaginationStyle == null || circularPaginationStyle.IndicatorSize == null)
{
return;
}
ImageVisual indicator = new ImageVisual
{
- URL = circularPaginationStyle.IndicatorImageURL.Normal,
+ URL = circularPaginationStyle.IndicatorImageURL?.Normal,
Size = new Size2D((int)circularPaginationStyle.IndicatorSize.Width, (int)circularPaginationStyle.IndicatorSize.Height),
Opacity = 0.5f,
};
private void UpdateContainer()
{
- if (circularPaginationStyle == null)
+ if (circularPaginationStyle == null || circularPaginationStyle.IndicatorSize == null || container == null)
{
return;
}
/// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
public void SetFocus(int dataIndex, bool animated)
{
+ if (LayoutManager == null)
+ {
+ return;
+ }
+
foreach (RecycleItem item in Children)
{
if (item.DataIndex == dataIndex)
/// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
protected override void OnPreReachedTargetPosition(float targetPosition)
{
+ if (LayoutManager == null)
+ {
+ return;
+ }
int targetDataIndex = (int)Math.Round(Math.Abs(targetPosition) / LayoutManager.StepSize);
for (int i = 0; i < Children.Count; i++)
{
RecycleItem item = Children[i] as RecycleItem;
+ if (item == null)
+ {
+ continue;
+ }
if (targetDataIndex == item.DataIndex)
{
{
// parent1 is in DefaultLayer.
Layer comparison2AsLayer = comparison2 as Layer;
- result = comparison2AsLayer.Depth > NUIApplication.GetDefaultWindow().GetDefaultLayer().Depth;
+ if(comparison2AsLayer != null)
+ {
+ result = comparison2AsLayer.Depth > NUIApplication.GetDefaultWindow().GetDefaultLayer().Depth;
+ }
}
else
{
// parent2 is in DefaultLayer.
Layer comparison1AsLayer = comparison1 as Layer;
- result = NUIApplication.GetDefaultWindow().GetDefaultLayer().Depth < comparison1AsLayer.Depth;
+ if (comparison1AsLayer != null)
+ {
+ result = NUIApplication.GetDefaultWindow().GetDefaultLayer().Depth < comparison1AsLayer.Depth;
+ }
}
}
else
// Compare Depth
Layer comparison1AsLayer = comparison1 as Layer;
Layer comparison2AsLayer = comparison2 as Layer;
-
- result = comparison1AsLayer.Depth < comparison2AsLayer.Depth;
+ if (comparison1AsLayer != null && comparison2AsLayer != null)
+ {
+ result = comparison1AsLayer.Depth < comparison2AsLayer.Depth;
+ }
}
else
{
// Compare SiblingOrder
View comparison1AsView = comparison1 as View;
View comparison2AsView = comparison2 as View;
-
- result = comparison1AsView.SiblingOrder < comparison2AsView.SiblingOrder;
+ if (comparison1AsView != null && comparison2AsView != null)
+ {
+ result = comparison1AsView.SiblingOrder < comparison2AsView.SiblingOrder;
+ }
}
}
else
string result = value.ToString();
FieldInfo info = typeof(T).GetField(result);
var attributes = info.GetCustomAttributes(typeof(DescriptionAttribute), true);
- if (null != attributes?.FirstOrDefault())
+ if (null != attributes?.FirstOrDefault() && (attributes.First() as DescriptionAttribute) != null)
{
result = (attributes.First() as DescriptionAttribute).Description;
}
if (layoutParent != null)
{
LayoutGroup layoutGroup = layoutParent as LayoutGroup;
- if(! layoutGroup.LayoutRequested)
+ if(layoutGroup != null && !layoutGroup.LayoutRequested)
{
layoutGroup.RequestLayout();
}
Size2D rootSize;
Position2D rootPosition = root.Position2D;
View parentView = parentNode as View;
- if (parentView)
+ if (parentView != null)
{
// Get parent View's Size. If using Legacy size negotiation then should have been set already.
rootSize = new Size2D(parentView.Size2D.Width, parentView.Size2D.Height);
for (uint layerIndex = 0; layerIndex < numberOfLayers; layerIndex++)
{
Layer layer = _window.GetLayer(layerIndex);
- if (layer)
+ if (layer != null)
{
for (uint i = 0; i < layer.ChildCount; i++)
{
// we add 1000, just incase View class starts using animatable properties
int startAnimatablePropertyIndex = (int)Tizen.NUI.PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + maxCountPerDerivation;
- while (viewType.GetTypeInfo().BaseType.Name != "CustomView") // custom view is our C# view base class. we don't go any deeper.
+ while (viewType.GetTypeInfo().BaseType?.Name != "CustomView") // custom view is our C# view base class. we don't go any deeper.
{
// for every base class increase property start index
startEventPropertyIndex += (int)Tizen.NUI.PropertyRanges.DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION; // DALi uses 10,000
public static System.IntPtr WidgetCreateFunction(ref string widgetName)
{
+ if ((Instance as WidgetApplication) == null)
+ {
+ return IntPtr.Zero;
+ }
+
Dictionary<System.Type, string> widgetInfo = (Instance as WidgetApplication).WidgetInfo;
foreach (System.Type widgetType in widgetInfo.Keys)
if (widgetInfo[widgetType] == widgetName)
{
Widget widget = Activator.CreateInstance(widgetType) as Widget;
- if (widget)
+ if (widget != null)
{
return widget.GetIntPtr();
}
#endif
if (property == null) //is the indexer defined on the base class?
- property = sourceType.BaseType.GetProperty(indexerName);
+ property = sourceType.BaseType?.GetProperty(indexerName);
if (property == null) //is the indexer defined on implemented interface ?
{
foreach (var implementedInterface in sourceType.ImplementedInterfaces)
void RegisterImplicitStyles()
{
Type type = TargetType;
+ if (type == null)
+ {
+ return;
+ }
while (true) {
BindableProperty implicitStyleProperty = BindableProperty.Create(nameof(ImplicitStyle), typeof(Style), typeof(View), default(Style),
propertyChanged: (bindable, oldvalue, newvalue) => OnImplicitStyleChanged());
{
// We need to measure child layout
View child = Registry.GetManagedBaseHandleFromNativePtr(childPtr) as View;
+ if (child == null)
+ {
+ measureSize.width = 0;
+ measureSize.height = 0;
+ return;
+ }
LayoutItem childLayout = child.Layout;
if (Parent != null)
{
LayoutGroup layoutGroup = Parent as LayoutGroup;
- if(! layoutGroup.LayoutRequested)
+ if(layoutGroup != null && !layoutGroup.LayoutRequested)
{
layoutGroup.RequestLayout();
}
}
else
{
- Owner.SetSize(right - left, bottom - top, Owner.Position.Z);
- if(SetPositionByLayout)
+ if (Owner.Position != null)
{
- Owner.SetPosition(left, top, Owner.Position.Z);
+ Owner.SetSize(right - left, bottom - top, Owner.Position.Z);
+ if (SetPositionByLayout)
+ {
+ Owner.SetPosition(left, top, Owner.Position.Z);
+ }
}
}
public override IWindowInfo CreateWindowInfo()
{
ComponentApplication instance = ComponentApplication.Instance as ComponentApplication;
- if (instance)
+ if (instance != null)
{
if (!defaultWindowSet)
{