|
@@ -3,7 +3,6 @@ package com.jixin.im.view.chatHolder;
|
|
|
import android.content.Intent;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
-import android.util.Log;
|
|
|
import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
@@ -29,6 +28,7 @@ import com.xuan.xuanhttplibrary.okhttp.callback.BaseCallback;
|
|
|
import com.xuan.xuanhttplibrary.okhttp.result.ObjectResult;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import de.greenrobot.event.EventBus;
|
|
|
import okhttp3.Call;
|
|
@@ -41,7 +41,7 @@ class RedViewHolder extends AChatHolderInterface {
|
|
|
private RedDialog mRedDialog;
|
|
|
|
|
|
private RoundedImageView rivReceiverAvatar;
|
|
|
- private TextView tvContent, tvExclusiveContent;
|
|
|
+ private TextView tvContent, tvRedPacketContent;
|
|
|
private TextView tvStatus;
|
|
|
private View redPacketBgView;
|
|
|
|
|
@@ -53,7 +53,7 @@ class RedViewHolder extends AChatHolderInterface {
|
|
|
@Override
|
|
|
public void initView(View view) {
|
|
|
mRootView = view.findViewById(R.id.chat_warp_view);
|
|
|
- tvExclusiveContent = view.findViewById(R.id.tv_exclusive_content);
|
|
|
+ tvRedPacketContent = view.findViewById(R.id.tv_red_packet_content);
|
|
|
rivReceiverAvatar = view.findViewById(R.id.iv_receive_avatar);
|
|
|
redPacketBgView = view.findViewById(R.id.view_red_packet_bg);
|
|
|
tvStatus = view.findViewById(R.id.chat_status);
|
|
@@ -68,20 +68,16 @@ class RedViewHolder extends AChatHolderInterface {
|
|
|
if ("4".equals(message.getFilePath())){
|
|
|
//专属红包
|
|
|
tvContent.setText("专属红包");
|
|
|
- String msgTypeContent = String.format(getString(R.string.exclusive_red_packet),message.getToUserName());
|
|
|
- String toUserId = message.getToUserId();
|
|
|
- rivReceiverAvatar.setVisibility(View.VISIBLE);
|
|
|
+// rivReceiverAvatar.setVisibility(View.VISIBLE);
|
|
|
+// AvatarHelper.getInstance().displayAvatar(message.getToUserName(), message.getToUserId(),
|
|
|
+// rivReceiverAvatar, true);
|
|
|
|
|
|
- AvatarHelper.getInstance().displayAvatar(toUserId, rivReceiverAvatar);
|
|
|
- tvExclusiveContent.setText(msgTypeContent);
|
|
|
- tvExclusiveContent.setVisibility(View.VISIBLE);
|
|
|
}else {
|
|
|
//普通红包,随机红包,口令红包
|
|
|
- tvExclusiveContent.setVisibility(View.INVISIBLE);
|
|
|
- rivReceiverAvatar.setVisibility(View.INVISIBLE);
|
|
|
+// rivReceiverAvatar.setVisibility(View.INVISIBLE);
|
|
|
tvContent.setText(charSequence);
|
|
|
}
|
|
|
-
|
|
|
+ setRedPacketContent(message);
|
|
|
|
|
|
if (mdata.getFileSize() == 2) {// 已领取
|
|
|
mRootView.setAlpha(0.6f);
|
|
@@ -100,6 +96,21 @@ class RedViewHolder extends AChatHolderInterface {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ private void setRedPacketContent(ChatMessage message){
|
|
|
+ String redPacketType = message.getFilePath();
|
|
|
+ String text = "";
|
|
|
+ switch (redPacketType){
|
|
|
+ case "3":
|
|
|
+ text = "口令红包";
|
|
|
+ break;
|
|
|
+ case "4":
|
|
|
+ text = String.format(getString(R.string.exclusive_red_packet),message.getToUserName());
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ tvRedPacketContent.setText(text);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public boolean isOnClick() {
|
|
@@ -156,8 +167,12 @@ class RedViewHolder extends AChatHolderInterface {
|
|
|
mContext.startActivity(intent);
|
|
|
} else {
|
|
|
// 在群里面我领取过的红包直接跳转
|
|
|
+ List<String > assignUserIdList = openRedpacket.getPacket().getAssignUserIds();
|
|
|
+ String assignUserId = "";
|
|
|
+ if (assignUserIdList!=null && assignUserIdList.size()>0){
|
|
|
+ assignUserId = assignUserIdList.get(0);
|
|
|
+ }
|
|
|
|
|
|
- String assignUserId = openRedpacket.getPacket().getAssignUserId();
|
|
|
if (isGounp && ( mdata.getFileSize() != 1 || (!TextUtils.isEmpty(assignUserId) &&!mLoginUserId.equals(assignUserId)))) {
|
|
|
mContext.startActivity(intent);
|
|
|
} else {
|