Commit 28e69ee3 authored by Grigory Fedorov's avatar Grigory Fedorov

Chat messages scrolled to bottom after update.

parent 87ee4a6e
...@@ -80,6 +80,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -80,6 +80,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
private ChatViewerFragmentListener listener; private ChatViewerFragmentListener listener;
private Animation shakeAnimation = null; private Animation shakeAnimation = null;
private int contextMenuItemPosition; private int contextMenuItemPosition;
private RecyclerView recyclerView;
public static ChatViewerFragment newInstance(String account, String user) { public static ChatViewerFragment newInstance(String account, String user) {
ChatViewerFragment fragment = new ChatViewerFragment(); ChatViewerFragment fragment = new ChatViewerFragment();
...@@ -158,7 +159,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -158,7 +159,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
chatMessageAdapter = new ChatMessageAdapter(getActivity(), account, user, this); chatMessageAdapter = new ChatMessageAdapter(getActivity(), account, user, this);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.chat_messages_recycler_view); recyclerView = (RecyclerView) view.findViewById(R.id.chat_messages_recycler_view);
recyclerView.setAdapter(chatMessageAdapter); recyclerView.setAdapter(chatMessageAdapter);
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
...@@ -414,6 +415,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem ...@@ -414,6 +415,7 @@ public class ChatViewerFragment extends Fragment implements PopupMenu.OnMenuItem
public void updateChat() { public void updateChat() {
chatMessageAdapter.onChange(); chatMessageAdapter.onChange();
recyclerView.scrollToPosition(chatMessageAdapter.getItemCount() - 1);
setUpOptionsMenu(toolbar.getMenu()); setUpOptionsMenu(toolbar.getMenu());
updateSecurityButton(); updateSecurityButton();
......
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:scrollbars="vertical" android:scrollbars="vertical"
android:transcriptMode="normal"
android:smoothScrollbar="false"
android:divider="@null" android:divider="@null"
android:dividerHeight="0dp" android:dividerHeight="0dp"
android:layout_above="@+id/input_layout" android:layout_above="@+id/input_layout"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment