var newTop = NavigationPages[NavigationPages.Count - 2];
//Invoke Page events
- newTop.InvokeAppearing();
- curTop.InvokeDisappearing();
+ newTop?.InvokeAppearing();
+ curTop?.InvokeDisappearing();
//TODO: The following transition codes will be replaced with view transition.
if (curAnimation)
}
RecyclerViewItem item = base.RealizeItem(index);
- if (isGrouped) item.ParentGroup = InternalItemSource.GetGroupParent(index);
-
- switch (SelectionMode)
+ if (item != null)
{
- case ItemSelectionMode.SingleSelection:
- if (item.BindingContext == SelectedItem) item.IsSelected = true;
- break;
+ if (isGrouped)
+ {
+ item.ParentGroup = InternalItemSource.GetGroupParent(index);
+ }
- case ItemSelectionMode.MultipleSelections:
- if (SelectedItems?.Contains(item.BindingContext) ?? false) item.IsSelected = true;
- break;
- case ItemSelectionMode.None:
- item.IsSelectable = false;
- break;
+ switch (SelectionMode)
+ {
+ case ItemSelectionMode.SingleSelection:
+ if (item.BindingContext == SelectedItem) item.IsSelected = true;
+ break;
+
+ case ItemSelectionMode.MultipleSelections:
+ if (SelectedItems?.Contains(item.BindingContext) ?? false) item.IsSelected = true;
+ break;
+ case ItemSelectionMode.None:
+ item.IsSelectable = false;
+ break;
+ }
}
-
return item;
}
{
base.OnRelayout(size, container);
- if (size.Width == containerSize?.Width && size.Height == containerSize.Height)
+ if (size == null || container == null || containerSize == null)
+ {
+ return;
+ }
+
+ if (size.Width == containerSize.Width && size.Height == containerSize.Height)
{
return;
}
// we add 1000, just incase View class starts using animatable properties
int startAnimatablePropertyIndex = (int)Tizen.NUI.PropertyRanges.ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + maxCountPerDerivation;
- if (viewType != null)
+ 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
+ startAnimatablePropertyIndex += maxCountPerDerivation;
+ if (viewType != null)
{
- // for every base class increase property start index
- startEventPropertyIndex += (int)Tizen.NUI.PropertyRanges.DEFAULT_PROPERTY_MAX_COUNT_PER_DERIVATION; // DALi uses 10,000
- startAnimatablePropertyIndex += maxCountPerDerivation;
NUILog.Debug("getStartPropertyIndex = " + viewType.Name + "current index " + startEventPropertyIndex);
viewType = viewType.GetTypeInfo().BaseType;
}
// Parent not a View so assume it's a Layer which is the size of the window.
void MeasureAndLayout(View root, float parentWidth, float parentHeight)
{
- float positionX = root.PositionX;
- float positionY = root.PositionY;
-
- // Determine measure specification for root.
- // The root layout policy could be an exact size, be match parent or wrap children.
- // If wrap children then at most it can be the root parent size.
- // If match parent then should be root parent size.
- // If exact then should be that size limited by the root parent size.
- MeasureSpecification parentWidthSpecification = CreateMeasureSpecification(parentWidth, root.WidthSpecification);
- MeasureSpecification parentHeightSpecification = CreateMeasureSpecification(parentHeight, root.HeightSpecification);
-
- // Start at root with it's parent's widthSpecification and heightSpecification
- MeasureHierarchy(root, parentWidthSpecification, parentHeightSpecification);
-
- // Start at root which was just measured.
- PerformLayout(root, new LayoutLength(positionX),
- new LayoutLength(positionY),
- new LayoutLength(positionX) + root.Layout.MeasuredWidth.Size,
- new LayoutLength(positionY) + root.Layout.MeasuredHeight.Size);
+ if (root.Layout != null)
+ {
+ float positionX = root.PositionX;
+ float positionY = root.PositionY;
+
+ // Determine measure specification for root.
+ // The root layout policy could be an exact size, be match parent or wrap children.
+ // If wrap children then at most it can be the root parent size.
+ // If match parent then should be root parent size.
+ // If exact then should be that size limited by the root parent size.
+ MeasureSpecification parentWidthSpecification = CreateMeasureSpecification(parentWidth, root.WidthSpecification);
+ MeasureSpecification parentHeightSpecification = CreateMeasureSpecification(parentHeight, root.HeightSpecification);
+
+ // Start at root with it's parent's widthSpecification and heightSpecification
+ MeasureHierarchy(root, parentWidthSpecification, parentHeightSpecification);
+
+ // Start at root which was just measured.
+ PerformLayout(root, new LayoutLength(positionX),
+ new LayoutLength(positionY),
+ new LayoutLength(positionX) + root.Layout.MeasuredWidth.Size,
+ new LayoutLength(positionY) + root.Layout.MeasuredHeight.Size);
+
+ }
if (SetupCoreAnimation() && OverrideCoreAnimation == false)
{
}
Assembly[] assemblies = Device.GetAssemblies();
- if (Tizen.NUI.Binding.Internals.Registrar.ExtraAssemblies != null)
+ if (assemblies != null && Tizen.NUI.Binding.Internals.Registrar.ExtraAssemblies != null)
{
assemblies = assemblies.Union(Tizen.NUI.Binding.Internals.Registrar.ExtraAssemblies).ToArray();
}
/// The copy constructor.
/// </summary>
/// <param name="other">The copy target.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when other is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Color(Color other) : this((float)other?.R, (float)other.G, (float)other.B, (float)other.A)
+ public Color(Color other) : this(other == null ? throw new ArgumentNullException(nameof(other)) : other.R, other.G, other.B, other.A)
{
}
/// <since_tizen> 3 </since_tizen>
public static implicit operator Vector4(Color color)
{
- return new Vector4((float)color?.R, (float)color.G, (float)color.B, (float)color.A);
+ if (color == null)
+ {
+ return null;
+ }
+ return new Vector4(color.R, color.G, color.B, color.A);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Color(Vector4 vec)
{
- return new Color((float)vec?.R, (float)vec.G, (float)vec.B, (float)vec.A);
+ if (vec == null)
+ {
+ return null;
+ }
+ return new Color(vec.R, vec.G, vec.B, vec.A);
}
/// <summary>
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// Converts a position instance to a Vector3 instance.
/// </summary>
/// <since_tizen> 3 </since_tizen>
- public static implicit operator Vector3(Position Position)
+ public static implicit operator Vector3(Position position)
{
- return new Vector3((float)Position?.X, (float)Position.Y, (float)Position.Z);
+ if (position == null)
+ {
+ return null;
+ }
+ return new Vector3(position.X, position.Y, position.Z);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Position(Vector3 vec)
{
- return new Position((float)vec?.X, (float)vec.Y, (float)vec.Z);
+ if (vec == null)
+ {
+ return null;
+ }
+ return new Position(vec.X, vec.Y, vec.Z);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static implicit operator Position(Position2D position2d)
{
- return new Position((float)position2d?.X, (float)position2d.Y, 0);
+ if (position2d == null)
+ {
+ return null;
+ }
+ return new Position(position2d.X, position2d.Y, 0);
}
/// <summary>
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// <since_tizen> 3 </since_tizen>
public static implicit operator Vector2(Position2D position2d)
{
- return new Vector2((float)position2d?.X, (float)position2d.Y);
+ if (position2d == null)
+ {
+ return null;
+ }
+ return new Vector2(position2d.X, position2d.Y);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Position2D(Vector2 vec)
{
- return new Position2D((int)vec?.X, (int)vec.Y);
+ if (vec == null)
+ {
+ return null;
+ }
+ return new Position2D((int)vec.X, (int)vec.Y);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static implicit operator Position2D(Position position)
{
- return new Position2D((int)position?.X, (int)position.Y);
+ if (position == null)
+ {
+ return null;
+ }
+ return new Position2D((int)position.X, (int)position.Y);
}
/// <inheritdoc/>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Vector2(RelativeVector2 relativeVector2)
{
- return new Vector2((float)relativeVector2?.X, (float)relativeVector2.Y);
+ if (relativeVector2 == null)
+ {
+ return null;
+ }
+ return new Vector2(relativeVector2.X, relativeVector2.Y);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator RelativeVector2(Vector2 vec)
{
- return new RelativeVector2((float)vec?.X, (float)vec.Y);
+ if (vec == null)
+ {
+ return null;
+ }
+ return new RelativeVector2(vec.X, vec.Y);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Vector4(RelativeVector4 relativeVector4)
{
- return new Vector4((float)relativeVector4?.X, (float)relativeVector4.Y, (float)relativeVector4.Z, (float)relativeVector4.W);
+ if (relativeVector4 == null)
+ {
+ return null;
+ }
+ return new Vector4(relativeVector4.X, relativeVector4.Y, relativeVector4.Z, relativeVector4.W);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator RelativeVector4(Vector4 vec)
{
- return new RelativeVector4((float)vec?.X, (float)vec.Y, (float)vec.Z, (float)vec.W);
+ if (vec == null)
+ {
+ return null;
+ }
+ return new RelativeVector4(vec.X, vec.Y, vec.Z, vec.W);
}
/// <summary>
/// <since_tizen> 5 </since_tizen>
public static implicit operator Vector3(Size size)
{
- return new Vector3((float)size?.Width, (float)size.Height, (float)size.Depth);
+ if (size == null)
+ {
+ return null;
+ }
+ return new Vector3(size.Width, size.Height, size.Depth);
}
/// <summary>
/// <since_tizen> 5 </since_tizen>
public static implicit operator Size(Vector3 vec)
{
- return new Size((int)vec?.Width, (int)vec.Height, (int)vec.Depth);
+ if (vec == null)
+ {
+ return null;
+ }
+ return new Size(vec.Width, vec.Height, vec.Depth);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static implicit operator Size(Size2D size2d)
{
- return new Size((int)size2d?.Width, (int)size2d.Height, 0);
+ if (size2d == null)
+ {
+ return null;
+ }
+ return new Size(size2d.Width, size2d.Height);
}
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// <since_tizen> 3 </since_tizen>
public static implicit operator Vector2(Size2D size)
{
- return new Vector2((float)size?.Width, (float)size.Height);
+ if (size == null)
+ {
+ return null;
+ }
+ return new Vector2(size.Width, size.Height);
}
/// <summary>
/// <since_tizen> 3 </since_tizen>
public static implicit operator Size2D(Vector2 vector2)
{
- return new Size2D((int)vector2?.X, (int)vector2.Y);
+ if (vector2 == null)
+ {
+ return null;
+ }
+ return new Size2D((int)vector2.X, (int)vector2.Y);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public static implicit operator Size2D(Size size)
{
- return new Size2D((int)size?.Width, (int)size.Height);
+ if (size == null)
+ {
+ return null;
+ }
+ return new Size2D((int)size.Width, (int)size.Height);
}
/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// The copy constructor.
/// </summary>
/// <param name="other">The copy target.</param>
+ /// <exception cref="ArgumentNullException"> Thrown when other is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Vector2(Vector2 other) : this((float)other?.X, (float)other.Y)
+ public Vector2(Vector2 other) : this(other == null ? throw new ArgumentNullException(nameof(other)) : other.X, other.Y)
{
}
-/* Copyright (c) 2020 Samsung Electronics Co., Ltd.
+/* Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// We need to measure child layout
View child = Registry.GetManagedBaseHandleFromNativePtr(childPtr) as View;
// independent child will be measured in LayoutGroup.OnMeasureIndependentChildren().
- if (child?.ExcludeLayouting ?? true)
+ if ((child == null) || (child?.ExcludeLayouting ?? true))
{
measureSize.width = 0;
measureSize.height = 0;
/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// <summary>
/// Constructor
/// </summary>
+ /// <exception cref="ArgumentNullException"> Thrown when other is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
- public ImageShadow(ImageShadow other) : this(other?.Url, other.Border, other.Offset, other.Extents)
+ public ImageShadow(ImageShadow other) : this(other == null ? throw new ArgumentNullException(nameof(other)) : other.Url, other.Border, other.Offset, other.Extents)
{
}
/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/// <summary>
/// Copy constructor.
/// </summary>
+ /// <exception cref="ArgumentNullException"> Thrown when other is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Shadow(Shadow other) : this((float)other?.BlurRadius, other.Offset, other.Color, other.Extents)
+ public Shadow(Shadow other) : this(other == null ? throw new ArgumentNullException(nameof(other)) : other.BlurRadius, other.Offset, other.Color, other.Extents)
{
}
*
*/
+using System;
using System.ComponentModel;
using System.Diagnostics;
/// <summary>
/// Copy Constructor
/// </summary>
+ /// <exception cref="ArgumentNullException"> Thrown when other is null. </exception>
[EditorBrowsable(EditorBrowsableState.Never)]
- protected ShadowBase(ShadowBase other) : this(other?.Offset, other.Extents)
+ protected ShadowBase(ShadowBase other) : this(other == null ? throw new ArgumentNullException(nameof(other)) : other.Offset, other.Extents)
{
}