From: everLEEst(SangHyeon Lee) Date: Fri, 25 Nov 2022 06:18:12 +0000 (-0800) Subject: [NUI] Fix Layouter to handle empty group case. X-Git-Tag: submit/tizen_7.0/20230329.100139~1^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a72b43256c10de227dac6be479f663014c467fe2;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Fix Layouter to handle empty group case. --- diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/GridLayouter.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/GridLayouter.cs index c4a406a..8dca378 100755 --- a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/GridLayouter.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/GridLayouter.cs @@ -210,11 +210,19 @@ namespace Tizen.NUI.Components bool failed = false; //Final Check of FirstIndex - while (colView.InternalItemSource.IsHeader(firstIndex) || + if (colView.InternalItemSource.Count - 1 < firstIndex) + { + StepCandidate = 0F; + failed = true; + } + + while (!failed && + (colView.InternalItemSource.IsHeader(firstIndex) || colView.InternalItemSource.IsGroupHeader(firstIndex) || - colView.InternalItemSource.IsGroupFooter(firstIndex)) + colView.InternalItemSource.IsGroupFooter(firstIndex))) { - if (colView.InternalItemSource.IsFooter(firstIndex)) + if (colView.InternalItemSource.IsFooter(firstIndex) + || ((colView.InternalItemSource.Count - 1) <= firstIndex)) { StepCandidate = 0F; failed = true; @@ -509,7 +517,7 @@ namespace Tizen.NUI.Components // Insert Single item. if (source == null) throw new ArgumentNullException(nameof(source)); if (colView == null) return; - if (isSourceEmpty) + if (isSourceEmpty || StepCandidate == 0) { Initialize(colView); } @@ -661,7 +669,7 @@ namespace Tizen.NUI.Components // Insert Group if (source == null) throw new ArgumentNullException(nameof(source)); if (colView == null) return; - if (isSourceEmpty) + if (isSourceEmpty || StepCandidate == 0) { Initialize(colView); } diff --git a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs index 52bb6ec..612602b 100755 --- a/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs +++ b/src/Tizen.NUI.Components/Controls/RecyclerView/Layouter/LinearLayouter.cs @@ -204,10 +204,19 @@ namespace Tizen.NUI.Components bool failed = false; //Final Check of FirstIndex - while (colView.InternalItemSource.IsHeader(firstIndex) || + + if (colView.InternalItemSource.Count - 1 < firstIndex) + { + StepCandidate = 0F; + failed = true; + } + + while (!failed && + (colView.InternalItemSource.IsHeader(firstIndex) || colView.InternalItemSource.IsGroupHeader(firstIndex) || - colView.InternalItemSource.IsGroupFooter(firstIndex)) + colView.InternalItemSource.IsGroupFooter(firstIndex))) { + if (colView.InternalItemSource.IsFooter(firstIndex) || ((colView.InternalItemSource.Count - 1) <= firstIndex)) { @@ -557,7 +566,7 @@ namespace Tizen.NUI.Components if (source == null) throw new ArgumentNullException(nameof(source)); if (colView == null) return; - if (isSourceEmpty) + if (isSourceEmpty || StepCandidate == 0) { Initialize(colView); } @@ -725,7 +734,7 @@ namespace Tizen.NUI.Components if (source == null) throw new ArgumentNullException(nameof(source)); if (colView == null) return; - if (isSourceEmpty) + if (isSourceEmpty || StepCandidate == 0) { Initialize(colView); }