@Override public void onMessageReceived(Message message) { if (conversationFragment != null) { conversationFragment.addMessage(message); } }
@Override public void onUserDetailUpdated(String userId) { if (conversationFragment != null) { conversationFragment.notifyAdapter(); } }
@Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { inflater = (LayoutInflater) getContext().getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.al_conversation_fragment, null); recyclerView = view.findViewById(R.id.conversationRecyclerView); conversationAdapter = new AlConversationAdapter(getActivity(), conversationList); LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager); ApplozicConversation.getLatestMessageList(getContext(), null, false, new MessageListHandler() { @Override public void onResult(List<Message> messageList, ApplozicException e) {
@Override public void onConversationDeleted(String userId, Integer channelKey, String response) { if (conversationFragment != null) { if ("success".equals(response)) { conversationFragment.removeMessage(userId, channelKey); } } }
@Override public void onLoadMore() { conversationAdapter.showLoading(true); conversationAdapter.notifyDataSetChanged(); ApplozicConversation.getLatestMessageList(getContext(), null, true, new MessageListHandler() { @Override public void onResult(List<Message> messageList, ApplozicException e) { conversationList.addAll(messageList); conversationAdapter.showLoading(false); conversationAdapter.notifyDataSetChanged(); } }); } });
@Override public void onMessageDeleted(String messageKey, String userId) { if (conversationFragment != null) { conversationFragment.notifyAdapter(); } }
@Override public void onMessageSync(Message message, String key) { if (conversationFragment != null) { conversationFragment.addMessage(message); } }
@Override public void onMessageMetadataUpdated(String keyString) { if (conversationFragment != null) { conversationFragment.notifyAdapter(); } } }
@Override public void onMessageSent(Message message) { if (conversationFragment != null) { conversationFragment.addMessage(message); } }
@Override public void onChannelUpdated() { if (conversationFragment != null) { conversationFragment.notifyAdapter(); } }