拍卖房 fix bugs.
This commit is contained in:
@@ -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;
|
||||
@@ -34,11 +35,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/28
|
||||
*@description: 卡关系弹框
|
||||
* @author qx
|
||||
* @data 2025/6/28
|
||||
* @description: 卡关系弹框
|
||||
*/
|
||||
public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelationshipPresenter, DialogCardRelationBinding> implements CardRelationshipContacts.View{
|
||||
public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelationshipPresenter, DialogCardRelationBinding> implements CardRelationshipContacts.View {
|
||||
|
||||
private String type;
|
||||
private String roomId;
|
||||
@@ -46,7 +47,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
private CardRelationAdapter adapter;
|
||||
private List<ViewItem> viewItems = new ArrayList<>();
|
||||
|
||||
private RoomAuctionABean roomAuctionABean;
|
||||
private RoomAuctionABean roomAuctionABean;
|
||||
RoomRelationBean roomRelationBean;
|
||||
RoomAutionTimeBean roomAutionTimeBean;
|
||||
RoonGiftModel roonGiftModel;
|
||||
@@ -56,16 +57,33 @@ 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) {
|
||||
CardRelationshipFragment dialogFragment = new CardRelationshipFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", roomId);
|
||||
args.putString("userId", userId);
|
||||
args.putString("type", type);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "CardRelationshipFragment");
|
||||
|
||||
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);
|
||||
args.putString("userId", userId);
|
||||
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;
|
||||
@@ -117,11 +139,11 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
case ViewItem.TYPE_TEXT: // 文本占满整行
|
||||
return 4;
|
||||
case ViewItem.TYPE_RELATION: // 每行 2 个
|
||||
return 1;
|
||||
return 1;
|
||||
case ViewItem.TYPE_GIFT: // 每行 3 个
|
||||
return 1; // 3 个时,总列数 3,则每项占 1 列;若总列数为 4,则需调整
|
||||
case ViewItem.TYPE_IMAGE_SELECTION: // 每行 4 个
|
||||
return 1;
|
||||
return 1;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
@@ -129,7 +151,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
});
|
||||
adapter = new CardRelationAdapter();
|
||||
recyclerView.setAdapter(adapter);
|
||||
roomAuctionABean=new RoomAuctionABean();
|
||||
roomAuctionABean = new RoomAuctionABean();
|
||||
|
||||
// 模拟从网络获取 RoomAuctionABean 数据
|
||||
|
||||
@@ -138,23 +160,23 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
mBinding.tvWheatQd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
roomRelationBean = adapter.getSelectedRelation();
|
||||
roomAutionTimeBean = adapter.getSelectedTime();
|
||||
roonGiftModel = adapter.getSelectedGift();
|
||||
if (type.equals("2")){
|
||||
roomRelationBean = adapter.getSelectedRelation();
|
||||
roomAutionTimeBean = adapter.getSelectedTime();
|
||||
roonGiftModel = adapter.getSelectedGift();
|
||||
if (type.equals("2")) {
|
||||
if (roomRelationBean != null && roomAutionTimeBean != null && roonGiftModel != null) {
|
||||
// 创建一个 RoomAuctionABean 对象
|
||||
MvpPre.roomAuction(roomId, userId, roonGiftModel.getGift_id(), roomRelationBean.getRelation_id(), "2", roomAutionTimeBean.getHours()+"");
|
||||
}else {
|
||||
MvpPre.roomAuction(roomId, userId, roonGiftModel.getGift_id(), roomRelationBean.getRelation_id(), "2", roomAutionTimeBean.getHours() + "");
|
||||
} else {
|
||||
ToastUtils.show("请选择竞拍信息");
|
||||
}
|
||||
}else {
|
||||
if (roomRelationBean != null&& roonGiftModel != null){
|
||||
} else {
|
||||
if (roomRelationBean != null && roonGiftModel != null) {
|
||||
|
||||
// MvpPre.roomAuctionTime(roonGiftModel.getGift_id());
|
||||
MvpPre.roomAuction(roomId, userId, roonGiftModel.getGift_id(), roomRelationBean.getRelation_id(), "1", "");
|
||||
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.show("请选择竞拍信息");
|
||||
}
|
||||
}
|
||||
@@ -173,10 +195,10 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
|
||||
@Override
|
||||
public void roomRelationList(List<RoomRelationBean> 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<CardRelation
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels) {
|
||||
if (roonGiftModels!=null) {
|
||||
if (roonGiftModels != null) {
|
||||
roomAuctionABean.setRoomGiftBeanList(roonGiftModels);
|
||||
upList();
|
||||
}
|
||||
@@ -204,7 +226,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
}
|
||||
|
||||
|
||||
private void upList(){
|
||||
private void upList() {
|
||||
if (roomAuctionABean != null) {
|
||||
// 添加文本项
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_TEXT, "选择关系"));
|
||||
@@ -214,7 +236,7 @@ public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelation
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_RELATION, bean));
|
||||
}
|
||||
|
||||
if (type.equals("2")){
|
||||
if (type.equals("2")) {
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_TEXT, "选择时长"));
|
||||
for (RoomAutionTimeBean bean : getDefaultTimeOptions()) {
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_IMAGE_SELECTION, bean));
|
||||
|
||||
Reference in New Issue
Block a user