[NUI] Fix Svace issue (#949)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Mon, 29 Jul 2019 07:22:18 +0000 (16:22 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 29 Jul 2019 07:22:18 +0000 (16:22 +0900)
* [NUI] Fix Svace issue

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
* delete unused file

src/Tizen.NUI.CommonUI/Controls/DropDown.cs
src/Tizen.NUI.CommonUI/Controls/FlexibleView/LinearLayoutManager.cs
src/Tizen.NUI.CommonUI/Controls/Tab.cs
src/Tizen.NUI.CommonUI/Controls/Toast.cs
src/Tizen.NUI/src/internal/Xaml/PruneIgnoredNodesVisitor.cs

index 561289e..bccd1b6 100755 (executable)
@@ -2021,14 +2021,20 @@ namespace Tizen.NUI.CommonUI
                     {
                         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;
index b9700ed..249afa6 100755 (executable)
@@ -610,6 +610,10 @@ namespace Tizen.NUI.CommonUI
             }
 
             FlexibleView.ViewHolder anchorChild = FindFirstCompleteVisibleItemView();
+            if (anchorChild != null)
+            {
+                return false;
+            }
             anchorInfo.Position = anchorChild.LayoutPosition;
             anchorInfo.Coordinate = mOrientationHelper.GetViewHolderStart(anchorChild);
 
@@ -721,26 +725,32 @@ namespace Tizen.NUI.CommonUI
                 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);
+                    }
                 }
             }
         }
@@ -866,32 +876,38 @@ namespace Tizen.NUI.CommonUI
         {
             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)
index ecc97f6..6e6e49f 100755 (executable)
@@ -569,7 +569,7 @@ namespace Tizen.NUI.CommonUI
                     int w = Size2D.Width;
                     for (int i = 0; i < totalNum; i++)
                     {
-                        preW = itemList[i].TextItem.NaturalSize2D.Width;
+                        preW = (itemList[i].TextItem.NaturalSize2D != null ? itemList[i].TextItem.NaturalSize2D.Width : 0);
                         itemList[i].Position2D.X = w - preW - preX;
                         itemList[i].Size2D.Width = preW;
                         preX = w - itemList[i].Position2D.X + itemGap;
index 8c3685b..9680ba6 100755 (executable)
@@ -212,13 +212,16 @@ namespace Tizen.NUI.CommonUI
                 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();
+                                       }
                 }
             }
         }
@@ -240,12 +243,15 @@ namespace Tizen.NUI.CommonUI
                 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();
                 }
             }
         }
@@ -532,23 +538,29 @@ namespace Tizen.NUI.CommonUI
 
         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]);
+                }
             }
         }
 
index 8c025e5..90fe609 100755 (executable)
@@ -22,7 +22,7 @@ namespace Tizen.NUI.Xaml
                     continue;
                 if (!propertyName.Equals(XamlParser.McUri, "Ignorable"))
                     continue;
-                (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string>())).AddRange(propertyValue.Split(','));
+                (parentNode.IgnorablePrefixes ?? (parentNode.IgnorablePrefixes = new List<string>()))?.AddRange(propertyValue.Split(','));
             }
 
             foreach (var propertyKvp in node.Properties.ToList())