[NUI] Fixed Svace issues
[platform/core/csapi/tizenfx.git] / src / Tizen.NUI.Wearable / src / public / WearableList.cs
old mode 100644 (file)
new mode 100755 (executable)
index dd07bdf..a7f4c32
@@ -1,4 +1,4 @@
-/* Copyright (c) 2020 Samsung Electronics Co., Ltd.
+/* Copyright (c) 2020 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.
@@ -33,7 +33,6 @@ namespace Tizen.NUI.Wearable
         /// <summary>
         /// Default constructor.
         /// </summary>
-        /// <param name="adapter">Recycle adapter of List.</param>
         /// <since_tizen> 8 </since_tizen>
         /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -54,6 +53,8 @@ namespace Tizen.NUI.Wearable
             SetFocus(0, false);
 
             Scrollbar = new CircularScrollbar();
+            DecelerationThreshold = 60.0f;
+            DecelerationRate = 0.991f;
         }
 
         protected override void SetScrollbar()
@@ -94,6 +95,11 @@ namespace Tizen.NUI.Wearable
         /// 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)
@@ -103,7 +109,7 @@ namespace Tizen.NUI.Wearable
                     FocusedItem = item;
                     FocusedItem.OnFocusGained();
 
-                    ScrollTo(item.DataIndex * mLayoutManager.StepSize, animated);
+                    ScrollTo(item.DataIndex * LayoutManager.StepSize, animated);
                 }
             }
         }
@@ -120,11 +126,19 @@ namespace Tizen.NUI.Wearable
         /// 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)
         {
-            int targetDataIndex = (int)Math.Round(Math.Abs(targetPosition) / mLayoutManager.StepSize);
+            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)
                 {