-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix RemainingItemsThresholdReachedCommand not firing when CollectionVew has Header and Footer both defined #29618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
25edc3c
c90cc46
72e1d2e
4e84f2e
5a4486e
7c90e92
0230e4b
603b889
6185e03
bb2becc
31f2bc0
b955f41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,14 +57,14 @@ public override void OnScrolled(RecyclerView recyclerView, int dx, int dy) | |
|
||
// Early returns for edge cases | ||
if (Last == -1 || ItemsViewAdapter == null || _itemsView.RemainingItemsThreshold == -1) | ||
{ | ||
return; | ||
} | ||
|
||
var itemsSourceCount = ItemsViewAdapter.ItemCount; | ||
bool hasHeader = ItemsViewAdapter.ItemsSource.HasHeader; | ||
bool hasFooter = ItemsViewAdapter.ItemsSource.HasFooter; | ||
|
||
// Adjust the last visible item index to match the ItemsSource index (excluding header/footer) | ||
// Range of actual data item indices in adapter | ||
int firstDataItemIndex = (hasHeader && hasFooter) ? 1 : 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the changes, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes @jsuarezruiz , I've updated the logic to reflect this and optimized the code for improved clarity and efficiency. Please review the modified fix and let me know if any further changes are required. |
||
int lastDataItemIndex = itemsSourceCount - firstDataItemIndex; | ||
|
||
|
@@ -76,13 +76,21 @@ public override void OnScrolled(RecyclerView recyclerView, int dx, int dy) | |
switch (_itemsView.RemainingItemsThreshold) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, could simplify the logic by consolidating checks:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsuarezruiz , I've optimized the logic for improved clarity and efficiency. Please review the modified fix and let me know if any further changes are required. |
||
{ | ||
case 0: | ||
if (Last == lastDataItemIndex - 1) | ||
_itemsView.SendRemainingItemsThresholdReached(); | ||
break; | ||
{ | ||
if (Last == lastDataItemIndex - 1) | ||
{ | ||
_itemsView.SendRemainingItemsThresholdReached(); | ||
} | ||
break; | ||
} | ||
default: | ||
if (lastDataItemIndex - 1 - Last <= _itemsView.RemainingItemsThreshold) | ||
_itemsView.SendRemainingItemsThresholdReached(); | ||
break; | ||
{ | ||
if (lastDataItemIndex - 1 - Last <= _itemsView.RemainingItemsThreshold) | ||
{ | ||
_itemsView.SendRemainingItemsThresholdReached(); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.