public void LoadLocalPreviousMessages() { try { loadList = false; paginationModel.SkipRecords += 30; if (chatConversation != null) { int PreviousListCount = ListChatsCon.Values.Sum(list => list.Count); ListChatsCon = ChatMessageRepository.GetChatMessagesForPageIndex(paginationModel, chatConversation.ChatId); int CurrentListCount = ListChatsCon.Values.Sum(list => list.Count); if (ListChatsCon != null && ListChatsCon.Count > 0) { mAdapter = new PrivateMessgeAdapter(this, ListChatsCon); mRecyclerView.SetAdapter(mAdapter); mAdapter.NotifyDataSetChanged(); mRecyclerView.ScrollToPosition(CurrentListCount - PreviousListCount - 2); loadList = true; } } } catch (Exception e) { Crashes.TrackError(e); } }
public void LoadLocalLatestMessages() { try { loadList = false; if (chatConversation != null) { ListChatsCon = ChatMessageRepository.GetChatMessagesForPageIndex(paginationModel, chatConversation.ChatId); if (ListChatsCon != null && ListChatsCon.Count > 0) { mAdapter = new PrivateMessgeAdapter(this, ListChatsCon); mRecyclerView.SetAdapter(mAdapter); mAdapter.NotifyDataSetChanged(); mRecyclerView.ScrollToPosition(mAdapter.ItemCount - 1); loadList = true; } } } catch (Exception e) { Crashes.TrackError(e); } }