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
29235d30
Commit
29235d30
authored
Jan 15, 2017
by
Yusuke Iwaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add default implementation for RealmModelListAdapter#getListUpdateCallback
parent
baec51e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
3 deletions
+27
-3
ExtRealmModelListAdapter.java
...rocket/android/layouthelper/ExtRealmModelListAdapter.java
+2
-2
RealmModelListAdapter.java
...at/rocket/android/realm_helper/RealmModelListAdapter.java
+25
-1
No files found.
app/src/main/java/chat/rocket/android/layouthelper/ExtRealmModelListAdapter.java
View file @
29235d30
...
...
@@ -44,7 +44,7 @@ public abstract class ExtRealmModelListAdapter<T extends RealmObject, VM,
this
.
updateListener
=
updateListener
;
}
pr
otected
ListUpdateCallback
listUpdateCallback
=
new
ListUpdateCallback
()
{
pr
ivate
final
ListUpdateCallback
listUpdateCallback
=
new
ListUpdateCallback
()
{
@Override
public
void
onInserted
(
int
position
,
int
count
)
{
notifyItemRangeInserted
(
position
+
1
,
count
);
...
...
@@ -117,7 +117,7 @@ public abstract class ExtRealmModelListAdapter<T extends RealmObject, VM,
}
@Override
p
ublic
ListUpdateCallback
getListUpdateCallback
()
{
p
rotected
ListUpdateCallback
getListUpdateCallback
()
{
return
listUpdateCallback
;
}
...
...
realm-helpers/src/main/java/chat/rocket/android/realm_helper/RealmModelListAdapter.java
View file @
29235d30
...
...
@@ -103,7 +103,31 @@ public abstract class RealmModelListAdapter<T extends RealmObject, VM,
protected
abstract
DiffUtil
.
Callback
getDiffCallback
(
List
<
VM
>
oldData
,
List
<
VM
>
newData
);
protected
abstract
ListUpdateCallback
getListUpdateCallback
();
private
final
ListUpdateCallback
listUpdateCallback
=
new
ListUpdateCallback
()
{
@Override
public
void
onInserted
(
int
position
,
int
count
)
{
notifyItemRangeInserted
(
position
,
count
);
}
@Override
public
void
onRemoved
(
int
position
,
int
count
)
{
notifyItemRangeRemoved
(
position
,
count
);
}
@Override
public
void
onMoved
(
int
fromPosition
,
int
toPosition
)
{
notifyItemMoved
(
fromPosition
,
toPosition
);
}
@Override
public
void
onChanged
(
int
position
,
int
count
,
Object
payload
)
{
notifyItemRangeChanged
(
position
,
count
,
payload
);
}
};
protected
ListUpdateCallback
getListUpdateCallback
()
{
return
listUpdateCallback
;
}
public
void
setOnItemClickListener
(
OnItemClickListener
<
VM
>
onItemClickListener
)
{
this
.
onItemClickListener
=
onItemClickListener
;
...
...
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