改了一些乱七八糟的东西

This commit is contained in:
xuhuixiang
2025-05-16 16:43:45 +08:00
parent be36e02e66
commit 3e7f1d9089
19 changed files with 263 additions and 121 deletions

View File

@@ -63,7 +63,7 @@ public interface ChatMessageType {
int CUSTOM_STICKER_BUSINESS_CARD = 1003;
/**
* 赠送
* 转账
*/
int CUSTOM_STICKER_TRANSFER_ACCOUNTS = 1004;

View File

@@ -53,6 +53,7 @@ import com.netease.yunxin.kit.corekit.im.provider.FetchCallback;
import com.netease.yunxin.kit.corekit.model.ErrorMsg;
import com.netease.yunxin.kit.corekit.model.ResultInfo;
import java.text.DecimalFormat;
import java.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
@@ -458,86 +459,109 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
}
public void setStatusView(TextView tvstatus, RedpacketBean1 data, ChatMessageBean message, RedpacketGroupBean redpacketGroupBean) {
switch (data.getStatus()) {
case "0":
tvstatus.setText(tvstatus.getResources().getString(R.string.dailinqu_txt1));
if (!data.getSenderUid().equals(IMKitClient.account())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.dailinqu_txt2));
}
if (redpacketGroupBean != null && redpacketGroupBean.getGrabbers() != null) {
for (int i = 0; i < redpacketGroupBean.getGrabbers().size(); i++) {
if ((redpacketGroupBean.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt1));
if (data.getCoinType().equals("0")) {
binding.bigLy.setBackgroundResource(R.drawable.hongbnao_f_g);
} else if (data.getCoinType().equals("1")) {
binding.bigLy.setBackgroundResource(R.drawable.zhuanzhang_f_s);
} else {
binding.bigLy.setBackgroundResource(R.drawable.lijinhongbao_fail);
}
break;
}
}
}
break;
case "1":
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt1));
if (message.getMessageData().getMessage().getFromAccount().equals(data.getSenderUid() + "")) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt2));
}
if (IMKitClient.account().equals(data.getSenderUid())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt4));
}
if (redpacketGroupBean != null && redpacketGroupBean.getGrabbers() != null && redpacketGroupBean.getGrabbers().size() == redpacketGroupBean.getCount()) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt5));
for (int i = 0; i < redpacketGroupBean.getGrabbers().size(); i++) {
if ((redpacketGroupBean.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt2));
break;
}
}
if ((redpacketGroupBean.getSenderUid() + "").equals(IMKitClient.account())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt5));
}
}
break;
case "2":
tvstatus.setText(tvstatus.getResources().getString(R.string.yiguoqi_txt1));
if (redpacketGroupBean != null && redpacketGroupBean.getGrabbers() != null) {
for (int i = 0; i < redpacketGroupBean.getGrabbers().size(); i++) {
if ((redpacketGroupBean.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt2));
break;
}
}
}
break;
case "3":
case "4":
tvstatus.setText(tvstatus.getResources().getString(R.string.yituihuan_txt));
if (message.getMessageData().getMessage().getFromAccount().equals(data.getSenderUid() + "")) {
tvstatus.setText(tvstatus.getResources().getString(R.string.yituihuan_txt1));
}
if (IMKitClient.account().equals(data.getSenderUid())) {
tvstatus.setText(tvstatus.getResources().getString(R.string.yituihuan_txt2));
}
break;
}
tvstatus.setText("¥ "+getQian(data.getAmount()));
// switch (data.getStatus()) {
// case "0":
//
// tvstatus.setText(tvstatus.getResources().getString(R.string.dailinqu_txt1));
// if (!data.getSenderUid().equals(IMKitClient.account())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.dailinqu_txt2));
//
// }
// if (redpacketGroupBean != null && redpacketGroupBean.getGrabbers() != null) {
// for (int i = 0; i < redpacketGroupBean.getGrabbers().size(); i++) {
// if ((redpacketGroupBean.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt1));
// if (data.getCoinType().equals("0")) {
// binding.bigLy.setBackgroundResource(R.drawable.hongbnao_f_g);
// } else if (data.getCoinType().equals("1")) {
// binding.bigLy.setBackgroundResource(R.drawable.zhuanzhang_f_s);
// } else {
// binding.bigLy.setBackgroundResource(R.drawable.lijinhongbao_fail);
// }
// break;
// }
// }
//
// }
// break;
// case "1":
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt1));
//
// if (message.getMessageData().getMessage().getFromAccount().equals(data.getSenderUid() + "")) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt2));
// }
// if (IMKitClient.account().equals(data.getSenderUid())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt4));
//
// }
//
// if (redpacketGroupBean != null && redpacketGroupBean.getGrabbers() != null && redpacketGroupBean.getGrabbers().size() == redpacketGroupBean.getCount()) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt5));
// for (int i = 0; i < redpacketGroupBean.getGrabbers().size(); i++) {
// if ((redpacketGroupBean.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt2));
//
// break;
// }
// }
// if ((redpacketGroupBean.getSenderUid() + "").equals(IMKitClient.account())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt5));
//
//
// }
// }
// break;
// case "2":
// tvstatus.setText(tvstatus.getResources().getString(R.string.yiguoqi_txt1));
//
// if (redpacketGroupBean != null && redpacketGroupBean.getGrabbers() != null) {
// for (int i = 0; i < redpacketGroupBean.getGrabbers().size(); i++) {
// if ((redpacketGroupBean.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.received_txt2));
//
// break;
// }
// }
// }
// break;
// case "3":
// case "4":
// tvstatus.setText(tvstatus.getResources().getString(R.string.yituihuan_txt));
//
// if (message.getMessageData().getMessage().getFromAccount().equals(data.getSenderUid() + "")) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.yituihuan_txt1));
// }
// if (IMKitClient.account().equals(data.getSenderUid())) {
// tvstatus.setText(tvstatus.getResources().getString(R.string.yituihuan_txt2));
// }
// break;
// }
}
public String getQian(String numberString) {
if(TextUtils.isEmpty(numberString)){
numberString = "0";
}
long number = Long.valueOf(numberString);
if (number % 100 == 0) {
long numbers = number/100;
DecimalFormat decimalFormat = new DecimalFormat("#,###,###");
String formattedNumber = decimalFormat.format(numbers);
return String.format("%s", formattedNumber);
} else if (number % 10 == 0) {
float numbers = number/100f;
DecimalFormat decimalFormat = new DecimalFormat("#,###,##0.0");
String formattedNumber = decimalFormat.format(numbers);
return String.format("%s", formattedNumber);
} else {
float numbers = number/100f;
DecimalFormat decimalFormat = new DecimalFormat("#,###,##0.00");
String formattedNumber = decimalFormat.format(numbers);
return String.format("%s", formattedNumber);
}
}
/**
* 设置消息头像的显示.

View File

@@ -68,6 +68,8 @@ public class TransferViewHolder extends ChatBaseMessageViewHolder {
currentMessage = message;
String name = message.getMessageData().getMessage().getAttachStr();
TransferShareBean circleShareBean = GsonUtils.getObjFromJSON(name, TransferShareBean.class);
Log.i("名片", "名片获取到的数据-1" + GsonUtils.beanToJSONString(message));
Log.i("名片", "名片获取到的数据0" + name);
Log.i("名片", "名片获取到的数据2" + GsonUtils.beanToJSONString(circleShareBean));
// binding.itemTitleTv.setVisibility(View.INVISIBLE);//去掉title

View File

@@ -11,9 +11,12 @@ import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.netease.nim.highavailable.LogUtils;
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
import com.netease.yunxin.kit.alog.ALog;
import com.netease.yunxin.kit.chatkit.ui.IChatDefaultFactory;
import com.netease.yunxin.kit.chatkit.ui.common.GsonUtils;
import com.netease.yunxin.kit.chatkit.ui.databinding.ChatBaseMessageViewHolderBinding;
import com.netease.yunxin.kit.chatkit.ui.fun.view.message.ChatMessageViewHolderFactory;
import com.netease.yunxin.kit.chatkit.ui.model.ChatMessageBean;
@@ -61,6 +64,8 @@ public class FunChatViewHolderFactory extends ChatMessageViewHolderFactory
@Override
public int getCustomViewType(ChatMessageBean messageBean) {
if (messageBean != null) {
// LogUtils.i("BIKAOVIDEO","BIKAOVIDEO结果是啥类型1"+ GsonUtils.beanToJSONString(messageBean));
if (messageBean.getMessageData().getMessage().getMsgType() == MsgTypeEnum.custom) {
CustomAttachment attachment =
(CustomAttachment) messageBean.getMessageData().getMessage().getAttachment();

View File

@@ -143,14 +143,20 @@ public class MessageBottomLayout extends FrameLayout
mBinding.inputCameraRb.setOnClickListener(view -> onCameraClick());
// mBinding.inputAudioRb.setOnClickListener(v -> switchRecord());
// mBinding.inputAudio2Rb.setOnClickListener(v -> switchRecord());
mBinding.inputRightLayout.setOnClickListener(v -> {
if (mBinding.inputAudio2Rb.getVisibility() == VISIBLE) {
switchRecord2();
} else {
sendText(replyMessage);
}
}
);
// mBinding.inputRightLayout.setOnClickListener(v -> {
// if (mBinding.inputAudio2Rb.getVisibility() == VISIBLE) {
// switchRecord2();
// } else {
// sendText(replyMessage);
// }
// }
// );
mBinding.inputAudio2Rb.setOnClickListener(v -> {
switchRecord2();
});
mBinding.emojiFsongTv.setOnClickListener(v -> {
sendText(replyMessage);
});
mBinding.layoutaudiostatus.setOnClickListener(view -> updateAudioStatus());//开始录音
mBinding.ivaudiodelete.setOnClickListener(view -> deleteRecord());
mBinding.ivaudiosend.setOnClickListener(view -> sendRecord());
@@ -1019,6 +1025,14 @@ public class MessageBottomLayout extends FrameLayout
mBinding.inputEmojiRb.setAlpha(mute ? 0.5f : 1f);
mBinding.inputMoreRb.setEnabled(!mute);
mBinding.inputMoreRb.setAlpha(mute ? 0.5f : 1f);
mBinding.inputCameraRb.setEnabled(!mute);
mBinding.inputCameraRb.setAlpha(mute ? 0.5f : 1f);
mBinding.inputAlbumRb.setEnabled(!mute);
mBinding.inputAlbumRb.setAlpha(mute ? 0.5f : 1f);
mBinding.inputAudio2Rb.setEnabled(!mute);
mBinding.inputAudio2Rb.setAlpha(mute ? 0.5f : 1f);
}
}

View File

@@ -51,8 +51,9 @@
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:textStyle="bold"
android:textColor="#FEE391"
android:textSize="12sp" />
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>