X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI.Components%2FControls%2FRecyclerView%2FGridRecycleLayoutManager.cs;h=b546abc22c5154a72b2787c17ecfe455262cacee;hb=0af19a453d91955d90cbb6ce1a997eb617a60aa8;hp=abfa02d9bb8c5c442a0faf0fe44f76de89ec2333;hpb=4f1569668bf2da74caf02a5a5a7ae36121911e54;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/GridRecycleLayoutManager.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/GridRecycleLayoutManager.cs old mode 100644 new mode 100755 index abfa02d..b546abc --- a/src/Tizen.NUI.Components/Controls/RecyclerView/GridRecycleLayoutManager.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/GridRecycleLayoutManager.cs @@ -86,7 +86,10 @@ namespace Tizen.NUI.Components { 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) @@ -133,7 +136,7 @@ namespace Tizen.NUI.Components { RecycleItem item = Container.Children[i] as RecycleItem; - if (previousItem != null) + if (previousItem != null && item != null) { item.Position = LayoutOrientation == Orientation.Vertical ? new Position( @@ -204,10 +207,13 @@ namespace Tizen.NUI.Components 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); + } } } } @@ -220,16 +226,18 @@ namespace Tizen.NUI.Components 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); + } } } } @@ -284,7 +292,7 @@ namespace Tizen.NUI.Components 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; }