|
|
@@ -43,16 +43,19 @@ import com.yunbao.main.activity.ContactsActivity;
|
|
|
import com.yunbao.main.activity.ImMsgAtActivity;
|
|
|
import com.yunbao.main.activity.ImMsgCommentActivity;
|
|
|
import com.yunbao.main.activity.ImMsgFansActivity;
|
|
|
+import com.yunbao.main.activity.ImMsgInteractionActivity;
|
|
|
import com.yunbao.main.activity.ImMsgOffcialActivity;
|
|
|
import com.yunbao.main.activity.ImMsgSystemActivity;
|
|
|
import com.yunbao.main.activity.ImMsgZanActivity;
|
|
|
import com.yunbao.main.adapter.MainMessageAdapter;
|
|
|
+import com.yunbao.main.adapter.UserAvatarAdapter;
|
|
|
import com.yunbao.mall.activity.OrderMessageActivity;
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
import org.greenrobot.eventbus.Subscribe;
|
|
|
import org.greenrobot.eventbus.ThreadMode;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Comparator;
|
|
|
@@ -66,16 +69,30 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
|
|
|
private SmartRefreshLayout mSmartRefreshLayout;
|
|
|
private RecyclerView mRecyclerView;
|
|
|
+// private TextView mRedPointFans;
|
|
|
+// private TextView mRedPointZan;
|
|
|
+// private TextView mRedPointAt;
|
|
|
+// private TextView mRedPointComment;
|
|
|
+// private TextView mRedPointOfficial;
|
|
|
+// private TextView mRedPointSystem;
|
|
|
+// private TextView mMsgOfficial;
|
|
|
+// private TextView mTimeOfficial;
|
|
|
+// private TextView mMsgSystem;
|
|
|
+// private TextView mTimeSystem;
|
|
|
+
|
|
|
+ private UserAvatarAdapter mUserAvatarAdapter;
|
|
|
+ private RecyclerView mUseravatars;
|
|
|
+ private ViewGroup mStatusSetBtn;
|
|
|
private TextView mRedPointFans;
|
|
|
- private TextView mRedPointZan;
|
|
|
- private TextView mRedPointAt;
|
|
|
- private TextView mRedPointComment;
|
|
|
- private TextView mRedPointOfficial;
|
|
|
- private TextView mRedPointSystem;
|
|
|
- private TextView mMsgOfficial;
|
|
|
- private TextView mTimeOfficial;
|
|
|
- private TextView mMsgSystem;
|
|
|
- private TextView mTimeSystem;
|
|
|
+ private TextView mMessageFans;
|
|
|
+ private TextView mRedPointInteraction;
|
|
|
+ private TextView mMessageInteraction;
|
|
|
+ private TextView mMessageoffcial;
|
|
|
+ private TextView mMessageShop;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
private MainMessageAdapter mAdapter;
|
|
|
private boolean mIsInitHeadView;
|
|
|
@@ -123,20 +140,22 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
int i = v.getId();
|
|
|
if (i == R.id.btn_fans) {
|
|
|
clickFans();
|
|
|
- } else if (i == R.id.btn_zan) {
|
|
|
+ } else if (i == R.id.btn_interaction) {
|
|
|
clickZan();
|
|
|
} else if (i == R.id.btn_at) {
|
|
|
- clickAt();
|
|
|
+// clickAt();
|
|
|
} else if (i == R.id.btn_comment) {
|
|
|
- clickComment();
|
|
|
+// clickComment();
|
|
|
} else if (i == R.id.btn_offcial_msg) {
|
|
|
clickOffcial();
|
|
|
- } else if (i == R.id.btn_system_msg) {
|
|
|
+ } else if (i == R.id.btn_shopping) {
|
|
|
clickSystem();
|
|
|
} else if (i == R.id.btn_contacts) {
|
|
|
ContactsActivity.forward(mContext);
|
|
|
} else if (i == R.id.btn_all_read) {
|
|
|
ignoreUnReadCount();
|
|
|
+ } else if (i == R.id.btn_status_setting) {
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -154,11 +173,11 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
}
|
|
|
SpUtil.getInstance().setBooleanValue(SpUtil.HAS_SYSTEM_MSG, false);
|
|
|
setRedPointVisibility(mRedPointFans, false);
|
|
|
- setRedPointVisibility(mRedPointZan, false);
|
|
|
- setRedPointVisibility(mRedPointAt, false);
|
|
|
- setRedPointVisibility(mRedPointComment, false);
|
|
|
- setRedPointVisibility(mRedPointOfficial, false);
|
|
|
- setRedPointVisibility(mRedPointSystem, false);
|
|
|
+ setRedPointVisibility(mRedPointInteraction, false);
|
|
|
+// setRedPointVisibility(mRedPointAt, false);
|
|
|
+// setRedPointVisibility(mRedPointComment, false);
|
|
|
+// setRedPointVisibility(mRedPointOfficial, false);
|
|
|
+// setRedPointVisibility(mRedPointSystem, false);
|
|
|
ImMessageUtil.getInstance().markAllConversationAsRead();
|
|
|
if (mAdapter != null) {
|
|
|
mAdapter.resetAllUnReadCount();
|
|
|
@@ -173,29 +192,33 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
}
|
|
|
|
|
|
private void clickZan() {
|
|
|
- setRedPointVisibility(mRedPointZan, false);
|
|
|
+// setRedPointVisibility(mRedPointZan, false);
|
|
|
+ setRedPointVisibility(mRedPointInteraction, false);
|
|
|
markAllMessagesAsRead(Constants.IM_MSG_LIKE);
|
|
|
- ImMsgZanActivity.forward(mContext);
|
|
|
- }
|
|
|
-
|
|
|
- private void clickAt() {
|
|
|
- setRedPointVisibility(mRedPointAt, false);
|
|
|
markAllMessagesAsRead(Constants.IM_MSG_AT);
|
|
|
- ImMsgAtActivity.forward(mContext);
|
|
|
- }
|
|
|
-
|
|
|
- private void clickComment() {
|
|
|
- setRedPointVisibility(mRedPointComment, false);
|
|
|
markAllMessagesAsRead(Constants.IM_MSG_COMMENT);
|
|
|
- ImMsgCommentActivity.forward(mContext);
|
|
|
+// ImMsgZanActivity.forward(mContext);
|
|
|
+ ImMsgInteractionActivity.forward(mContext);
|
|
|
}
|
|
|
|
|
|
+// private void clickAt() {
|
|
|
+// setRedPointVisibility(mRedPointAt, false);
|
|
|
+// markAllMessagesAsRead(Constants.IM_MSG_AT);
|
|
|
+// ImMsgAtActivity.forward(mContext);
|
|
|
+// }
|
|
|
+
|
|
|
+// private void clickComment() {
|
|
|
+// setRedPointVisibility(mRedPointComment, false);
|
|
|
+// markAllMessagesAsRead(Constants.IM_MSG_COMMENT);
|
|
|
+// ImMsgCommentActivity.forward(mContext);
|
|
|
+// }
|
|
|
+
|
|
|
/**
|
|
|
* 点击官方通知
|
|
|
*/
|
|
|
private void clickOffcial() {
|
|
|
SpUtil.getInstance().setBooleanValue(SpUtil.HAS_SYSTEM_MSG, false);
|
|
|
- setRedPointVisibility(mRedPointOfficial, false);
|
|
|
+// setRedPointVisibility(mRedPointOfficial, false);
|
|
|
ImMsgOffcialActivity.forward(mContext, mOfficialNameVal, mOfficialAvatarVal);
|
|
|
}
|
|
|
|
|
|
@@ -203,7 +226,7 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
* 点击系统消息
|
|
|
*/
|
|
|
private void clickSystem() {
|
|
|
- setRedPointVisibility(mRedPointSystem, false);
|
|
|
+// setRedPointVisibility(mRedPointSystem, false);
|
|
|
markAllMessagesAsRead(Constants.IM_MSG_SYSTEM);
|
|
|
ImMsgSystemActivity.forward(mContext);
|
|
|
}
|
|
|
@@ -243,24 +266,58 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
@Override
|
|
|
public void onHeadView(View topView) {
|
|
|
if (!mIsInitHeadView) {
|
|
|
+ /**
|
|
|
+ * private RecyclerView mUseravatars;
|
|
|
+ * private ViewGroup mStatusSetBtn;
|
|
|
+ * private TextView mRedPointFans;
|
|
|
+ * private TextView mMessageFans;
|
|
|
+ * private TextView mRedPointInteraction;
|
|
|
+ * private TextView mMessageInteraction;
|
|
|
+ * private TextView mMessageoffcial;
|
|
|
+ * private TextView mMessageShop;
|
|
|
+ * */
|
|
|
+ mUseravatars = topView.findViewById(R.id.recycler_user_avatars);
|
|
|
+ if (mUseravatars != null) {
|
|
|
+ mUserAvatarAdapter = new UserAvatarAdapter(mContext);
|
|
|
+ mUseravatars.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.HORIZONTAL, false));
|
|
|
+ mUseravatars.setAdapter(mUserAvatarAdapter);
|
|
|
+
|
|
|
+ // 设置用户点击监听
|
|
|
+ mUserAvatarAdapter.setOnUserClickListener(new UserAvatarAdapter.OnUserClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onUserClick(ImConUserBean userInfo) {
|
|
|
+ // 点击用户头像时跳转到聊天界面
|
|
|
+ markAllMessagesAsRead(userInfo.getId());
|
|
|
+ ChatRoomActivity.forward(mContext, userInfo, userInfo.isFollowThisUser());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ mStatusSetBtn = topView.findViewById(R.id.btn_status_setting);
|
|
|
mRedPointFans = topView.findViewById(R.id.red_point_fans);
|
|
|
- mRedPointZan = topView.findViewById(R.id.red_point_zan);
|
|
|
- mRedPointAt = topView.findViewById(R.id.red_point_at);
|
|
|
- mRedPointComment = topView.findViewById(R.id.red_point_comment);
|
|
|
- mRedPointOfficial = topView.findViewById(R.id.red_point_offcial);
|
|
|
- mRedPointSystem = topView.findViewById(R.id.red_point_system);
|
|
|
- mMsgOfficial = topView.findViewById(R.id.msg_offcial);
|
|
|
- mTimeOfficial = topView.findViewById(R.id.time_offcial);
|
|
|
- mMsgSystem = topView.findViewById(R.id.msg_system);
|
|
|
- mTimeSystem = topView.findViewById(R.id.time_system);
|
|
|
- mOfficialAvatar = topView.findViewById(R.id.avatar_offcial);
|
|
|
- mOfficialName = topView.findViewById(R.id.name_offcial);
|
|
|
+ mMessageFans = topView.findViewById(R.id.tv_fans);
|
|
|
+ mRedPointInteraction = topView.findViewById(R.id.red_point_interaction);
|
|
|
+ mMessageInteraction = topView.findViewById(R.id.tv_interaction);
|
|
|
+ mMessageoffcial = topView.findViewById(R.id.msg_offcial);
|
|
|
+ mMessageShop = topView.findViewById(R.id.msg_shopping);
|
|
|
+
|
|
|
+// mRedPointZan = topView.findViewById(R.id.red_point_zan);
|
|
|
+// mRedPointAt = topView.findViewById(R.id.red_point_at);
|
|
|
+// mRedPointComment = topView.findViewById(R.id.red_point_comment);
|
|
|
+// mRedPointOfficial = topView.findViewById(R.id.red_point_offcial);
|
|
|
+// mRedPointSystem = topView.findViewById(R.id.red_point_system);
|
|
|
+// mMsgOfficial = topView.findViewById(R.id.msg_offcial);
|
|
|
+// mTimeOfficial = topView.findViewById(R.id.time_offcial);
|
|
|
+// mMsgSystem = topView.findViewById(R.id.msg_system);
|
|
|
+// mTimeSystem = topView.findViewById(R.id.time_system);
|
|
|
+// .findViewById(R.id.name_offcial);
|
|
|
+ // ... existing code ...
|
|
|
+ mStatusSetBtn.setOnClickListener(this);
|
|
|
topView.findViewById(R.id.btn_fans).setOnClickListener(this);
|
|
|
- topView.findViewById(R.id.btn_zan).setOnClickListener(this);
|
|
|
- topView.findViewById(R.id.btn_at).setOnClickListener(this);
|
|
|
- topView.findViewById(R.id.btn_comment).setOnClickListener(this);
|
|
|
- topView.findViewById(R.id.btn_offcial_msg).setOnClickListener(this);
|
|
|
- topView.findViewById(R.id.btn_system_msg).setOnClickListener(this);
|
|
|
+ topView.findViewById(R.id.btn_interaction).setOnClickListener(this); // 第310行 - 这里出错
|
|
|
+ topView.findViewById(R.id.btn_offcial_msg).setOnClickListener(this); // 第311行 - 这里也会出错
|
|
|
+ topView.findViewById(R.id.btn_shopping).setOnClickListener(this); // 第312行 - 这里也会出错
|
|
|
+// topView.findViewById(R.id.btn_offcial_msg).setOnClickListener(this);
|
|
|
+// topView.findViewById(R.id.btn_system_msg).setOnClickListener(this);
|
|
|
mIsInitHeadView = true;
|
|
|
getLastMessage();
|
|
|
}
|
|
|
@@ -280,24 +337,27 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
int unReadCount = conBean.getUnReadCount();
|
|
|
String time = conBean.getLastMsgTimeString();
|
|
|
if (Constants.IM_MSG_SYSTEM.equals(from)) {
|
|
|
- if (mMsgSystem != null) {
|
|
|
- mMsgSystem.setText(lastMsg);
|
|
|
- }
|
|
|
- if (mTimeSystem != null) {
|
|
|
- mTimeSystem.setText(time);
|
|
|
- }
|
|
|
- if (unReadCount > 0) {
|
|
|
- setRedPointVisibility(mRedPointSystem, true);
|
|
|
- if (mRedPointSystem != null) {
|
|
|
- mRedPointSystem.setText(String.valueOf(unReadCount));
|
|
|
- }
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointSystem, false);
|
|
|
+ if (mMessageoffcial != null) {
|
|
|
+ mMessageoffcial.setText(lastMsg);
|
|
|
}
|
|
|
+// if (mTimeSystem != null) {
|
|
|
+// mTimeSystem.setText(time);
|
|
|
+// }
|
|
|
+// if (unReadCount > 0) {
|
|
|
+// setRedPointVisibility(mRedPointSystem, true);
|
|
|
+// if (mRedPointSystem != null) {
|
|
|
+// mRedPointSystem.setText(String.valueOf(unReadCount));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointSystem, false);
|
|
|
+// }
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if (Constants.IM_MSG_FANS.equals(from)) {
|
|
|
+ if (mMessageFans != null) {
|
|
|
+ mMessageFans.setText(lastMsg);
|
|
|
+ }
|
|
|
if (unReadCount > 0) {
|
|
|
setRedPointVisibility(mRedPointFans, true);
|
|
|
if (mRedPointFans != null) {
|
|
|
@@ -308,37 +368,46 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
- if (Constants.IM_MSG_LIKE.equals(from)) {
|
|
|
- if (unReadCount > 0) {
|
|
|
- setRedPointVisibility(mRedPointZan, true);
|
|
|
- if (mRedPointZan != null) {
|
|
|
- mRedPointZan.setText(String.valueOf(unReadCount));
|
|
|
- }
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointZan, false);
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- if (Constants.IM_MSG_AT.equals(from)) {
|
|
|
- if (unReadCount > 0) {
|
|
|
- setRedPointVisibility(mRedPointAt, true);
|
|
|
- if (mRedPointAt != null) {
|
|
|
- mRedPointAt.setText(String.valueOf(unReadCount));
|
|
|
- }
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointAt, false);
|
|
|
- }
|
|
|
- return;
|
|
|
- }
|
|
|
- if (Constants.IM_MSG_COMMENT.equals(from)) {
|
|
|
- if (unReadCount > 0) {
|
|
|
- setRedPointVisibility(mRedPointComment, true);
|
|
|
- if (mRedPointComment != null) {
|
|
|
- mRedPointComment.setText(String.valueOf(unReadCount));
|
|
|
- }
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointComment, false);
|
|
|
- }
|
|
|
+// if (Constants.IM_MSG_LIKE.equals(from)) {
|
|
|
+// if (unReadCount > 0) {
|
|
|
+// setRedPointVisibility(mRedPointInteraction, true);
|
|
|
+// if (mRedPointInteraction != null) {
|
|
|
+// mRedPointInteraction.setText(String.valueOf(unReadCount));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointInteraction, false);
|
|
|
+// }
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// if (Constants.IM_MSG_AT.equals(from)) {
|
|
|
+// if (unReadCount > 0) {
|
|
|
+// setRedPointVisibility(mRedPointInteraction, true);
|
|
|
+// if (mRedPointInteraction != null) {
|
|
|
+// mRedPointInteraction.setText(String.valueOf(unReadCount));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointInteraction, false);
|
|
|
+// }
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// if (Constants.IM_MSG_COMMENT.equals(from)) {
|
|
|
+// if (unReadCount > 0) {
|
|
|
+// setRedPointVisibility(mRedPointInteraction, true);
|
|
|
+// if (mRedPointInteraction != null) {
|
|
|
+// mRedPointInteraction.setText(String.valueOf(unReadCount));
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointInteraction, false);
|
|
|
+// }
|
|
|
+// return;
|
|
|
+// }
|
|
|
+ // 在onImUserMsgEvent方法中,将三种消息类型合并处理
|
|
|
+ if (Constants.IM_MSG_LIKE.equals(from) ||
|
|
|
+ Constants.IM_MSG_AT.equals(from) ||
|
|
|
+ Constants.IM_MSG_COMMENT.equals(from)) {
|
|
|
+
|
|
|
+ // 获取所有互动消息的总未读数量
|
|
|
+ updateInteractionMessages();
|
|
|
return;
|
|
|
}
|
|
|
if (mRecyclerView != null && mAdapter != null) {
|
|
|
@@ -354,16 +423,56 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
ImConUserBean bean = JSON.parseObject(info[0], ImConUserBean.class);
|
|
|
bean.setConBean(conBean);
|
|
|
mAdapter.insertItem(bean);
|
|
|
+ if (mUserAvatarAdapter != null) {
|
|
|
+ mUserAvatarAdapter.addUser(bean);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
mAdapter.updateItem(conBean, position);
|
|
|
+ if (mUserAvatarAdapter != null) {
|
|
|
+ mUserAvatarAdapter.updateUserPosition(from);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新互动消息显示
|
|
|
+ */
|
|
|
+ private void updateInteractionMessages() {
|
|
|
+ ImUnReadCount unReadCount = ImMessageUtil.getInstance().getUnReadMsgCount();
|
|
|
+ if (unReadCount == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取三种消息类型的未读数量
|
|
|
+ int likeCount = Integer.parseInt(unReadCount.getLikeUnReadCount());
|
|
|
+ int atCount = Integer.parseInt(unReadCount.getAtUnReadCount());
|
|
|
+ int commentCount = Integer.parseInt(unReadCount.getCommentUnReadCount());
|
|
|
+
|
|
|
+ // 计算总的未读数量
|
|
|
+ int totalInteractionCount = likeCount + atCount + commentCount;
|
|
|
+
|
|
|
+ if (totalInteractionCount > 0) {
|
|
|
+ setRedPointVisibility(mRedPointInteraction, true);
|
|
|
+ if (mRedPointInteraction != null) {
|
|
|
+ mRedPointInteraction.setText(String.valueOf(totalInteractionCount));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新消息文本显示(可以显示最新的一条消息)
|
|
|
+ if (mMessageInteraction != null) {
|
|
|
+ // 这里可以根据需要显示具体的消息内容
|
|
|
+ String messageText = "您有新的互动消息";
|
|
|
+ mMessageInteraction.setText(messageText);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ setRedPointVisibility(mRedPointInteraction, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
|
|
public void onFollowEvent(FollowEvent e) {
|
|
|
@@ -429,6 +538,19 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
if (mOfficialName != null) {
|
|
|
mOfficialName.setText(mOfficialNameVal);
|
|
|
}
|
|
|
+ if (mRecyclerView != null && mAdapter != null) {
|
|
|
+ mAdapter.setList(conUserList);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (mRecyclerView != null && mAdapter != null) {
|
|
|
+ mAdapter.setList(conUserList);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新用户头像列表
|
|
|
+ if (mUserAvatarAdapter != null) {
|
|
|
+ mUserAvatarAdapter.setData(conUserList);
|
|
|
+ }
|
|
|
+
|
|
|
conUserList.remove(0);
|
|
|
if (conUserList.size() > 0) {
|
|
|
for (ImConUserBean conUserBean : conUserList) {
|
|
|
@@ -457,6 +579,9 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
if (mRecyclerView != null && mAdapter != null) {
|
|
|
mAdapter.clear();
|
|
|
}
|
|
|
+ if (mUserAvatarAdapter != null) {
|
|
|
+ mUserAvatarAdapter.setData(new ArrayList<>());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -479,31 +604,20 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
setRedPointVisibility(mRedPointFans, false);
|
|
|
}
|
|
|
String unReadCountZan = unReadCount.getLikeUnReadCount();
|
|
|
- if (!"0".equals(unReadCountZan)) {
|
|
|
- setRedPointVisibility(mRedPointZan, true);
|
|
|
- if (mRedPointZan != null) {
|
|
|
- mRedPointZan.setText(String.valueOf(unReadCountZan));
|
|
|
- }
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointZan, false);
|
|
|
- }
|
|
|
- final String unReadCountAt = unReadCount.getAtUnReadCount();
|
|
|
- if (!"0".equals(unReadCountAt)) {
|
|
|
- setRedPointVisibility(mRedPointAt, true);
|
|
|
- if (mRedPointAt != null) {
|
|
|
- mRedPointAt.setText(String.valueOf(unReadCountAt));
|
|
|
- }
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointAt, false);
|
|
|
- }
|
|
|
+ String unReadCountAt = unReadCount.getAtUnReadCount();
|
|
|
String unReadCountComment = unReadCount.getCommentUnReadCount();
|
|
|
- if (!"0".equals(unReadCountComment)) {
|
|
|
- setRedPointVisibility(mRedPointComment, true);
|
|
|
- if (mRedPointComment != null) {
|
|
|
- mRedPointComment.setText(String.valueOf(unReadCountComment));
|
|
|
+
|
|
|
+ int totalInteractionCount = Integer.parseInt(unReadCountZan) +
|
|
|
+ Integer.parseInt(unReadCountAt) +
|
|
|
+ Integer.parseInt(unReadCountComment);
|
|
|
+
|
|
|
+ if (totalInteractionCount > 0) {
|
|
|
+ setRedPointVisibility(mRedPointInteraction, true);
|
|
|
+ if (mRedPointInteraction != null) {
|
|
|
+ mRedPointInteraction.setText(String.valueOf(totalInteractionCount));
|
|
|
}
|
|
|
} else {
|
|
|
- setRedPointVisibility(mRedPointComment, false);
|
|
|
+ setRedPointVisibility(mRedPointInteraction, false);
|
|
|
}
|
|
|
ImHttpUtil.getLastMessage(new HttpCallback() {
|
|
|
@Override
|
|
|
@@ -513,38 +627,38 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
if (obj.containsKey("officeInfo")) {
|
|
|
JSONObject officeInfo = obj.getJSONObject("officeInfo");
|
|
|
String time = ImMessageUtil.getInstance().getMessageTimeString(officeInfo.getLongValue("pushtime"));
|
|
|
- if (mTimeOfficial != null) {
|
|
|
- mTimeOfficial.setText(time);
|
|
|
- }
|
|
|
- if (mMsgOfficial != null) {
|
|
|
- mMsgOfficial.setText(officeInfo.getString("title"));
|
|
|
- }
|
|
|
- if (mRedPointOfficial != null) {
|
|
|
- if (SpUtil.getInstance().getBooleanValue(SpUtil.HAS_SYSTEM_MSG)) {
|
|
|
- setRedPointVisibility(mRedPointOfficial, true);
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointOfficial, false);
|
|
|
- }
|
|
|
+// if (mTimeOfficial != null) {
|
|
|
+// mTimeOfficial.setText(time);
|
|
|
+// }
|
|
|
+ if (mMessageoffcial != null) {
|
|
|
+ mMessageoffcial.setText(officeInfo.getString("title"));
|
|
|
}
|
|
|
+// if (mRedPointOfficial != null) {
|
|
|
+// if (SpUtil.getInstance().getBooleanValue(SpUtil.HAS_SYSTEM_MSG)) {
|
|
|
+// setRedPointVisibility(mRedPointOfficial, true);
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointOfficial, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
} else {
|
|
|
- mMsgOfficial.setText(String.format(WordUtil.getString(R.string.im_msg_welcome), WordUtil.getString(R.string.app_name)));
|
|
|
+ mMessageoffcial.setText(String.format(WordUtil.getString(R.string.im_msg_welcome), WordUtil.getString(R.string.app_name)));
|
|
|
}
|
|
|
if (obj.containsKey("sysInfo")) {
|
|
|
JSONObject sysInfo = obj.getJSONObject("sysInfo");
|
|
|
String time = ImMessageUtil.getInstance().getMessageTimeString(sysInfo.getLongValue("addtime"));
|
|
|
- mTimeSystem.setText(time);
|
|
|
- mMsgSystem.setText(sysInfo.getString("title"));
|
|
|
+// mTimeSystem.setText(time);
|
|
|
+ mMessageShop.setText(sysInfo.getString("title"));
|
|
|
String unReadCountSystem = unReadCount.getSystemUnReadCount();
|
|
|
- if (mRedPointSystem != null) {
|
|
|
- if (!"0".equals(unReadCountSystem)) {
|
|
|
- setRedPointVisibility(mRedPointSystem, true);
|
|
|
- mRedPointSystem.setText(unReadCountSystem);
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointSystem, false);
|
|
|
- }
|
|
|
- }
|
|
|
+// if (mRedPointSystem != null) {
|
|
|
+// if (!"0".equals(unReadCountSystem)) {
|
|
|
+// setRedPointVisibility(mRedPointSystem, true);
|
|
|
+// mRedPointSystem.setText(unReadCountSystem);
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointSystem, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
} else {
|
|
|
- mMsgSystem.setText(String.format(WordUtil.getString(R.string.im_msg_welcome), WordUtil.getString(R.string.app_name)));
|
|
|
+// mMsgSystem.setText(String.format(WordUtil.getString(R.string.im_msg_welcome), WordUtil.getString(R.string.app_name)));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -586,22 +700,22 @@ public class MainMessageViewHolder extends AbsMainViewHolder implements View.OnC
|
|
|
if (obj.containsKey("officeInfo")) {
|
|
|
JSONObject officeInfo = obj.getJSONObject("officeInfo");
|
|
|
String time = ImMessageUtil.getInstance().getMessageTimeString(officeInfo.getLongValue("pushtime"));
|
|
|
- if (mTimeOfficial != null) {
|
|
|
- mTimeOfficial.setText(time);
|
|
|
- }
|
|
|
- if (mMsgOfficial != null) {
|
|
|
- mMsgOfficial.setText(officeInfo.getString("title"));
|
|
|
- }
|
|
|
- if (mRedPointOfficial != null) {
|
|
|
- if (SpUtil.getInstance().getBooleanValue(SpUtil.HAS_SYSTEM_MSG)) {
|
|
|
- setRedPointVisibility(mRedPointOfficial, true);
|
|
|
- } else {
|
|
|
- setRedPointVisibility(mRedPointOfficial, false);
|
|
|
- }
|
|
|
+// if (mTimeOfficial != null) {
|
|
|
+// mTimeOfficial.setText(time);
|
|
|
+// }
|
|
|
+ if (mMessageoffcial != null) {
|
|
|
+ mMessageoffcial.setText(officeInfo.getString("title"));
|
|
|
}
|
|
|
+// if (mRedPointOfficial != null) {
|
|
|
+// if (SpUtil.getInstance().getBooleanValue(SpUtil.HAS_SYSTEM_MSG)) {
|
|
|
+// setRedPointVisibility(mRedPointOfficial, true);
|
|
|
+// } else {
|
|
|
+// setRedPointVisibility(mRedPointOfficial, false);
|
|
|
+// }
|
|
|
+// }
|
|
|
} else {
|
|
|
- if (mMsgOfficial != null) {
|
|
|
- mMsgOfficial.setText(String.format(WordUtil.getString(R.string.im_msg_welcome), WordUtil.getString(R.string.app_name)));
|
|
|
+ if (mMessageoffcial != null) {
|
|
|
+ mMessageoffcial.setText(String.format(WordUtil.getString(R.string.im_msg_welcome), WordUtil.getString(R.string.app_name)));
|
|
|
}
|
|
|
}
|
|
|
}
|