Commit b6f32a03 by Kunj Gupta

Added bottom scroll in chat screen.

parent 57deba6b
...@@ -111,15 +111,6 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList ...@@ -111,15 +111,6 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
actionBar.setDisplayShowTitleEnabled(true); actionBar.setDisplayShowTitleEnabled(true);
} }
List<ChatBotHistory> chatBotHistoryList = ChatBotHistoryManager.getAllChatBotHistory();
for (int i = 0; i < chatBotHistoryList.size(); i++) {
ChatBotHistory chatBotHistory = chatBotHistoryList.get(i);
mMessages.add(new Message.Builder(Message.TYPE_MESSAGE)
.username(chatBotHistory.getUserName()).message(chatBotHistory.getMessage()).build());
}
mAdapter = new MessageAdapter(this, mMessages);
CatalogueApplication app = (CatalogueApplication) getApplication(); CatalogueApplication app = (CatalogueApplication) getApplication();
mSocket = app.getSocket(); mSocket = app.getSocket();
mSocket.on(Socket.EVENT_CONNECT, onConnect); mSocket.on(Socket.EVENT_CONNECT, onConnect);
...@@ -138,7 +129,17 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList ...@@ -138,7 +129,17 @@ public class ChatActivity extends HandleNotificationActivity implements OnDSList
mMessagesView = (RecyclerView) findViewById(R.id.messages); mMessagesView = (RecyclerView) findViewById(R.id.messages);
mMessagesView.setLayoutManager(new LinearLayoutManager(this)); mMessagesView.setLayoutManager(new LinearLayoutManager(this));
List<ChatBotHistory> chatBotHistoryList = ChatBotHistoryManager.getAllChatBotHistory();
for (int i = 0; i < chatBotHistoryList.size(); i++) {
ChatBotHistory chatBotHistory = chatBotHistoryList.get(i);
mMessages.add(new Message.Builder(Message.TYPE_MESSAGE)
.username(chatBotHistory.getUserName()).message(chatBotHistory.getMessage()).build());
}
mAdapter = new MessageAdapter(this, mMessages);
mMessagesView.setAdapter(mAdapter); mMessagesView.setAdapter(mAdapter);
scrollToBottom();
mInputMessageView = (EditText) findViewById(R.id.message_input); mInputMessageView = (EditText) findViewById(R.id.message_input);
mInputMessageView.setOnEditorActionListener(new TextView.OnEditorActionListener() { mInputMessageView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
......
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 sign in to comment