Skip to content

Commit

Permalink
[NUI] Add more condition when item is last.
Browse files Browse the repository at this point in the history
  • Loading branch information
everLEEst committed Nov 28, 2022
1 parent 0364f0c commit 5d7c35a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ public override void Initialize(RecyclerView view)

bool failed = false;
//Final Check of FirstIndex
if (colView.InternalItemSource.Count - 1 < firstIndex)
if ((colView.InternalItemSource.Count - 1 < firstIndex) ||
(colView.InternalItemSource.IsFooter(firstIndex) && (colView.InternalItemSource.Count - 1) == firstIndex))
{
StepCandidate = 0F;
failed = true;
Expand Down Expand Up @@ -517,7 +518,7 @@ public override void NotifyItemInserted(IItemSource source, int startIndex)
// Insert Single item.
if (source == null) throw new ArgumentNullException(nameof(source));
if (colView == null) return;
if (isSourceEmpty || StepCandidate == 0)
if (isSourceEmpty || StepCandidate <= 1)
{
Initialize(colView);
}
Expand Down Expand Up @@ -669,7 +670,7 @@ public override void NotifyItemRangeInserted(IItemSource source, int startIndex,
// Insert Group
if (source == null) throw new ArgumentNullException(nameof(source));
if (colView == null) return;
if (isSourceEmpty || StepCandidate == 0)
if (isSourceEmpty || StepCandidate <= 1)
{
Initialize(colView);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ public override void Initialize(RecyclerView view)
bool failed = false;

//Final Check of FirstIndex

if (colView.InternalItemSource.Count - 1 < firstIndex)
if ((colView.InternalItemSource.Count - 1 < firstIndex) ||
(colView.InternalItemSource.IsFooter(firstIndex) && (colView.InternalItemSource.Count - 1) == firstIndex))
{
StepCandidate = 0F;
failed = true;
Expand Down

0 comments on commit 5d7c35a

Please sign in to comment.