Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
62036b98
Commit
62036b98
authored
Sep 21, 2017
by
Filipe de Lima Brito
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete LoadMoreScrollListener.java
parent
fc1de20c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
44 deletions
+0
-44
LoadMoreScrollListener.java
...va/chat/rocket/android/helper/LoadMoreScrollListener.java
+0
-44
No files found.
app/src/main/java/chat/rocket/android/helper/LoadMoreScrollListener.java
deleted
100644 → 0
View file @
fc1de20c
package
chat
.
rocket
.
android
.
helper
;
import
android.support.v7.widget.LinearLayoutManager
;
import
android.support.v7.widget.RecyclerView
;
@SuppressWarnings
(
"PMD.AbstractNaming"
)
public
abstract
class
LoadMoreScrollListener
extends
RecyclerView
.
OnScrollListener
{
private
final
LinearLayoutManager
layoutManager
;
private
final
int
loadThreshold
;
private
boolean
isLoading
;
/**
* constructor. loadThreshold is better to set to 0.4 * total.
*/
public
LoadMoreScrollListener
(
LinearLayoutManager
layoutManager
,
int
loadThreshold
)
{
this
.
layoutManager
=
layoutManager
;
this
.
loadThreshold
=
loadThreshold
;
setLoadingDone
();
}
@Override
public
void
onScrolled
(
RecyclerView
recyclerView
,
int
deltaX
,
int
deltaY
)
{
super
.
onScrolled
(
recyclerView
,
deltaX
,
deltaY
);
final
int
visibleItemCount
=
recyclerView
.
getChildCount
();
final
int
totalItemCount
=
layoutManager
.
getItemCount
();
final
int
firstVisibleItem
=
layoutManager
.
findFirstVisibleItemPosition
();
if
(!
isLoading
&&
firstVisibleItem
+
visibleItemCount
>=
totalItemCount
-
loadThreshold
&&
visibleItemCount
<
totalItemCount
&&
deltaY
<
0
)
{
isLoading
=
true
;
requestMoreItem
();
}
}
public
void
setLoadingDone
()
{
isLoading
=
false
;
}
public
abstract
void
requestMoreItem
();
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment