Hi there,
I want to add arrived message to top of my recyclerview, and as you provided in "insert" demo, I'm using .insert(object, position)
By this way Item added, but! we should scroll down to reach to position 0!
means item added but still is invisible to user.
mCommentsList.add(0, comment); // Add arrived item to data list
mAdapter.insert(comment, 0); // insert arrived item to adapter
But I want user see the insert animation ( I applied DefaultItemAnimation to recyclerview ), by this trick, user can't see that animation!
In second try, I've set .setReverseLayout and setStackFromEnd to true in my linear layout, everything work okay, and like messenger I've add new arrived item to end of list, but the issue is in adapter load more.
( -> of course first item divider decoration draw and it's not so nice, but its not my issue now)
For this I've set .setMore methos to my adaptor and in onMoreClick i call my load more method.
my more data loading method:
private void moreData(){
final List<Comment> mMoreList = new ArrayList<>();
Utilities.runOnUIThread(new Runnable() {
@Override
public void run() {
NetworkRequestsManager.getInstance().getNotifications(NextURL, new GeneralNetworkListener<String>() {
@Override
public void getResult(String response, boolean error) {
if (error){
TopToast.make(mRecyclerView, mContext, Utilities.getTypeface(Constants.fontLight), response, TopToast.LENGTH_SHORT).show();
mAdapter.pauseMore();
} else {
if (!response.isEmpty()){
ApiCommentsObject apiresponse = gson.fromJson(response, ApiCommentsObject.class);
NextURL = apiresponse.Meta.NextPage;
if (apiresponse.Comments.isEmpty()){
mAdapter.pauseMore();
} else {
for (Comment comment : apiresponse.Comments){
mMoreList.add(comment);
}
mCommentsList.addAll(mMoreList);
mAdapter.addAll(mMoreList);
}
} else {
mAdapter.pauseMore();
}
}
}
});
}
});
but when adapter get update, recyclerview goes to latest item in list and load more view show again, and user missed loaded items. How can resolve the problem? :'(
Hi there, I want to add arrived message to top of my recyclerview, and as you provided in "insert" demo, I'm using
.insert(object, position)
By this way Item added, but! we should scroll down to reach to position 0! means item added but still is invisible to user.my trick is this:
But I want user see the insert animation ( I applied DefaultItemAnimation to recyclerview ), by this trick, user can't see that animation!
In second try, I've set
.setReverseLayout
andsetStackFromEnd
to true in my linear layout, everything work okay, and like messenger I've add new arrived item to end of list, but the issue is in adapter load more.( -> of course first item divider decoration draw and it's not so nice, but its not my issue now)
For this I've set
.setMore
methos to my adaptor and inonMoreClick
i call my load more method.my more data loading method:
but when adapter get update, recyclerview goes to latest item in list and load more view show again, and user missed loaded items. How can resolve the problem? :'(