-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from muak/development
Development
- Loading branch information
Showing
30 changed files
with
576 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
## files generated by popular Visual Studio add-ons. | ||
|
||
.vs/ | ||
.idea/ | ||
|
||
# User-specific files | ||
*.suo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using System; | ||
using AiForms.Renderers; | ||
using Android.Support.V7.Widget; | ||
|
||
namespace AiForms.Renderers.Droid | ||
{ | ||
public class CollectionViewScrollListener:RecyclerView.OnScrollListener | ||
{ | ||
public bool IsReachedBottom { get; set; } | ||
|
||
CollectionView _collectionView; | ||
|
||
|
||
public CollectionViewScrollListener(CollectionView collectionView) | ||
{ | ||
_collectionView = collectionView; | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
if(disposing) | ||
{ | ||
_collectionView = null; | ||
} | ||
base.Dispose(disposing); | ||
} | ||
|
||
public override void OnScrolled(RecyclerView recyclerView, int dx, int dy) | ||
{ | ||
base.OnScrolled(recyclerView, dx, dy); | ||
|
||
if(dx < 0 || dy < 0 || IsReachedBottom || _collectionView.LoadMoreCommand == null) | ||
{ | ||
return; | ||
} | ||
|
||
var layoutManager = recyclerView.GetLayoutManager() as LinearLayoutManager; | ||
|
||
var visibleItemCount = recyclerView.ChildCount; | ||
var totalItemCount = layoutManager.ItemCount; | ||
var firstVisibleItem = layoutManager.FindFirstVisibleItemPosition(); | ||
|
||
if(totalItemCount - visibleItemCount - _collectionView.LoadMoreMargin <= firstVisibleItem) | ||
{ | ||
IsReachedBottom = true; | ||
_collectionView.LoadMoreCommand?.Execute(null); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.