|
@@ -45,6 +45,7 @@ public class ChatItem {
|
|
|
public ImageView mSendingImage = null;
|
|
|
public ImageView mUnreadImage = null;
|
|
|
public ImageView mUnsendImage = null;
|
|
|
+ public ImageView mReLoadingImage = null;
|
|
|
public TextView mReadStatusText = null;
|
|
|
|
|
|
public Animation sendingAnimation = null;
|
|
@@ -75,6 +76,7 @@ public class ChatItem {
|
|
|
mSendingImage = (ImageView)convertView.findViewById(R.id.mSendingImage);
|
|
|
mUnsendImage = (ImageView)convertView.findViewById(R.id.mUnsendImage);
|
|
|
mUnreadImage = (ImageView)convertView.findViewById(R.id.mUnreadImage);
|
|
|
+ mReLoadingImage = (ImageView)convertView.findViewById(R.id.mReLoadingImage);
|
|
|
mReadStatusText = (TextView)convertView.findViewById(R.id.mReadStatusText);
|
|
|
}
|
|
|
|
|
@@ -88,7 +90,8 @@ public class ChatItem {
|
|
|
|
|
|
//消息状态
|
|
|
setLocalState(messageBean.localState);
|
|
|
- setReadStatus(messageBean.owner, messageBean.state);
|
|
|
+ setReLoadingImage(messageBean);
|
|
|
+ setReadStatus(messageBean.owner, messageBean.localState);
|
|
|
|
|
|
//setPosition(messageBean);
|
|
|
}
|
|
@@ -227,18 +230,40 @@ public class ChatItem {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public void setReLoadingImage(MessageBean bean) {
|
|
|
+ if (mReLoadingImage == null)
|
|
|
+ return;
|
|
|
+ if (bean.owner == Constant.OWNER_ME)
|
|
|
+ return;
|
|
|
+ if (bean.type == Constant.MESSAGE_TYPE_PHOTO) {
|
|
|
+ int status = bean.filePath.length() > 1 ? View.GONE : View.VISIBLE;
|
|
|
+ mReLoadingImage.setVisibility(status);
|
|
|
+ } else if (bean.type == Constant.MESSAGE_TYPE_VIDEO) {
|
|
|
+ int status = bean.filePath.length() > 1 && bean.videoPath.length() > 1 ? View.GONE : View.VISIBLE;
|
|
|
+ mReLoadingImage.setVisibility(status);
|
|
|
+ } else {
|
|
|
+ mReLoadingImage.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void setReadStatus(int owner, int state) {
|
|
|
if (mReadStatusText == null)
|
|
|
return;
|
|
|
- if (owner != Constant.OWNER_ME || state == 0) {
|
|
|
- mReadStatusText.setVisibility(View.GONE);
|
|
|
- } else {
|
|
|
- if (state == 1)
|
|
|
+ if (owner == Constant.OWNER_ME) {
|
|
|
+ if (state == Constant.MESSAGE_STATE_SEND_SUCCESS || state == Constant.MESSAGE_STATE_UNREAD) {
|
|
|
+ mReadStatusText.setVisibility(View.VISIBLE);
|
|
|
mReadStatusText.setText(R.string.read_status_1);
|
|
|
- else if (state == 2)
|
|
|
+ } else if (state == Constant.MESSAGE_STATE_READ) {
|
|
|
+ mReadStatusText.setVisibility(View.VISIBLE);
|
|
|
mReadStatusText.setText(R.string.read_status_2);
|
|
|
- else if (state == 3)
|
|
|
+ } else if (state == Constant.MESSAGE_STATE_SEND_FAIL) {
|
|
|
+ mReadStatusText.setVisibility(View.VISIBLE);
|
|
|
mReadStatusText.setText(R.string.read_status_3);
|
|
|
+ } else {
|
|
|
+ mReadStatusText.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ mReadStatusText.setVisibility(View.GONE);
|
|
|
}
|
|
|
}
|
|
|
|