Scroll chat rooms list to top when a new one is created to ensure it is visible
This commit is contained in:
parent
7f2d427f8a
commit
2e6355289f
1 changed files with 5 additions and 0 deletions
|
@ -157,6 +157,7 @@ public class ChatRoomsFragment extends Fragment
|
||||||
Core core, ChatRoom cr, ChatRoom.State state) {
|
Core core, ChatRoom cr, ChatRoom.State state) {
|
||||||
if (state == ChatRoom.State.Created) {
|
if (state == ChatRoom.State.Created) {
|
||||||
refreshChatRoom(cr);
|
refreshChatRoom(cr);
|
||||||
|
scrollToTop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -263,6 +264,10 @@ public class ChatRoomsFragment extends Fragment
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void scrollToTop() {
|
||||||
|
mChatRoomsList.getLayoutManager().scrollToPosition(0);
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshChatRoom(ChatRoom cr) {
|
private void refreshChatRoom(ChatRoom cr) {
|
||||||
ChatRoomViewHolder holder = (ChatRoomViewHolder) cr.getUserData();
|
ChatRoomViewHolder holder = (ChatRoomViewHolder) cr.getUserData();
|
||||||
if (holder != null) {
|
if (holder != null) {
|
||||||
|
|
Loading…
Reference in a new issue