use of com.avos.avoscloud.im.v2.AVIMMessage in project ride-read-android by Ride-Read.
the class LeftMsgHolder method bindData.
@Override
public void bindData(Object o) {
AVIMMessage message = (AVIMMessage) o;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
String time = dateFormat.format(message.getTimestamp());
String content = getContext().getString(R.string.unsupport_message_type);
if (message instanceof AVIMTextMessage) {
content = ((AVIMTextMessage) message).getText();
}
mTvChatTxtLeft.setText(content);
mTvChatTime.setText(time);
// nameView.setText(message.getFrom());
}
use of com.avos.avoscloud.im.v2.AVIMMessage in project ride-read-android by Ride-Read.
the class ChatSingleActivity method initView.
@Override
public void initView() {
mUser = (UserBaseInfo) getIntent().getSerializableExtra(CHAT_USER);
mUserName = getIntent().getStringExtra(CHAT_USER_NAME);
if (TextUtils.isEmpty(mUserName))
mUserName = "消息";
new TitleBuilder(this).setTitleText(mUserName).IsBack(true).setLeftOnClickListener(v -> finish()).build();
mSwipeRefreshLayout.setEnabled(false);
layoutManager = new LinearLayoutManager(this);
mRecycleView.setLayoutManager(layoutManager);
mMsgAdapter = new ChatMsgAdapter();
mRecycleView.setAdapter(mMsgAdapter);
getConversation(mUser.getUid() + "");
mSwipeRefreshLayout.setOnRefreshListener(() -> {
AVIMMessage message = mMsgAdapter.getFirstMessage();
if (null != mImConversation) {
mImConversation.queryMessages(message.getMessageId(), message.getTimestamp(), 20, new AVIMMessagesQueryCallback() {
@Override
public void done(List<AVIMMessage> list, AVIMException e) {
mSwipeRefreshLayout.setRefreshing(false);
if (filterException(e)) {
if (null != list && list.size() > 0) {
mMsgAdapter.addMessageList(list);
mMsgAdapter.notifyDataSetChanged();
layoutManager.scrollToPositionWithOffset(list.size() - 1, 0);
}
}
}
});
} else {
mSwipeRefreshLayout.setRefreshing(false);
}
});
}
use of com.avos.avoscloud.im.v2.AVIMMessage in project ride-read-android by Ride-Read.
the class RightMsgHolder method bindData.
@Override
public void bindData(Object msg) {
message = (AVIMMessage) msg;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String time = dateFormat.format(message.getTimestamp());
String content = getContext().getString(R.string.unsupport_message_type);
;
if (message instanceof AVIMTextMessage) {
content = ((AVIMTextMessage) message).getText();
}
mTvChatTxtRight.setText(content);
mTvChatTime.setText(time);
if (AVIMMessage.AVIMMessageStatus.AVIMMessageStatusFailed == message.getMessageStatus()) {
mImgChatStatusRight.setVisibility(View.VISIBLE);
mPbChatProgressbarRight.setVisibility(View.GONE);
mFlChatStatusRight.setVisibility(View.VISIBLE);
} else if (AVIMMessage.AVIMMessageStatus.AVIMMessageStatusSending == message.getMessageStatus()) {
mImgChatStatusRight.setVisibility(View.GONE);
mPbChatProgressbarRight.setVisibility(View.VISIBLE);
mFlChatStatusRight.setVisibility(View.VISIBLE);
} else {
mFlChatStatusRight.setVisibility(View.GONE);
}
}
Aggregations