2025-10-28 16:56:13 +08:00
|
|
|
package com.xscm.modulemain.dialog;
|
2025-10-20 10:16:44 +08:00
|
|
|
|
|
|
|
|
import static android.view.View.GONE;
|
|
|
|
|
import static android.view.View.VISIBLE;
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle;
|
|
|
|
|
import android.view.Gravity;
|
|
|
|
|
import android.view.View;
|
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
|
import android.view.Window;
|
|
|
|
|
import android.view.WindowManager;
|
|
|
|
|
|
|
|
|
|
import androidx.fragment.app.FragmentManager;
|
|
|
|
|
|
|
|
|
|
import com.blankj.utilcode.util.ToastUtils;
|
2025-10-28 16:56:13 +08:00
|
|
|
import com.xscm.modulemain.R;
|
|
|
|
|
import com.xscm.modulemain.activity.room.contacts.PublishCommentContacts;
|
|
|
|
|
import com.xscm.modulemain.activity.room.presenter.PublishCommentPresenter;
|
|
|
|
|
import com.xscm.modulemain.databinding.DialogPublishCommentBinding;
|
2025-10-20 10:16:44 +08:00
|
|
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
|
|
|
|
import com.xscm.moduleutil.bean.HeadlineBean;
|
|
|
|
|
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
|
|
|
|
import com.xscm.moduleutil.utils.ColorManager;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*@author qx
|
|
|
|
|
*@data 2025/6/27
|
|
|
|
|
*@description: 发布头条的弹出框
|
|
|
|
|
*/
|
|
|
|
|
public class PublishCommentDialogFragment extends BaseMvpDialogFragment<PublishCommentPresenter, DialogPublishCommentBinding> implements PublishCommentContacts.View{
|
|
|
|
|
HeadlineBean headlineBean;
|
|
|
|
|
String roomId;
|
|
|
|
|
@Override
|
|
|
|
|
protected PublishCommentPresenter bindPresenter() {
|
|
|
|
|
return new PublishCommentPresenter(this, getActivity());
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-24 17:52:11 +08:00
|
|
|
public static PublishCommentDialogFragment show(String roomId, FragmentManager fragmentManager) {
|
2025-10-20 10:16:44 +08:00
|
|
|
PublishCommentDialogFragment dialogFragment = new PublishCommentDialogFragment();
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putString("roomId", roomId);
|
|
|
|
|
dialogFragment.setArguments(args);
|
|
|
|
|
dialogFragment.show(fragmentManager, "PublishCommentDialogFragment");
|
2025-10-24 17:52:11 +08:00
|
|
|
return dialogFragment;
|
2025-10-20 10:16:44 +08:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void onStart() {
|
|
|
|
|
super.onStart();
|
|
|
|
|
Window window = getDialog().getWindow();
|
|
|
|
|
if (window != null) {
|
|
|
|
|
// 设置固定高度为 500dp
|
|
|
|
|
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
|
|
|
|
window.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
|
|
|
|
|
|
|
// 可选:设置动画样式(从底部弹出)
|
|
|
|
|
// window.setWindowAnimations(com.qxcm.moduleutil.R.style.CommonShowDialogBottom);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void initDialogStyle(Window window) {
|
|
|
|
|
super.initDialogStyle(window);
|
|
|
|
|
window.setGravity(Gravity.CENTER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void initData() {
|
|
|
|
|
roomId=getArguments().getString("roomId");
|
|
|
|
|
MvpPre.currentHeadline();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void initView() {
|
|
|
|
|
mBinding.ivClose.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
dismiss();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
mBinding.btnAction.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
if (mBinding.edRoomName.getText().toString().trim().isEmpty()){
|
|
|
|
|
ToastUtils.showShort("请输入内容");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
MvpPre.sendHeadine(mBinding.edRoomName.getText().toString().trim(),headlineBean.getNext_money(),roomId );
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.btnAction, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
|
|
|
|
mBinding.btnAction.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected int getLayoutId() {
|
|
|
|
|
return R.layout.dialog_publish_comment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void sendHeadine() {
|
|
|
|
|
dismiss();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void currentHeadline(HeadlineBean headlineBean) {
|
|
|
|
|
if (headlineBean.getNow_money().equals("0")){
|
|
|
|
|
mBinding.tvTitle.setText("发头条");
|
|
|
|
|
mBinding.tvTime.setText(headlineBean.getCountdown()+"分钟");
|
|
|
|
|
mBinding.tvJb.setText(headlineBean.getNext_money());
|
|
|
|
|
mBinding.tvTs.setVisibility(GONE);
|
|
|
|
|
}else {
|
|
|
|
|
mBinding.tvTitle.setText("抢头条");
|
|
|
|
|
mBinding.tvTime.setText(headlineBean.getCountdown()+"分钟");
|
|
|
|
|
mBinding.tvJb.setText(headlineBean.getNext_money());
|
|
|
|
|
mBinding.tvTs.setVisibility(VISIBLE);
|
|
|
|
|
mBinding.tvTs.setText("当前头条价格"+headlineBean.getNow_money()+",抢头条价格"+headlineBean.getNext_money()+",可立即覆盖当前头条");
|
|
|
|
|
}
|
|
|
|
|
this.headlineBean = headlineBean;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|