第N+4次提交专属红包

This commit is contained in:
xuhuixiang
2025-04-29 17:28:46 +08:00
parent b07055fe3f
commit 34f39dd489
13 changed files with 232 additions and 83 deletions

View File

@@ -498,7 +498,7 @@ public class MainActivity extends BaseActivity {
private void getVersion() {
try {
Api.getInstance().version(com.hbl.lewan.network.ApiService.AREA_CODE.equals("+86")?7:0, DataUtils.getVersionCode(MainActivity.this), IMUIKitConfig.SUBSTATIONID)
Api.getInstance().version(com.hbl.lewan.network.ApiService.AREA_CODE.equals("+86")?7:0, DataUtils.getVersionCode(MainActivity.this), com.netease.yunxin.kit.chatkit.ui.network.ApiService.SUBSTATIONID1)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObserver<>() {

View File

@@ -364,7 +364,7 @@ public class MineFragment extends BaseFragment {
private void getVersion() {
try {
Api.getInstance().version(com.hbl.lewan.network.ApiService.AREA_CODE.equals("+86")?7:0, DataUtils.getVersionCode(getActivity()), IMUIKitConfig.SUBSTATIONID)
Api.getInstance().version(com.hbl.lewan.network.ApiService.AREA_CODE.equals("+86")?7:0, DataUtils.getVersionCode(getActivity()), com.netease.yunxin.kit.chatkit.ui.network.ApiService.SUBSTATIONID1)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BaseObserver<>() {

View File

@@ -24,6 +24,7 @@ import com.hbl.lewan.R;
import com.hbl.lewan.databinding.ActivityReceiveRedPacketBinding;
import com.hbl.lewan.network.BaseObserver;
import com.hbl.lewan.network.Result;
import com.hbl.lewan.utils.AppUtils;
import com.hbl.lewan.utils.GsonUtils;
import com.hbl.lewan.utils.ImageCacheLoader;
import com.hbl.lewan.utils.LogUtils;
@@ -265,7 +266,7 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
public void onSuccess(Result<RedpacketGroupBean> feedbackResp) {
redpacketGroupBean = feedbackResp.data;
titles = (ArrayList<GrabbersBean>) redpacketGroupBean.getGrabbers();
ChatDataUtils.set(ReceiveRedPacketActivity.this, "redpack_" + redpacketGroupBean.getId(), redpacketGroupBean.getStatus());
ChatDataUtils.set(ReceiveRedPacketActivity.this, "redpack_" + redpacketGroupBean.getId(), redpacketGroupBean.getStatus()+"");
RxBus.getInstance().post(new RxHongBaoBean(redpacketGroupBean.getId() + ""));
setList();
@@ -286,7 +287,7 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
public void onSuccess(Result<RedpacketGroupBean> feedbackResp) {
redpacketGroupBean = feedbackResp.data;
titles = (ArrayList<GrabbersBean>) redpacketGroupBean.getGrabbers();
ChatDataUtils.set(ReceiveRedPacketActivity.this, "redpack_" + redpacketGroupBean.getId(), redpacketGroupBean.getStatus());
ChatDataUtils.set(ReceiveRedPacketActivity.this, "redpack_" + redpacketGroupBean.getId(), redpacketGroupBean.getStatus()+"");
RxBus.getInstance().post(new RxHongBaoBean(redpacketGroupBean.getId() + ""));
setList();
@@ -312,7 +313,7 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
@Override
public void onSuccess(Result<RedpacketBean> feedbackResp) {
redpacketBean = feedbackResp.data;
ChatDataUtils.set(ReceiveRedPacketActivity.this, "redpack_" + redpacketBean.getId(), redpacketBean.getStatus());
ChatDataUtils.set(ReceiveRedPacketActivity.this, "redpack_" + redpacketBean.getId(), redpacketBean.getStatus()+"");
RxBus.getInstance().post(new RxHongBaoBean(redpacketBean.getId() + ""));
chagneBean();
}
@@ -330,9 +331,9 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
viewBinding.toWalletTv.setText(R.string.ddfglq_txt);
// titleTipsTvuser.setText(String.format("1个红包共%s%.2f",getString(R.string.danwei_txt), redpacketBean.getAmount() / 100f));
if (redpacketBean.getCoinType() == 0) {
viewBinding.titleTipsTvuser.setText(getString(R.string.red_envelope_amount_txt) + String.format("%.2f", redpacketBean.getAmount() / 100f) + getTypeName() + ",等待对方领取");
viewBinding.titleTipsTvuser.setText(getString(R.string.red_envelope_amount_txt) + AppUtils.getQian(redpacketGroupBean.getAmount()) + getTypeName() + ",等待对方领取");
} else {
viewBinding.titleTipsTvuser.setText(getString(R.string.red_envelope_amount_txt) + String.format("%.2f", redpacketBean.getAmount() / 100f) + getTypeName() + ",等待对方领取");
viewBinding.titleTipsTvuser.setText(getString(R.string.red_envelope_amount_txt) +AppUtils.getQian(redpacketGroupBean.getAmount()) + getTypeName() + ",等待对方领取");
}
} else if (redpacketBean.getStatus() == 1) {
@@ -358,7 +359,7 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
}
viewBinding.endLy.setVisibility(View.GONE);
viewBinding.priceTv.setText(String.format("%.2f", redpacketBean.getAmount() / 100f) + getTypeName());
viewBinding.priceTv.setText(AppUtils.getQian(redpacketGroupBean.getAmount()) + getTypeName());
viewBinding.timeTv.setText(redpacketBean.getReceiveTime() + "");
if ((redpacketBean.getReceiverUid() + "").equals(IMKitClient.account())) {
@@ -396,14 +397,14 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
viewBinding.numberTv1Ly.setVisibility(View.GONE);
if (redpacketGroupBean.getType().equals("0")) {
// binding.titleTipsTv.setText(bonusBean.getBonus().getNumber() + getString(R.string.red_envelopes_in_total) + String.format("%.2f", Integer.parseInt(bonusBean.getBonus().getMoney().trim()) / 100f) + getString(R.string.danwei_txt));
viewBinding.titleTipsTv.setText(String.format(getString(R.string.red_envelopes_in_total), redpacketGroupBean.getCount() + "", String.format("%.2f", redpacketGroupBean.getAmount() / 100f)));
viewBinding.titleTipsTv.setText(String.format(getString(R.string.red_envelopes_in_total), redpacketGroupBean.getCount() + "", AppUtils.getQian(redpacketGroupBean.getAmount())));
} else {
if (redpacketGroupBean.getGrabbers() == null || redpacketGroupBean.getGrabbers().size() == 0) {
if (redpacketGroupBean.getStatus() == 2) {
viewBinding.titleTipsTv.setText(getString(R.string.hbxq_yiguoqi_txt) + getString(R.string.received_txt1) + "0/" + redpacketGroupBean.getCount() + getString(R.string.ge_gong_txt) + "0.00" + "/" + String.format("%.2f", redpacketGroupBean.getAmount() / 100f));
viewBinding.titleTipsTv.setText(getString(R.string.hbxq_yiguoqi_txt) + getString(R.string.received_txt1) + "0/" + redpacketGroupBean.getCount() + getString(R.string.ge_gong_txt) + "0" + "/" + AppUtils.getQian(redpacketGroupBean.getAmount()));
} else {
viewBinding.titleTipsTv.setText(getString(R.string.received_txt1) + "0/" + redpacketGroupBean.getCount() + getString(R.string.ge_gong_txt) + "0.00" + "/" + String.format("%.2f", redpacketGroupBean.getAmount() / 100f));
viewBinding.titleTipsTv.setText(getString(R.string.received_txt1) + "0/" + redpacketGroupBean.getCount() + getString(R.string.ge_gong_txt) + "0" + "/" + AppUtils.getQian(redpacketGroupBean.getAmount()));
}
} else {
int size = 0;
@@ -425,10 +426,10 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
}
if (redpacketGroupBean.getStatus() == 2) {
viewBinding.titleTipsTv.setText(getString(R.string.hbxq_yiguoqi_txt) + getString(R.string.received_txt1) + redpacketGroupBean.getGrabbers().size() + "/" + redpacketGroupBean.getCount() + getString(R.string.ge_gong_txt)
+ String.format("%.2f", size / 100f) + "/" + String.format("%.2f", redpacketGroupBean.getAmount() / 100f));
+ AppUtils.getQian(size) + "/" +AppUtils.getQian(redpacketGroupBean.getAmount()));
} else {
viewBinding.titleTipsTv.setText(getString(R.string.received_txt1) + redpacketGroupBean.getGrabbers().size() + "/" + redpacketGroupBean.getCount() + getString(R.string.ge_gong_txt)
+ String.format("%.2f", size / 100f) + "/" + String.format("%.2f", redpacketGroupBean.getAmount() / 100f));
+ AppUtils.getQian(size) + "/" +AppUtils.getQian(redpacketGroupBean.getAmount()));
}
@@ -464,7 +465,7 @@ public class ReceiveRedPacketActivity extends BaseActivity implements View.OnCli
tvprice.setTextColor(Color.parseColor("#E4543E"));
} else {
tvprice.setTextColor(getResources().getColor(android.R.color.black));
imageView1.setVisibility(View.VISIBLE);
imageView1.setVisibility(View.GONE);
imageView1.setImageResource(getTypeNameImg());
}
ColorUtils.loadAvator(s.getGrabberAvatar(), imageView);

View File

@@ -111,6 +111,7 @@ public class SendRedPacketActivity extends BaseActivity {
public List<UserInfo> listmemebers = new ArrayList<>();
private ActivityResultLauncher launcher;
UserInfo userInfo;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
getWindow().setStatusBarColor(getResources().getColor(R.color.color_fcfcfc));
@@ -219,6 +220,7 @@ public class SendRedPacketActivity extends BaseActivity {
}
return result;
};
private void initGroup() {
teammodel.requestTeamData(getIntent().getStringExtra("receiverUid"));
teammodel.requestTeamMembers(getIntent().getStringExtra("receiverUid"));
@@ -440,6 +442,7 @@ public class SendRedPacketActivity extends BaseActivity {
}
if (isGroup) {
if (isPinShouQi) {
float number = Float.parseFloat(viewBinding.numberHintEt.getText().toString().trim()) * 100;
if (number / Integer.parseInt(viewBinding.sizeHintEt.getText().toString().trim()) < 1) {
ToastX.showShortToast(R.string.dghbjebnsy_txt);
@@ -461,7 +464,7 @@ public class SendRedPacketActivity extends BaseActivity {
return;
}
}
} else {
// if (Float.parseFloat(viewBinding.numberHintEt.getText().toString().trim()) > IMUIKitConfig.SINGLE_MAX_MONEY) {
//// ToastUtils.showShort(String.format(getString(R.string.max_red_packet_tips_txt),getString(R.string.danwei_txt),Const.SINGLE_MAX_MONEY));
@@ -743,6 +746,7 @@ public class SendRedPacketActivity extends BaseActivity {
if (isJinBi) {
viewBinding.tvLogin.setBackgroundResource(R.drawable.logout_btn_z_88);
if (isGroup) {
if (isPinShouQi) {
if (!TextUtils.isEmpty(viewBinding.numberHintEt.getText().toString().trim()) && !TextUtils.isEmpty(viewBinding.sizeHintEt.getText().toString().trim())) {
viewBinding.tvLogin.setBackgroundResource(R.drawable.logout_btn_red);
}
@@ -751,6 +755,11 @@ public class SendRedPacketActivity extends BaseActivity {
viewBinding.tvLogin.setBackgroundResource(R.drawable.logout_btn_red);
}
}
} else {
if (!TextUtils.isEmpty(viewBinding.numberHintEt.getText().toString().trim())) {
viewBinding.tvLogin.setBackgroundResource(R.drawable.logout_btn_red);
}
}
} else {
viewBinding.tvLogin.setBackgroundResource(R.drawable.logout_btn_z_88);
if (isGroup) {
@@ -816,8 +825,7 @@ public class SendRedPacketActivity extends BaseActivity {
private void toChange(String position, float number, int type) {
if (isGroup) {
HashMap<String, Object> maps = new HashMap<>();
maps.put("type", isPinShouQi ? 0 : 1);
maps.put("count", viewBinding.sizeHintEt.getText().toString().trim());
maps.put("type", isPinShouQi ? 0 : 2);
maps.put("amount", (int) (number * 100));
maps.put("senderUid", Integer.parseInt(IMKitClient.account()));
maps.put("groupId", getIntent().getStringExtra("receiverUid"));
@@ -830,6 +838,16 @@ public class SendRedPacketActivity extends BaseActivity {
} else {
maps.put("remark", getString(R.string.remarks_hit_txt));
}
if (!isPinShouQi) {
maps.put("userUid", userInfo.getAccount());
maps.put("count", "1");
} else {
maps.put("count", viewBinding.sizeHintEt.getText().toString().trim());
}
maps.put("coinType", isJinBi ? 0 : 1);
if (!TextUtils.isEmpty(IMUIKitConfig.SUBSTATIONID)) {
maps.put("substationId", IMUIKitConfig.SUBSTATIONID);
@@ -843,32 +861,19 @@ public class SendRedPacketActivity extends BaseActivity {
@Override
public void onSuccess(Result<RedpacketGroupBean> feedbackResp) {
RedpacketGroupBean groupBean = feedbackResp.data;
//Long id, Integer status, Integer amount, Integer senderUid, String groupId,
// Integer count, Integer residualCount, Integer residualAmount, String sendTime,
// String finishTime, String remark, String senderNickname, Integer coinType,
// List<GrabbersBean> grabbers, Integer receiverUid, String receiveTime
List<GrabbersBean1> grabbersBean1List = null;
if (groupBean.getGrabbers() != null && groupBean.getGrabbers().size() > 0) {
//String redEnvelopeId, String grabberUid, String grabAmount, String grabTime, String grabberNickname, String grabberAvatar
grabbersBean1List = new ArrayList<>();
for (GrabbersBean grabbersBean : groupBean.getGrabbers())
grabbersBean1List.add(new GrabbersBean1(grabbersBean.getRedEnvelopeId() + "", grabbersBean.getGrabberUid() + "",
grabbersBean.getGrabAmount() + "", grabbersBean.getGrabTime() + "", grabbersBean.getGrabberNickname(), grabbersBean.getGrabberAvatar()));
}
RedPacketAttachment redPacketAttachment = new RedPacketAttachment(groupBean.getId() + "", groupBean.getStatus() + "", groupBean.getAmount() + "",
groupBean.getSenderUid() + "", groupBean.getGroupId(),
groupBean.getCount() + "", groupBean.getResidualCount() + "", groupBean.getResidualAmount() + "", groupBean.getSendTime(),
groupBean.getFinishTime(), groupBean.getRemark(), groupBean.getSenderNickname(), groupBean.getCoinType() + "",
null, null);
//{"amount":"1000","coinType":"0","count":"2","groupId":"38605640048","id":"1917033242059538434",
// "isCashGift":"0","remark":"恭喜发财,大吉大利","residualAmount":"1000","residualCount":"2",
// "sendTime":"2025-04-29 09:48:36","senderNickname":"特朗普",
// "senderUid":"61330233","status":"0","type":1005}
if (!isPinShouQi) {
redPacketAttachment = new RedPacketAttachment(groupBean.getId() + "", groupBean.getStatus() + "", groupBean.getAmount() + "",
groupBean.getSenderUid() + "", groupBean.getGroupId(),
groupBean.getCount() + "", groupBean.getResidualCount() + "", groupBean.getResidualAmount() + "", groupBean.getSendTime(),
groupBean.getFinishTime(), groupBean.getRemark(), groupBean.getSenderNickname(), groupBean.getCoinType() + "",
userInfo.getAccount(), null, userInfo.getAvatar());
}
toShareMessageGroup(redPacketAttachment);
}

View File

@@ -42,7 +42,6 @@
android:id="@+id/price_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dp_10"
android:text="-22.00"
android:textColor="@color/black"
android:textSize="@dimen/sp_14" />
@@ -51,6 +50,7 @@
android:id="@+id/item_type_iv"
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:visibility="gone"
android:src="@mipmap/wallet_jinbi_img" />
</LinearLayout>

View File

@@ -343,7 +343,7 @@
<string name="tebiezhuanzhu_txt">特别关注</string>
<string name="nmhmylg_txt">你们还没有聊过哦~</string>
<string name="myltjl_txt">还没有聊天记录哦~</string>
<string name="to_wallet_send_redpack_txt">已存入Cash余额,点击查看></string>
<string name="to_wallet_send_redpack_txt">已存入余额,点击查看></string>
<string name="to_wallet_send_redpack_txt_lipin">已存入礼品积分余额,點擊查看></string>
<string name="species_txt">Cash</string>
<string name="jifen_txt">积分</string>
@@ -389,7 +389,7 @@
<string name="hbygq_txt">红包已过期</string>
<string name="hbyblq_txt">红包已被领取</string>
<string name="ddfglq_txt">等待对方领取</string>
<string name="red_envelope_issued_txt">发出的Cash红包</string>
<string name="red_envelope_issued_txt">发出的红包</string>
<string name="red_envelope_issued_txt1">发出的礼品积分红包</string>
<string name="red_envelope_issued_txt2">发出的礼金红包</string>
<string name="wo_txt"></string>
@@ -497,16 +497,16 @@
<string name="shenqi_topup_txt">發發發充值</string>
<string name="shenqi_with_txt">發發發提现</string>
<string name="weizhi_txt">未知</string>
<string name="jinbihongbao_tuikuan_txt">Cash红包-退还</string>
<string name="jinbihongbao_laizi_txt">Cash红包-来自</string>
<string name="jinbihongbao_wfg_txt">Cash红包-我发给</string>
<string name="jinbihongbao_tuikuan_txt">红包-退还</string>
<string name="jinbihongbao_laizi_txt">红包-来自</string>
<string name="jinbihongbao_wfg_txt">红包-我发给</string>
<string name="jinbizhuanzhang_tk_txt">Cash赠送-退还</string>
<string name="jinbizhuanzhang_laizi_txt">Cash赠送-来自</string>
<string name="jinbizhuanzhang_wofagei_txt">Cash赠送-我发给</string>
<string name="jinbiqunhongbao_tuikuan_txt">Cash群红包-退还</string>
<string name="jinbiqunhongbao_txt">Cash群红包</string>
<string name="jinbiqunhongbao_wfg_txt">Cash群红包-我发给</string>
<string name="jinbiqunhb_laizi_txt">Cash群红包-来自</string>
<string name="jinbiqunhongbao_tuikuan_txt">群红包-退还</string>
<string name="jinbiqunhongbao_txt">群红包</string>
<string name="jinbiqunhongbao_wfg_txt">群红包-我发给</string>
<string name="jinbiqunhb_laizi_txt">群红包-来自</string>
<string name="jinbichongzhi_f_bank_txt">Cash充值-来自储值兑币机</string>
<string name="yijujue_txt">已拒绝</string>
<string name="s_to_g_txt">礼品积分转Cash</string>

View File

@@ -36,6 +36,7 @@ public class RedPacketAttachment extends CustomAttachment {
private String receiverUid;
private String receiveTime;
private String isCashGift; //礼金
private String receiverNickname;
public RedPacketAttachment() {
super(ChatMessageType.CUSTOM_STICKER_RED_ENVELOPE);
@@ -66,6 +67,40 @@ public class RedPacketAttachment extends CustomAttachment {
}
public RedPacketAttachment(String id, String status, String amount, String senderUid, String groupId,
String count, String residualCount, String residualAmount, String sendTime,
String finishTime, String remark, String senderNickname, String coinType,
String receiverUid, String receiveTime,String receiverNickname) {
super(ChatMessageType.CUSTOM_STICKER_RED_ENVELOPE);
this.id = id;
this.status = status;
this.amount = amount;
this.senderUid = senderUid;
this.groupId = groupId;
this.count = count;
this.residualCount = residualCount;
this.residualAmount = residualAmount;
this.sendTime = sendTime;
this.finishTime = finishTime;
this.remark = remark;
this.senderNickname = senderNickname;
this.coinType = coinType;
this.isCashGift = (coinType.equals("2") ? "1" : "0");
// this.grabbers = grabbers;
this.receiverUid = receiverUid;
this.receiveTime = receiveTime;
this.receiverNickname = receiverNickname;
}
public String getReceiverNickname() {
return receiverNickname;
}
public void setReceiverNickname(String receiverNickname) {
this.receiverNickname = receiverNickname;
}
public String getIsCashGift() {
return isCashGift;
}
@@ -237,6 +272,7 @@ public class RedPacketAttachment extends CustomAttachment {
// data.put("grabbers",grabbers);
data.put("receiverUid", receiverUid);
data.put("receiveTime", receiveTime);
data.put("receiverNickname", receiverNickname);
} catch (Exception exception) {
@@ -265,6 +301,7 @@ public class RedPacketAttachment extends CustomAttachment {
// this.grabbers = (List<GrabbersBean1>) data.getJSONArray("grabbers");
this.receiverUid = data.getString("receiverUid");
this.receiveTime = data.getString("receiveTime");
this.receiverNickname = data.getString("receiverNickname");
} catch (Exception exception) {

View File

@@ -14,12 +14,16 @@ import android.view.View;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.netease.nim.highavailable.LogUtils;
import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.uinfo.UserService;
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.netease.yunxin.kit.alog.ALog;
import com.netease.yunxin.kit.chatkit.model.UserInfoWithTeam;
import com.netease.yunxin.kit.chatkit.repo.TeamRepo;
import com.netease.yunxin.kit.chatkit.ui.R;
import com.netease.yunxin.kit.chatkit.ui.common.ChatDataUtils;
import com.netease.yunxin.kit.chatkit.ui.common.GsonUtils;
@@ -45,6 +49,11 @@ import com.netease.yunxin.kit.chatkit.ui.page.fragment.ChatBaseFragment;
import com.netease.yunxin.kit.chatkit.ui.view.message.viewholder.ChatBaseMessageViewHolder;
import com.netease.yunxin.kit.common.ui.utils.ToastX;
import com.netease.yunxin.kit.corekit.im.IMKitClient;
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.util.List;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
@@ -77,6 +86,9 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
Log.i("名片", "名片获取到的数据0" + name);
Log.i("名片", "名片获取到的数据2" + GsonUtils.beanToJSONString(circleShareBean));
//{"data":{"amount":"1000","coinType":"0","count":"1","groupId":"38605640048","id":"1917130493314334722","receiverUid":"61330236","remark":"恭喜发财,大吉大利","residualAmount":"1000",
// "residualCount":"1","sendTime":"2025-04-29 16:15:03","senderNickname":"特朗普",
// "senderUid":"61330233","status":"0"},"type":1005}
if (circleShareBean != null) {
if (TextUtils.isEmpty(circleShareBean.data.getRemark())) {
@@ -108,9 +120,9 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
Log.i("名片", "名片获取到的数据3" + GsonUtils.beanToJSONString(circleShareBean));
changeInfo(circleShareBean.data, binding, message, null, null);
if(status == 0) {
getRedInfo(circleShareBean.data, binding, message, false);
}
if (!message.getMessageData().getMessage().getFromAccount().equals(IMKitClient.account())) {
baseViewBinding.otherUserAvatar.setVisibility(View.VISIBLE);
}
@@ -200,8 +212,18 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
ChatDataUtils.set(binding.bigLy.getContext(), "redpack_" + feedbackResp.data.getId(), feedbackResp.data.getStatus());
if (isTopRed && feedbackResp.data.getStatus() > 0)
RxBus.getInstance().post(new RxHongBaoBean(feedbackResp.data.getId() + ""));
changeInfo(RedpacketBean1.getRedpacket(feedbackResp.data), binding, message, null, feedbackResp.data);
RedpacketBean1 redpacketBean1 = RedpacketBean1.getRedpacket(feedbackResp.data);
if(!TextUtils.isEmpty(data.getReceiverUid())){
redpacketBean1.setReceiverUid(data.getReceiverUid());
}
changeInfo(redpacketBean1, binding, message, null, feedbackResp.data);
// if(feedbackResp.data.getType() == 2){
// binding.mingpianTv.setText("专属红包");
// }
if (isTopRed) {
if(!TextUtils.isEmpty(data.getReceiverUid())){
feedbackResp.data.setReceiverUid(data.getReceiverUid());
}
toTiaozhuanGroup(feedbackResp.data, message);
}
}
@@ -223,8 +245,18 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
ChatDataUtils.set(binding.bigLy.getContext(), "redpack_" + feedbackResp.data.getId(), feedbackResp.data.getStatus());
if (isTopRed && feedbackResp.data.getStatus() > 0)
RxBus.getInstance().post(new RxHongBaoBean(feedbackResp.data.getId() + ""));
changeInfo(RedpacketBean1.getRedpacket(feedbackResp.data), binding, message, null, feedbackResp.data);
RedpacketBean1 redpacketBean1 = RedpacketBean1.getRedpacket(feedbackResp.data);
if(!TextUtils.isEmpty(data.getReceiverUid())){
redpacketBean1.setReceiverUid(data.getReceiverUid());
}
changeInfo(redpacketBean1, binding, message, null, feedbackResp.data);
if(feedbackResp.data.getType() == 2){
binding.mingpianTv.setText("专属红包");
}
if (isTopRed) {
if(!TextUtils.isEmpty(data.getReceiverUid())){
feedbackResp.data.setReceiverUid(data.getReceiverUid());
}
toTiaozhuanGroup(feedbackResp.data, message);
}
}
@@ -310,8 +342,19 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
private void changeInfo(RedpacketBean1 data, RedpacketViewheadBinding binding, ChatMessageBean message, RedpacketBean redpacketBean, RedpacketGroupBean redpacketGroupBean) {
LogUtils.i("红包类型", "名片获取到的数据红包类型:" + data.getCoinType());
LogUtils.i("红包类型", "名片获取到的数据红包类型1" + GsonUtils.beanToJSONString(data));
if (data.getCoinType().equals("0")) {
binding.mingpianTv.setText(binding.mingpianTv.getResources().getString(R.string.hongbao_des_txt));
binding.mingpianTv.setText("拼手气红包");
if(!TextUtils.isEmpty(data.getReceiverUid())){
LogUtils.i("红包类型", "名片获取到的数据红包类型2" + GsonUtils.beanToJSONString(data));
binding.mingpianTv.setText("专属红包");
getTeamInfos(binding.itemTitleTv,data.getGroupId(),data.getReceiverUid());
}
if (Integer.parseInt(data.getStatus()) > 0) {
binding.bigLy.setBackgroundResource(R.drawable.hongbnao_f_g);
} else {
@@ -344,6 +387,33 @@ public class RedPacketViewHolder extends ChatBaseMessageViewHolder {
setStatusView(binding.layoutHongbao.getVisibility() == View.VISIBLE ? binding.itemStatusTv : binding.tvLijinstatus, data, message, redpacketGroupBean);
}
private void getTeamInfos(TextView itemTitleTv,String groupId, String receiverUid) {
TeamRepo.getMemberInfo(
groupId,
receiverUid,
new FetchCallback<UserInfoWithTeam>() {
@Override
public void onFailed(int i) {
itemTitleTv.setText(""+receiverUid+"的专属红包");
}
@Override
public void onException(@Nullable Throwable throwable) {
itemTitleTv.setText(""+receiverUid+"的专属红包");
}
@Override
public void onSuccess(@Nullable UserInfoWithTeam userInfoWithTeam) {
itemTitleTv.setText(""+userInfoWithTeam.getName()+"的专属红包");
}
});
}
public void setStatusView(TextView tvstatus, RedpacketBean1 data, ChatMessageBean message, RedpacketGroupBean redpacketGroupBean) {
switch (data.getStatus()) {
case "0":

View File

@@ -27,7 +27,9 @@ import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum;
import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.netease.nimlib.sdk.uinfo.UserService;
import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import com.netease.yunxin.kit.chatkit.model.UserInfoWithTeam;
import com.netease.yunxin.kit.chatkit.repo.ChatRepo;
import com.netease.yunxin.kit.chatkit.repo.TeamRepo;
import com.netease.yunxin.kit.chatkit.ui.R;
import com.netease.yunxin.kit.chatkit.ui.common.ChatDataUtils;
import com.netease.yunxin.kit.chatkit.ui.common.GsonUtils;
@@ -193,6 +195,15 @@ public class RedPacketDialog extends Dialog {
}
remarksTv.setText(redpacketGroupBean.getRemark());
remarksTvGift.setText(redpacketGroupBean.getRemark());
if(redpacketGroupBean.getType()==2){
if(!redpacketGroupBean.getReceiverUid().equals(IMKitClient.account())){
getTeamInfos(remarksTv,redpacketGroupBean.getGroupId(),redpacketGroupBean.getReceiverUid());
openIv.setVisibility(View.GONE);
}
}
} else {
remarksTv.setText(tuiMessageBean.getRemark());
}
@@ -243,6 +254,31 @@ public class RedPacketDialog extends Dialog {
}
private void getTeamInfos(TextView itemTitleTv,String groupId, String receiverUid) {
TeamRepo.getMemberInfo(
groupId,
receiverUid,
new FetchCallback<UserInfoWithTeam>() {
@Override
public void onFailed(int i) {
itemTitleTv.setText(""+receiverUid+"可领取");
}
@Override
public void onException(@Nullable Throwable throwable) {
itemTitleTv.setText(""+receiverUid+"可领取");
}
@Override
public void onSuccess(@Nullable UserInfoWithTeam userInfoWithTeam) {
itemTitleTv.setText(""+userInfoWithTeam.getName()+"可领取");
}
});
}
private void toDetails() {
if (tuiMessageBean != null) {
dismiss();
@@ -449,21 +485,11 @@ public class RedPacketDialog extends Dialog {
if ((feedbackResp.data.getGrabbers().get(i).getGrabberUid() + "").equals(IMKitClient.account())) {
numberTv.setText(String.format("%.2f", feedbackResp.data.getGrabbers().get(i).getGrabAmount() / 100f));
numberTvGift.setText(String.format("%.2f", feedbackResp.data.getGrabbers().get(i).getGrabAmount() / 100f));
// danweiTv.setText(getContext().getResources().getString(R.string.danwei_txt));
}
}
ChatDataUtils.set(getContext(), "redpack_" + redpacketGroupBean.getId(), redpacketGroupBean.getStatus());
// List<GrabbersBean1> grabbersBean1List = null;
// if(redpacketGroupBean.getGrabbers()!=null&&redpacketGroupBean.getGrabbers().size()>0){
// //String redEnvelopeId, String grabberUid, String grabAmount, String grabTime, String grabberNickname, String grabberAvatar
// grabbersBean1List = new ArrayList<>();
// for (GrabbersBean grabbersBean:redpacketGroupBean.getGrabbers())
// grabbersBean1List.add(new GrabbersBean1(grabbersBean.getRedEnvelopeId()+"",grabbersBean.getGrabberUid()+"",
// grabbersBean.getGrabAmount()+"",grabbersBean.getGrabTime()+"",grabbersBean.getGrabberNickname(),grabbersBean.getGrabberAvatar()));
// }
RedPacketGetAttachment redPacketAttachment = new RedPacketGetAttachment(redpacketGroupBean.getId() + "", redpacketGroupBean.getStatus() + "", redpacketGroupBean.getAmount() + "",
redpacketGroupBean.getSenderUid() + "", groupId,
redpacketGroupBean.getCount() + "", redpacketGroupBean.getResidualCount() + "", redpacketGroupBean.getResidualAmount() + "", redpacketGroupBean.getSendTime(),

View File

@@ -94,6 +94,8 @@ public class RedpacketBean1 implements Serializable {
redpacketBean.setResidualAmount(redpacketBean1.getResidualAmount()+"");
redpacketBean.setFinishTime(redpacketBean1.getFinishTime());
redpacketBean.setSenderNickname(redpacketBean1.getSenderNickname());
redpacketBean.setReceiverUid(redpacketBean1.getReceiverUid());
// if(redpacketBean1.getGrabbers()!=null) {
// redpacketBean.setGrabbers(GsonUtils.beanToJSONString(redpacketBean1.getGrabbers()));
// }

View File

@@ -23,6 +23,15 @@ public class RedpacketGroupBean implements Serializable {
private String senderNickname;
private Integer coinType;
private List<GrabbersBean> grabbers;
private String receiverUid;
public String getReceiverUid() {
return receiverUid;
}
public void setReceiverUid(String receiverUid) {
this.receiverUid = receiverUid;
}
public Integer getCoinType() {
return coinType;

View File

@@ -60,6 +60,7 @@ public interface ApiService {
String SUBSTATIONID = "1703655363476242434";
// String SUBSTATIONID = "";
String SUBSTATIONID1 = "1703655363476242434";
/**
* 抢群红包

View File

@@ -39,7 +39,6 @@
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:text="来自 黄黄不是嬛嬛 的赠送"
android:textColor="#FFFEE3"
android:textSize="14sp" />
@@ -52,7 +51,6 @@
android:ellipsize="end"
android:gravity="center_vertical"
android:lines="1"
android:text="待領取"
android:textColor="#FEE391"
android:textSize="12sp" />
</LinearLayout>