From b46913b9208d5add532a996a65523c96f828baf6 Mon Sep 17 00:00:00 2001 From: lzl <1239365383@qq.com> Date: Thu, 4 Dec 2025 22:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=8D=E5=8D=96=E6=88=BF=20fix=20bugs.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/room/activity/RoomActivity.kt | 4 + .../room/fragment/RoomAuctionFragment.java | 45 +++++- .../dialog/CardRelationshipFragment.java | 84 +++++++----- .../dialog/CustomCenterDialogFragment.java | 129 ++++++++++-------- 4 files changed, 170 insertions(+), 92 deletions(-) diff --git a/MainModule/src/main/java/com/xscm/modulemain/activity/room/activity/RoomActivity.kt b/MainModule/src/main/java/com/xscm/modulemain/activity/room/activity/RoomActivity.kt index 2c59c3e0..3d3296ec 100644 --- a/MainModule/src/main/java/com/xscm/modulemain/activity/room/activity/RoomActivity.kt +++ b/MainModule/src/main/java/com/xscm/modulemain/activity/room/activity/RoomActivity.kt @@ -1933,6 +1933,8 @@ class RoomActivity : BaseMvpActivity(), 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(), } 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) } diff --git a/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomAuctionFragment.java b/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomAuctionFragment.java index a96cab2c..09832f45 100644 --- a/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomAuctionFragment.java +++ b/MainModule/src/main/java/com/xscm/modulemain/activity/room/fragment/RoomAuctionFragment.java @@ -78,9 +78,14 @@ public class RoomAuctionFragment extends BaseMvpFragment auctionList; private int type; RoomFragment parentFragment; + private int isShowCardRelationshipFragment = -2; - public RoomAuctionFragment(){} - public RoomAuctionFragment(RoomInfoResp resp){ + private CardRelationshipFragment dialogFragment = null; + + public RoomAuctionFragment() { + } + + public RoomAuctionFragment(RoomInfoResp resp) { roomInfoResp = resp; } @@ -408,8 +413,7 @@ public class RoomAuctionFragment extends BaseMvpFragment { + 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 { + 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,7 +976,11 @@ public class RoomAuctionFragment extends BaseMvpFragment implements CardRelationshipContacts.View{ +public class CardRelationshipFragment extends BaseMvpDialogFragment implements CardRelationshipContacts.View { private String type; private String roomId; @@ -46,7 +47,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment viewItems = new ArrayList<>(); - private RoomAuctionABean roomAuctionABean; + private RoomAuctionABean roomAuctionABean; RoomRelationBean roomRelationBean; RoomAutionTimeBean roomAutionTimeBean; RoonGiftModel roonGiftModel; @@ -56,16 +57,33 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment roomRelationBeans) { - if (roomRelationBeans!=null) { + if (roomRelationBeans != null) { roomAuctionABean.setRoomRelationBeanList(roomRelationBeans); MvpPre.getGiftList("99"); - }else { + } else { ToastUtils.show("数据接口错误"); } @@ -184,7 +206,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment roonGiftModels) { - if (roonGiftModels!=null) { + if (roonGiftModels != null) { roomAuctionABean.setRoomGiftBeanList(roonGiftModels); upList(); } @@ -204,7 +226,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment { // if (fragment.isAdded()) { @@ -78,25 +94,29 @@ public class CustomCenterDialogFragment extends DialogFragment { // } // }, 4000); // 4秒后关闭 - new Handler(Looper.getMainLooper()).postDelayed(() -> { - try { - if (fragment.isAdded() && - !fragment.isRemoving() && - !fragment.isDetached() && - fragment.getActivity() != null && - !fragment.getActivity().isFinishing() && - !fragment.getActivity().isDestroyed()) { + new Handler(Looper.getMainLooper()).postDelayed(() -> { + try { + if (fragment.isAdded() && + !fragment.isRemoving() && + !fragment.isDetached() && + fragment.getActivity() != null && + !fragment.getActivity().isFinishing() && + !fragment.getActivity().isDestroyed()) { - if (fragment.getFragmentManager() != null && !fragment.getFragmentManager().isStateSaved()) { - fragment.dismiss(); - } else { - fragment.dismissAllowingStateLoss(); + if (fragment.getFragmentManager() != null && !fragment.getFragmentManager().isStateSaved()) { + fragment.dismiss(); + } else { + fragment.dismissAllowingStateLoss(); + } } + } catch (Exception e) { + LogUtils.e("CustomCenterDialogFragment", e.getMessage()); + // 安全地忽略异常 } - } catch (Exception e) { - // 安全地忽略异常 - } - }, 4000); // 4秒后关闭 + }, 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) { @@ -126,41 +145,42 @@ public class CustomCenterDialogFragment extends DialogFragment { window.setGravity(Gravity.CENTER); } - avatar1= dialog.findViewById(R.id.avatar1); - avatar2= dialog.findViewById(R.id.avatar2); - tv_name1= dialog.findViewById(R.id.tv_name1); - tv_name2= dialog.findViewById(R.id.tv_name2); - tv_tname= dialog.findViewById(R.id.tv_tname); + avatar1 = dialog.findViewById(R.id.avatar1); + avatar2 = dialog.findViewById(R.id.avatar2); + tv_name1 = dialog.findViewById(R.id.tv_name1); + tv_name2 = dialog.findViewById(R.id.tv_name2); + tv_tname = dialog.findViewById(R.id.tv_tname); - za_avatar1= dialog.findViewById(R.id.za_avatar1); - za_avatar2= dialog.findViewById(R.id.za_avatar2); - tv_za_name1= dialog.findViewById(R.id.tv_za_name1); - tv_za_name2= dialog.findViewById(R.id.tv_za_name2); - tv_za_tname= dialog.findViewById(R.id.tv_tname_za); + za_avatar1 = dialog.findViewById(R.id.za_avatar1); + za_avatar2 = dialog.findViewById(R.id.za_avatar2); + tv_za_name1 = dialog.findViewById(R.id.tv_za_name1); + tv_za_name2 = dialog.findViewById(R.id.tv_za_name2); + tv_za_tname = dialog.findViewById(R.id.tv_tname_za); - constraintLayout_qm= dialog.findViewById(R.id.cl_container); - constraintLayout2_za= dialog.findViewById(R.id.cl_container_za); - if (auction_user.getAuction_type().equals("2")){ + constraintLayout_qm = dialog.findViewById(R.id.cl_container); + constraintLayout2_za = dialog.findViewById(R.id.cl_container_za); + if (auction_user.getAuction_type().equals("2")) { constraintLayout_qm.setVisibility(View.VISIBLE); constraintLayout2_za.setVisibility(View.GONE); - ImageUtils.loadHeadCC(recipient.getAvatar(),avatar1); - ImageUtils.loadHeadCC(auction_user.getAvatar(),avatar2); + ImageUtils.loadHeadCC(recipient.getAvatar(), avatar1); + ImageUtils.loadHeadCC(auction_user.getAvatar(), avatar2); tv_name1.setText(recipient.getNickname()); tv_name2.setText(auction_user.getNickname()); - tv_tname.setText(auction_user.getRelation_name()+"关系竞拍成功"); + tv_tname.setText(auction_user.getRelation_name() + "关系竞拍成功"); setTextViewGradient(tv_tname, ContextCompat.getColor(getContext(), com.xscm.moduleutil.R.color.color_FFFFF0F0), ContextCompat.getColor(getContext(), com.xscm.moduleutil.R.color.color_FFA4C8)); - }else { + } else { constraintLayout_qm.setVisibility(View.GONE); constraintLayout2_za.setVisibility(View.VISIBLE); - ImageUtils.loadHeadCC(recipient.getAvatar(),za_avatar1); - ImageUtils.loadHeadCC(auction_user.getAvatar(),za_avatar2); + ImageUtils.loadHeadCC(recipient.getAvatar(), za_avatar1); + ImageUtils.loadHeadCC(auction_user.getAvatar(), za_avatar2); tv_za_name1.setText(recipient.getNickname()); tv_za_name2.setText(auction_user.getNickname()); - tv_za_tname.setText(auction_user.getRelation_name()+"关系竞拍成功"); + tv_za_tname.setText(auction_user.getRelation_name() + "关系竞拍成功"); } 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();