拍卖房 fix bugs.

This commit is contained in:
2025-12-04 22:51:36 +08:00
parent 2756fdb4b7
commit b46913b920
4 changed files with 170 additions and 92 deletions

View File

@@ -1933,6 +1933,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
if (userId == currentUserId) {
setRoleType(3, 888)
switchMic(2)
aBoolean = false
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up)
}
}
} else if (text.type == 2) {
@@ -1942,6 +1944,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
} else if ("888" == pitNumber) {
mRoomInfoResp?.room_auction = RoomAuction()
if (userId == currentUserId) {
aBoolean = true
ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding)
setRoleType(0, 0)
switchMic(2)
}

View File

@@ -78,8 +78,13 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
private List<RoomAuction.AuctionListBean> auctionList;
private int type;
RoomFragment parentFragment;
private int isShowCardRelationshipFragment = -2;
private CardRelationshipFragment dialogFragment = null;
public RoomAuctionFragment() {
}
public RoomAuctionFragment(){}
public RoomAuctionFragment(RoomInfoResp resp) {
roomInfoResp = resp;
}
@@ -408,8 +413,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
}
}
}
else if (id == R.id.bangdan) {//出价榜单
} 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("")) {
@@ -861,6 +865,17 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
}
}
@Override
public void onResume() {
super.onResume();
if (isShowCardRelationshipFragment == -1) {
isShowCardRelationshipFragment = CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(),
SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager(), dialogFragment -> {
this.dialogFragment = dialogFragment;
});
}
}
public void event1022(RoomMessageEvent messageEvent) {
if (messageEvent.getText().getType() == 1) {//拍卖位上麦
if (messageEvent.getText().getPit_number().equals("888")) {
@@ -870,14 +885,26 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
((RoomActivity) getActivity()).upYs(false);
}
}
isShowCardRelationshipFragment = -2;
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager());
isShowCardRelationshipFragment = CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(),
SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager(), dialogFragment -> {
this.dialogFragment = dialogFragment;
});
}
} 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"));
try {
if (dialogFragment != null){
dialogFragment.dismiss();
}
}catch (Exception e){
LogUtils.e("RoomAuctionFragment", "event1022: " + e.getMessage());
}
}
yinc();
}
@@ -949,9 +976,13 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
getvjs();
// imActionYs.setVisibility(GONE);
if (getActivity() instanceof RoomActivity) {
if (getHostUser() < 4){
((RoomActivity) getActivity()).upJs(true);
}else {
((RoomActivity) getActivity()).upJs(false);
}
}
}
if (messageEvent.getText().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
mBinding.ivJp.setVisibility(INVISIBLE);
}

View File

@@ -13,6 +13,7 @@ import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.modulemain.R;
import com.xscm.modulemain.adapter.CardRelationAdapter;
import com.xscm.modulemain.activity.room.contacts.CardRelationshipContacts;
@@ -56,8 +57,18 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
return new CardRelationshipPresenter(this, getActivity());
}
public interface OnCardRelationListener{
void OnCardRelationListener(CardRelationshipFragment dialogFragment);
}
public static void show(String roomId, String userId,String type, FragmentManager fragmentManager) {
public static int show(String roomId, String userId, String type, FragmentManager fragmentManager,OnCardRelationListener onCardRelationListener) {
//activity 退到后台调用闪退
try {
// 检查 FragmentManager 状态
if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
return -1;
}
CardRelationshipFragment dialogFragment = new CardRelationshipFragment();
Bundle args = new Bundle();
args.putString("roomId", roomId);
@@ -65,7 +76,14 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
args.putString("type", type);
dialogFragment.setArguments(args);
dialogFragment.show(fragmentManager, "CardRelationshipFragment");
onCardRelationListener.OnCardRelationListener(dialogFragment);
return 0;
} catch (Exception e) {
LogUtils.e("CardRelationshipFragment", "show: " + e.getMessage());
return -1;
}
}
@Override
public void onAttach(@NonNull Context context) {
super.onAttach(context);
@@ -79,6 +97,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
MvpPre.roomRelationList(type);
}
@Override
public void onStart() {
super.onStart();
@@ -86,7 +105,8 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
if (window != null) {
// 设置固定高度为 500dp
int screenHeight = getResources().getDisplayMetrics().heightPixels;
int heightInDp = (int) (screenHeight * 0.6f);;
int heightInDp = (int) (screenHeight * 0.6f);
;
int heightInPx = (int) heightInDp;
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInPx);
@@ -97,12 +117,14 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
getDialog().setCancelable(false);
getDialog().setCanceledOnTouchOutside(false);
}
@Override
protected void initDialogStyle(Window window) {
super.initDialogStyle(window);
window.setGravity(Gravity.BOTTOM);
setStyle(DialogFragment.STYLE_NORMAL, com.xscm.moduleutil.R.style.CustomDialogFragmentTheme);
}
@Override
protected void initView() {
RecyclerView recyclerView = mBinding.recycleView;

View File

@@ -24,6 +24,7 @@ import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.FragmentManager;
import com.blankj.utilcode.util.LogUtils;
import com.xscm.modulemain.R;
import com.xscm.moduleutil.bean.room.RoomAuction;
import com.xscm.moduleutil.utils.ImageUtils;
@@ -53,17 +54,32 @@ public class CustomCenterDialogFragment extends DialogFragment {
}
public static void show(RoomAuction.AuctionListBean recipient, RoomAuction.AuctionUserBean auction_user, FragmentManager fragmentManager) {
//activity 退到后台调用闪退
try {
// 检查 FragmentManager 状态
if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
return;
}
CustomCenterDialogFragment fragment = new CustomCenterDialogFragment();
Bundle args = new Bundle();
args.putSerializable("recipient", recipient);
args.putSerializable("auction_user", auction_user);
fragment.setArguments(args);
fragment.show(fragmentManager, "CustomCenterDialogFragment");
} catch (Exception e) {
LogUtils.e("CustomCenterDialogFragment", e.getMessage());
}
}
public static void showWithAutoDismiss(RoomAuction.AuctionListBean recipient,
RoomAuction.AuctionUserBean auction_user,
FragmentManager fragmentManager) {
//activity 退到后台调用闪退
try {
// 检查 FragmentManager 状态
if (fragmentManager.isDestroyed() || fragmentManager.isStateSaved()) {
return;
}
CustomCenterDialogFragment fragment = new CustomCenterDialogFragment();
Bundle args = new Bundle();
args.putSerializable("recipient", recipient);
@@ -94,9 +110,13 @@ public class CustomCenterDialogFragment extends DialogFragment {
}
}
} catch (Exception e) {
LogUtils.e("CustomCenterDialogFragment", e.getMessage());
// 安全地忽略异常
}
}, 4000); // 4秒后关闭
} catch (Exception e) {
LogUtils.e("CustomCenterDialogFragment", e.getMessage());
}
}
@@ -112,7 +132,6 @@ public class CustomCenterDialogFragment extends DialogFragment {
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
@@ -161,6 +180,7 @@ public class CustomCenterDialogFragment extends DialogFragment {
return dialog;
}
private void setTextViewGradient(TextView textView, int startColor, int endColor) {
Shader shader = new LinearGradient(
0, 0, textView.getPaint().getTextSize() * textView.length(), 0,
@@ -169,6 +189,7 @@ public class CustomCenterDialogFragment extends DialogFragment {
Shader.TileMode.CLAMP);
textView.getPaint().setShader(shader);
}
@Override
public void onResume() {
super.onResume();