[NUI] Fix NUI.Components svace issue (#1163)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Wed, 4 Dec 2019 07:41:39 +0000 (16:41 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 4 Dec 2019 07:41:39 +0000 (16:41 +0900)
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
12 files changed:
src/Tizen.NUI.Components/Controls/Button.cs
src/Tizen.NUI.Components/Controls/DropDown.cs
src/Tizen.NUI.Components/Controls/ImageControl.cs
src/Tizen.NUI.Components/Controls/InputField.cs
src/Tizen.NUI.Components/Controls/Popup.cs
src/Tizen.NUI.Components/Controls/Progress.cs
src/Tizen.NUI.Components/Controls/Scrollbar.cs
src/Tizen.NUI.Components/Controls/SelectButton.cs
src/Tizen.NUI.Components/Controls/Slider.cs
src/Tizen.NUI.Components/Controls/Switch.cs
src/Tizen.NUI.Components/Controls/Tab.cs
src/Tizen.NUI.Components/Controls/Toast.cs

index 719dea2..7748276 100755 (executable)
@@ -193,7 +193,7 @@ namespace Tizen.NUI.Components
         {
             get
             {
-                return Style.Text.Text.GetValue(ControlState);
+                return Style.Text.Text?.GetValue(ControlState);
             }
             set
             {
@@ -247,7 +247,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.Text.TranslatableText = new Selector<string>();
                     }
-                    Style.Text.TranslatableText.All = value;
+                    if (Style.Text.TranslatableText != null)
+                    {
+                        Style.Text.TranslatableText.All = value;
+                    }
                 }
             }
         }
@@ -303,7 +306,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Text.TextColor = new Selector<Color>();
                 }
-                Style.Text.TextColor.All = value;
+                if (Style.Text.TextColor != null)
+                {
+                    Style.Text.TextColor.All = value;
+                }
             }
         }
         /// <summary>
@@ -339,7 +345,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.Icon.ResourceUrl = new Selector<string>();
                     }
-                    Style.Icon.ResourceUrl.All = value;
+                    if (Style.Icon.ResourceUrl != null)
+                    {
+                        Style.Icon.ResourceUrl.All = value;
+                    }
                 }
             }
         }
index a6e888b..bd9a857 100755 (executable)
@@ -553,7 +553,7 @@ namespace Tizen.NUI.Components
                 if (childToRemove)
                 {
                     childToRemove.TouchEvent -= ListItemTouchEvent;
-                    dropDownMenuFullList.Remove(childToRemove);
+                    dropDownMenuFullList?.Remove(childToRemove);
                     dropDownMenuFullList?.Layout?.RequestLayout();
                 }
             }
@@ -962,7 +962,6 @@ namespace Tizen.NUI.Components
                     data.IsSelected = false;
                 }
                 DropDownItemView listItemView = dropDownMenuFullList.GetChildAt((uint)selectedItemIndex) as DropDownItemView;
-                data.IsSelected = false;
                 SetListItemToSelected(listItemView);
             }
 
@@ -1198,7 +1197,7 @@ namespace Tizen.NUI.Components
                         itemDataStyle.BackgroundColor = new Selector<Color>();
                     }
 
-                    itemDataStyle.BackgroundColor.Clone(value);
+                    itemDataStyle.BackgroundColor?.Clone(value);
                 }
             }
 
index 16093ba..1f5e091 100755 (executable)
@@ -91,7 +91,7 @@ namespace Tizen.NUI.Components
                 }
             }
 
-            imageView.ApplyStyle(imageControlStyle.Image);
+            imageView.ApplyStyle(imageControlStyle?.Image);
         }
 
         /// <summary>
index 3b67ce2..dd007ac 100755 (executable)
@@ -140,7 +140,10 @@ namespace Tizen.NUI.Components
                 {
                     inputFieldAttrs.InputBoxAttributes.TextColor = new Selector<Color>();
                 }
-                inputFieldAttrs.InputBoxAttributes.TextColor.All = value;
+                if (null != inputFieldAttrs.InputBoxAttributes.TextColor)
+                {
+                    inputFieldAttrs.InputBoxAttributes.TextColor.All = value;
+                }
                 textField.TextColor = value;
             }
         }
@@ -164,7 +167,10 @@ namespace Tizen.NUI.Components
                 {
                     inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor = new Selector<Color>();
                 }
-                inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor.All = value;
+                if (null != inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor)
+                {
+                    inputFieldAttrs.InputBoxAttributes.PlaceholderTextColor.All = value;
+                }
                 textField.PlaceholderTextColor = value;
             }
         }
@@ -188,7 +194,10 @@ namespace Tizen.NUI.Components
                 {
                     inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor = new Selector<Color>();
                 }
-                inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor.All = value;
+                if (null != inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor)
+                {
+                    inputFieldAttrs.InputBoxAttributes.PrimaryCursorColor.All = value;
+                }
                 textField.PrimaryCursorColor = value;
             }
         }
@@ -314,7 +323,10 @@ namespace Tizen.NUI.Components
                     {
                         inputFieldAttrs.BackgroundImageAttributes.ResourceUrl = new Selector<string>();
                     }
-                    inputFieldAttrs.BackgroundImageAttributes.ResourceUrl.All = value;
+                    if (inputFieldAttrs.BackgroundImageAttributes.ResourceUrl != null)
+                    {
+                        inputFieldAttrs.BackgroundImageAttributes.ResourceUrl.All = value;
+                    }
                     RelayoutRequest();
                 }
             }
@@ -341,7 +353,10 @@ namespace Tizen.NUI.Components
                     {
                         inputFieldAttrs.BackgroundImageAttributes.Border = new Selector<Rectangle>();
                     }
-                    inputFieldAttrs.BackgroundImageAttributes.Border.All = value;
+                    if (inputFieldAttrs.BackgroundImageAttributes.Border != null)
+                    {
+                        inputFieldAttrs.BackgroundImageAttributes.Border.All = value;
+                    }
                     RelayoutRequest();
                 }
             }
index bc77658..23bb672 100755 (executable)
@@ -95,7 +95,10 @@ namespace Tizen.NUI.Components
                 {
                     instance.Style.Buttons.Text.PointSize = new Selector<float?>();
                 }
-                instance.Style.Buttons.Text.PointSize.All = (float)newValue;
+                if (instance.Style.Buttons.Text.PointSize != null)
+                {
+                    instance.Style.Buttons.Text.PointSize.All = (float)newValue;
+                }
                 instance.UpdateButton();
             }
         },
@@ -133,7 +136,10 @@ namespace Tizen.NUI.Components
                 {
                     instance.Style.Buttons.Text.TextColor = new Selector<Color>();
                 }
-                instance.Style.Buttons.Text.TextColor.All = (Color)newValue;
+                if (instance.Style.Buttons.Text.TextColor != null)
+                {
+                    instance.Style.Buttons.Text.TextColor.All = (Color)newValue;
+                }
                 //instance.UpdateButton();
             }
         },
@@ -188,7 +194,10 @@ namespace Tizen.NUI.Components
                 {
                     instance.Style.Buttons.Background.ResourceUrl = new Selector<string>();
                 }
-                instance.Style.Buttons.Background.ResourceUrl.All = (string)newValue;
+                if (instance.Style.Buttons.Background.ResourceUrl != null)
+                {
+                    instance.Style.Buttons.Background.ResourceUrl.All = (string)newValue;
+                }
                 instance.UpdateButton();
             }
         },
@@ -209,7 +218,10 @@ namespace Tizen.NUI.Components
                 {
                     instance.Style.Buttons.Background.Border = new Selector<Rectangle>();
                 }
-                instance.Style.Buttons.Background.Border.All = (Rectangle)newValue;
+                if (instance.Style.Buttons.Background.Border != null)
+                {
+                    instance.Style.Buttons.Background.Border.All = (Rectangle)newValue;
+                }
                 instance.UpdateButton();
             }
         },
@@ -287,7 +299,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.Title.Text = new StringSelector();
                     }
-                    Style.Title.Text.All = value;
+                    if (Style.Title.Text != null)
+                    {
+                        Style.Title.Text.All = value;
+                    }
 
                     //RelayoutRequest();
                 }
@@ -311,7 +326,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Title.PointSize = new FloatSelector();
                 }
-                Style.Title.PointSize.All = value;
+                if (Style.Title.PointSize != null)
+                {
+                    Style.Title.PointSize.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -333,7 +351,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Title.TextColor = new ColorSelector();
                 }
-                Style.Title.TextColor.All = value;
+                if (Style.Title.TextColor != null)
+                {
+                    Style.Title.TextColor.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -767,7 +788,7 @@ namespace Tizen.NUI.Components
                 btn.ClickEvent += ButtonClickEvent;
 
                 this.Add(btn);
-                buttonList.Add(btn);
+                buttonList?.Add(btn);
             }
 
             int pos = 0;
index 6045074..64d66a2 100755 (executable)
@@ -212,7 +212,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Track.ResourceUrl = new StringSelector();
                 }
-                Style.Track.ResourceUrl.All = value;
+                if (Style.Track.ResourceUrl != null)
+                {
+                    Style.Track.ResourceUrl.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -234,7 +237,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Progress.ResourceUrl = new StringSelector();
                 }
-                Style.Progress.ResourceUrl.All = value;
+                if (Style.Progress.ResourceUrl != null)
+                {
+                    Style.Progress.ResourceUrl.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -256,7 +262,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Buffer.ResourceUrl = new StringSelector();
                 }
+                if (Style.Buffer.ResourceUrl != null)
+                {
                 Style.Buffer.ResourceUrl.All = value;
+                }
                 RelayoutRequest();
             }
         }
@@ -278,7 +287,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Track.BackgroundColor = new ColorSelector();
                 }
+                if (Style.Track.BackgroundColor != null)
+                {
                 Style.Track.BackgroundColor.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -300,7 +312,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Progress.BackgroundColor = new ColorSelector();
                 }
-                Style.Progress.BackgroundColor.All = value;
+                if (null != Style.Progress.BackgroundColor)
+                {
+                    Style.Progress.BackgroundColor.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -322,7 +337,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Buffer.BackgroundColor = new ColorSelector();
                 }
-                Style.Buffer.BackgroundColor.All = value;
+                if (null != Style.Buffer.BackgroundColor)
+                {
+                    Style.Buffer.BackgroundColor.All = value;
+                }
                 //RelayoutRequest();
             }
         }
index e8b6fae..21ab5a4 100755 (executable)
@@ -237,7 +237,7 @@ namespace Tizen.NUI.Components
                 {
                     Style.Thumb.Size = new Size();
                 }
-                if (thumbImage != null)
+                if (Style.Thumb.Size != null && thumbImage != null)
                 {
                     Style.Thumb.Size.Width = value.Width;
                     Style.Thumb.Size.Height = value.Height;
@@ -264,7 +264,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.Track.ResourceUrl = new StringSelector();
                     }
-                    Style.Track.ResourceUrl.All = value;
+                    if (Style.Track.ResourceUrl != null)
+                    {
+                        Style.Track.ResourceUrl.All = value;
+                    }
                 }
                 RelayoutRequest();
             }
index c444166..27aad7e 100755 (executable)
@@ -117,7 +117,7 @@ namespace Tizen.NUI.Components
             SelectButtonStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as SelectButtonStyle;
             if (tempAttributes != null)
             {
-                Style.CopyFrom(tempAttributes);
+                Style?.CopyFrom(tempAttributes);
                 UpdateUIContent();
             }
         }
@@ -266,18 +266,20 @@ namespace Tizen.NUI.Components
 
                 selectableImage.RaiseToTop();
             }
+            if (style != null)
+            {
+                Style.SelectableImage.PositionUsesPivotPoint = true;
+                Style.SelectableImage.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft;
+                Style.SelectableImage.PivotPoint = Tizen.NUI.PivotPoint.TopLeft;
 
-            Style.SelectableImage.PositionUsesPivotPoint = true;
-            Style.SelectableImage.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft;
-            Style.SelectableImage.PivotPoint = Tizen.NUI.PivotPoint.TopLeft;
-
-            Style.IsSelectable = true;
+                Style.IsSelectable = true;
+            }
             LayoutDirectionChanged += SelectButtonLayoutDirectionChanged;
         }
 
         private void UpdateTextAttributes()
         {
-            if (Style.Text != null)
+            if (Style != null && Style.Text != null && selectableImage != null)
             {
                 Style.Text.PositionUsesPivotPoint = true;
                 Style.Text.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft;
@@ -318,26 +320,29 @@ namespace Tizen.NUI.Components
             int textPaddingLeft = Style.Text.Padding.Start;
             int textPaddingRight = Style.Text.Padding.End;
             int pos = 0;
-            if (LayoutDirection == ViewLayoutDirectionType.RTL)
-            {
-                Style.Text.HorizontalAlignment = HorizontalAlignment.End;
-                Style.Text.Position.X = textPaddingRight;
-                               pos = (int)(Style.Text.Size.Width) + textPaddingLeft + textPaddingRight;
-                if (Style.Icon.Padding != null)
-                               {
-                    pos += Style.Icon.Padding.End;
-                               }
-
-            }
-            else if (LayoutDirection == ViewLayoutDirectionType.LTR)
+            if (Style.Text != null && Style.Text.Position != null)
             {
-                Style.Text.HorizontalAlignment = HorizontalAlignment.Begin;
-                Style.Text.Position.X = iconWidth + textPaddingLeft;
-                if (Style.Icon.Padding != null)
-                               {
-                    Style.Text.Position.X += (Style.Icon.Padding.Start + Style.Icon.Padding.End); 
-                    pos = Style.Icon.Padding.Start;
-                               }
+                if (LayoutDirection == ViewLayoutDirectionType.RTL)
+                {
+                    Style.Text.HorizontalAlignment = HorizontalAlignment.End;
+                    Style.Text.Position.X = textPaddingRight;
+                               pos = (int)(Style.Text.Size.Width) + textPaddingLeft + textPaddingRight;
+                    if (Style.Icon.Padding != null)
+                               {
+                        pos += Style.Icon.Padding.End;
+                               }
+    
+                }
+                else if (LayoutDirection == ViewLayoutDirectionType.LTR)
+                {
+                    Style.Text.HorizontalAlignment = HorizontalAlignment.Begin;
+                    Style.Text.Position.X = iconWidth + textPaddingLeft;
+                    if (Style.Icon.Padding != null)
+                               {
+                        Style.Text.Position.X += (Style.Icon.Padding.Start + Style.Icon.Padding.End); 
+                        pos = Style.Icon.Padding.Start;
+                               }
+                }
             }
 
             selectableImage.Position2D.X = pos;
index ed9aeea..3f04ffd 100755 (executable)
@@ -415,7 +415,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Thumb.ResourceUrl = new StringSelector(); 
                 }
-                Style.Thumb.ResourceUrl.All = value;
+                if (Style.Thumb.ResourceUrl != null)
+                {
+                    Style.Thumb.ResourceUrl.All = value;
+                }
             }
         }
 
@@ -454,7 +457,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Track.BackgroundColor = new ColorSelector();
                 }
-                Style.Track.BackgroundColor.All = value;
+                if (Style.Track.BackgroundColor != null)
+                {
+                    Style.Track.BackgroundColor.All = value;
+                }
             }
         }
 
@@ -474,7 +480,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Progress.BackgroundColor = new ColorSelector();
                 }
-                Style.Progress.BackgroundColor.All = value;
+                if (Style.Progress.BackgroundColor != null)
+                {
+                    Style.Progress.BackgroundColor.All = value;
+                }
             }
         }
 
@@ -543,7 +552,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.LowIndicatorImage.ResourceUrl = new StringSelector();
                 }
-                Style.LowIndicatorImage.ResourceUrl.All = value;
+                if (Style.LowIndicatorImage.ResourceUrl != null)
+                {
+                    Style.LowIndicatorImage.ResourceUrl.All = value;
+                }
             }
         }
 
@@ -563,7 +575,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.HighIndicatorImage.ResourceUrl = new StringSelector();
                 }
-                Style.HighIndicatorImage.ResourceUrl.All = value;
+                if (Style.HighIndicatorImage.ResourceUrl != null)
+                {
+                    Style.HighIndicatorImage.ResourceUrl.All = value;
+                }
             }
         }
 
@@ -583,7 +598,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.LowIndicator.Text = new StringSelector();
                 }
-                Style.LowIndicator.Text.All = value;
+                if (Style.LowIndicator.Text != null)
+                {
+                    Style.LowIndicator.Text.All = value;
+                }
             }
         }
 
@@ -603,7 +621,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.HighIndicator.Text = new StringSelector();
                 }
-                Style.HighIndicator.Text.All = value;
+                if (Style.HighIndicator.Text != null)
+                {
+                    Style.HighIndicator.Text.All = value;
+                }
             }
         }
 
index f1747fe..9c58b78 100755 (executable)
@@ -95,7 +95,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.Track.ResourceUrl = new StringSelector();
                     }
-                    Style.Track.ResourceUrl.All = value;
+                    if (Style.Track.ResourceUrl != null)
+                    {
+                        Style.Track.ResourceUrl.All = value;
+                    }
                 }
             }
         }
@@ -137,7 +140,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.Thumb.ResourceUrl = new StringSelector();
                     }
-                    Style.Thumb.ResourceUrl.All = value;
+                    if (Style.Thumb.ResourceUrl != null)
+                    {
+                        Style.Thumb.ResourceUrl.All = value;
+                    }
                 }
             }
         }
index 93e8a03..fec36f8 100755 (executable)
@@ -228,7 +228,10 @@ namespace Tizen.NUI.Components
                     {
                         Style.UnderLine.BackgroundColor = new ColorSelector();
                     }
-                    Style.UnderLine.BackgroundColor.All = value;
+                    if (Style.UnderLine.BackgroundColor != null)
+                    {
+                        Style.UnderLine.BackgroundColor.All = value;
+                    }
                     //RelayoutRequest();
                 }
             }
@@ -251,7 +254,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Text.PointSize = new FloatSelector();
                 }
+                if (Style.Text.PointSize != null)
+                {
                 Style.Text.PointSize.All = value;
+                }
                 //RelayoutRequest();
             }
         }
@@ -291,7 +297,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Text.TextColor = new ColorSelector();
                 }
-                Style.Text.TextColor.All = value;
+                if (Style.Text.TextColor != null)
+                {
+                    Style.Text.TextColor.All = value;
+                }
                 //RelayoutRequest();
             }
         }
index 029ce56..c1b96ea 100755 (executable)
@@ -169,7 +169,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Text.PointSize = new FloatSelector();
                 }
+                if (null != Style.Text.PointSize)
+                {
                 Style.Text.PointSize.All = value;
+                }
             }
         }
 
@@ -206,7 +209,10 @@ namespace Tizen.NUI.Components
                 {
                     Style.Text.TextColor = new ColorSelector();
                 }
-                Style.Text.TextColor.All = value;
+                if (null != Style.Text.TextColor)
+                {
+                    Style.Text.TextColor.All = value;
+                }
                 //RelayoutRequest();
             }
         }