1:添加热度卡,在背包显示
2:修改道具商城和个性装扮,分别显示热身卡和不显示 3:完成热度卡在房间中使用,一键全使用和单个使用,完成
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -26,6 +29,7 @@ import com.blankj.utilcode.util.LogUtils;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.modulemain.Application;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.user.activity.PropMallActivity;
|
||||
import com.xscm.modulemain.adapter.GiftUserAdapter;
|
||||
import com.xscm.modulemain.databinding.RoomGiftDialogBinding;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
@@ -93,6 +97,9 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
private String heart_id = "";//交友房中,点击助力需要发送heart_id
|
||||
private String auction_id;
|
||||
|
||||
private boolean isCard = false;//是否是热度卡
|
||||
|
||||
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
@@ -232,9 +239,9 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
// View.VISIBLE : View.INVISIBLE);//选中了两个以上麦位,一键送礼隐藏
|
||||
all = gifyuseradapter.isAll();
|
||||
if (all) {
|
||||
mBinding.tvAllWheat.setVisibility(View.GONE);
|
||||
mBinding.tvAllWheat.setVisibility(GONE);
|
||||
} else {
|
||||
mBinding.tvAllWheat.setVisibility(View.VISIBLE);
|
||||
mBinding.tvAllWheat.setVisibility(VISIBLE);
|
||||
}
|
||||
gifyuseradapter.notifyItemChanged(position, item);
|
||||
oldSelectedIds.clear();
|
||||
@@ -425,14 +432,32 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
giftNumber = mGiftNumList.get(i).getNumber();
|
||||
}
|
||||
}
|
||||
if (packType == 1) {
|
||||
giveGift(giftNumber);
|
||||
|
||||
if (isCard) {
|
||||
getSelectedGift();
|
||||
if (TextUtils.isEmpty(roonGiftModel.getGift_id())){
|
||||
ToastUtils.show("请选择热度卡");
|
||||
return;
|
||||
}
|
||||
MvpPre.roomHotCard(roonGiftModel.getGift_id(), roomId, giftNumber);
|
||||
} else {
|
||||
giveGift(giftNumber);
|
||||
|
||||
if (packType == 1) {
|
||||
giveGift(giftNumber);
|
||||
} else {
|
||||
giveGift(giftNumber);
|
||||
}
|
||||
}
|
||||
} else if (view1.getId() == R.id.cz) {//充值,当是房间热度卡的时候,就不显示充值,是去购买
|
||||
if (isCard) {
|
||||
Intent intent = new Intent(getSelfActivity(), PropMallActivity.class);
|
||||
intent.putExtra("id", "13");
|
||||
startActivity(intent);
|
||||
dismiss();
|
||||
} else {
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager(), "", "");
|
||||
dismiss();
|
||||
}
|
||||
} else if (view1.getId() == R.id.cz) {
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager(), "", "");
|
||||
dismiss();
|
||||
} else if (view1.getId() == R.id.tv_all_wheat) {//全麦
|
||||
if (all) {
|
||||
gifyuseradapter.allElection(false);
|
||||
@@ -444,27 +469,47 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
all = !all;
|
||||
oldSelectedIds.clear();
|
||||
oldSelectedIds.addAll(gifyuseradapter.getAllSelectedIds());
|
||||
} else if (view1.getId() == R.id.tv_bb_qs) {
|
||||
int count = gifyuseradapter.getSelectCount();
|
||||
if (count <= 0) {
|
||||
ToastUtils.show("请选择打赏的用户");
|
||||
return;
|
||||
}
|
||||
if (gifyuseradapter.getUserIdCount() > 1) {
|
||||
ToastUtils.show("一键全送只能选择一个用户");
|
||||
return;
|
||||
}
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getAuction_id() != null) {
|
||||
auction_id = userInfo.getAuction_id();
|
||||
} else {
|
||||
auction_id = "";
|
||||
} else if (view1.getId() == R.id.tv_bb_qs) {//一键全送,当是热度卡的时候,这里显示的是一件全使用,不需要选择人员的
|
||||
if (isCard) {
|
||||
queren2("", "1");
|
||||
} else {
|
||||
int count = gifyuseradapter.getSelectCount();
|
||||
if (count <= 0) {
|
||||
ToastUtils.show("请选择打赏的用户");
|
||||
return;
|
||||
}
|
||||
if (gifyuseradapter.getUserIdCount() > 1) {
|
||||
ToastUtils.show("一键全送只能选择一个用户");
|
||||
return;
|
||||
}
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getAuction_id() != null) {
|
||||
auction_id = userInfo.getAuction_id();
|
||||
} else {
|
||||
auction_id = "";
|
||||
}
|
||||
}
|
||||
queren();
|
||||
}
|
||||
queren();
|
||||
}
|
||||
}
|
||||
|
||||
private void queren2(String udid, String num) {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
||||
"提示",
|
||||
"是否是全部使用?",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
MvpPre.roomHotCard(udid, roomId, num);
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
private void queren() {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(ActivityUtils.getTopActivity(),
|
||||
@@ -498,14 +543,14 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void userRefresh(GiftUserRefreshEvent event) {
|
||||
if (event.gift == null || event.gift.getRule() == null || event.gift.getGift_bag_name() == null) {
|
||||
mBinding.llGiftRule.setVisibility(View.GONE);
|
||||
mBinding.llGiftRule.setVisibility(GONE);
|
||||
} else {
|
||||
if (event.gift.getActivities_id() == 5) {
|
||||
|
||||
showGiftLotteryDialog(event.gift, roomId);
|
||||
return;
|
||||
}
|
||||
mBinding.llGiftRule.setVisibility(View.VISIBLE);
|
||||
mBinding.llGiftRule.setVisibility(VISIBLE);
|
||||
setGiftDetail(event.gift);
|
||||
}
|
||||
if (event.addSelf) {
|
||||
@@ -666,7 +711,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, userInfo.getAuction_id());
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1",gift_bag);
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1", gift_bag);
|
||||
dismiss();
|
||||
}
|
||||
} else {
|
||||
@@ -734,7 +779,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
if (rewardUserBeanList != null && !rewardUserBeanList.isEmpty()) {
|
||||
mBinding.rvGiftUser.setVisibility(View.VISIBLE);
|
||||
mBinding.rvGiftUser.setVisibility(VISIBLE);
|
||||
int limit = Math.min(rewardUserBeanList.size(), 6);
|
||||
List<RewardUserBean> limitedList = rewardUserBeanList.subList(0, limit);
|
||||
gifyuseradapter.setNewData(limitedList);
|
||||
@@ -785,7 +830,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// 当页面切换时,控制 tv_bb_qs 按钮的显示
|
||||
updateTvBbQsVisibility(position);
|
||||
updateTvBbQsVisibility(position, giftLabelBeans.get(position).getId());
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(position).getId(), 1, "1");
|
||||
}
|
||||
|
||||
@@ -795,13 +840,18 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
}
|
||||
});
|
||||
// 初始化时设置按钮可见性
|
||||
updateTvBbQsVisibility(1);
|
||||
updateTvBbQsVisibility(1, giftLabelBeans.get(1).getId());
|
||||
}
|
||||
|
||||
// 调用示例
|
||||
private void refreshCurrentGiftFragment(String id, int status, String type) {
|
||||
if (getCurrentGiftFragment() != null) {
|
||||
getCurrentGiftFragment().loadDataIfNeeded(id, status, type);
|
||||
|
||||
if (id.equals("1013")) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -819,23 +869,37 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// 控制 tv_bb_qs 按钮显示的方法
|
||||
private void updateTvBbQsVisibility(int currentPosition) {
|
||||
private void updateTvBbQsVisibility(int currentPosition, String id) {
|
||||
// 假设你希望在特定位置(例如位置1)显示按钮
|
||||
if (currentPosition == 0) { // 根据你的需求调整位置
|
||||
// 显示按钮
|
||||
if (mBinding.tvBbQs != null) {
|
||||
mBinding.tvBbQs.setVisibility(View.VISIBLE);
|
||||
mBinding.cz.setVisibility(View.GONE);
|
||||
MvpPre.getGiftPackListCount();
|
||||
}
|
||||
mBinding.tvBbQs.setVisibility(VISIBLE);
|
||||
mBinding.cz.setVisibility(GONE);
|
||||
MvpPre.getGiftPackListCount();
|
||||
mBinding.tvBbQs.setText("一键全送");
|
||||
mBinding.tvGive.setText("赠送");
|
||||
mBinding.rlWheatLayout.setVisibility(VISIBLE);
|
||||
isCard = false;
|
||||
} else if (id.equals("1013")) {
|
||||
mBinding.tvBbQs.setVisibility(VISIBLE);
|
||||
mBinding.cz.setVisibility(VISIBLE);
|
||||
mBinding.rlWheatLayout.setVisibility(GONE);
|
||||
mBinding.cz.setText("去购买");
|
||||
mBinding.tvBbQs.setText("一键全使用");
|
||||
mBinding.tvGive.setText("使用");
|
||||
MvpPre.wallet();
|
||||
isCard = true;
|
||||
} else {
|
||||
// 隐藏按钮
|
||||
if (mBinding.tvBbQs != null) {
|
||||
mBinding.tvBbQs.setVisibility(View.GONE);
|
||||
mBinding.cz.setVisibility(View.VISIBLE);
|
||||
MvpPre.wallet();
|
||||
}
|
||||
mBinding.tvBbQs.setVisibility(GONE);
|
||||
mBinding.cz.setVisibility(VISIBLE);
|
||||
mBinding.cz.setText("去充值");
|
||||
mBinding.tvGive.setText("赠送");
|
||||
mBinding.rlWheatLayout.setVisibility(VISIBLE);
|
||||
MvpPre.wallet();
|
||||
isCard = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -918,6 +982,11 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomHotCard() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
private class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<GiftLabelBean> list;
|
||||
|
||||
Reference in New Issue
Block a user