1:红包发布和打开
2:抢最标准的红包
This commit is contained in:
@@ -2,6 +2,7 @@ package com.example.moduleroom.activity;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import com.alibaba.android.arouter.facade.annotation.Autowired;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RedAdapter;
|
||||
@@ -13,32 +14,46 @@ import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.RedpacketDetail;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/29
|
||||
*@description:红包最终的展示页面
|
||||
* @author qx
|
||||
* @data 2025/9/29
|
||||
* @description:红包最终的展示页面
|
||||
*/
|
||||
@Route(path = ARouteConstants.ROOM_RED_RESULT)
|
||||
public class RedResultActivity extends BaseMvpActivity<RedEnvelopesPresenter, FragmentRedBinding> implements RedEnvelopesContacts.View {
|
||||
|
||||
private RedViewModel mViewModel;
|
||||
private RedAdapter redAdapter;
|
||||
private int page=1;
|
||||
private int page = 1;
|
||||
private String redpacketId;
|
||||
|
||||
public static RedResultActivity newInstance() {
|
||||
return new RedResultActivity();
|
||||
// public static RedResultActivity newInstance() {
|
||||
// return new RedResultActivity();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
redpacketId = getIntent().getStringExtra("redpacketId");
|
||||
if (redpacketId == null || redpacketId.isEmpty()) {
|
||||
// 处理红包ID为空的情况
|
||||
return;
|
||||
}
|
||||
if (MvpPre==null){
|
||||
MvpPre = new RedEnvelopesPresenter(this, this);
|
||||
}
|
||||
MvpPre.getRedpacketDetail(redpacketId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RedEnvelopesPresenter bindPresenter() {
|
||||
return new RedEnvelopesPresenter( this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
return new RedEnvelopesPresenter(this, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +73,7 @@ public class RedResultActivity extends BaseMvpActivity<RedEnvelopesPresenter, Fr
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
|
||||
page=1;
|
||||
page = 1;
|
||||
// MvpPre.getRoomHourRanking(page+"", "20");
|
||||
}
|
||||
|
||||
@@ -75,4 +90,17 @@ public class RedResultActivity extends BaseMvpActivity<RedEnvelopesPresenter, Fr
|
||||
return R.layout.fragment_red;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void redPacketDetail(RedpacketDetail redpacketDetail) {
|
||||
if (redpacketDetail != null) {
|
||||
ImageUtils.loadHeadCC(redpacketDetail.getMy_record().getAvatar(), mBinding.userAvatar);
|
||||
mBinding.userName.setText(redpacketDetail.getMy_record().getNickname());
|
||||
mBinding.tvRedTitle.setText(redpacketDetail.getRedPacket_info().getRemark());
|
||||
mBinding.tvRedJb.setText(redpacketDetail.getMy_record().getAmount());
|
||||
mBinding.tvJb.setText(redpacketDetail.getRedPacket_info().getCoin_type() == 1 ? "金币" : "钻石");
|
||||
mBinding.tvLq.setText(redpacketDetail.getRecords().size() + "/" + redpacketDetail.getRedPacket_info().getTotal_count());
|
||||
|
||||
redAdapter.setNewData(redpacketDetail.getRecords());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,21 +4,30 @@ import android.view.View;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.RedpacketDetail;
|
||||
import com.xscm.moduleutil.bean.room.RedResultBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomHourBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
public class RedAdapter extends BaseQuickAdapter<RedResultBean.RedBean, BaseViewHolder> {
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class RedAdapter extends BaseQuickAdapter<RedpacketDetail.Records, BaseViewHolder> {
|
||||
public RedAdapter() {
|
||||
super(R.layout.item_red);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder baseViewHolder, RedResultBean.RedBean redBean) {
|
||||
ImageUtils.loadHeadCC(redBean.getRedUserAvatar(), baseViewHolder.getView(R.id.red_user_avatar));
|
||||
baseViewHolder.setText(R.id.tv_user_name, redBean.getRedUserName());
|
||||
baseViewHolder.setText(R.id.tv_red_num, redBean.getRedNum()+"");
|
||||
baseViewHolder.setText(R.id.tv_time, redBean.getRedTime());
|
||||
protected void convert(BaseViewHolder baseViewHolder,RedpacketDetail.Records redBean) {
|
||||
ImageUtils.loadHeadCC(redBean.getAvatar(), baseViewHolder.getView(R.id.red_user_avatar));
|
||||
baseViewHolder.setText(R.id.tv_user_name, redBean.getNickname());
|
||||
baseViewHolder.setText(R.id.tv_red_num, redBean.getAmount());
|
||||
baseViewHolder.setText(R.id.tv_time, formatTimestamp(Long.getLong(redBean.getCreatetime())));
|
||||
}
|
||||
|
||||
private String formatTimestamp(long timestamp) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
return sdf.format(new Date(timestamp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,18 @@ package com.example.moduleroom.adapter;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
|
||||
/**
|
||||
* 红包的列表适配器
|
||||
*/
|
||||
public class RedBagAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
|
||||
public class RedBagAdapter extends BaseQuickAdapter<RedPacketInfo, BaseViewHolder> {
|
||||
public RedBagAdapter() {
|
||||
super(R.layout.item_red_bag);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, String item) {
|
||||
protected void convert(BaseViewHolder helper, RedPacketInfo item) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,8 +71,8 @@ public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBea
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomBgImage:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_bg_image;
|
||||
// 更多操作
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomLeave:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_leave;
|
||||
// case RoomSettingBean.QXRoomSettingTypeRoomLeave:
|
||||
// return com.xscm.moduleutil.R.mipmap.ic_leave;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomShare:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_share;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomMyDress:
|
||||
@@ -87,8 +87,8 @@ public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBea
|
||||
return com.xscm.moduleutil.R.mipmap.ic_report;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||
return b ? com.xscm.moduleutil.R.mipmap.ic_close_floating_screen : com.xscm.moduleutil.R.mipmap.ic_open_floating_screen;
|
||||
// case RoomSettingBean.QXRoomSettingTypeRoomFloatingRed:
|
||||
// return com.xscm.moduleutil.R.mipmap.red_tx;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomFloatingRed:
|
||||
return com.xscm.moduleutil.R.mipmap.red_tx;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,14 @@ package com.example.moduleroom.contacts;
|
||||
import android.app.Activity;
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.RedpacketDetail;
|
||||
|
||||
public class RedEnvelopesContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
void redPacketDetail(RedpacketDetail redpacketDetail);
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
|
||||
void getRedpacketDetail(String redpacketId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.example.moduleroom.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@@ -11,9 +13,15 @@ import androidx.annotation.NonNull;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.databinding.DialogRedBagSendBinding;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -25,13 +33,15 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
private int type;//这是第一个页面,发送红包的第一个页面,默认为1,第二个页面,是2,点击查看帮助,是type=3
|
||||
private int stype;//当前是哪个页面:1:默认第一个页面, 2:选择条件页面
|
||||
|
||||
private int redType;//红包类型 0:普通红包 1:口令红包
|
||||
private int redType;//红包类型 1:普通红包 2:口令红包
|
||||
private int redTime;//开奖倒计时 0:立刻 1:1分钟;2:2分钟;5:5分钟 10:10分钟(这里传递给服务的时候,需要乘60)
|
||||
private int redGold;//红包类型 0:金币红包 1:钻石红包
|
||||
private int redGold=1;//红包类型 0:金币红包 1:钻石红包
|
||||
private int redCount;//条件 0:无 1:收藏房间 2:仅麦上用户
|
||||
private String roomId;
|
||||
|
||||
public RedBagSendDialog(@NonNull @NotNull Context context) {
|
||||
public RedBagSendDialog(@NonNull @NotNull Context context, String roomId ) {
|
||||
super(context, com.xscm.moduleutil.R.style.BaseDialogStyleH);
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,14 +59,16 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 345.f / 345), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
setView(1);
|
||||
mBinding.edText.setKeyListener(DigitsKeyListener.getInstance("0123456789"));
|
||||
mBinding.etNum.setKeyListener(DigitsKeyListener.getInstance("0123456789"));
|
||||
mBinding.imHelp.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (type!=3){
|
||||
if (type != 3) {
|
||||
setView(3);
|
||||
setWebView("https://www.baidu.com");
|
||||
}else {
|
||||
} else {
|
||||
setView(stype);
|
||||
}
|
||||
}
|
||||
@@ -72,11 +84,48 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
mBinding.butSub.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mBinding.butSub.getText().equals("下一步")){
|
||||
if (mBinding.butSub.getText().equals("下一步")) {
|
||||
setView(2);
|
||||
setFRed();
|
||||
}else {
|
||||
} else {
|
||||
// 验证输入
|
||||
String numStr = mBinding.etNum.getText().toString().trim();
|
||||
String textStr = mBinding.edText.getText().toString().trim();
|
||||
|
||||
// 检查是否为空
|
||||
if (TextUtils.isEmpty(numStr)) {
|
||||
ToastUtils.show("请输入数量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(textStr)) {
|
||||
ToastUtils.show("请输入金额");
|
||||
return;
|
||||
}
|
||||
if (redType==2){
|
||||
if (TextUtils.isEmpty(mBinding.evKl.getText().toString().trim())){
|
||||
ToastUtils.show("请输入口令");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为数字并比较
|
||||
try {
|
||||
int num = Integer.parseInt(numStr);
|
||||
int text = Integer.parseInt(textStr);
|
||||
|
||||
if (text <= num) {
|
||||
ToastUtils.show("金额必须大于数量");
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证通过,继续发送红包逻辑
|
||||
sendRedPacket();
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
ToastUtils.show("请输入有效的数字");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -84,11 +133,11 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId==R.id.bt_pt){
|
||||
redType=0;
|
||||
if (checkedId == R.id.bt_pt) {
|
||||
redType = 1;
|
||||
mBinding.lKl.setVisibility(GONE);
|
||||
}else if (checkedId==R.id.bt_kl){
|
||||
redType=1;
|
||||
} else if (checkedId == R.id.bt_kl) {
|
||||
redType = 2;
|
||||
mBinding.lKl.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -97,16 +146,16 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
mBinding.rgDjs.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId==R.id.rb_lk){
|
||||
redTime=0;
|
||||
}else if (checkedId==R.id.rb_1){
|
||||
redTime=1*60;
|
||||
}else if (checkedId==R.id.rb_2){
|
||||
redTime=2*60;
|
||||
}else if (checkedId==R.id.rb_5){
|
||||
redTime=5*60;
|
||||
}else if (checkedId==R.id.rb_10){
|
||||
redTime=10*60;
|
||||
if (checkedId == R.id.rb_lk) {
|
||||
redTime = 0;
|
||||
} else if (checkedId == R.id.rb_1) {
|
||||
redTime = 1 * 60;
|
||||
} else if (checkedId == R.id.rb_2) {
|
||||
redTime = 2 * 60;
|
||||
} else if (checkedId == R.id.rb_5) {
|
||||
redTime = 5 * 60;
|
||||
} else if (checkedId == R.id.rb_10) {
|
||||
redTime = 10 * 60;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -122,7 +171,7 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
// 钻石红包恢复默认样式
|
||||
mBinding.rbDiamond.setTextColor(Color.parseColor("#FFC9C7"));
|
||||
mBinding.rbDiamond.setBackgroundResource(com.xscm.moduleutil.R.drawable.selector_red_bag_type_button);
|
||||
redGold=0;
|
||||
redGold = 1;
|
||||
} else if (checkedId == R.id.rb_diamond) {
|
||||
// 选中钻石红包:文字白色,背景透明
|
||||
mBinding.rbDiamond.setTextColor(Color.parseColor("#D01717"));
|
||||
@@ -131,20 +180,20 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
// 金币红包恢复默认样式
|
||||
mBinding.rbGold.setTextColor(Color.parseColor("#FFC9C7"));
|
||||
mBinding.rbGold.setBackgroundResource(com.xscm.moduleutil.R.drawable.selector_red_bag_type_button);
|
||||
redGold=1;
|
||||
redGold =2;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 设置点击监听器
|
||||
mBinding.btNone.setOnClickListener(new View.OnClickListener() {
|
||||
mBinding.btNone.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 点击"无"时,取消其他所有选项的选中状态
|
||||
mBinding.btFavoriteRoom.setSelected(false);
|
||||
mBinding.btMicUser.setSelected(false);
|
||||
// 切换"无"的选中状态
|
||||
mBinding.btNone.setSelected(! mBinding.btNone.isSelected());
|
||||
mBinding.btNone.setSelected(!mBinding.btNone.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -152,11 +201,11 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 如果"无"被选中,则先取消"无"的选中状态
|
||||
if ( mBinding.btNone.isSelected()) {
|
||||
if (mBinding.btNone.isSelected()) {
|
||||
mBinding.btNone.setSelected(false);
|
||||
}
|
||||
// 切换当前按钮的选中状态
|
||||
mBinding.btFavoriteRoom.setSelected(! mBinding.btFavoriteRoom.isSelected());
|
||||
mBinding.btFavoriteRoom.setSelected(!mBinding.btFavoriteRoom.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,16 +213,78 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 如果"无"被选中,则先取消"无"的选中状态
|
||||
if ( mBinding.btNone.isSelected()) {
|
||||
if (mBinding.btNone.isSelected()) {
|
||||
mBinding.btNone.setSelected(false);
|
||||
}
|
||||
// 切换当前按钮的选中状态
|
||||
mBinding.btMicUser.setSelected(!mBinding.btMicUser.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
private void sendRedPacket() {
|
||||
// 获取输入值
|
||||
String numStr = mBinding.etNum.getText().toString().trim();
|
||||
String textStr = mBinding.edText.getText().toString().trim();
|
||||
String kl = "";
|
||||
|
||||
if (redType == 2) {
|
||||
kl = mBinding.evKl.getText().toString().trim();
|
||||
}
|
||||
|
||||
// 验证输入
|
||||
if (TextUtils.isEmpty(numStr)) {
|
||||
ToastUtils.show("请输入数量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(textStr)) {
|
||||
ToastUtils.show("请输入金额");
|
||||
return;
|
||||
}
|
||||
|
||||
if (redType == 2 && TextUtils.isEmpty(kl)) {
|
||||
ToastUtils.show("请输入口令");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
int num = Integer.parseInt(numStr);
|
||||
int text = Integer.parseInt(textStr);
|
||||
|
||||
if (text <= num) {
|
||||
ToastUtils.show("金额必须大于数量");
|
||||
return;
|
||||
}
|
||||
|
||||
// 发送红包
|
||||
RetrofitClient.getInstance().redPacketCreate(
|
||||
redType,
|
||||
kl,
|
||||
redGold,
|
||||
textStr,
|
||||
numStr,
|
||||
getSelectedConditions(),
|
||||
redTime + "",
|
||||
roomId,
|
||||
mBinding.edBz.getText().toString(),
|
||||
new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull String redPacketBean) {
|
||||
ToastUtils.show("发送成功");
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
ToastUtils.show("请输入有效的数字");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getSelectedConditions() {
|
||||
Button btNone = mBinding.llTj.findViewById(R.id.bt_none);
|
||||
Button btFavoriteRoom = mBinding.llTj.findViewById(R.id.bt_favorite_room);
|
||||
@@ -193,14 +304,25 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
}
|
||||
}
|
||||
|
||||
private WalletBean walletBean;
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
RetrofitClient.getInstance().wallet(new BaseObserver<WalletBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(WalletBean walletBeans) {
|
||||
walletBean = walletBeans;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setView(int types) {
|
||||
type=types;
|
||||
type = types;
|
||||
switch (types) {
|
||||
case 1:
|
||||
mBinding.clRedXz.setVisibility(VISIBLE);
|
||||
@@ -216,7 +338,7 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
mBinding.butSub.setVisibility(VISIBLE);
|
||||
mBinding.butSub.setText("下一步");
|
||||
mBinding.imHelp.setImageResource(com.xscm.moduleutil.R.drawable.room_redbag_help);
|
||||
stype=1;
|
||||
stype = 1;
|
||||
break;
|
||||
case 2:
|
||||
mBinding.clRedXz.setVisibility(GONE);
|
||||
@@ -232,7 +354,7 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
mBinding.butSub.setVisibility(VISIBLE);
|
||||
mBinding.butSub.setText("发红包");
|
||||
mBinding.imHelp.setImageResource(com.xscm.moduleutil.R.drawable.room_redbag_help);
|
||||
stype=2;
|
||||
stype = 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
@@ -260,12 +382,12 @@ public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
mBinding.wvWeb.loadUrl(url);
|
||||
}
|
||||
|
||||
private void setFRed(){
|
||||
if (redGold==0){
|
||||
mBinding.tvJeTitle.setText("-"+"金币可用");
|
||||
private void setFRed() {
|
||||
if (redGold == 1) {
|
||||
mBinding.tvJeTitle.setText(walletBean.getCoin() != null ? walletBean.getCoin() : "0" + "金币可用");
|
||||
mBinding.tvJ.setText("金币");
|
||||
}else if (redGold==1){
|
||||
mBinding.tvJeTitle.setText("-"+"钻石可用");
|
||||
} else if (redGold == 2) {
|
||||
mBinding.tvJeTitle.setText(walletBean.getEarnings() != null ? walletBean.getEarnings() : "0" + "钻石可用");
|
||||
mBinding.tvJ.setText("钻石");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,14 @@ import android.view.WindowManager;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RedBagAdapter;
|
||||
import com.example.moduleroom.databinding.DialogRedListBinding;
|
||||
import com.example.moduleroom.fragment.RedEnvelopesFragment;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.QXRedPacketManager;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -25,6 +29,7 @@ import java.util.List;
|
||||
public class RedListDialog extends BaseDialog<DialogRedListBinding> {
|
||||
|
||||
RedBagAdapter redBagAdapter;
|
||||
private QXRedPacketManager qxRedPacketManager;
|
||||
|
||||
public RedListDialog(@NonNull Context context) {
|
||||
super(context, com.xscm.moduleutil.R.style.BaseDialogStyleH);
|
||||
@@ -40,6 +45,7 @@ public class RedListDialog extends BaseDialog<DialogRedListBinding> {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
Window window = getWindow();
|
||||
qxRedPacketManager=QXRedPacketManager.getInstance();
|
||||
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.ivClose.setOnClickListener(v -> dismiss());
|
||||
@@ -113,19 +119,27 @@ public class RedListDialog extends BaseDialog<DialogRedListBinding> {
|
||||
// }
|
||||
// });
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
list.add("1");
|
||||
list.add("2");
|
||||
list.add("3");
|
||||
list.add("4");
|
||||
list.add("5");
|
||||
list.add("4");
|
||||
list.add("5");
|
||||
list.add("4");
|
||||
list.add("5");
|
||||
list.add("4");
|
||||
list.add("5");
|
||||
redBagAdapter.setNewData(list);
|
||||
redBagAdapter.setNewData(qxRedPacketManager.getAllRedPackets()) ;
|
||||
redBagAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
RedEnvelopesFragment redEnvelopesFragment = new RedEnvelopesFragment(getContext());
|
||||
redEnvelopesFragment.setRedPacket(qxRedPacketManager.getAllRedPackets().get(position));
|
||||
redEnvelopesFragment.show();
|
||||
|
||||
});
|
||||
|
||||
// List<String> list = new ArrayList<>();
|
||||
// list.add("1");
|
||||
// list.add("2");
|
||||
// list.add("3");
|
||||
// list.add("4");
|
||||
// list.add("5");
|
||||
// list.add("4");
|
||||
// list.add("5");
|
||||
// list.add("4");
|
||||
// list.add("5");
|
||||
// list.add("4");
|
||||
// list.add("5");
|
||||
// redBagAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -162,8 +162,8 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
dataList.add(new RoomSettingBean("背景图片", "ic_bg_image", null, null, RoomSettingBean.QXRoomSettingTypeRoomBgImage, read, isSelected, false, false));
|
||||
|
||||
dataList.add(new RoomSettingBean("更多操作", null, null, null, -1, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("发红包", "ic_red", null, null, RoomSettingBean.QXRoomSettingTypeRoomFloatingRed, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("离开房间", "ic_leave", null, null, RoomSettingBean.QXRoomSettingTypeRoomLeave, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("发红包", "ic_red", null, null, RoomSettingBean.QXRoomSettingTypeRoomFloatingRed, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("离开房间", "ic_leave", null, null, RoomSettingBean.QXRoomSettingTypeRoomLeave, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("分享房间", "ic_share", null, null, RoomSettingBean.QXRoomSettingTypeRoomShare, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("调音台", "ic_my_dress", null, null, RoomSettingBean.QXRoomSettingTypeRoomMyDress, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("房间设置", "ic_room_setting", null, null, RoomSettingBean.QXRoomSettingTypeRoomSetting, read, isSelected, false, false));
|
||||
@@ -263,9 +263,11 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
EventBus.getDefault().post(new MusicEvent());
|
||||
|
||||
dismiss();
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomLeave) {
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeSing) {
|
||||
}
|
||||
// else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomLeave) {
|
||||
// EventBus.getDefault().post(new RoomOutEvent());
|
||||
// }
|
||||
else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeSing) {
|
||||
// MvpPre.changeRoomType(roomId, "1");
|
||||
queren("1");
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction) {
|
||||
@@ -320,15 +322,15 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
}
|
||||
upAdapter();
|
||||
}
|
||||
// else if (bean.getType()==RoomSettingBean.QXRoomSettingTypeRoomFloatingRed){
|
||||
//
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).redDialogView();
|
||||
// }
|
||||
// dismiss();
|
||||
//
|
||||
//
|
||||
// }
|
||||
else if (bean.getType()==RoomSettingBean.QXRoomSettingTypeRoomFloatingRed){
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).redDialogView();
|
||||
}
|
||||
dismiss();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
@@ -395,7 +397,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
return true;
|
||||
}
|
||||
if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport
|
||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport || type == RoomSettingBean.QXRoomSettingTypeRoomFloatingRed
|
||||
) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -428,6 +430,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomReport ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomFloatingRed||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen;
|
||||
}
|
||||
|
||||
|
||||
@@ -889,6 +889,7 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
case 1056:
|
||||
case 1057:
|
||||
case 1059:
|
||||
case 1060:
|
||||
case 1025:
|
||||
case 1058:
|
||||
// EventBus.getDefault().post(message);
|
||||
|
||||
@@ -8,11 +8,19 @@ import android.view.WindowManager;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.databinding.FragmentRedEnvelopesBinding;
|
||||
import com.xscm.moduleutil.bean.RedPackGrab;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
import com.xscm.moduleutil.event.RedEnvelopeStatus;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.view.QXRedBagSendView;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
@@ -23,6 +31,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class RedEnvelopesFragment extends BaseDialog<FragmentRedEnvelopesBinding> {
|
||||
private RedEnvelopeStatus mCurrentStatus;
|
||||
private RedPacketInfo mRedPacketInfo;
|
||||
public RedEnvelopesFragment(@NonNull @NotNull Context context) {
|
||||
super(context, com.xscm.moduleutil.R.style.BaseDialogStyleH);
|
||||
}
|
||||
@@ -54,13 +64,50 @@ public class RedEnvelopesFragment extends BaseDialog<FragmentRedEnvelopesBinding
|
||||
mBinding.imRedK.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT).navigation();
|
||||
RetrofitClient.getInstance().grab(mRedPacketInfo.getRedpacket_id(), new BaseObserver<RedPackGrab>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull RedPackGrab redPackGrab) {
|
||||
if (redPackGrab!=null){
|
||||
if (redPackGrab.getCode()==1){
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT).withString("redpacketId", mRedPacketInfo.getRedpacket_id()).navigation();
|
||||
}else if (redPackGrab.getCode()==2){
|
||||
ToastUtils.showShort("您已经抢过红包了");
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT).withString("redpacketId", mRedPacketInfo.getRedpacket_id()).navigation();
|
||||
}else {
|
||||
snatched();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// QXRedBagSendView redBagView = new QXRedBagSendView(getContext());
|
||||
// redBagView.showInView((ViewGroup) getWindow().getDecorView());
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
mBinding.tvCk.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_RED_RESULT).withString("redpacketId", mRedPacketInfo.getRedpacket_id()).navigation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void snatched(){
|
||||
mBinding.tvRedCount.setText("手慢,没有抢到");
|
||||
mBinding.imRedK.setVisibility(View.GONE);
|
||||
mBinding.textPl.setVisibility(View.GONE);
|
||||
mBinding.tvTitle.setVisibility(View.GONE);
|
||||
mBinding.tvPinl.setVisibility(View.GONE);
|
||||
mBinding.tvKl.setVisibility(View.GONE);
|
||||
mBinding.tvCk.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
}
|
||||
@@ -69,4 +116,33 @@ public class RedEnvelopesFragment extends BaseDialog<FragmentRedEnvelopesBinding
|
||||
public int getLayoutId() {
|
||||
return R.layout.fragment_red_envelopes;
|
||||
}
|
||||
|
||||
public void setRedPacket(RedPacketInfo redPacketInfo) {
|
||||
this.mRedPacketInfo = redPacketInfo;
|
||||
ImageUtils.loadHeadCC(redPacketInfo.getAvatar(), mBinding.userAvatar);
|
||||
mBinding.tvUserName.setText(redPacketInfo.getNickname());
|
||||
mBinding.tvRedCount.setText(redPacketInfo.getRemark());
|
||||
// 根据红包信息确定当前状态
|
||||
// if (redPacketInfo.isHasCountdown() && redPacketInfo.isHasCondition()) {
|
||||
// mCurrentStatus = RedEnvelopeStatus.COUNTDOWN_AND_CONDITION;
|
||||
// handleCountdownAndCondition();
|
||||
// } else if (redPacketInfo.isHasCountdown()) {
|
||||
// mCurrentStatus = RedEnvelopeStatus.COUNTDOWN_TO_OPEN;
|
||||
// handleCountdown();
|
||||
// } else if (redPacketInfo.isHasCondition()) {
|
||||
// mCurrentStatus = RedEnvelopeStatus.CONDITION_TO_OPEN;
|
||||
// handleCondition();
|
||||
// } else {
|
||||
mCurrentStatus = RedEnvelopeStatus.READY_TO_OPEN;//红包可以直接抢的
|
||||
handleReadyToOpen();
|
||||
// }
|
||||
}
|
||||
|
||||
private void handleReadyToOpen() {
|
||||
mBinding.textPl.setVisibility(View.GONE);
|
||||
mBinding.tvTitle.setVisibility(View.GONE);
|
||||
mBinding.tvPinl.setVisibility(View.GONE);
|
||||
mBinding.tvKl.setVisibility(View.VISIBLE);
|
||||
mBinding.imRedK.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,37 @@ package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import com.example.moduleroom.contacts.RedEnvelopesContacts;
|
||||
import com.xscm.moduleutil.bean.RedpacketDetail;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public class RedEnvelopesPresenter extends BasePresenter<RedEnvelopesContacts.View> implements RedEnvelopesContacts.IRoomPre{
|
||||
RedEnvelopesContacts.View mView;
|
||||
public RedEnvelopesPresenter(RedEnvelopesContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRedpacketDetail(String redpacketId) {
|
||||
api.redPacketDetail(redpacketId, new BaseObserver<RedpacketDetail>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull RedpacketDetail redpacketDetail) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().redPacketDetail(redpacketDetail);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.content.Context;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.example.moduleroom.contacts.RoomContacts;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
@@ -21,6 +22,7 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RoomPresenter extends BasePresenter<RoomContacts.View> implements RoomContacts.IRoomPre {
|
||||
RoomContacts.View mView;
|
||||
@@ -443,4 +445,23 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomRedPackets(String roomId) {
|
||||
api.roomRedPackets(roomId,new BaseObserver<List<RedPacketInfo>>(){
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull List<RedPacketInfo> redPacketInfos) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().roomRedPackets(redPacketInfos);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -394,6 +394,7 @@
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ed_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:background="@null"
|
||||
@@ -405,6 +406,7 @@
|
||||
android:layout_toStartOf="@+id/tv_j"
|
||||
android:textColorHint="#999"
|
||||
android:textColor="#333"
|
||||
android:inputType="number"
|
||||
android:hint="请输入金额"/>
|
||||
|
||||
<TextView
|
||||
@@ -448,6 +450,7 @@
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_num"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:background="@null"
|
||||
@@ -459,6 +462,7 @@
|
||||
android:layout_toStartOf="@+id/tv_g"
|
||||
android:textColorHint="#999"
|
||||
android:textColor="#333"
|
||||
android:inputType="number"
|
||||
android:hint="请输入数量"/>
|
||||
|
||||
<TextView
|
||||
@@ -576,6 +580,7 @@
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/ed_bz"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:layout_weight="2"
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_jb"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#fff"
|
||||
|
||||
@@ -139,6 +139,23 @@
|
||||
android:gravity="center"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_ck"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_26"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_63"
|
||||
android:text="查看大家的手气>"
|
||||
android:gravity="center"
|
||||
tools:ignore="HardcodedText"
|
||||
tools:text="查看大家手气"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_share"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user