1721 lines
79 KiB
Java
1721 lines
79 KiB
Java
package com.example.moduleroom.fragment;
|
||
|
||
import static android.view.View.GONE;
|
||
import static android.view.View.INVISIBLE;
|
||
import static android.view.View.VISIBLE;
|
||
|
||
import android.annotation.SuppressLint;
|
||
import android.app.AlertDialog;
|
||
import android.content.Context;
|
||
import android.os.Bundle;
|
||
import android.os.CountDownTimer;
|
||
import android.util.TypedValue;
|
||
import android.view.LayoutInflater;
|
||
import android.view.View;
|
||
import android.view.ViewGroup;
|
||
import android.view.WindowManager;
|
||
import android.widget.TextView;
|
||
|
||
import androidx.annotation.NonNull;
|
||
import androidx.annotation.Nullable;
|
||
import androidx.core.content.ContextCompat;
|
||
|
||
import com.blankj.utilcode.util.LogUtils;
|
||
import com.example.moduleroom.R;
|
||
import com.example.moduleroom.activity.RoomActivity;
|
||
import com.example.moduleroom.contacts.RoomAuctionContacts;
|
||
import com.example.moduleroom.databinding.FragmentRoomAuctionBinding;
|
||
import com.example.moduleroom.dialog.BidListDialogFragment;
|
||
import com.example.moduleroom.dialog.CardRelationshipFragment;
|
||
import com.example.moduleroom.dialog.CustomCenterDialogFragment;
|
||
import com.example.moduleroom.dialog.RoomCharmDialog;
|
||
import com.example.moduleroom.dialog.RoomGiftDialogFragment;
|
||
import com.example.moduleroom.dialog.RoomOnlineDialogFragment;
|
||
import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
||
import com.example.moduleroom.presenter.RoomAuctionPresenterTow;
|
||
import com.hjq.toast.ToastUtils;
|
||
import com.orhanobut.logger.Logger;
|
||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||
import com.xscm.moduleutil.base.CommonAppContext;
|
||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||
import com.xscm.moduleutil.bean.UserInfo;
|
||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||
import com.xscm.moduleutil.bean.room.RoomBean;
|
||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||
import com.xscm.moduleutil.dialog.RoomAuctionWebViewDialog;
|
||
import com.xscm.moduleutil.utils.ClickUtils;
|
||
import com.xscm.moduleutil.utils.ColorManager;
|
||
import com.xscm.moduleutil.utils.ImageUtils;
|
||
import com.xscm.moduleutil.utils.SpUtil;
|
||
import com.xscm.moduleutil.utils.StringUtil;
|
||
import com.xscm.moduleutil.widget.RoomMakeWheatView;
|
||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||
|
||
import org.greenrobot.eventbus.EventBus;
|
||
|
||
import java.util.List;
|
||
|
||
/**
|
||
* @author qx
|
||
* @data 2025/6/27
|
||
* @description: 拍卖房
|
||
*/
|
||
public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow, FragmentRoomAuctionBinding>
|
||
implements RoomAuctionContacts.View {
|
||
private RoomInfoResp roomInfoResp;
|
||
private RoomAuction roomAuction;
|
||
private RoomBean roomBean;
|
||
RoomMakeWheatView wheatView;
|
||
RoomMakeWheatView wheatView2;
|
||
|
||
CountDownTimer mCountDownTimer;
|
||
private long remainingTime;
|
||
|
||
private String auctionId = "";
|
||
private RoomAuction.AuctionUserBean auctionUserBean;
|
||
private List<RoomAuction.AuctionListBean> auctionList;
|
||
// private ImageView imActionJs, imActionYs;
|
||
// private LinearLayout stub;
|
||
private boolean isButtonsInflated = false;
|
||
private int type;
|
||
RoomFragment parentFragment;
|
||
|
||
public static RoomAuctionFragment newInstance() {
|
||
|
||
Bundle args = new Bundle();
|
||
|
||
RoomAuctionFragment fragment = new RoomAuctionFragment();
|
||
|
||
fragment.setArguments(args);
|
||
return fragment;
|
||
}
|
||
// public static RoomAuctionFragment newInstance(RoomInfoResp roomInfoResp, int type) {
|
||
//
|
||
// Bundle args = new Bundle();
|
||
//
|
||
// RoomAuctionFragment fragment = new RoomAuctionFragment();
|
||
// args.putSerializable("roomInfo", roomInfoResp);
|
||
// args.putInt("type", type);
|
||
// fragment.setArguments(args);
|
||
// return fragment;
|
||
// }
|
||
|
||
private SharedViewModel sharedViewModel;
|
||
|
||
@Nullable
|
||
@Override
|
||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||
//
|
||
// // 观察专门给子Fragment的数据
|
||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||
// if (data != null) {
|
||
// // 处理数据
|
||
// roomInfoUpdate(data);
|
||
// }
|
||
// });
|
||
return super.onCreateView(inflater, container, savedInstanceState);
|
||
}
|
||
|
||
@Override
|
||
public void onAttach(@NonNull Context context) {
|
||
super.onAttach(context);
|
||
// roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo");
|
||
// type = getArguments().getInt("type");
|
||
}
|
||
|
||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||
this.roomInfoResp = roomInfoResp;
|
||
}
|
||
|
||
|
||
@Override
|
||
public void onStart() {
|
||
super.onStart();
|
||
// 确保 overlay buttons 已初始化
|
||
initOverlayButtons();
|
||
}
|
||
|
||
/// 更新数据
|
||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||
roomInfoResp = resp;
|
||
if (roomInfoResp.getRoom_info().getLabel_id().equals("1")) {
|
||
type = 1;
|
||
} else if (roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
|
||
type = 2;
|
||
}
|
||
initOverlayButtons();
|
||
getTextView();
|
||
steView(type);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).setvisibTop(true);
|
||
}
|
||
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(0);
|
||
if (roomPitBean.getUser_id() != null && !roomPitBean.getUser_id().isEmpty() && !roomPitBean.getUser_id().equals("0")) {
|
||
roomPitBean.setIs_pm(1);
|
||
wheatView.setData(roomPitBean);
|
||
|
||
// if (imActionJs != null)
|
||
// imActionJs.setVisibility(VISIBLE);
|
||
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upYs(true);
|
||
}
|
||
} else {
|
||
RoomPitBean pitBean = new RoomPitBean();
|
||
pitBean.setUser_id("");
|
||
pitBean.setPit_number("9");
|
||
pitBean.setAvatar("");
|
||
pitBean.setNickname("");
|
||
pitBean.setSex("");
|
||
pitBean.setCharm("");
|
||
wheatView.setData(pitBean);
|
||
|
||
}
|
||
parentFragment = (RoomFragment) getParentFragment();
|
||
|
||
roomAuction = roomInfoResp.getRoom_auction();
|
||
if (roomAuction != null) {
|
||
if (roomAuction.getAuction_user() != null) {
|
||
auctionUserBean = roomAuction.getAuction_user();
|
||
RoomPitBean roomPitBean1 = new RoomPitBean();
|
||
roomPitBean1.setUser_id(auctionUserBean.getUser_id());
|
||
roomPitBean1.setNickname(auctionUserBean.getNickname());
|
||
roomPitBean1.setAvatar(auctionUserBean.getAvatar());
|
||
roomPitBean1.setDress(auctionUserBean.getDress());
|
||
roomPitBean1.setSex(auctionUserBean.getSex());
|
||
roomPitBean1.setPit_number("888");
|
||
roomPitBean1.setIs_pm(1);
|
||
wheatView2.setData(roomPitBean1);
|
||
mBinding.tvPB.setText(StringUtil.toWan2(auctionUserBean.getCharm(), 1));
|
||
countDownTime(auctionUserBean.getDuration());
|
||
|
||
if (auctionUserBean.getAuction_id() != null) {
|
||
mBinding.ivJp.setVisibility(VISIBLE);
|
||
gengv();
|
||
auctionId = auctionUserBean.getAuction_id();
|
||
SpUtil.setAuctionId(auctionId);
|
||
} else {
|
||
SpUtil.setAuctionId("");
|
||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||
}
|
||
|
||
if (auctionUserBean.getUser_id() != null && auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||
} else {
|
||
if (wheatView.pitBean != null) {
|
||
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
// if (imActionJs != null && imActionYs != null) {
|
||
// imActionJs.setVisibility(VISIBLE);
|
||
// imActionYs.setVisibility(VISIBLE);
|
||
// }
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(true);
|
||
}
|
||
} else {
|
||
// if (imActionJs != null && imActionYs != null) {
|
||
// imActionJs.setVisibility(INVISIBLE);
|
||
// imActionYs.setVisibility(INVISIBLE);
|
||
// }
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(false);
|
||
}
|
||
}
|
||
} else {
|
||
// if (imActionJs != null && imActionYs != null) {
|
||
// imActionJs.setVisibility(INVISIBLE);
|
||
// imActionYs.setVisibility(INVISIBLE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(false);
|
||
}
|
||
// }
|
||
}
|
||
mBinding.ivJp.setVisibility(VISIBLE);
|
||
}
|
||
|
||
|
||
}
|
||
if (roomAuction.getAuction_list() != null && roomAuction.getAuction_list().size() > 0) {
|
||
auctionList = roomAuction.getAuction_list();
|
||
gexList();
|
||
}
|
||
|
||
|
||
} else {
|
||
RoomPitBean roomPitBean1 = new RoomPitBean();
|
||
roomPitBean1.setPit_number("888");
|
||
roomPitBean1.setSex("");
|
||
roomPitBean1.setUser_id("");
|
||
roomPitBean1.setNickname("");
|
||
roomPitBean1.setAvatar("");
|
||
roomPitBean1.setIs_pm(1);
|
||
wheatView2.setData(roomPitBean1);
|
||
mBinding.tvPB.setText("0");
|
||
auctionId = "";
|
||
SpUtil.setAuctionId("");
|
||
}
|
||
tzblChanged();//获取在线列表数据
|
||
RoomPitBean roomPitBean2 = wheatView.pitBean;
|
||
if (roomPitBean2 != null && roomPitBean2.getUser_id() != null && !roomPitBean2.getUser_id().equals("0")) {
|
||
if (roomPitBean2.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(true);
|
||
}
|
||
// if (imActionJs != null && imActionYs != null) {
|
||
//
|
||
//
|
||
//
|
||
// imActionJs.setVisibility(VISIBLE);
|
||
// imActionYs.setVisibility(VISIBLE);
|
||
// }
|
||
} else {
|
||
// if (imActionJs != null && imActionYs != null) {
|
||
// imActionJs.setVisibility(INVISIBLE);
|
||
// imActionYs.setVisibility(INVISIBLE);
|
||
// }
|
||
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(false);
|
||
}
|
||
}
|
||
}
|
||
getvjs();
|
||
}
|
||
|
||
@Override
|
||
protected RoomAuctionPresenterTow bindPresenter() {
|
||
return new RoomAuctionPresenterTow(this, getActivity());
|
||
}
|
||
|
||
/// 主持上麦
|
||
|
||
public void initOverlayButtons() {
|
||
// if (isButtonsInflated) return;
|
||
// stub= getActivity().findViewById(R.id.stub_buttons2);
|
||
// if (stub != null) {
|
||
//// View inflated = stub.getRootView();
|
||
// stub.setVisibility(VISIBLE);
|
||
// imActionJs = stub.findViewById(R.id.im_action_ys);
|
||
// imActionYs = stub.findViewById(R.id.im_action_js);
|
||
//
|
||
// if (imActionJs != null && imActionYs != null) {
|
||
// // 设置点击事件
|
||
// imActionJs.setOnClickListener(this::onChock);
|
||
// imActionYs.setOnClickListener(this::onChock);
|
||
//
|
||
//// isButtonsInflated = true;
|
||
// } else {
|
||
// // 报错提示:说明 top_overlay_buttons.xml 中没有定义这些 id
|
||
// throw new IllegalStateException("im_action_js or im_action_ys not found in overlay layout");
|
||
// }
|
||
// }
|
||
|
||
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).tob();
|
||
}
|
||
}
|
||
|
||
@Override
|
||
protected void initData() {
|
||
|
||
}
|
||
|
||
private void getvjs() {
|
||
// if (imActionJs == null) {
|
||
// initOverlayButtons();
|
||
// }
|
||
// if (imActionJs != null) {
|
||
if (roomInfoResp.getUser_info().getIs_room_owner() == 1 || roomInfoResp.getUser_info().getIs_management() == 1 || roomInfoResp.getUser_info().getIs_host() == 1) {
|
||
// imActionJs.setVisibility(VISIBLE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upJs(true);
|
||
}
|
||
} else {
|
||
// imActionJs.setVisibility(INVISIBLE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upJs(false);
|
||
}
|
||
}
|
||
// }
|
||
}
|
||
|
||
protected void tzblChanged() {
|
||
|
||
StringBuilder userIds = new StringBuilder();
|
||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||
String userId = roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id();
|
||
if (userId != null && !userId.equals("0") && !userId.isEmpty()) {
|
||
if (userIds.length() > 0) {
|
||
userIds.append(",");
|
||
}
|
||
userIds.append(userId);
|
||
}
|
||
}
|
||
|
||
if (auctionUserBean != null && auctionUserBean.getUser_id() != null && !auctionUserBean.getUser_id().equals("0")) {
|
||
if (userIds.length() > 0) {
|
||
userIds.append(",");
|
||
}
|
||
userIds.append(auctionUserBean.getUser_id());
|
||
}
|
||
|
||
if (userIds.length() > 0 && roomInfoResp.getRoom_info().getRoom_id() != null) {
|
||
MvpPre.userOnlineStatus(userIds.toString(), roomInfoResp.getRoom_info().getRoom_id());
|
||
}
|
||
}
|
||
|
||
@Override
|
||
protected void initView() {
|
||
wheatView = mBinding.roomMakeWheat;
|
||
wheatView2 = mBinding.roomMakeWheat2;
|
||
mBinding.ivJp.setOnClickListener(this::onChock);
|
||
mBinding.roomMakeWheat.setOnClickListener(this::onChock);
|
||
mBinding.roomMakeWheat2.setOnClickListener(this::onChock);
|
||
mBinding.bangdan.setOnClickListener(this::onChock);
|
||
// mBinding.ivAuction1.setOnClickListener(this::onChock);
|
||
// mBinding.ivAuction2.setOnClickListener(this::onChock);
|
||
// mBinding.ivAuction3.setOnClickListener(this::onChock);
|
||
mBinding.user4.setOnClickListener(this::onChock);
|
||
mBinding.user5.setOnClickListener(this::onChock);
|
||
mBinding.user6.setOnClickListener(this::onChock);
|
||
mBinding.tvPB.setOnClickListener(this::onChock);
|
||
mBinding.questionMark.setOnClickListener(this::onChock);
|
||
getTextView();
|
||
// initOverlayButtons();
|
||
// steView(type);
|
||
|
||
mBinding.qinmi.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||
|
||
mBinding.ivAuction1.setOnClickListener(view -> {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
if (mBinding.ivAuction1.getUserId() != null && !mBinding.ivAuction1.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), mBinding.ivAuction1.getUserId(), mBinding.ivAuction1.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
});
|
||
|
||
mBinding.ivAuction1.setmOnCharmClickListener(new RoomMakeWheatView.onCharmClickListener() {
|
||
|
||
@Override
|
||
public void onCharmClick(RoomMakeWheatView view, RoomPitBean pitBean) {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().isEmpty() && !pitBean.getUser_id().equals("0")) {
|
||
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
||
}
|
||
}
|
||
});
|
||
|
||
mBinding.ivAuction2.setOnClickListener(view -> {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
if (mBinding.ivAuction2.getUserId() != null && !mBinding.ivAuction2.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), mBinding.ivAuction2.getUserId(), mBinding.ivAuction2.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
});
|
||
mBinding.ivAuction2.setmOnCharmClickListener(new RoomMakeWheatView.onCharmClickListener() {
|
||
|
||
@Override
|
||
public void onCharmClick(RoomMakeWheatView view, RoomPitBean pitBean) {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().isEmpty() && !pitBean.getUser_id().equals("0")) {
|
||
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
||
}
|
||
}
|
||
});
|
||
mBinding.ivAuction3.setOnClickListener(view -> {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
if (mBinding.ivAuction3.getUserId() != null && !mBinding.ivAuction3.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), mBinding.ivAuction3.getUserId(), mBinding.ivAuction3.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
});
|
||
mBinding.ivAuction3.setmOnCharmClickListener(new RoomMakeWheatView.onCharmClickListener() {
|
||
|
||
@Override
|
||
public void onCharmClick(RoomMakeWheatView view, RoomPitBean pitBean) {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().isEmpty() && !pitBean.getUser_id().equals("0")) {
|
||
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
private void onChock(View view) {
|
||
if (ClickUtils.isFastDoubleClick()) {
|
||
return;
|
||
}
|
||
int id = view.getId();
|
||
if (id == R.id.iv_jp) {
|
||
// 添加多层空值检查
|
||
if (roomInfoResp != null &&
|
||
roomInfoResp.getRoom_auction() != null &&
|
||
roomInfoResp.getRoom_auction().getAuction_user() != null &&
|
||
roomInfoResp.getRoom_auction().getAuction_user().getUser_id() != null &&
|
||
!roomInfoResp.getRoom_auction().getAuction_user().getUser_id().isEmpty()) {
|
||
|
||
try {
|
||
UserInfo userInfo = new UserInfo();
|
||
userInfo.setUser_id(Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getUser_id()));
|
||
userInfo.setNickname(roomInfoResp.getRoom_auction().getAuction_user().getNickname());
|
||
userInfo.setAvatar(roomInfoResp.getRoom_auction().getAuction_user().getAvatar());
|
||
userInfo.setAuction_id(roomInfoResp.getRoom_auction().getAuction_user() != null ? roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() : "");
|
||
userInfo.setPit_number("888");
|
||
|
||
if (roomInfoResp.getRoom_info() != null &&
|
||
roomInfoResp.getRoom_info().getRoom_id() != null) {
|
||
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(), 1, "", getParentFragmentManager());
|
||
}
|
||
} catch (NumberFormatException e) {
|
||
LogUtils.e("NumberFormatException in parsing user_id: " + e.getMessage());
|
||
ToastUtils.show("数据解析错误");
|
||
} catch (Exception e) {
|
||
LogUtils.e("Error showing gift dialog: " + e.getMessage());
|
||
ToastUtils.show("操作失败");
|
||
}
|
||
} else {
|
||
ToastUtils.show("拍卖信息不存在");
|
||
}
|
||
} else if (id == R.id.room_make_wheat) {
|
||
if (!wheatView.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView.getUserId(), wheatView.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
} else {
|
||
MvpPre.applyPit(roomInfoResp.getRoom_info().getRoom_id(), "9");
|
||
}
|
||
} else if (id == R.id.room_make_wheat2) {
|
||
if (wheatView2.getUserId() != null) {
|
||
if (wheatView2.getUserId().equals("")) {
|
||
if ((wheatView.getUserId() != null && wheatView.getUserId().equals(SpUtil.getUserId() + "") || getHostUser() < 4)) {
|
||
RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), 888 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
|
||
}
|
||
} else {
|
||
if (roomInfoResp.getRoom_auction() != null && roomInfoResp.getRoom_auction().getAuction_user() != null) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() != null ? roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() : "0"), getChildFragmentManager());
|
||
} else {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// else if (id == R.id.im_action_js) {//延时
|
||
// MvpPre.auctionDelay(SpUtil.getauctionId());
|
||
// } else if (id == R.id.im_action_ys) {//结束
|
||
// dialogEnd();
|
||
// }
|
||
else if (id == R.id.bangdan) {//出价榜单
|
||
BidListDialogFragment.newInstance(SpUtil.getauctionId()).show(getChildFragmentManager(), "BidListDialogFragment");
|
||
} else if (id == R.id.iv_auction1) {
|
||
if (mBinding.ivAuction1.getUserId() != null && !mBinding.ivAuction1.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), mBinding.ivAuction1.getUserId(), mBinding.ivAuction1.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
} else if (id == R.id.iv_auction2) {
|
||
if (mBinding.ivAuction2.getUserId() != null && !mBinding.ivAuction2.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), mBinding.ivAuction2.getUserId(), mBinding.ivAuction2.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
} else if (id == R.id.iv_auction3) {
|
||
if (mBinding.ivAuction3.getUserId() != null && !mBinding.ivAuction3.getUserId().equals("")) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), mBinding.ivAuction3.getUserId(), mBinding.ivAuction3.pitNumber, getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
} else if (id == R.id.user_4) {
|
||
if (auctionList != null && auctionList.size() > 3) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), auctionList.get(3).getUser_id(), "", getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
|
||
} else if (id == R.id.user_5) {
|
||
if (auctionList != null && auctionList.size() > 4) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), auctionList.get(4).getUser_id(), "", getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
} else if (id == R.id.user_6) {
|
||
if (auctionList != null && auctionList.size() > 5) {
|
||
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), auctionList.get(5).getUser_id(), "", getHostUser(), false, 1, 0, getChildFragmentManager());
|
||
}
|
||
} else if (id == R.id.tv_p_b) {
|
||
if (wheatView2.pitBean.getUser_id() == null || wheatView2.pitBean.getUser_id().equals("") || wheatView2.pitBean.getUser_id().equals("0")) {
|
||
return;
|
||
}
|
||
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
||
}else if (id == R.id.question_mark){
|
||
// Bundle bundle = new Bundle();
|
||
// bundle.putString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"api/Page/page_show?id=22");
|
||
// WebViewDialog dialog = new WebViewDialog(getActivity(), bundle);
|
||
// dialog.show();
|
||
if (type==1) {
|
||
Bundle bundle = new Bundle();
|
||
bundle.putString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"api/Page/page_show?id=23");
|
||
RoomAuctionWebViewDialog dialog = new RoomAuctionWebViewDialog(getActivity(), bundle);
|
||
dialog.show();
|
||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=23").withString("title", "真爱拍规则").navigation();
|
||
}else {
|
||
|
||
Bundle bundle = new Bundle();
|
||
bundle.putString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"api/Page/page_show?id=22");
|
||
RoomAuctionWebViewDialog dialog = new RoomAuctionWebViewDialog(getActivity(), bundle);
|
||
dialog.show();
|
||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=22").withString("title", "亲密拍规则").navigation();
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
private void getTextView() {
|
||
int defaultColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_0DFFB9); // 亲密拍默认颜色(绿色)
|
||
int selectedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white); // 选中颜色(白色)
|
||
int clickedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_BB8BE2); // 真爱拍选中颜色(蓝色)
|
||
float defaultSize = 16f; // 默认字体大小
|
||
float selectedSize = 24f; // 选中字体大小
|
||
mBinding.zhenai.setText("真爱拍");
|
||
mBinding.qinmi.setText("亲密拍");
|
||
// 根据type设置初始状态
|
||
if (type == 1) {
|
||
// type=1 真爱拍模式
|
||
mBinding.zhenai.setTextColor(clickedColor); // 真爱拍蓝色
|
||
mBinding.zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 真爱拍24号字体
|
||
mBinding.qinmi.setTextColor(selectedColor); // 亲密拍白色
|
||
mBinding.qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 亲密拍16号字体
|
||
} else {
|
||
// type=2 亲密拍模式
|
||
mBinding.qinmi.setTextColor(defaultColor); // 亲密拍绿色
|
||
mBinding.qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 亲密拍24号字体
|
||
mBinding.zhenai.setTextColor(selectedColor); // 真爱拍白色
|
||
mBinding.zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 真爱拍16号字体
|
||
}
|
||
mBinding.zhenai.setOnClickListener(v -> {
|
||
if (wheatView.getUserId().equals(SpUtil.getUserId() + "")) {
|
||
// 判断 wheatView2 是否有人
|
||
if (wheatView2 != null && wheatView2.getUserId() != null && !wheatView2.getUserId().isEmpty()) {
|
||
// 显示提示:竞拍进行中
|
||
ToastUtils.show("竞拍正在进行中,请稍后再操作");
|
||
} else {
|
||
// 显示确认对话框
|
||
queren(1);
|
||
}
|
||
} else {
|
||
ToastUtils.show("请联系主持进行切换");
|
||
}
|
||
});
|
||
|
||
mBinding.qinmi.setOnClickListener(v -> {
|
||
if (wheatView.getUserId().equals(SpUtil.getUserId() + "")) {
|
||
|
||
if (wheatView2 != null && wheatView2.getUserId() != null && !wheatView2.getUserId().isEmpty()) {
|
||
// 显示提示:竞拍进行中
|
||
ToastUtils.show("竞拍正在进行中,请稍后再操作");
|
||
} else {
|
||
// 显示确认对话框
|
||
queren(2);
|
||
}
|
||
} else {
|
||
ToastUtils.show("请联系主持进行切换");
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
private void dialogEnd() {
|
||
// 创建并显示确认对话框
|
||
new ConfirmDialog(getActivity(),
|
||
"提示",
|
||
"您确定要结束本次拍卖吗?",
|
||
"确认",
|
||
"取消",
|
||
v -> {
|
||
// 点击“确认”按钮时执行删除操作
|
||
MvpPre.auctionEnd(SpUtil.getauctionId(), roomInfoResp.getRoom_info().getRoom_id());
|
||
},
|
||
v -> {
|
||
// 点击“取消”按钮时什么都不做
|
||
}, false, 0).show();
|
||
}
|
||
|
||
private void queren(int newType) {
|
||
// 创建并显示确认对话框
|
||
new ConfirmDialog(requireContext(),
|
||
"温馨提示",
|
||
newType == 1 ? "确定要切换为真爱拍吗" : "确认切换为亲密拍吗",
|
||
"确认",
|
||
"取消",
|
||
v -> {
|
||
// steView(newType);
|
||
// // 根据新的type更新TextView样式
|
||
// int defaultColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_0DFFB9); // 绿色
|
||
// int selectedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white); // 白色
|
||
// int clickedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_BB8BE2); // 蓝色
|
||
// float defaultSize = 16f;
|
||
// float selectedSize = 24f;
|
||
//
|
||
// toggleTextStyles(mBinding.qinmi, mBinding.zhenai, defaultColor, selectedColor, clickedColor, defaultSize, selectedSize, type);
|
||
|
||
// 点击“确认”按钮时执行
|
||
MvpPre.auctionMode(roomInfoResp.getRoom_info().getRoom_id(), newType == 1 ? "1" : "2");
|
||
},
|
||
v -> {
|
||
// 点击“取消”按钮时什么都不做
|
||
}, false, 0).show();
|
||
}
|
||
|
||
private void steView(int type) {
|
||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) mBinding.tvPB.getLayoutParams();
|
||
if (type == 1) {
|
||
mBinding.tvPB.setVisibility(VISIBLE);
|
||
|
||
layoutParams.setMargins(0, 35, 0, 0);
|
||
mBinding.tvPB.setLayoutParams(layoutParams);
|
||
|
||
mBinding.ccc.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_bj);
|
||
mBinding.pB.setImageResource(com.xscm.moduleutil.R.mipmap.za_t);
|
||
mBinding.btnRelation.setImageResource(com.xscm.moduleutil.R.mipmap.za_g);
|
||
mBinding.tvRelation.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
|
||
mBinding.btnGift.setImageResource(com.xscm.moduleutil.R.mipmap.za_l);
|
||
mBinding.tvGift.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
|
||
mBinding.btnTime.setImageResource(com.xscm.moduleutil.R.mipmap.za_sj);
|
||
mBinding.tvTimetg.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white));
|
||
mBinding.ivJp.setImageResource(com.xscm.moduleutil.R.mipmap.za_ljjp);
|
||
mBinding.avatar4.setImageResource(com.xscm.moduleutil.R.mipmap.za_m);
|
||
mBinding.avatar5.setImageResource(com.xscm.moduleutil.R.mipmap.za_m);
|
||
mBinding.avatar6.setImageResource(com.xscm.moduleutil.R.mipmap.za_m);
|
||
if (wheatView.getUserId() == null || wheatView.getUserId().isEmpty() || wheatView.getUserId().equals("") || wheatView.getUserId().equals("0")) {
|
||
wheatView.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
|
||
}
|
||
// wheatView2.pitImageVId=com.qxcm.moduleutil.R.mipmap.za_p;
|
||
wheatView2.setImageResource(com.xscm.moduleutil.R.mipmap.za_p, 0, "0");
|
||
mBinding.ivAuction1.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
|
||
mBinding.ivAuction2.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
|
||
mBinding.ivAuction3.setImageResource(com.xscm.moduleutil.R.mipmap.za_m, 0, "0");
|
||
setparams();
|
||
mBinding.clBj1.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw);
|
||
mBinding.clBj2.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw);
|
||
mBinding.clBj3.setBackgroundResource(com.xscm.moduleutil.R.mipmap.za_maiw);
|
||
|
||
} else {
|
||
layoutParams.setMargins(0, 15, 0, 0);
|
||
mBinding.tvPB.setLayoutParams(layoutParams);
|
||
mBinding.ccc.setBackgroundResource(com.xscm.moduleutil.R.drawable.bg_rounded_corner);
|
||
mBinding.pB.setImageResource(com.xscm.moduleutil.R.mipmap.qm_b);
|
||
mBinding.btnRelation.setImageResource(com.xscm.moduleutil.R.mipmap.guanx);
|
||
mBinding.tvRelation.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_FF999999));
|
||
mBinding.btnGift.setImageResource(com.xscm.moduleutil.R.mipmap.liwu);
|
||
mBinding.tvGift.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_FF999999));
|
||
mBinding.btnTime.setImageResource(com.xscm.moduleutil.R.mipmap.shij);
|
||
mBinding.tvTimetg.setTextColor(ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_FF999999));
|
||
mBinding.ivJp.setImageResource(com.xscm.moduleutil.R.mipmap.room_auction_jp);
|
||
mBinding.avatar4.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default);
|
||
mBinding.avatar5.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default);
|
||
mBinding.avatar6.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default);
|
||
mBinding.tvPB.setVisibility(VISIBLE);
|
||
if (wheatView.getUserId() == null || wheatView.getUserId().isEmpty() || wheatView.getUserId().equals("") || wheatView.getUserId().equals("0")) {
|
||
wheatView.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default, 0, "0");
|
||
}
|
||
wheatView2.setImageResource(com.xscm.moduleutil.R.mipmap.auction, 0, "0");
|
||
mBinding.ivAuction1.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default, 0, "0");
|
||
mBinding.ivAuction2.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default, 0, "0");
|
||
mBinding.ivAuction3.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default, 0, "0");
|
||
mBinding.clBj1.setBackgroundResource(com.xscm.moduleutil.R.mipmap.auction_bj1);
|
||
mBinding.clBj2.setBackgroundResource(com.xscm.moduleutil.R.mipmap.auction_bj2);
|
||
mBinding.clBj3.setBackgroundResource(com.xscm.moduleutil.R.mipmap.auction_bj3);
|
||
}
|
||
}
|
||
|
||
|
||
private void setparams() {
|
||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) wheatView2.getLayoutParams();
|
||
// ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) wheatView2.getLayoutParams();
|
||
layoutParams.setMargins(0, 30, 0, 0);
|
||
wheatView2.setLayoutParams(layoutParams);
|
||
|
||
|
||
}
|
||
|
||
@Override
|
||
protected int getLayoutId() {
|
||
return R.layout.fragment_room_auction;
|
||
}
|
||
|
||
/* 这是判断当前用户是否是麦上房主、管理员、主持,不在主持麦的都是不同用户
|
||
* @return
|
||
*/
|
||
private int getHostUser() {
|
||
if (roomInfoResp.getUser_info().getPit_number() == 9) {
|
||
if (roomInfoResp.getUser_info().getIs_room_owner() == 1) {
|
||
return 1;
|
||
} else if (roomInfoResp.getUser_info().getIs_management() == 1) {
|
||
return 2;
|
||
} else if (roomInfoResp.getUser_info().getIs_host() == 1) {
|
||
return 3;
|
||
} else {
|
||
return 4;
|
||
}
|
||
} else {
|
||
if (roomInfoResp.getUser_info().getIs_room_owner() == 1) {
|
||
return 1;
|
||
}
|
||
if (roomInfoResp.getUser_info().getIs_management() == 1) {
|
||
return 2;
|
||
}
|
||
if (roomInfoResp.getUser_info().getIs_host() == 1) {
|
||
return 3;
|
||
}
|
||
return 4;
|
||
}
|
||
}
|
||
|
||
@Override
|
||
public void applyPit() {
|
||
|
||
}
|
||
|
||
@Override
|
||
public void roomAuction(AuctionBean auctionBean) {
|
||
|
||
}
|
||
|
||
@Override
|
||
public void auctionDelay() {
|
||
|
||
}
|
||
|
||
@Override
|
||
public void auctionEnd() {
|
||
|
||
}
|
||
|
||
@Override
|
||
public void auctionMode() {
|
||
|
||
}
|
||
|
||
@Override
|
||
public void userOnlineStatus(List<UserOnlineStatusBean> list) {
|
||
// RoomMakeWheatView wheatView = mBinding.roomMakeWheat;
|
||
RoomPitBean pitBean = wheatView.pitBean;
|
||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||
|
||
for (UserOnlineStatusBean bean : list) {
|
||
if (pitBean != null && pitBean.getUser_id() != null && bean.getUser_id().equals(pitBean.getUser_id())) {
|
||
wheatView.setOnlineStatus(bean);
|
||
}
|
||
if (pitBean2 != null && pitBean2.getUser_id() != null && bean.getUser_id().equals(pitBean2.getUser_id())) {
|
||
wheatView2.setOnlineStatus(bean);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||
// public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
||
// boolean b = false;
|
||
//// if (messageEvent.getMsgType() == 1003) {//上麦
|
||
//// if (messageEvent.getText().getPit_number().equals("9")) {
|
||
//// wheatView.setData(getPitBean(messageEvent));
|
||
//// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
//// imActionJs.setVisibility(View.VISIBLE);
|
||
//// imActionYs.setVisibility(View.VISIBLE);
|
||
////
|
||
//// parentFragment.updateWheatStatus(getPitBean(messageEvent), 9, true, true);
|
||
//// } else {
|
||
//// getvjs();
|
||
//// imActionYs.setVisibility(INVISIBLE);
|
||
//// }
|
||
//// }
|
||
//// } else
|
||
//// if (messageEvent.getMsgType() == 1004) {
|
||
//// if (messageEvent.getText().getPit_number().equals("9")) {
|
||
//// wheatView.setData(getPitBean2(messageEvent, "9"));
|
||
//// getvjs();
|
||
//// imActionYs.setVisibility(GONE);
|
||
////
|
||
////
|
||
//// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
//// RoomPitBean pitBean = wheatView.pitBean;
|
||
//// pitBean.setUser_id("");
|
||
//// pitBean.setAvatar("");
|
||
//// pitBean.setNickname("");
|
||
//// pitBean.setSex("");
|
||
//// pitBean.setCharm("");
|
||
//// parentFragment.updateWheatStatus(pitBean, Integer.parseInt(messageEvent.getText().getPit_number()), false, true);
|
||
////// parentFragment.setRoleType(0, 0);
|
||
////// parentFragment.switchMic(2);
|
||
//// }
|
||
////
|
||
//// } else if (messageEvent.getText().getPit_number().equals("888")) {
|
||
//// wheatView2.setData(getPitBean2(messageEvent, "888"));
|
||
//// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
//// if (getActivity() instanceof RoomActivity) {
|
||
//// ((RoomActivity) getActivity()).setRoleType(0, 0);
|
||
//// ((RoomActivity) getActivity()).switchMic(2);
|
||
//// }
|
||
////// parentFragment.setRoleType(0, 0);
|
||
////// parentFragment.switchMic(2);
|
||
//// }
|
||
//// }
|
||
////
|
||
////// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
////// parentFragment.setRoleType(0, 0);
|
||
////// parentFragment.switchMic(2);
|
||
////// }
|
||
//// } else
|
||
// if (messageEvent.getMsgType() == 1022) {
|
||
//
|
||
// if (messageEvent.getText().getType() == 1) {//拍卖位上麦
|
||
// if (messageEvent.getText().getPit_number().equals("888")) {
|
||
// wheatView2.setData(getPitBean(messageEvent));
|
||
// getvjs();
|
||
// imActionYs.setVisibility(GONE);
|
||
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
// if (getActivity() instanceof RoomActivity) {
|
||
// ((RoomActivity) getActivity()).setRoleType(3, 888);
|
||
// ((RoomActivity) getActivity()).switchMic(2);
|
||
// }
|
||
//// parentFragment.setRoleType(3, 888);
|
||
//// parentFragment.switchMic(2);
|
||
// }
|
||
// }
|
||
//
|
||
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
// CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager());
|
||
// }
|
||
// } else if (messageEvent.getText().getType() == 2) {//拍卖位下麦
|
||
// if (messageEvent.getText().getPit_number().equals("9")) {
|
||
// wheatView.setData(getPitBean2(messageEvent, "9"));
|
||
//// assert parentFragment != null;
|
||
//// parentFragment.setRoleType(0, 0);
|
||
//// parentFragment.switchMic(2);
|
||
// if (getActivity() instanceof RoomActivity) {
|
||
// ((RoomActivity) getActivity()).setRoleType(0, 0);
|
||
// ((RoomActivity) getActivity()).switchMic(2);
|
||
// }
|
||
// } else if (messageEvent.getText().getPit_number().equals("888")) {
|
||
// wheatView2.setData(getPitBean2(messageEvent, "888"));
|
||
//// if (parentFragment != null) {
|
||
// if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
//// parentFragment.setRoleType(0, 0);
|
||
//// parentFragment.switchMic(2);
|
||
// if (getActivity() instanceof RoomActivity) {
|
||
// ((RoomActivity) getActivity()).setRoleType(0, 0);
|
||
// ((RoomActivity) getActivity()).switchMic(2);
|
||
// }
|
||
// }
|
||
//// }
|
||
// }
|
||
// yinc();
|
||
// }
|
||
//
|
||
// } else
|
||
// if (messageEvent.getMsgType() == 1023) {//开始竞拍
|
||
// mBinding.ivJp.setVisibility(VISIBLE);
|
||
// if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
// imActionYs.setVisibility(VISIBLE);
|
||
// imActionJs.setVisibility(VISIBLE);
|
||
// } else {
|
||
// getvjs();
|
||
// imActionYs.setVisibility(GONE);
|
||
// }
|
||
// if (messageEvent.getText().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
// mBinding.ivJp.setVisibility(INVISIBLE);
|
||
// }
|
||
// roomInfoResp.getRoom_auction().setAuction_user(messageEvent.getText().getAuction_user());
|
||
// auctionId = messageEvent.getText().getAuction_user().getAuction_id();
|
||
// SpUtil.setAuctionId(auctionId);
|
||
// countDownTime(messageEvent.getText().getAuction_user().getDuration());
|
||
// auctionUserBean = messageEvent.getText().getAuction_user();
|
||
// gengv();
|
||
// } else if (messageEvent.getMsgType() == 1024) {//竞拍,拍卖列表变化
|
||
// auctionList = messageEvent.getText().getAuction_list();
|
||
// gexList();
|
||
// } else if (messageEvent.getMsgType() == 1025) {//结束
|
||
// if (messageEvent.getText().getRecipient() != null) {//成功
|
||
// CustomCenterDialogFragment.showWithAutoDismiss(messageEvent.getText().getRecipient(), messageEvent.getText().getAuction_user(), getActivity().getSupportFragmentManager());
|
||
// } else {//失败
|
||
// showCountDownDialog(getContext());
|
||
// }
|
||
// SpUtil.setAuctionId("");
|
||
// mBinding.ivJp.setVisibility(INVISIBLE);
|
||
// imActionYs.setVisibility(INVISIBLE);
|
||
// getvjs();
|
||
// releaseCountDownTimer();
|
||
// auctionList = null;
|
||
// gexList();
|
||
// steView(type);
|
||
// isButtonsInflated = false;
|
||
// } else if (messageEvent.getMsgType() == 1012) {
|
||
// stub.setVisibility(GONE);
|
||
// } else if (messageEvent.getMsgType() == 1026) {//主持延迟
|
||
// countDownTime(messageEvent.getText().getDuration());
|
||
// } else if (messageEvent.getMsgType() == 1027) {//拍卖类型变化
|
||
// type = messageEvent.getText().getType();
|
||
// getTextView();
|
||
// steView(type);
|
||
// } else if (messageEvent.getMsgType() == 1005) {
|
||
// if (mBinding.roomMakeWheat2.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// mBinding.tvPB.setText(messageEvent.getText().getToUserInfo().getCharm() + "");
|
||
// } else {
|
||
// if (mBinding.ivAuction1 != null && mBinding.ivAuction1.getUserId() != null) {
|
||
// if (mBinding.ivAuction1.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// RoomMakeWheatView wheatView = mBinding.ivAuction1;
|
||
// wheatView.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||
// wheatView.setData(wheatView.pitBean);
|
||
// } else if (mBinding.ivAuction2.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// RoomMakeWheatView wheatView = mBinding.ivAuction2;
|
||
// wheatView.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||
// wheatView.setData(wheatView.pitBean);
|
||
// } else if (mBinding.ivAuction3.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// RoomMakeWheatView wheatView = mBinding.ivAuction3;
|
||
// wheatView.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||
// wheatView.setData(wheatView.pitBean);
|
||
// }
|
||
// }
|
||
// }
|
||
// } else if (messageEvent.getMsgType() == 1035) {
|
||
// RoomPitBean pitBean = mBinding.roomMakeWheat.pitBean;
|
||
// if (pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||
// pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
// pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
// pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
// pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
// mBinding.roomMakeWheat.setData(pitBean);
|
||
// }
|
||
// RoomPitBean pitBean2 = mBinding.roomMakeWheat2.pitBean;
|
||
// if (pitBean2.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||
// pitBean2.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
// pitBean2.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
// pitBean2.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
// pitBean2.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
// mBinding.roomMakeWheat2.setData(pitBean2);
|
||
// }
|
||
//
|
||
// if (auctionList != null && auctionList.size() > 0) {
|
||
// for (int i = 0; i < auctionList.size(); i++) {
|
||
// if (auctionList.get(i).getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||
// auctionList.get(i).setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
// auctionList.get(i).setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
// auctionList.get(i).setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
// auctionList.get(i).setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
// gexList();
|
||
// }
|
||
// }
|
||
//
|
||
// }
|
||
// }
|
||
//
|
||
// }
|
||
|
||
private void gengv() {
|
||
if (auctionUserBean != null) {
|
||
mBinding.tvRelation.setText(auctionUserBean.getRelation_name());
|
||
mBinding.tvTimetg.setText(auctionUserBean.getTime_day() + "小时");
|
||
mBinding.tvGift.setText(auctionUserBean.getGift_name());
|
||
ImageUtils.loadHeadCC(auctionUserBean.getBase_image(), mBinding.btnGift);
|
||
// auctionId=auctionUserBean.getAuction_id();
|
||
SpUtil.setAuctionId(auctionUserBean.getAuction_id());
|
||
LogUtils.e("lxj", mBinding.tvTimetg.getText());
|
||
}
|
||
}
|
||
|
||
// TODO: 2025/9/12 清除个人魅力
|
||
public void event1059(RoomMessageEvent messageEvent) {
|
||
RoomPitBean pitBean = wheatView.pitBean;
|
||
if (pitBean!=null) {
|
||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean.setCharm("");
|
||
wheatView.setCharm("0");
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||
if (pitBean2!=null) {
|
||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean2.setCharm("");
|
||
wheatView2.setCharm("0");
|
||
mBinding.tvPB.setText("0");
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||
if (pitBean3!=null){
|
||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean3.setCharm("");
|
||
mBinding.ivAuction1.setmTvTime("0");
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||
if (pitBean4!=null) {
|
||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean4.setCharm("");
|
||
mBinding.ivAuction2.setmTvTime("0");
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||
if (pitBean5!=null) {
|
||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean5.setCharm("");
|
||
mBinding.ivAuction3.setmTvTime("0");
|
||
return;
|
||
}
|
||
}
|
||
}
|
||
|
||
public void event1058(RoomMessageEvent messageEvent) {
|
||
int type = messageEvent.getText().getType();
|
||
if (messageEvent.getText().getUser_id() != null) {
|
||
|
||
|
||
RoomPitBean pitBean = wheatView.pitBean;
|
||
if (pitBean!=null) {
|
||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||
wheatView.setData(pitBean);
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||
if (pitBean2!=null) {
|
||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
||
wheatView2.setData(pitBean2);
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||
if (pitBean3!=null) {
|
||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
||
mBinding.ivAuction1.setData(pitBean3);
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||
if (pitBean4!=null) {
|
||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
||
mBinding.ivAuction2.setData(pitBean4);
|
||
return;
|
||
}
|
||
}
|
||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||
if (pitBean5!=null) {
|
||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
||
mBinding.ivAuction3.setData(pitBean5);
|
||
return;
|
||
}
|
||
}
|
||
if (auctionList != null && auctionList.size() > 0) {
|
||
for (int i = 0; i < auctionList.size(); i++) {
|
||
RoomAuction.AuctionListBean auctionListBean = auctionList.get(i);
|
||
int j = i;
|
||
j++;
|
||
if (j == 4) {
|
||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
mBinding.ivOnline4.setVisibility(type == 1 ? GONE : VISIBLE);
|
||
}
|
||
} else if (j == 5) {
|
||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
mBinding.ivOnline5.setVisibility(type == 1 ? GONE : VISIBLE);
|
||
}
|
||
} else if (j == 6) {
|
||
if (auctionListBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||
mBinding.ivOnline6.setVisibility(type == 1 ? GONE : VISIBLE);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public void event1003(RoomMessageEvent messageEvent) {
|
||
if (messageEvent.getText().getPit_number().equals("9")) {
|
||
wheatView.setData(getPitBean(messageEvent));
|
||
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
// imActionJs.setVisibility(View.VISIBLE);
|
||
// imActionYs.setVisibility(View.VISIBLE);
|
||
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(true);
|
||
}
|
||
// 用户上麦,根据权限显示按钮
|
||
} else {
|
||
getvjs();
|
||
// imActionYs.setVisibility(INVISIBLE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upYs(false);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
public void event1004(RoomMessageEvent messageEvent) {
|
||
if (messageEvent.getText().getPit_number().equals("9")) {
|
||
wheatView.setData(getPitBean2(messageEvent, "9"));
|
||
// 下麦时隐藏按钮
|
||
getvjs();
|
||
// imActionYs.setVisibility(GONE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upYs(false);
|
||
}
|
||
} else if (messageEvent.getText().getPit_number().equals("888")) {
|
||
wheatView2.setData(getPitBean2(messageEvent, "888"));
|
||
|
||
}
|
||
}
|
||
|
||
public void event1022(RoomMessageEvent messageEvent) {
|
||
if (messageEvent.getText().getType() == 1) {//拍卖位上麦
|
||
if (messageEvent.getText().getPit_number().equals("888")) {
|
||
wheatView2.setData(getPitBean(messageEvent));
|
||
getvjs();
|
||
// imActionYs.setVisibility(GONE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upYs(false);
|
||
}
|
||
}
|
||
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
|
||
CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager());
|
||
}
|
||
} else if (messageEvent.getText().getType() == 2) {//拍卖位下麦
|
||
if (messageEvent.getText().getPit_number().equals("9")) {
|
||
wheatView.setData(getPitBean2(messageEvent, "9"));
|
||
} else if (messageEvent.getText().getPit_number().equals("888")) {
|
||
wheatView2.setData(getPitBean2(messageEvent, "888"));
|
||
}
|
||
yinc();
|
||
}
|
||
}
|
||
|
||
public void event1025(RoomMessageEvent messageEvent) {
|
||
if (messageEvent.getText().getRecipient() != null) {//成功
|
||
CustomCenterDialogFragment.showWithAutoDismiss(messageEvent.getText().getRecipient(), messageEvent.getText().getAuction_user(), getActivity().getSupportFragmentManager());
|
||
} else {//失败
|
||
showCountDownDialog(getContext());
|
||
}
|
||
SpUtil.setAuctionId("");
|
||
releaseCountDownTimer();
|
||
auctionList = null;
|
||
gexList();
|
||
steView(type);
|
||
isButtonsInflated = false;
|
||
mBinding.tvPB.setText("0");
|
||
}
|
||
|
||
public void event1021(RoomMessageEvent messageEvent) {
|
||
mBinding.tvPB.setText("0");
|
||
if (mBinding.ivAuction1.pitBean != null) {
|
||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||
pitBean3.setCharm("");
|
||
mBinding.ivAuction1.setmTvTime("0");
|
||
}
|
||
if (mBinding.ivAuction2.pitBean != null) {
|
||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||
pitBean4.setCharm("");
|
||
mBinding.ivAuction2.setmTvTime("0");
|
||
}
|
||
if (mBinding.ivAuction3.pitBean != null) {
|
||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||
pitBean5.setCharm("");
|
||
mBinding.ivAuction3.setmTvTime("0");
|
||
}
|
||
}
|
||
|
||
public void event1027(RoomMessageEvent messageEvent) {
|
||
type = messageEvent.getText().getType();
|
||
// getTextView();
|
||
steView(type);
|
||
// 更新TextView样式
|
||
int defaultColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_0DFFB9); // 绿色
|
||
int selectedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white); // 白色
|
||
int clickedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_BB8BE2); // 蓝色
|
||
float defaultSize = 16f;
|
||
float selectedSize = 24f;
|
||
|
||
toggleTextStyles(mBinding.qinmi, mBinding.zhenai, defaultColor, selectedColor, clickedColor, defaultSize, selectedSize, type);
|
||
|
||
}
|
||
|
||
public void event1024(RoomMessageEvent messageEvent) {
|
||
auctionList = messageEvent.getText().getAuction_list();
|
||
gexList();
|
||
}
|
||
|
||
|
||
public void event1023(RoomMessageEvent messageEvent) {
|
||
mBinding.ivJp.setVisibility(VISIBLE);
|
||
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
// imActionYs.setVisibility(VISIBLE);
|
||
// imActionJs.setVisibility(VISIBLE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upVisibility(true);
|
||
}
|
||
|
||
} else {
|
||
getvjs();
|
||
// imActionYs.setVisibility(GONE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upJs(false);
|
||
}
|
||
}
|
||
if (messageEvent.getText().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
|
||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||
}
|
||
roomInfoResp.getRoom_auction().setAuction_user(messageEvent.getText().getAuction_user());
|
||
auctionId = messageEvent.getText().getAuction_user().getAuction_id();
|
||
SpUtil.setAuctionId(auctionId);
|
||
countDownTime(messageEvent.getText().getAuction_user().getDuration());
|
||
auctionUserBean = messageEvent.getText().getAuction_user();
|
||
gengv();
|
||
}
|
||
|
||
public void event1026(RoomMessageEvent messageEvent) {
|
||
countDownTime(messageEvent.getText().getDuration());
|
||
}
|
||
|
||
public void event1035(RoomMessageEvent messageEvent) {
|
||
RoomPitBean pitBean = mBinding.roomMakeWheat.pitBean;
|
||
if (pitBean!=null) {
|
||
if (pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
mBinding.roomMakeWheat.setData(pitBean);
|
||
}
|
||
}
|
||
RoomPitBean pitBean2 = mBinding.roomMakeWheat2.pitBean;
|
||
if (pitBean2 != null){
|
||
if (pitBean2.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||
pitBean2.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
pitBean2.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
pitBean2.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
pitBean2.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
mBinding.roomMakeWheat2.setData(pitBean2);
|
||
}
|
||
}
|
||
|
||
if (auctionList != null && auctionList.size() > 0) {
|
||
for (int i = 0; i < auctionList.size(); i++) {
|
||
if (auctionList.get(i).getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||
auctionList.get(i).setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
auctionList.get(i).setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
auctionList.get(i).setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
auctionList.get(i).setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
gexList();
|
||
}
|
||
}
|
||
|
||
}
|
||
}
|
||
|
||
public void event1005(RoomMessageEvent messageEvent) {
|
||
// 批量处理用户魅力值更新
|
||
List<UserInfo> toUserInfos = messageEvent.getText().getToUserInfos();
|
||
if (toUserInfos != null && !toUserInfos.isEmpty()) {
|
||
for (UserInfo userInfo : toUserInfos) {
|
||
updateCharmForUser(userInfo);
|
||
}
|
||
return;
|
||
}
|
||
|
||
// 单个用户处理
|
||
UserInfo toUserInfo = messageEvent.getText().getToUserInfo();
|
||
if (toUserInfo != null) {
|
||
updateCharmForUser(toUserInfo);
|
||
}
|
||
|
||
|
||
// if (mBinding.roomMakeWheat2.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// mBinding.tvPB.setText(messageEvent.getText().getToUserInfo().getCharm() + "");
|
||
// } else {
|
||
// if (mBinding.ivAuction1 != null && mBinding.ivAuction1.getUserId() != null) {
|
||
// if (mBinding.ivAuction1.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// RoomMakeWheatView wheatView = mBinding.ivAuction1;
|
||
// wheatView.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||
// wheatView.setData(wheatView.pitBean);
|
||
// } else if (mBinding.ivAuction2.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// RoomMakeWheatView wheatView = mBinding.ivAuction2;
|
||
// wheatView.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||
// wheatView.setData(wheatView.pitBean);
|
||
// } else if (mBinding.ivAuction3.getUserId().equals(messageEvent.getText().getToUserInfo().getUser_id() + "")) {
|
||
// RoomMakeWheatView wheatView = mBinding.ivAuction3;
|
||
// wheatView.pitBean.setCharm(messageEvent.getText().getToUserInfo().getCharm());
|
||
// wheatView.setData(wheatView.pitBean);
|
||
// }
|
||
// }
|
||
// }
|
||
}
|
||
|
||
/**
|
||
* 优化后的用户魅力值更新方法
|
||
* 通过映射表提高查找效率,避免重复的if-else判断
|
||
*/
|
||
private void updateCharmForUser(UserInfo userInfo) {
|
||
if (userInfo == null) return;
|
||
|
||
String userId = String.valueOf(userInfo.getUser_id());
|
||
String charm = userInfo.getCharm();
|
||
|
||
// 特殊处理拍卖主持人(888号麦位)
|
||
if (wheatView2.getUserId().equals(userId)) {
|
||
mBinding.tvPB.setText(StringUtil.toWan2(charm, 1));
|
||
wheatView2.pitBean.setCharm(charm);
|
||
wheatView2.setCharm(charm);
|
||
return;
|
||
}
|
||
|
||
// 处理拍卖麦位用户(111, 222, 333号麦位)
|
||
RoomMakeWheatView targetWheatView = null;
|
||
if (mBinding.ivAuction1.getUserId().equals(userId)) {
|
||
targetWheatView = mBinding.ivAuction1;
|
||
} else if (mBinding.ivAuction2.getUserId().equals(userId)) {
|
||
targetWheatView = mBinding.ivAuction2;
|
||
} else if (mBinding.ivAuction3.getUserId().equals(userId)) {
|
||
targetWheatView = mBinding.ivAuction3;
|
||
}
|
||
|
||
if (targetWheatView != null) {
|
||
targetWheatView.pitBean.setCharm(charm);
|
||
targetWheatView.setmTvTime(charm);
|
||
}
|
||
}
|
||
|
||
@Override
|
||
public void onDestroy() {
|
||
super.onDestroy();
|
||
// stub.setVisibility(GONE);
|
||
// isButtonsInflated = false;
|
||
// releaseCountDownTimer();
|
||
// EventBus.getDefault().unregister(this);
|
||
releaseResources();
|
||
}
|
||
|
||
private void yinc() {
|
||
getvjs();
|
||
mBinding.ivJp.setVisibility(INVISIBLE);
|
||
// imActionYs.setVisibility(INVISIBLE);
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upYs(false);
|
||
}
|
||
mBinding.tvDjTime.setVisibility(INVISIBLE);
|
||
mBinding.tvRelation.setText("关系");
|
||
mBinding.tvTimetg.setText("时间");
|
||
mBinding.tvGift.setText("礼物");
|
||
mBinding.btnGift.setImageResource(com.xscm.moduleutil.R.mipmap.liwu);
|
||
|
||
closeCardRelationshipFragment();//这是当抱麦上的人没有选择关系后,主持有权利结束这个游戏,并且关闭弹框
|
||
}
|
||
|
||
public void closeCardRelationshipFragment() {
|
||
CardRelationshipFragment fragment = (CardRelationshipFragment) requireActivity().getSupportFragmentManager().findFragmentByTag("CardRelationshipFragment");
|
||
if (fragment != null) {
|
||
fragment.dismiss();
|
||
}
|
||
}
|
||
|
||
private void gexList() {
|
||
if (auctionList != null && auctionList.size() > 0) {
|
||
for (int i = 0; i < auctionList.size(); i++) {
|
||
int j = i;
|
||
j++;
|
||
|
||
RoomAuction.AuctionListBean auctionListBean = auctionList.get(i);
|
||
RoomPitBean pitBean = new RoomPitBean();
|
||
pitBean.setUser_id(auctionListBean.getUser_id());
|
||
pitBean.setNickname(auctionListBean.getNickname());
|
||
pitBean.setAvatar(auctionListBean.getAvatar());
|
||
pitBean.setCharm(auctionListBean.getCharm());
|
||
pitBean.setSex(auctionListBean.getSex());
|
||
pitBean.setDress(auctionListBean.getDress());
|
||
if (j == 1) {
|
||
pitBean.setPit_number("111");
|
||
RoomMakeWheatView wheatView = mBinding.ivAuction1;
|
||
mBinding.nickName1.setText(pitBean.getNickname());
|
||
wheatView.setData(pitBean);
|
||
} else if (j == 2) {
|
||
pitBean.setPit_number("222");
|
||
RoomMakeWheatView wheatView = mBinding.ivAuction2;
|
||
mBinding.nickName2.setText(pitBean.getNickname());
|
||
wheatView.setData(pitBean);
|
||
} else if (j == 3) {
|
||
pitBean.setPit_number("333");
|
||
RoomMakeWheatView wheatView = mBinding.ivAuction3;
|
||
mBinding.nickName3.setText(pitBean.getNickname());
|
||
wheatView.setData(pitBean);
|
||
} else if (j == 4) {
|
||
// if (auctionListBean.getUser_id().equals(SpUtil.getUserId() + "")){
|
||
// if (parentFragment != null) {
|
||
// parentFragment.setRoleType(3, 444);
|
||
// parentFragment.switchMic(2);
|
||
// }
|
||
// }
|
||
ImageUtils.loadHeadCC(auctionListBean.getAvatar(), mBinding.avatar4);
|
||
|
||
} else if (j == 5) {
|
||
// if (auctionListBean.getUser_id().equals(SpUtil.getUserId() + "")){
|
||
// if (parentFragment != null) {
|
||
// parentFragment.setRoleType(3, 555);
|
||
// parentFragment.switchMic(2);
|
||
// }
|
||
// }
|
||
ImageUtils.loadHeadCC(auctionListBean.getAvatar(), mBinding.avatar5);
|
||
} else if (j == 6) {
|
||
// if (auctionListBean.getUser_id().equals(SpUtil.getUserId() + "")){
|
||
// if (parentFragment != null) {
|
||
// parentFragment.setRoleType(3, 666);
|
||
// parentFragment.switchMic(2);
|
||
// }
|
||
// }
|
||
ImageUtils.loadHeadCC(auctionListBean.getAvatar(), mBinding.avatar6);
|
||
}
|
||
|
||
}
|
||
} else {
|
||
RoomMakeWheatView wheatView = mBinding.ivAuction1;
|
||
mBinding.nickName1.setText("一号麦");
|
||
wheatView.setData(getPitBean2(null, "111"));
|
||
|
||
RoomMakeWheatView wheatView2 = mBinding.ivAuction2;
|
||
mBinding.nickName2.setText("二号麦");
|
||
wheatView2.setData(getPitBean2(null, "222"));
|
||
|
||
RoomMakeWheatView wheatView3 = mBinding.ivAuction3;
|
||
mBinding.nickName3.setText("三号麦");
|
||
wheatView3.setData(getPitBean2(null, "333"));
|
||
|
||
|
||
mBinding.avatar4.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default);
|
||
mBinding.avatar5.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default);
|
||
mBinding.avatar6.setImageResource(com.xscm.moduleutil.R.mipmap.room_ic_wheat_default);
|
||
// mBinding.ivAuction1.setData(getPitBean2(null));
|
||
// mBinding.ivAuction2.setData(getPitBean2(null));
|
||
// mBinding.ivAuction3.setData(getPitBean2(null));
|
||
|
||
}
|
||
if (parentFragment != null) {
|
||
parentFragment.getVoiceStatus(auctionUserBean, auctionList, mBinding.roomMakeWheat.pitBean.getUser_id());
|
||
|
||
// parentFragment.setRoleType(3, 0);
|
||
// parentFragment.switchMic(2);
|
||
}
|
||
}
|
||
|
||
|
||
// TODO: 2025/6/30 竞拍失败的dialog
|
||
public void showCountDownDialog(Context context) {
|
||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||
View dialogView = getLayoutInflater().inflate(R.layout.dialog_with_countdown, null);
|
||
builder.setView(dialogView);
|
||
|
||
TextView btnKnow = dialogView.findViewById(R.id.btn_know);
|
||
TextView tvCountDown = dialogView.findViewById(R.id.tv_countdown);
|
||
|
||
final AlertDialog dialog = builder.create();
|
||
dialog.setCancelable(false); // 防止点击外部取消
|
||
|
||
final CountDownTimer countDownTimer = new CountDownTimer(3000, 1000) {
|
||
@Override
|
||
public void onTick(long millisUntilFinished) {
|
||
int secondsRemaining = (int) (millisUntilFinished / 1000);
|
||
tvCountDown.setText(String.valueOf(secondsRemaining));
|
||
}
|
||
|
||
@Override
|
||
public void onFinish() {
|
||
dialog.dismiss(); // 倒计时结束自动关闭
|
||
}
|
||
};
|
||
|
||
btnKnow.setOnClickListener(v -> {
|
||
countDownTimer.cancel(); // 取消倒计时
|
||
dialog.dismiss(); // 手动关闭对话框
|
||
});
|
||
|
||
dialog.show();
|
||
|
||
countDownTimer.start(); // 开始倒计时
|
||
//设置 Dialog 最大宽度(例如屏幕宽度的 80%)
|
||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||
lp.copyFrom(dialog.getWindow().getAttributes());
|
||
lp.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9f); // 80% 屏幕宽度
|
||
int maxHeightDp = 200; // 最大高度 200dp
|
||
int maxHeightPx = (int) (maxHeightDp * context.getResources().getDisplayMetrics().density);
|
||
|
||
// lp.height = Math.min(
|
||
// maxHeightPx,
|
||
// context.getResources().getDisplayMetrics().heightPixels * 3 / 5
|
||
// ); // 取较小值
|
||
dialog.getWindow().setAttributes(lp);
|
||
}
|
||
|
||
|
||
public void countDownTime(long time) {
|
||
try {
|
||
if (time <= 0) {
|
||
setTime(0);
|
||
releaseCountDownTimer();
|
||
return;
|
||
}
|
||
releaseCountDownTimer();
|
||
// 获取当前时间的毫秒值
|
||
long currentTime = System.currentTimeMillis() / 1000L;
|
||
// 计算倒计时的总秒数
|
||
long countDownTime = (time - currentTime);
|
||
Logger.d("@@@", "countDownTime = " + countDownTime);
|
||
if (countDownTime <= 0) {
|
||
setTime(0);
|
||
releaseCountDownTimer();
|
||
return;
|
||
}
|
||
mCountDownTimer = new CountDownTimer(countDownTime * 1000L, 1000L) {
|
||
@Override
|
||
public void onTick(long millisUntilFinished) {
|
||
int time1 = (int) (millisUntilFinished / 1000);
|
||
setTime(time1);
|
||
remainingTime = time1;
|
||
}
|
||
|
||
@Override
|
||
public void onFinish() {
|
||
setTime(0);
|
||
|
||
remainingTime = 0;
|
||
}
|
||
};
|
||
mCountDownTimer.start();
|
||
} catch (Exception e) {
|
||
Logger.e("countDownTime", e);
|
||
}
|
||
}
|
||
|
||
private String formatTime(int totalSeconds) {
|
||
int hours = totalSeconds / 3600;
|
||
int minutes = (totalSeconds % 3600) / 60;
|
||
int seconds = totalSeconds % 60;
|
||
|
||
// return String.format("%02d:%02d", minutes, seconds);
|
||
return String.format("%02d:%02d:%02d", hours, minutes, seconds);
|
||
}
|
||
|
||
@SuppressLint("DefaultLocale")
|
||
public void setTime(int seconds) {
|
||
mBinding.tvDjTime.setVisibility(VISIBLE);
|
||
if (seconds == 0) {
|
||
mBinding.tvDjTime.setText("倒计时:00:00");
|
||
}
|
||
String formattedTime = formatTime(seconds);
|
||
mBinding.tvDjTime.setText("倒计时:" + formattedTime);
|
||
|
||
}
|
||
|
||
// TODO: 2025/3/19 释放倒计时器
|
||
private void releaseCountDownTimer() {
|
||
if (mCountDownTimer != null) {
|
||
mCountDownTimer.cancel();
|
||
mCountDownTimer = null;
|
||
mBinding.tvDjTime.setVisibility(INVISIBLE);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
// TODO: 2025/6/30 上麦,麦位变化
|
||
private RoomPitBean getPitBean(RoomMessageEvent messageEvent) {
|
||
RoomPitBean pitBean = new RoomPitBean();
|
||
pitBean.setPit_number(messageEvent.getText().getPit_number());
|
||
pitBean.setUser_id(messageEvent.getText().getFromUserInfo().getUser_id() + "");
|
||
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
|
||
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||
return pitBean;
|
||
}
|
||
|
||
// TODO: 2025/6/30 下麦麦位变化
|
||
private RoomPitBean getPitBean2(RoomMessageEvent messageEvent, String number) {
|
||
RoomPitBean pitBean = new RoomPitBean();
|
||
pitBean.setPit_number(messageEvent != null ? messageEvent.getText().getPit_number() : number);
|
||
pitBean.setUser_id("");
|
||
pitBean.setAvatar("");
|
||
pitBean.setNickname("");
|
||
pitBean.setSex("");
|
||
pitBean.setCharm("");
|
||
pitBean.setIs_pm(1);
|
||
pitBean.setDress("");
|
||
return pitBean;
|
||
}
|
||
|
||
|
||
@Override
|
||
public void onDestroyView() {
|
||
super.onDestroyView();
|
||
// if (EventBus.getDefault().isRegistered(this)) {
|
||
// EventBus.getDefault().unregister(this);
|
||
// }
|
||
// stub.setVisibility(GONE);
|
||
releaseResources();
|
||
}
|
||
|
||
public void releaseResources() {
|
||
if (EventBus.getDefault().isRegistered(this)) {
|
||
EventBus.getDefault().unregister(this);
|
||
}
|
||
if (getActivity() instanceof RoomActivity) {
|
||
((RoomActivity) getActivity()).upTop();
|
||
}
|
||
isButtonsInflated = false;
|
||
releaseCountDownTimer();
|
||
closeCardRelationshipFragment();
|
||
}
|
||
|
||
/**
|
||
* 切换两个 TextView 的样式
|
||
*
|
||
* @param qinmi 亲密拍 TextView
|
||
* @param zhenai 真爱拍 TextView
|
||
* @param defaultColor 默认颜色(绿色)
|
||
* @param selectedColor 选中颜色(白色)
|
||
* @param clickedColor 真爱拍选中颜色(蓝色)
|
||
* @param defaultSize 默认字体大小(16sp)
|
||
* @param selectedSize 选中字体大小(24sp)
|
||
* @param type 类型(1=真爱拍,2=亲密拍)
|
||
*/
|
||
public void toggleTextStyles(TextView qinmi, TextView zhenai, int defaultColor,
|
||
int selectedColor, int clickedColor, float defaultSize, float selectedSize, int type) {
|
||
if (type == 1) {
|
||
// 真爱拍模式:真爱拍选中(蓝色,大字体),亲密拍未选中(白色,小字体)
|
||
zhenai.setTextColor(clickedColor); // 真爱拍蓝色
|
||
zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 真爱拍24号字体
|
||
qinmi.setTextColor(selectedColor); // 亲密拍白色
|
||
qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 亲密拍16号字体
|
||
} else if (type == 2) {
|
||
// 亲密拍模式:亲密拍选中(绿色,大字体),真爱拍未选中(白色,小字体)
|
||
qinmi.setTextColor(defaultColor); // 亲密拍绿色
|
||
qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 亲密拍24号字体
|
||
zhenai.setTextColor(selectedColor); // 真爱拍白色
|
||
zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 真爱拍16号字体
|
||
}
|
||
mBinding.qinmi.requestLayout();
|
||
mBinding.qinmi.invalidate();
|
||
mBinding.zhenai.requestLayout();
|
||
mBinding.zhenai.invalidate();
|
||
|
||
}
|
||
|
||
|
||
///
|
||
|
||
}
|