修改名称。
This commit is contained in:
@@ -0,0 +1,173 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.RankingAutcionAdapter;
|
||||
import com.xscm.modulemain.activity.room.contacts.BidListContacts;
|
||||
import com.xscm.modulemain.databinding.DialogRoomBidListBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.BidListPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/28
|
||||
*@description: 出价榜单
|
||||
*/
|
||||
public class BidListDialogFragment extends BaseMvpDialogFragment<BidListPresenter, DialogRoomBidListBinding> implements BidListContacts.View {
|
||||
private RankingAutcionAdapter cAdapter;//魅力适配器
|
||||
|
||||
@Override
|
||||
protected BidListPresenter bindPresenter() {
|
||||
return new BidListPresenter( this, getActivity());
|
||||
}
|
||||
public static BidListDialogFragment newInstance(String auction_id) {
|
||||
BidListDialogFragment roomRankingFragment = new BidListDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("auction_id", auction_id);
|
||||
roomRankingFragment.setArguments(bundle);
|
||||
return roomRankingFragment;
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.roomAuctionList(getArguments().getString("auction_id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
cAdapter = new RankingAutcionAdapter();
|
||||
mBinding.rankRecycleView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mBinding.rankRecycleView.setAdapter(cAdapter);
|
||||
cAdapter.bindToRecyclerView(mBinding.rankRecycleView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_room_bid_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
lp.height = (int) (screenHeight * 0.8f); // 80% 高度
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度撑满
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void roomAuctionList(List<RoomAuction.AuctionListBean> auctionListBean) {
|
||||
cAdapter.setNewData(auctionListBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNo1(RoomAuction.AuctionListBean listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop1HeadIcon);
|
||||
mBinding.roomTop1Name.setText(listsBean.getNickname());
|
||||
LinearLayout llContainer =mBinding.llVip1;
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = listsBean.getIcon(); // 获取图片列表
|
||||
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_57),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
imageView1.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView1);
|
||||
|
||||
llContainer.addView(imageView1);
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.roomHeadTop1Label.setText(listsBean.getGift_prices());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNo2(RoomAuction.AuctionListBean listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop2HeadIcon);
|
||||
mBinding.roomTop2Name.setText(listsBean.getNickname());
|
||||
LinearLayout llContainer =mBinding.llVip2;
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = listsBean.getIcon(); // 获取图片列表
|
||||
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_57),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
imageView1.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView1);
|
||||
|
||||
llContainer.addView(imageView1);
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.roomHeadTop2Label.setText(listsBean.getGift_prices());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNo3(RoomAuction.AuctionListBean listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop3HeadIcon);
|
||||
mBinding.roomTop3Name.setText(listsBean.getNickname());
|
||||
LinearLayout llContainer =mBinding.llVip3;
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = listsBean.getIcon(); // 获取图片列表
|
||||
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_57),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
imageView1.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView1);
|
||||
|
||||
llContainer.addView(imageView1);
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.roomHeadTop3Label.setText(listsBean.getGift_prices());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharmEmpty() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.CardRelationAdapter;
|
||||
import com.xscm.modulemain.activity.room.contacts.CardRelationshipContacts;
|
||||
import com.xscm.modulemain.databinding.DialogCardRelationBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.CardRelationshipPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.RoomAutionTimeBean;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RoomAuctionABean;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.RoomTime;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.ViewItem;
|
||||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/28
|
||||
*@description: 卡关系弹框
|
||||
*/
|
||||
public class CardRelationshipFragment extends BaseMvpDialogFragment<CardRelationshipPresenter, DialogCardRelationBinding> implements CardRelationshipContacts.View{
|
||||
|
||||
private String type;
|
||||
private String roomId;
|
||||
private String userId;
|
||||
private CardRelationAdapter adapter;
|
||||
private List<ViewItem> viewItems = new ArrayList<>();
|
||||
|
||||
private RoomAuctionABean roomAuctionABean;
|
||||
RoomRelationBean roomRelationBean;
|
||||
RoomAutionTimeBean roomAutionTimeBean;
|
||||
RoonGiftModel roonGiftModel;
|
||||
|
||||
@Override
|
||||
protected CardRelationshipPresenter bindPresenter() {
|
||||
return new CardRelationshipPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
}
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
type = getArguments().getString("type");
|
||||
roomId = getArguments().getString("roomId");
|
||||
userId = getArguments().getString("userId");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.roomRelationList(type);
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.6f);;
|
||||
int heightInPx = (int) heightInDp;
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
// 设置不可通过点击外部关闭
|
||||
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;
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(requireContext(), 4); // 最大支持 4 列
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
// 设置 SpanSizeLookup 控制不同 item 占据的列数
|
||||
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
int viewType = adapter.getItemViewType(position);
|
||||
switch (viewType) {
|
||||
case ViewItem.TYPE_TEXT: // 文本占满整行
|
||||
return 4;
|
||||
case ViewItem.TYPE_RELATION: // 每行 2 个
|
||||
return 1;
|
||||
case ViewItem.TYPE_GIFT: // 每行 3 个
|
||||
return 1; // 3 个时,总列数 3,则每项占 1 列;若总列数为 4,则需调整
|
||||
case ViewItem.TYPE_IMAGE_SELECTION: // 每行 4 个
|
||||
return 1;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
adapter = new CardRelationAdapter();
|
||||
recyclerView.setAdapter(adapter);
|
||||
roomAuctionABean=new RoomAuctionABean();
|
||||
|
||||
// 模拟从网络获取 RoomAuctionABean 数据
|
||||
|
||||
// 构建 ViewItem 列表
|
||||
|
||||
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")){
|
||||
if (roomRelationBean != null && roomAutionTimeBean != null && roonGiftModel != null) {
|
||||
// 创建一个 RoomAuctionABean 对象
|
||||
MvpPre.roomAuction(roomId, userId, roonGiftModel.getGift_id(), roomRelationBean.getRelation_id(), "2", roomAutionTimeBean.getHours()+"");
|
||||
}else {
|
||||
ToastUtils.show("请选择竞拍信息");
|
||||
}
|
||||
}else {
|
||||
if (roomRelationBean != null&& roonGiftModel != null){
|
||||
|
||||
// MvpPre.roomAuctionTime(roonGiftModel.getGift_id());
|
||||
MvpPre.roomAuction(roomId, userId, roonGiftModel.getGift_id(), roomRelationBean.getRelation_id(), "1", "");
|
||||
|
||||
}else {
|
||||
ToastUtils.show("请选择竞拍信息");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvWheatQd, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvWheatQd.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_card_relation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomRelationList(List<RoomRelationBean> roomRelationBeans) {
|
||||
if (roomRelationBeans!=null) {
|
||||
roomAuctionABean.setRoomRelationBeanList(roomRelationBeans);
|
||||
MvpPre.getGiftList("99");
|
||||
}else {
|
||||
ToastUtils.show("数据接口错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels) {
|
||||
if (roonGiftModels!=null) {
|
||||
roomAuctionABean.setRoomGiftBeanList(roonGiftModels);
|
||||
upList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuction(AuctionBean auctionBean) {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuctionTime(RoomTime roomTime) {
|
||||
MvpPre.roomAuction(roomId, userId, roonGiftModel.getGift_id(), roomRelationBean.getRelation_id(), "1", roomTime.getTime_day());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void upList(){
|
||||
if (roomAuctionABean != null) {
|
||||
// 添加文本项
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_TEXT, "选择关系"));
|
||||
|
||||
// 添加关系列表
|
||||
for (RoomRelationBean bean : roomAuctionABean.getRoomRelationBeanList()) {
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_RELATION, bean));
|
||||
}
|
||||
|
||||
if (type.equals("2")){
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_TEXT, "选择时长"));
|
||||
for (RoomAutionTimeBean bean : getDefaultTimeOptions()) {
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_IMAGE_SELECTION, bean));
|
||||
}
|
||||
}
|
||||
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_TEXT, "选择礼物"));
|
||||
// 添加礼物列表
|
||||
for (RoonGiftModel bean : roomAuctionABean.getRoomGiftBeanList()) {
|
||||
viewItems.add(new ViewItem(ViewItem.TYPE_GIFT, bean));
|
||||
}
|
||||
|
||||
adapter.submitList(viewItems);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<RoomAutionTimeBean> getDefaultTimeOptions() {
|
||||
List<RoomAutionTimeBean> list = new ArrayList<>();
|
||||
list.add(new RoomAutionTimeBean(1));
|
||||
list.add(new RoomAutionTimeBean(3));
|
||||
list.add(new RoomAutionTimeBean(5));
|
||||
list.add(new RoomAutionTimeBean(10));
|
||||
list.add(new RoomAutionTimeBean(15));
|
||||
list.add(new RoomAutionTimeBean(20));
|
||||
list.add(new RoomAutionTimeBean(25));
|
||||
list.add(new RoomAutionTimeBean(30));
|
||||
return list;
|
||||
}
|
||||
|
||||
public void dismissDialog() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||
|
||||
public class CustomCenterDialogFragment extends DialogFragment {
|
||||
|
||||
private int animStyle = com.xscm.moduleutil.R.anim.anim_scale_in; // 默认使用透明度动画
|
||||
|
||||
RoomAuction.AuctionListBean recipient;
|
||||
RoomAuction.AuctionUserBean auction_user;
|
||||
private OnDialogActionListener listener;
|
||||
GifAvatarOvalView avatar1,za_avatar1;
|
||||
GifAvatarOvalView avatar2,za_avatar2;
|
||||
private TextView tv_tname,tv_za_tname;
|
||||
private TextView tv_name1,tv_za_name1;
|
||||
private TextView tv_name2,tv_za_name2;
|
||||
ConstraintLayout constraintLayout_qm, constraintLayout2_za;
|
||||
|
||||
public interface OnDialogActionListener {
|
||||
void onKnowClicked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
public static void show(RoomAuction.AuctionListBean recipient, RoomAuction.AuctionUserBean auction_user, FragmentManager fragmentManager) {
|
||||
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");
|
||||
}
|
||||
|
||||
public static void showWithAutoDismiss(RoomAuction.AuctionListBean recipient,
|
||||
RoomAuction.AuctionUserBean auction_user,
|
||||
FragmentManager fragmentManager) {
|
||||
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");
|
||||
|
||||
// new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
// if (fragment.isAdded()) {
|
||||
// fragment.dismiss();
|
||||
// }
|
||||
// }, 4000); // 4秒后关闭
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 安全地忽略异常
|
||||
}
|
||||
}, 4000); // 4秒后关闭
|
||||
|
||||
}
|
||||
|
||||
public void setAnimationStyle(int animStyle) {
|
||||
this.animStyle = animStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
recipient = (RoomAuction.AuctionListBean) getArguments().getSerializable("recipient");
|
||||
auction_user = (RoomAuction.AuctionUserBean) getArguments().getSerializable("auction_user");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Dialog dialog = new Dialog(requireContext());
|
||||
dialog.setContentView(R.layout.dialog_room_auction);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
if (window != null) {
|
||||
window.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
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);
|
||||
|
||||
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.setVisibility(View.VISIBLE);
|
||||
constraintLayout2_za.setVisibility(View.GONE);
|
||||
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()+"关系竞拍成功");
|
||||
setTextViewGradient(tv_tname, ContextCompat.getColor(getContext(), com.xscm.moduleutil.R.color.color_FFFFF0F0), ContextCompat.getColor(getContext(), com.xscm.moduleutil.R.color.color_FFA4C8));
|
||||
}else {
|
||||
constraintLayout_qm.setVisibility(View.GONE);
|
||||
constraintLayout2_za.setVisibility(View.VISIBLE);
|
||||
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()+"关系竞拍成功");
|
||||
}
|
||||
|
||||
return dialog;
|
||||
}
|
||||
private void setTextViewGradient(TextView textView, int startColor, int endColor) {
|
||||
Shader shader = new LinearGradient(
|
||||
0, 0, textView.getPaint().getTextSize() * textView.length(), 0,
|
||||
new int[]{startColor, endColor},
|
||||
null,
|
||||
Shader.TileMode.CLAMP);
|
||||
textView.getPaint().setShader(shader);
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
Animation animation = AnimationUtils.loadAnimation(requireContext(), animStyle);
|
||||
window.getDecorView().startAnimation(animation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.xscm.modulemain.dialog
|
||||
|
||||
import android.R
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.xscm.modulemain.adapter.EmotionAdapter
|
||||
import com.xscm.modulemain.databinding.DialogEmotionPickerBinding
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.tencent.qcloud.tuikit.timcommon.util.ThreadUtils
|
||||
import com.xscm.moduleutil.bean.room.Emotion
|
||||
import com.xscm.moduleutil.bean.room.EmotionDeatils
|
||||
import com.xscm.moduleutil.http.BaseObserver
|
||||
import com.xscm.moduleutil.http.RetrofitClient
|
||||
import io.reactivex.disposables.Disposable
|
||||
import retrofit2.Retrofit
|
||||
|
||||
class EmotionPickerDialog(context: Context) : Dialog(context, com.xscm.moduleutil.R.style.BaseDialogStyleH) {
|
||||
|
||||
private lateinit var binding: DialogEmotionPickerBinding
|
||||
private lateinit var emotionAdapter: EmotionAdapter
|
||||
private val emotions = mutableListOf<Emotion>()
|
||||
private val emotionsDeatils = mutableListOf<EmotionDeatils>()
|
||||
|
||||
private var onEmotionSelectedListener: ((EmotionDeatils) -> Unit)? = null
|
||||
private var currentPage = 1
|
||||
private var isLoading = false
|
||||
private var currentTab = "1" // 默认tab
|
||||
|
||||
init {
|
||||
binding = DialogEmotionPickerBinding.inflate(LayoutInflater.from(context))
|
||||
setContentView(binding.root)
|
||||
|
||||
setupWindow()
|
||||
setupViews()
|
||||
// loadEmotions(currentTab, 1)
|
||||
}
|
||||
|
||||
private fun setupWindow() {
|
||||
val window = window ?: return
|
||||
window.setGravity(Gravity.BOTTOM)
|
||||
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
window.setBackgroundDrawableResource(android.R.color.transparent)
|
||||
|
||||
val params = window.attributes
|
||||
params.windowAnimations = com.xscm.moduleutil.R.style.BaseDialogStyleH
|
||||
window.attributes = params
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
RetrofitClient.getInstance().upEmotion(object : BaseObserver<List<Emotion>>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
|
||||
override fun onNext(t: List<Emotion>) {
|
||||
if (t.isNotEmpty()) {
|
||||
emotions.addAll(t)
|
||||
for (i in t) {
|
||||
binding.tabLayout.addTab(binding.tabLayout.newTab().setText(i.type_name))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
// 设置Tab
|
||||
// 在代码中设置
|
||||
val tabLayout = binding.tabLayout
|
||||
tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||
override fun onTabSelected(tab: TabLayout.Tab?) {
|
||||
// 设置选中状态的文本大小
|
||||
tab?.view?.findViewById<TextView>(com.google.android.material.R.id.text)?.apply {
|
||||
textSize = 16f
|
||||
setTextColor(Color.WHITE)
|
||||
}
|
||||
loadEmotions(emotions.get(tab?.position!!).id.toString(), 1);
|
||||
}
|
||||
|
||||
override fun onTabUnselected(tab: TabLayout.Tab?) {
|
||||
// 设置未选中状态的文本大小
|
||||
tab?.view?.findViewById<TextView>(com.google.android.material.R.id.text)?.apply {
|
||||
textSize = 12f
|
||||
setTextColor(Color.parseColor("#999999"))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTabReselected(tab: TabLayout.Tab?) {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
// 设置RecyclerView
|
||||
emotionAdapter = EmotionAdapter()
|
||||
binding.rvEmotions.layoutManager = GridLayoutManager(context, 4)
|
||||
binding.rvEmotions.adapter = emotionAdapter
|
||||
|
||||
// 在 setupViews() 方法中
|
||||
emotionAdapter.setOnEmotionClickListener { emotion ->
|
||||
onEmotionSelectedListener?.invoke( emotion)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
// // 设置下拉刷新
|
||||
// binding.swipeRefreshLayout.setOnRefreshListener {
|
||||
// loadEmotions(currentTab, 1)
|
||||
// }
|
||||
//
|
||||
// // 设置上拉加载更多
|
||||
// binding.rvEmotions.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
// override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
// super.onScrolled(recyclerView, dx, dy)
|
||||
//
|
||||
// val layoutManager = recyclerView.layoutManager as LinearLayoutManager
|
||||
// val visibleItemCount = layoutManager.childCount
|
||||
// val totalItemCount = layoutManager.itemCount
|
||||
// val firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition()
|
||||
//
|
||||
// if (!isLoading && (visibleItemCount + firstVisibleItemPosition) >= totalItemCount && firstVisibleItemPosition >= 0) {
|
||||
// loadEmotions(currentTab, ++currentPage)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
|
||||
// 设置表情点击事件
|
||||
// emotionAdapter.setOnEmotionClickListener { emotion ->
|
||||
// onEmotionSelectedListener?.invoke(emotion)
|
||||
// dismiss()
|
||||
// }
|
||||
//
|
||||
// // 关闭按钮
|
||||
// binding.ivClose.setOnClickListener {
|
||||
// dismiss()
|
||||
// }
|
||||
}
|
||||
|
||||
private fun loadEmotions(type: String, page: Int) {
|
||||
if (page == 1) {
|
||||
emotionsDeatils.clear()
|
||||
}
|
||||
|
||||
isLoading = true
|
||||
|
||||
RetrofitClient.getInstance().getEmotionDeatils(type, object : BaseObserver<List<EmotionDeatils>>() {
|
||||
override fun onSubscribe(d: Disposable) {
|
||||
}
|
||||
|
||||
override fun onNext(t: List<EmotionDeatils>) {
|
||||
if (t.isNotEmpty()) {
|
||||
emotionsDeatils.addAll(t)
|
||||
emotionAdapter.setNewData(emotionsDeatils)
|
||||
}else{
|
||||
emotionsDeatils.clear()
|
||||
emotionAdapter.setNewData(emotionsDeatils)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
isLoading = false
|
||||
|
||||
}
|
||||
|
||||
fun setOnEmotionSelectedListener(listener: (EmotionDeatils) -> Unit) {
|
||||
onEmotionSelectedListener = listener
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
import com.xscm.modulemain.R;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/26
|
||||
* @description: 底部弹框,退出房间选择
|
||||
*/
|
||||
public class ExitRoomBottomSheet extends BottomSheetDialogFragment {
|
||||
|
||||
public interface OnOptionSelectedListener {
|
||||
void onMinimize(); // 最小化
|
||||
|
||||
void onExitRoom(); // 退出房间
|
||||
|
||||
void onCancel(); // 取消
|
||||
}
|
||||
|
||||
private OnOptionSelectedListener listener;
|
||||
private static final String ARG_SHOW_MINIMIZE = "show_minimize";
|
||||
private static final String ARG_SHOW_EXIT = "show_exit";
|
||||
private static final String ARG_SHOW_CANCEL = "show_cancel";
|
||||
|
||||
private boolean showMinimize = true;
|
||||
private boolean showExit = true;
|
||||
private boolean showCancel = true;
|
||||
|
||||
public static ExitRoomBottomSheet newInstance(boolean showMinimize, boolean showExit, boolean showCancel) {
|
||||
ExitRoomBottomSheet fragment = new ExitRoomBottomSheet();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(ARG_SHOW_MINIMIZE, showMinimize);
|
||||
args.putBoolean(ARG_SHOW_EXIT, showExit);
|
||||
args.putBoolean(ARG_SHOW_CANCEL, showCancel);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public static ExitRoomBottomSheet newInstance() {
|
||||
return newInstance(true, true, true);
|
||||
}
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
showMinimize = getArguments().getBoolean(ARG_SHOW_MINIMIZE, true);
|
||||
showExit = getArguments().getBoolean(ARG_SHOW_EXIT, true);
|
||||
showCancel = getArguments().getBoolean(ARG_SHOW_CANCEL, true);
|
||||
}
|
||||
setStyle(STYLE_NORMAL, com.xscm.moduleutil.R.style.AppBottomSheetDialogTheme); // 自定义样式(可选)
|
||||
setCancelable(true); // 点击外部可关闭
|
||||
}
|
||||
|
||||
@SuppressLint("MissingInflatedId")
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.dialog_exit_room_bottom_sheet, container, false);
|
||||
TextView tv_minimize = view.findViewById(R.id.tv_minimize);
|
||||
TextView tv_exit_room = view.findViewById(R.id.tv_exit_room);
|
||||
TextView tv_cancel = view.findViewById(R.id.tv_cancel);
|
||||
|
||||
// 根据参数设置按钮可见性
|
||||
if (tv_minimize != null) {
|
||||
tv_minimize.setVisibility(showMinimize ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (tv_exit_room != null) {
|
||||
tv_exit_room.setVisibility(showExit ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
if (tv_cancel != null) {
|
||||
tv_cancel.setVisibility(showCancel ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
tv_minimize.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onMinimize();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
tv_exit_room.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onExitRoom();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
tv_cancel.setOnClickListener(v -> {
|
||||
if (listener != null) listener.onCancel();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
public void setOnOptionSelectedListener(OnOptionSelectedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Shader;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.AnimationUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/8/24
|
||||
*@description:交友房关系卡成功
|
||||
*/
|
||||
public class FriendsDialogFragment extends DialogFragment {
|
||||
|
||||
private int animStyle = com.xscm.moduleutil.R.anim.anim_scale_in; // 默认使用透明度动画
|
||||
|
||||
FriendUserBean recipient;
|
||||
private OnDialogActionListener listener;
|
||||
GifAvatarOvalView avatar1,za_avatar1;
|
||||
GifAvatarOvalView avatar2,za_avatar2;
|
||||
private TextView tv_tname;
|
||||
private TextView tv_name1;
|
||||
private TextView tv_name2;
|
||||
ConstraintLayout constraintLayout_qm;
|
||||
|
||||
public interface OnDialogActionListener {
|
||||
void onKnowClicked();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
}
|
||||
|
||||
public static void show(FriendUserBean bean, FragmentManager fragmentManager) {
|
||||
FriendsDialogFragment fragment = new FriendsDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("FriendUserBean", bean);
|
||||
fragment.setArguments(args);
|
||||
fragment.show(fragmentManager, "FriendsDialogFragment");
|
||||
|
||||
new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
if (fragment != null && fragment.isAdded()) {
|
||||
fragment.dismiss();
|
||||
}
|
||||
}, 4000); // 4秒后关闭
|
||||
}
|
||||
|
||||
|
||||
public void setAnimationStyle(int animStyle) {
|
||||
this.animStyle = animStyle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
recipient = (FriendUserBean) getArguments().getSerializable("FriendUserBean");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
Dialog dialog = new Dialog(requireContext());
|
||||
dialog.setContentView(R.layout.dialog_friends_room);
|
||||
|
||||
Window window = dialog.getWindow();
|
||||
if (window != null) {
|
||||
window.setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
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);
|
||||
|
||||
za_avatar1= dialog.findViewById(R.id.za_avatar1);
|
||||
za_avatar2= dialog.findViewById(R.id.za_avatar2);
|
||||
|
||||
constraintLayout_qm= dialog.findViewById(R.id.cl_container);
|
||||
constraintLayout_qm.setVisibility(View.VISIBLE);
|
||||
ImageUtils.loadHeadCC(recipient.getUser1_avatar(),avatar1);
|
||||
ImageUtils.loadHeadCC(recipient.getUser2_avatar(),avatar2);
|
||||
tv_name1.setText(recipient.getUser1_nickname());
|
||||
tv_name2.setText(recipient.getUser2_nickname());
|
||||
tv_tname.setText(recipient.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));
|
||||
return dialog;
|
||||
}
|
||||
private void setTextViewGradient(TextView textView, int startColor, int endColor) {
|
||||
Shader shader = new LinearGradient(
|
||||
0, 0, textView.getPaint().getTextSize() * textView.length(), 0,
|
||||
new int[]{startColor, endColor},
|
||||
null,
|
||||
Shader.TileMode.CLAMP);
|
||||
textView.getPaint().setShader(shader);
|
||||
}
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
Animation animation = AnimationUtils.loadAnimation(requireContext(), animStyle);
|
||||
window.getDecorView().startAnimation(animation);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,188 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.HourlyChartContacts;
|
||||
import com.xscm.modulemain.activity.room.presenter.HourlyChartPresenter;
|
||||
import com.xscm.modulemain.adapter.RoomHourlyAdapter;
|
||||
import com.xscm.modulemain.databinding.DialogHourlyChartFragmentBinding;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.room.RoomHourBean;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/29
|
||||
*@description:小时榜
|
||||
*/
|
||||
public class HourlyChartDialog extends BaseMvpDialogFragment<HourlyChartPresenter, DialogHourlyChartFragmentBinding> implements HourlyChartContacts.View {
|
||||
private int page;
|
||||
|
||||
private RoomHourlyAdapter roomHourlyAdapter;
|
||||
|
||||
// 添加标志,控制对话框从右侧显示
|
||||
protected boolean mGravityRight = true;
|
||||
|
||||
@Override
|
||||
protected HourlyChartPresenter bindPresenter() {
|
||||
return new HourlyChartPresenter( this, getActivity());
|
||||
}
|
||||
|
||||
|
||||
public static HourlyChartDialog newInstance() {
|
||||
HourlyChartDialog hourlyChartDialog = new HourlyChartDialog();
|
||||
return hourlyChartDialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public @NotNull Dialog onCreateDialog(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
|
||||
Dialog dialog = new Dialog(requireContext(), com.xscm.moduleutil.R.style.FullScreenDialogStyle);
|
||||
return dialog;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getDialog() != null && getDialog().getWindow() != null) {
|
||||
// 设置为全屏高度,并去掉状态栏
|
||||
getDialog().getWindow().setLayout(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
);
|
||||
// 添加全屏标志,去掉状态栏
|
||||
getDialog().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
if (mGravityRight) {
|
||||
getDialog().getWindow().setGravity(Gravity.END);
|
||||
} else {
|
||||
getDialog().getWindow().setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
page=1;
|
||||
MvpPre.getRoomHourRanking(page+"", "20");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// 设置dialog的窗口属性
|
||||
if (getDialog() != null && getDialog().getWindow() != null) {
|
||||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
if (mGravityRight) {
|
||||
getDialog().getWindow().setGravity(Gravity.END);
|
||||
} else {
|
||||
getDialog().getWindow().setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
}
|
||||
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
roomHourlyAdapter = new RoomHourlyAdapter();
|
||||
mBinding.recyclerView.setAdapter(roomHourlyAdapter);
|
||||
// 确保最后一项完全可见
|
||||
mBinding.recyclerView.setClipToPadding(false);
|
||||
mBinding.recyclerView.setPadding(
|
||||
0,
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_12),
|
||||
0,
|
||||
getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_12)
|
||||
);
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull @NotNull RefreshLayout refreshLayout) {
|
||||
page=1;
|
||||
MvpPre.getRoomHourRanking(page+"", "20");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMore(@NonNull @NotNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getRoomHourRanking(page+"", "20");
|
||||
}
|
||||
});
|
||||
|
||||
roomHourlyAdapter.setOnItemClickListener(new RoomHourlyAdapter.OnItemClickListener() {
|
||||
|
||||
@Override
|
||||
public void onItemClick(RoomHourBean.RoomListBean item, int position) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), item.getRoom_id(),"",null);
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.viewBackground.setOnClickListener(v -> dismiss());
|
||||
mBinding.imHourlyWf.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "api/Page/page_show?id=24");
|
||||
RoomAuctionWebViewDialog dialog = new RoomAuctionWebViewDialog(getActivity(), bundle);
|
||||
dialog.show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_hourly_chart_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomHourRanking(RoomHourBean roomHourBean) {
|
||||
if (roomHourBean!=null){
|
||||
mBinding.tvHourlyDjs.setText("榜单时间 "+roomHourBean.getTime_range());
|
||||
if (page == 1) {
|
||||
if (roomHourBean.getLists() != null && !roomHourBean.getLists().isEmpty()) {
|
||||
roomHourlyAdapter.setNewData(roomHourBean.getLists());
|
||||
} else {
|
||||
roomHourlyAdapter.setNewData(new ArrayList<>()); // 清空旧数据并提示空状态
|
||||
}
|
||||
} else {
|
||||
if (roomHourBean.getLists() != null && !roomHourlyAdapter.getData().isEmpty()) {
|
||||
roomHourlyAdapter.addData(roomHourBean.getLists());
|
||||
} else {
|
||||
// 没有更多数据时可调用 finishLoadMoreWithNoMoreData()
|
||||
mBinding.smartRefreshLayout.finishLoadMoreWithNoMoreData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findView() {
|
||||
mBinding.smartRefreshLayout.finishLoadMore() ;
|
||||
mBinding.smartRefreshLayout.finishRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
if (mGravityRight) {
|
||||
window.setGravity(Gravity.END);
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.DialogSlideRightAnimation);
|
||||
} else {
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Switch;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/7/3
|
||||
*@description: 直播对战设置
|
||||
*/
|
||||
public class LiveBattleSettingsDialog extends Dialog {
|
||||
|
||||
private Switch switchFriendInvitation;
|
||||
private Switch switchRecommendInvitation;
|
||||
private OnSettingsChangeListener listener;
|
||||
private int is_pk;
|
||||
|
||||
public LiveBattleSettingsDialog(@NonNull Context context,int is_pk, OnSettingsChangeListener listener) {
|
||||
super(context);
|
||||
this.listener = listener;
|
||||
this.is_pk = is_pk;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE); // 隐藏标题栏
|
||||
setContentView(R.layout.dialog_live_battle_settings);
|
||||
|
||||
// 初始化视图
|
||||
switchFriendInvitation = findViewById(R.id.switch_friend_invitation);
|
||||
switchRecommendInvitation = findViewById(R.id.switch_recommend_invitation);
|
||||
|
||||
// 设置初始状态(根据需要)
|
||||
switchFriendInvitation.setChecked(false);
|
||||
switchRecommendInvitation.setChecked(false);
|
||||
|
||||
if (is_pk==1){
|
||||
switchFriendInvitation.setChecked(true);
|
||||
}else {
|
||||
switchFriendInvitation.setChecked(false);
|
||||
}
|
||||
// 添加开关监听器
|
||||
switchFriendInvitation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (listener != null) {
|
||||
listener.onFriendInvitationChanged(isChecked);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
switchRecommendInvitation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
if (listener != null) {
|
||||
listener.onRecommendInvitationChanged(isChecked);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
window.setGravity(Gravity.CENTER); // 居中显示
|
||||
window.setBackgroundDrawableResource(com.xscm.moduleutil.R.drawable.bg_r16_fff); // 透明背景
|
||||
}
|
||||
super.show();
|
||||
}
|
||||
|
||||
public interface OnSettingsChangeListener {
|
||||
void onFriendInvitationChanged(boolean isChecked);
|
||||
void onRecommendInvitationChanged(boolean isChecked);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.FragmentPkResultDialogBinding;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/7/4
|
||||
*@description: pk结果弹窗
|
||||
*/
|
||||
public class PkResultDialogFragment extends BaseDialog<FragmentPkResultDialogBinding> {
|
||||
private RoomMessageEvent messageEvent;
|
||||
public PkResultDialogFragment(@NonNull Context context, RoomMessageEvent messageEvent) {
|
||||
super(context);
|
||||
this.messageEvent = messageEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.fragment_pk_result_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
if (messageEvent != null){
|
||||
if(messageEvent.getText().getType()==0){
|
||||
mBinding.clPk.setBackgroundResource(com.xscm.moduleutil.R.mipmap.pk_sb);
|
||||
ImageUtils.loadHeadCC(messageEvent.getText().getDefeated_cover(),mBinding.userAvatar1);
|
||||
ImageUtils.loadHeadCC(messageEvent.getText().getVictory_cover(),mBinding.userAvatar2);
|
||||
mBinding.tvName1.setText(messageEvent.getText().getDefeated_name());
|
||||
mBinding.tvName2.setText(messageEvent.getText().getVictory_name());
|
||||
mBinding.ivStart1.setImageResource(com.xscm.moduleutil.R.mipmap.fail);
|
||||
mBinding.ivStart2.setImageResource(com.xscm.moduleutil.R.mipmap.victory);
|
||||
}else if (messageEvent.getText().getType()==1){
|
||||
mBinding.clPk.setBackgroundResource(com.xscm.moduleutil.R.mipmap.pk_sl);
|
||||
ImageUtils.loadHeadCC(messageEvent.getText().getDefeated_cover(),mBinding.userAvatar2);
|
||||
ImageUtils.loadHeadCC(messageEvent.getText().getVictory_cover(),mBinding.userAvatar1);
|
||||
mBinding.tvName1.setText(messageEvent.getText().getVictory_name());
|
||||
mBinding.tvName2.setText(messageEvent.getText().getDefeated_name());
|
||||
mBinding.ivStart1.setImageResource(com.xscm.moduleutil.R.mipmap.victory);
|
||||
mBinding.ivStart2.setImageResource(com.xscm.moduleutil.R.mipmap.fail);
|
||||
}else if (messageEvent.getText().getType()==2){
|
||||
mBinding.clPk.setBackgroundResource(com.xscm.moduleutil.R.mipmap.pk_pj);
|
||||
ImageUtils.loadHeadCC(messageEvent.getText().getDefeated_cover(),mBinding.userAvatar2);
|
||||
ImageUtils.loadHeadCC(messageEvent.getText().getVictory_cover(),mBinding.userAvatar1);
|
||||
mBinding.tvName1.setText(messageEvent.getText().getVictory_name());
|
||||
mBinding.tvName2.setText(messageEvent.getText().getDefeated_name());
|
||||
mBinding.ivStart1.setVisibility(View.GONE);
|
||||
mBinding.ivStart2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.PkTimeAdapter;
|
||||
import com.xscm.modulemain.activity.room.contacts.PkTimeContract;
|
||||
import com.xscm.modulemain.databinding.FragmentPkTimeFragmentBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.PkTimePresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.RoomAutionTimeBean;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/7/3
|
||||
*@description: pk点击开始选择时间
|
||||
*/
|
||||
public class PkTimeDialogFragment extends BaseMvpDialogFragment<PkTimePresenter, FragmentPkTimeFragmentBinding> implements PkTimeContract.View {
|
||||
private String pk_id;
|
||||
private PkTimeAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
protected PkTimePresenter bindPresenter() {
|
||||
return new PkTimePresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static void show(String pk_id, FragmentManager fragmentManager) {
|
||||
PkTimeDialogFragment dialogFragment = new PkTimeDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("pk_id", pk_id);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "PkTimeDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
pk_id = getArguments().getString("pk_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.6f);
|
||||
;
|
||||
int heightInPx = (int) heightInDp;
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@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 initData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
RecyclerView recyclerView = mBinding.recycleView;
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(requireContext(), 4); // 最大支持 4 列
|
||||
recyclerView.setLayoutManager(layoutManager);
|
||||
mAdapter = new PkTimeAdapter();
|
||||
recyclerView.setAdapter(mAdapter);
|
||||
mAdapter.setNewData(getDefaultTimeOptions());
|
||||
mBinding.tvWheatQd.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RoomAutionTimeBean roomAutionTimeBean = mAdapter.getSelectedTime();
|
||||
if (roomAutionTimeBean != null) {
|
||||
MvpPre.startPk(pk_id, roomAutionTimeBean.getDays() + "");
|
||||
dismiss();
|
||||
}else {
|
||||
ToastUtils.show("请选择时间");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mBinding.tvWheatCancel.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_pk_time_fragment;
|
||||
}
|
||||
|
||||
|
||||
public static List<RoomAutionTimeBean> getDefaultTimeOptions() {
|
||||
List<RoomAutionTimeBean> list = new ArrayList<>();
|
||||
list.add(new RoomAutionTimeBean(1));
|
||||
list.add(new RoomAutionTimeBean(5));
|
||||
list.add(new RoomAutionTimeBean(10));
|
||||
list.add(new RoomAutionTimeBean(15));
|
||||
list.add(new RoomAutionTimeBean(20));
|
||||
list.add(new RoomAutionTimeBean(25));
|
||||
list.add(new RoomAutionTimeBean(30));
|
||||
list.add(new RoomAutionTimeBean(35));
|
||||
list.add(new RoomAutionTimeBean(40));
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startPk() {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
|
||||
import static com.tencent.qcloud.network.sonar.utils.Utils.isNetworkAvailable;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.text.TextPaint;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.style.ClickableSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.SpanUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.modulemain.databinding.DialogPolicBinding;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
|
||||
/**
|
||||
* 隐私协议
|
||||
*/
|
||||
public class PolicyDialog extends Dialog {
|
||||
private final DialogPolicBinding policBinding;
|
||||
private PolicyClickListener mPolicyClickListener;
|
||||
|
||||
public PolicyDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
policBinding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_polic, null, false);
|
||||
policBinding.setClick(new PolicyClickProxy());
|
||||
getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
setContentView(policBinding.getRoot());
|
||||
setCanceledOnTouchOutside(false);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
SpanUtils spanUtils = new SpanUtils();
|
||||
ClickableSpan clickSpan = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
// Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
// intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6");
|
||||
// intent.putExtra("title", "用户协议");
|
||||
// startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", "file:///android_asset/page_yongh.html").withString("title", "用户协议").navigation();
|
||||
|
||||
// 检查网络连接状态
|
||||
if (isNetworkAvailable(getContext())) {
|
||||
// 有网络时加载网络资源
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6");
|
||||
intent.putExtra("title", "用户协议");
|
||||
startActivity(intent);
|
||||
} else {
|
||||
// 无网络时加载本地资源
|
||||
ARouter.getInstance().build(ARouteConstants.H5)
|
||||
.withString("url", "file:///android_asset/page_yongh.html")
|
||||
.withString("title", "用户协议")
|
||||
.navigation();
|
||||
}
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=6" ).withString("title", "用户协议").navigation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(@NonNull TextPaint ds) {
|
||||
ds.setColor(Color.parseColor("#FFFFD6A2"));
|
||||
ds.setUnderlineText(true);
|
||||
}
|
||||
};
|
||||
ClickableSpan ysClickSpan = new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
// Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
// intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4");
|
||||
// intent.putExtra("title", "隐私协议");
|
||||
// startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", "file:///android_asset/page_show.html").withString("title", "隐私协议").navigation();
|
||||
if (isNetworkAvailable(getContext())) {
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4");
|
||||
intent.putExtra("title", "隐私协议");
|
||||
startActivity(intent);
|
||||
}else {
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", "file:///android_asset/page_show.html").withString("title", "隐私协议").navigation();
|
||||
|
||||
}
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"/api/Page/page_show?id=4").withString("title", "隐私协议").navigation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(@NonNull TextPaint ds) {
|
||||
ds.setColor(Color.parseColor("#FFFFD6A2"));
|
||||
ds.setUnderlineText(true);
|
||||
}
|
||||
};
|
||||
spanUtils.append("欢迎使用羽声语音!\n").append("在使用我们的产品和服务之前,请您先阅读并了解").append("《用户协议》").setClickSpan(clickSpan).append("和").append("《隐私协议》").setClickSpan(ysClickSpan).append("。我们将严格按照上述协议为" +
|
||||
"您提供服务,保护您的信息安全,点" +
|
||||
"击“同意”即表示您已阅读并同意全部" +
|
||||
"条款,可以继续使用我们的产品和服" +
|
||||
"务。");
|
||||
policBinding.tvText.setText(spanUtils.create());
|
||||
policBinding.tvText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
}
|
||||
|
||||
public void setPolicyClickListener(PolicyClickListener policyClickListener) {
|
||||
this.mPolicyClickListener = policyClickListener;
|
||||
}
|
||||
|
||||
public class PolicyClickProxy {
|
||||
public void onAgreeClick() {
|
||||
if (mPolicyClickListener != null) {
|
||||
mPolicyClickListener.policyAgree();
|
||||
}
|
||||
}
|
||||
|
||||
public void onExit() {
|
||||
if (mPolicyClickListener != null) {
|
||||
mPolicyClickListener.policyExit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface PolicyClickListener {
|
||||
void policyAgree();
|
||||
|
||||
void policyExit();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
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;
|
||||
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;
|
||||
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());
|
||||
}
|
||||
|
||||
public static PublishCommentDialogFragment show(String roomId, FragmentManager fragmentManager) {
|
||||
PublishCommentDialogFragment dialogFragment = new PublishCommentDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", roomId);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "PublishCommentDialogFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
@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;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,422 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.DigitsKeyListener;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.DialogRedBagSendBinding;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RedBagSendDialog extends BaseDialog<DialogRedBagSendBinding> {
|
||||
private static final String TAG = "RedBagSendDialog";
|
||||
private int type;//这是第一个页面,发送红包的第一个页面,默认为1,第二个页面,是2,点击查看帮助,是type=3
|
||||
private int stype;//当前是哪个页面:1:默认第一个页面, 2:选择条件页面
|
||||
|
||||
private int redType;//红包类型 1:普通红包 2:口令红包
|
||||
private int redTime;//开奖倒计时 0:立刻 1:1分钟;2:2分钟;5:5分钟 10:10分钟(这里传递给服务的时候,需要乘60)
|
||||
private int redGold=1;//红包类型 0:金币红包 1:钻石红包
|
||||
private int redCount;//条件 0:无 1:收藏房间 2:仅麦上用户
|
||||
private String roomId;
|
||||
|
||||
public RedBagSendDialog(@NonNull @NotNull Context context, String roomId ) {
|
||||
super(context, com.xscm.moduleutil.R.style.BaseDialogStyleH);
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.dialog_red_bag_send;
|
||||
}
|
||||
|
||||
private boolean diaj=false;
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
Window window = getWindow();
|
||||
// window.setLayout(345, 454);
|
||||
// window.setLayout((int) (ScreenUtils.getScreenWidth() * 345.f / 345), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 0.9), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
setView(1);
|
||||
mBinding.edText.setKeyListener(DigitsKeyListener.getInstance("0123456789"));
|
||||
mBinding.etNum.setKeyListener(DigitsKeyListener.getInstance("0123456789"));
|
||||
mBinding.imHelp.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (type != 3) {
|
||||
setView(3);
|
||||
setWebView(CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"api/Page/page_show?id=25");
|
||||
} else {
|
||||
setView(stype);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.imRedClose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.butSub.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mBinding.butSub.getText().equals("下一步")) {
|
||||
if (redType==2){
|
||||
if (TextUtils.isEmpty(mBinding.evKl.getText().toString().trim())){
|
||||
ToastUtils.show("请输入口令");
|
||||
return;
|
||||
}
|
||||
}
|
||||
setView(2);
|
||||
setFRed();
|
||||
} else {
|
||||
if (diaj){
|
||||
return;
|
||||
}
|
||||
diaj=true;
|
||||
// 验证输入
|
||||
String numStr = mBinding.etNum.getText().toString().trim();
|
||||
String textStr = mBinding.edText.getText().toString().trim();
|
||||
|
||||
// 检查是否为空
|
||||
if (TextUtils.isEmpty(numStr)) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入数量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(textStr)) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入金额");
|
||||
return;
|
||||
}
|
||||
if (redType==2){
|
||||
if (TextUtils.isEmpty(mBinding.evKl.getText().toString().trim())){
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入口令");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为数字并比较
|
||||
try {
|
||||
int num = Integer.parseInt(numStr);
|
||||
int text = Integer.parseInt(textStr);
|
||||
|
||||
if (text <= num) {
|
||||
diaj=false;
|
||||
ToastUtils.show("金额必须大于数量");
|
||||
return;
|
||||
}
|
||||
|
||||
// 验证通过,继续发送红包逻辑
|
||||
sendRedPacket();
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入有效的数字");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
mBinding.rgXz.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId == R.id.bt_pt) {
|
||||
redType = 1;
|
||||
mBinding.lKl.setVisibility(GONE);
|
||||
} else if (checkedId == R.id.bt_kl) {
|
||||
redType = 2;
|
||||
mBinding.lKl.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rgDjs.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId == R.id.rb_lk) {
|
||||
redTime = 0;
|
||||
} else if (checkedId == R.id.rb_1) {
|
||||
redTime = 1 * 60;
|
||||
} else if (checkedId == R.id.rb_2) {
|
||||
redTime = 2 * 60;
|
||||
} else if (checkedId == R.id.rb_5) {
|
||||
redTime = 5 * 60;
|
||||
} else if (checkedId == R.id.rb_10) {
|
||||
redTime = 10 * 60;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rgRedType.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
if (checkedId == R.id.rb_gold) {
|
||||
// 选中金币红包:文字红色,背景黄色
|
||||
mBinding.rbGold.setTextColor(Color.parseColor("#D01717"));
|
||||
mBinding.rbGold.setBackgroundResource(com.xscm.moduleutil.R.drawable.selector_red_bag_type_button);
|
||||
// 钻石红包恢复默认样式
|
||||
mBinding.rbDiamond.setTextColor(Color.parseColor("#FFC9C7"));
|
||||
mBinding.rbDiamond.setBackgroundResource(com.xscm.moduleutil.R.drawable.selector_red_bag_type_button);
|
||||
redGold = 1;
|
||||
} else if (checkedId == R.id.rb_diamond) {
|
||||
// 选中钻石红包:文字白色,背景透明
|
||||
mBinding.rbDiamond.setTextColor(Color.parseColor("#D01717"));
|
||||
mBinding.rbDiamond.setBackgroundResource(com.xscm.moduleutil.R.drawable.selector_red_bag_type_button);
|
||||
|
||||
// 金币红包恢复默认样式
|
||||
mBinding.rbGold.setTextColor(Color.parseColor("#FFC9C7"));
|
||||
mBinding.rbGold.setBackgroundResource(com.xscm.moduleutil.R.drawable.selector_red_bag_type_button);
|
||||
redGold =2;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 设置点击监听器
|
||||
mBinding.btNone.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 点击"无"时,取消其他所有选项的选中状态
|
||||
mBinding.btFavoriteRoom.setSelected(false);
|
||||
mBinding.btMicUser.setSelected(false);
|
||||
// 切换"无"的选中状态
|
||||
mBinding.btNone.setSelected(!mBinding.btNone.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.btFavoriteRoom.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 如果"无"被选中,则先取消"无"的选中状态
|
||||
if (mBinding.btNone.isSelected()) {
|
||||
mBinding.btNone.setSelected(false);
|
||||
}
|
||||
// 切换当前按钮的选中状态
|
||||
mBinding.btFavoriteRoom.setSelected(!mBinding.btFavoriteRoom.isSelected());
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.btMicUser.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 如果"无"被选中,则先取消"无"的选中状态
|
||||
if (mBinding.btNone.isSelected()) {
|
||||
mBinding.btNone.setSelected(false);
|
||||
}
|
||||
// 切换当前按钮的选中状态
|
||||
mBinding.btMicUser.setSelected(!mBinding.btMicUser.isSelected());
|
||||
}
|
||||
});
|
||||
}
|
||||
private void sendRedPacket() {
|
||||
// 获取输入值
|
||||
String numStr = mBinding.etNum.getText().toString().trim();
|
||||
String textStr = mBinding.edText.getText().toString().trim();
|
||||
String kl = "";
|
||||
|
||||
if (redType == 2) {
|
||||
kl = mBinding.evKl.getText().toString().trim();
|
||||
}
|
||||
|
||||
// 验证输入
|
||||
if (TextUtils.isEmpty(numStr)) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入数量");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(textStr)) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入金额");
|
||||
return;
|
||||
}
|
||||
|
||||
if (redType == 2 && TextUtils.isEmpty(kl)) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入口令");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
int num = Integer.parseInt(numStr);
|
||||
int text = Integer.parseInt(textStr);
|
||||
|
||||
if (text <= num) {
|
||||
diaj=false;
|
||||
ToastUtils.show("金额必须大于数量");
|
||||
return;
|
||||
}
|
||||
|
||||
// 发送红包
|
||||
RetrofitClient.getInstance().redPacketCreate(
|
||||
redType,
|
||||
kl,
|
||||
redGold,
|
||||
textStr,
|
||||
numStr,
|
||||
getSelectedConditions(),
|
||||
redTime + "",
|
||||
roomId,
|
||||
mBinding.edBz.getText().toString(),
|
||||
new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(@NotNull Disposable d) {}
|
||||
|
||||
@Override
|
||||
public void onNext(@NotNull String redPacketBean) {
|
||||
ToastUtils.show("发送成功");
|
||||
diaj=false;
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
diaj=false;
|
||||
ToastUtils.show("请输入有效的数字");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String getSelectedConditions() {
|
||||
Button btNone = mBinding.llTj.findViewById(R.id.bt_none);
|
||||
Button btFavoriteRoom = mBinding.llTj.findViewById(R.id.bt_favorite_room);
|
||||
Button btMicUser = mBinding.llTj.findViewById(R.id.bt_mic_user);
|
||||
|
||||
if (btNone.isSelected()) {
|
||||
return "0";
|
||||
} else {
|
||||
List<String> selectedList = new ArrayList<>();
|
||||
if (btFavoriteRoom.isSelected()) {
|
||||
selectedList.add("1");
|
||||
}
|
||||
if (btMicUser.isSelected()) {
|
||||
selectedList.add("2");
|
||||
}
|
||||
return String.join(",", selectedList);
|
||||
}
|
||||
}
|
||||
|
||||
private WalletBean walletBean;
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
RetrofitClient.getInstance().wallet(new BaseObserver<WalletBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(WalletBean walletBeans) {
|
||||
walletBean = walletBeans;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setView(int types) {
|
||||
type = types;
|
||||
switch (types) {
|
||||
case 1:
|
||||
mBinding.clRedXz.setVisibility(VISIBLE);
|
||||
mBinding.lKl.setVisibility(VISIBLE);
|
||||
mBinding.lDjs.setVisibility(VISIBLE);
|
||||
mBinding.lLx.setVisibility(VISIBLE);
|
||||
mBinding.tvJeTitle.setVisibility(GONE);
|
||||
mBinding.lJine.setVisibility(GONE);
|
||||
mBinding.lGs.setVisibility(GONE);
|
||||
mBinding.llTj.setVisibility(GONE);
|
||||
mBinding.lBz.setVisibility(GONE);
|
||||
mBinding.wvWeb.setVisibility(GONE);
|
||||
mBinding.butSub.setVisibility(VISIBLE);
|
||||
mBinding.butSub.setText("下一步");
|
||||
mBinding.imHelp.setImageResource(com.xscm.moduleutil.R.drawable.room_redbag_help);
|
||||
stype = 1;
|
||||
break;
|
||||
case 2:
|
||||
mBinding.clRedXz.setVisibility(GONE);
|
||||
mBinding.lKl.setVisibility(GONE);
|
||||
mBinding.lDjs.setVisibility(GONE);
|
||||
mBinding.lLx.setVisibility(GONE);
|
||||
mBinding.tvJeTitle.setVisibility(VISIBLE);
|
||||
mBinding.lJine.setVisibility(VISIBLE);
|
||||
mBinding.lGs.setVisibility(VISIBLE);
|
||||
mBinding.llTj.setVisibility(VISIBLE);
|
||||
mBinding.lBz.setVisibility(VISIBLE);
|
||||
mBinding.wvWeb.setVisibility(GONE);
|
||||
mBinding.butSub.setVisibility(VISIBLE);
|
||||
mBinding.butSub.setText("发红包");
|
||||
mBinding.imHelp.setImageResource(com.xscm.moduleutil.R.drawable.room_redbag_help);
|
||||
stype = 2;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
mBinding.clRedXz.setVisibility(GONE);
|
||||
mBinding.lKl.setVisibility(GONE);
|
||||
mBinding.lDjs.setVisibility(GONE);
|
||||
mBinding.lLx.setVisibility(GONE);
|
||||
mBinding.tvJeTitle.setVisibility(GONE);
|
||||
mBinding.lJine.setVisibility(GONE);
|
||||
mBinding.lGs.setVisibility(GONE);
|
||||
mBinding.llTj.setVisibility(GONE);
|
||||
mBinding.lBz.setVisibility(GONE);
|
||||
mBinding.wvWeb.setVisibility(VISIBLE);
|
||||
mBinding.butSub.setVisibility(GONE);
|
||||
mBinding.imHelp.setImageResource(com.xscm.moduleutil.R.drawable.room_redbag_back);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/10/11 打开规则按钮
|
||||
private void setWebView(String url) {
|
||||
mBinding.wvWeb.getSettings().setJavaScriptEnabled(true);
|
||||
mBinding.wvWeb.loadUrl(url);
|
||||
}
|
||||
|
||||
private void setFRed() {
|
||||
if (redGold == 1) {
|
||||
mBinding.tvJeTitle.setText(walletBean.getCoin() != null ? walletBean.getCoin() : "0" + "金币可用");
|
||||
mBinding.tvJ.setText("金币");
|
||||
} else if (redGold == 2) {
|
||||
mBinding.tvJeTitle.setText(walletBean.getEarnings() != null ? walletBean.getEarnings() : "0" + "钻石可用");
|
||||
mBinding.tvJ.setText("钻石");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Rect;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.RedBagAdapter;
|
||||
import com.xscm.modulemain.databinding.DialogRedListBinding;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
import com.xscm.moduleutil.utils.QXRedPacketManager;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
/**
|
||||
* 这是红包列表
|
||||
*/
|
||||
public class RedListDialog extends BaseDialog<DialogRedListBinding> {
|
||||
|
||||
RedBagAdapter redBagAdapter;
|
||||
private QXRedPacketManager qxRedPacketManager;
|
||||
|
||||
public RedListDialog(@NonNull Context context) {
|
||||
super(context, com.xscm.moduleutil.R.style.BaseDialogStyleH);
|
||||
}
|
||||
// 添加获取适配器的方法
|
||||
public RedBagAdapter getAdapter() {
|
||||
return redBagAdapter;
|
||||
}
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.dialog_red_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
Window window = getWindow();
|
||||
qxRedPacketManager=QXRedPacketManager.getInstance();
|
||||
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 0.8), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
// window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.ivClose.setOnClickListener(v -> dismiss());
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3); // 每行显示3个
|
||||
mBinding.recyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
// 设置间距
|
||||
mBinding.recyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
|
||||
int spacing = getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_10);
|
||||
outRect.left = spacing;
|
||||
outRect.right = spacing;
|
||||
outRect.bottom = spacing;
|
||||
if (parent.getChildAdapterPosition(view) % 3 == 0) {
|
||||
outRect.left = spacing;
|
||||
}
|
||||
if (parent.getChildAdapterPosition(view) % 3 == 2) {
|
||||
outRect.right = spacing;
|
||||
}
|
||||
}
|
||||
});
|
||||
redBagAdapter=new RedBagAdapter();
|
||||
mBinding.recyclerView.setAdapter(redBagAdapter);
|
||||
// 监听数据变化,动态调整高度
|
||||
redBagAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
|
||||
@Override
|
||||
public void onChanged() {
|
||||
adjustRecyclerViewHeight();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void adjustRecyclerViewHeight() {
|
||||
int itemCount = redBagAdapter.getItemCount();
|
||||
if (itemCount == 0) return;
|
||||
|
||||
// 计算需要的行数(每行3个)
|
||||
int rows = (int) Math.ceil((double) itemCount / 3);
|
||||
|
||||
// 限制最多显示2行
|
||||
int maxRows = Math.min(rows, 2);
|
||||
|
||||
// 计算总高度:2行 × item高度 + 间距
|
||||
int itemHeight = getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_80);
|
||||
int spacing = getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_10);
|
||||
int totalHeight = maxRows * itemHeight + (maxRows + 1) * spacing;
|
||||
|
||||
ViewGroup.LayoutParams params = mBinding.recyclerView.getLayoutParams();
|
||||
params.height = totalHeight;
|
||||
mBinding.recyclerView.setLayoutParams(params);
|
||||
|
||||
// 如果超过2行,启用滚动
|
||||
mBinding.recyclerView.setNestedScrollingEnabled(itemCount > 6);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
// RetrofitClient.getInstance().firstChargeGift(new BaseObserver<FirstChargeGiftBean>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(FirstChargeGiftBean firstChargeGiftBean) {
|
||||
// if (firstChargeGiftBean != null) {
|
||||
// showGift(firstChargeGiftBean);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
redBagAdapter.setNewData(qxRedPacketManager.getAllRedPackets()) ;
|
||||
redBagAdapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
|
||||
if (mListener != null) {
|
||||
mListener.onRedPacketClick(redBagAdapter.getData().get(position), position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface OnRedPacketClickListener {
|
||||
void onRedPacketClick(RedPacketInfo redPacketInfo,int position);
|
||||
}
|
||||
private OnRedPacketClickListener mListener;
|
||||
|
||||
public void setOnRedPacketClickListener(OnRedPacketClickListener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
|
||||
private Resources getResources() {
|
||||
return getContext().getResources();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.RequestContacts;
|
||||
import com.xscm.modulemain.activity.room.fragment.MusicSongListFragment;
|
||||
import com.xscm.modulemain.activity.room.fragment.RequestFragment;
|
||||
import com.xscm.modulemain.activity.room.presenter.RequestPresenter;
|
||||
import com.xscm.modulemain.databinding.FragmentRequestDialogBinding;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.MusicSongBean;
|
||||
import com.xscm.moduleutil.bean.SongMusicBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.agora.musiccontentcenter.Music;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/10
|
||||
*@description: 点唱选歌弹框
|
||||
*/
|
||||
public class RequestDialogFragment extends BaseMvpDialogFragment<RequestPresenter, FragmentRequestDialogBinding> implements
|
||||
RequestContacts.View {
|
||||
private int page;
|
||||
private static String roomId;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private int type;//1:点唱,2:背景音乐
|
||||
@Override
|
||||
protected RequestPresenter bindPresenter() {
|
||||
return new RequestPresenter(this, getActivity());
|
||||
}
|
||||
public static RequestDialogFragment show(String id, RoomInfoResp roomInfoResp, int type, FragmentManager fragmentManager) {
|
||||
RequestDialogFragment dialogFragment = new RequestDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); // 可选:传递参数
|
||||
args.putSerializable("roomInfo", roomInfoResp);
|
||||
args.putInt("type", type);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RequestDialogFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
roomId=getArguments().getString("roomId");
|
||||
roomInfoResp= (RoomInfoResp) getArguments().getSerializable("roomInfo");
|
||||
type=getArguments().getInt("type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.6f);;
|
||||
int heightInPx = (int) heightInDp;
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
// 强制支持 adjustResize 行为
|
||||
// window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||
|
||||
setStyle(DialogFragment.STYLE_NORMAL, com.xscm.moduleutil.R.style.CustomDialogFragmentTheme);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
String[] title = new String[]{"点歌", "已点"};
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
// 创建子 Fragment 并设置回调监听器
|
||||
RequestFragment dataFragment = RequestFragment.newInstance(roomId, RequestFragment.TYPE_DATA,type);
|
||||
dataFragment.setOnRequestFragmentListener(new RequestFragment.OnRequestFragmentListener() {
|
||||
@Override
|
||||
public void onCloseDialog(Music musicSongBean) {
|
||||
// AgoraManager.getInstance(getContext()).isPreload(musicSongBean.getSongCode(),1);
|
||||
MvpPre.song(roomId, SpUtil.getUserId()+"", musicSongBean.getSongCode()+"", musicSongBean.getName(), musicSongBean.getSinger(), musicSongBean.getPoster(), String.valueOf(musicSongBean.getDurationS()));
|
||||
}
|
||||
});
|
||||
|
||||
MusicSongListFragment weekFragment = MusicSongListFragment.newInstance(roomId,roomInfoResp, RequestFragment.TYPE_WEEK);
|
||||
weekFragment.setOnRequestFragmentListener(() -> dismiss());
|
||||
|
||||
fragments.add(dataFragment);
|
||||
fragments.add(weekFragment);
|
||||
mBinding.vpRequest.setAdapter(new MyFragmentPagerAdapter(getActivity(), title,roomId,roomInfoResp,type));
|
||||
|
||||
// 绑定 TabLayout
|
||||
new TabLayoutMediator(mBinding.slidingTabLayout, mBinding.vpRequest,
|
||||
(tab, position) -> tab.setText(title[position])
|
||||
).attach();
|
||||
}
|
||||
|
||||
public interface Refreshable {
|
||||
void refresh();
|
||||
}
|
||||
@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 int getLayoutId() {
|
||||
return R.layout.fragment_request_dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void songList(List<MusicSongBean> musicSongBeans) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upSong(String S) {
|
||||
com.hjq.toast.ToastUtils.show(S);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void song(List<SongMusicBean> music) {
|
||||
com.hjq.toast.ToastUtils.show("操作成功");
|
||||
}
|
||||
private static class MyFragmentPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
private String[] list;
|
||||
private String roomId;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private int type;
|
||||
|
||||
public MyFragmentPagerAdapter(@NonNull FragmentActivity fragmentActivity, String[] list,String roomId,RoomInfoResp roomInfoResp,int type) {
|
||||
super(fragmentActivity);
|
||||
this.list = list;
|
||||
this.roomId=roomId;
|
||||
this.roomInfoResp=roomInfoResp;
|
||||
this.type=type;
|
||||
}
|
||||
|
||||
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return list[position];
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
if (position == 1)
|
||||
return MusicSongListFragment.newInstance(roomId,roomInfoResp, RequestFragment.TYPE_WEEK);
|
||||
else {
|
||||
return RequestFragment.newInstance(roomId, RequestFragment.TYPE_DATA,type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return list.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.databinding.DialogRoomAuctionWebviewBinding;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/24
|
||||
*@description: 这是拍卖房的规则界面
|
||||
*/
|
||||
public class RoomAuctionWebViewDialog extends BaseDialog<DialogRoomAuctionWebviewBinding> {
|
||||
|
||||
String mUrl;
|
||||
int type;//10:天空之境 11:岁月之城 12:时空之巅
|
||||
|
||||
public RoomAuctionWebViewDialog(@NonNull Context context, Bundle args) {
|
||||
super(context, R.style.BaseDialogStyleH);
|
||||
this.mUrl = args.getString("url");
|
||||
this.type = args.getInt("type");
|
||||
initData1();
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getWindow() != null) {
|
||||
// 获取屏幕尺寸
|
||||
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||
// 设置高度为屏幕高度的80%
|
||||
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = (int) (displayMetrics.heightPixels * 0.9);
|
||||
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.dialog_room_auction_webview;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
setCancelable(true);
|
||||
setCanceledOnTouchOutside(true);
|
||||
Window window = getWindow();
|
||||
assert window != null;
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT);
|
||||
mBinding.topBar.setTitle("规则");
|
||||
mBinding.topBar.getIvBack().setOnClickListener(v -> dismiss());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void initData1() {
|
||||
// WebSettings webSettings = mBinding.webView.getSettings();
|
||||
// webSettings.setUseWideViewPort(true);
|
||||
// webSettings.setLoadWithOverviewMode(true);
|
||||
// webSettings.setJavaScriptEnabled(true);
|
||||
// webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||
// //增加JSBridge
|
||||
// mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||
//// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||
// webSettings.setBuiltInZoomControls(false);
|
||||
// webSettings.setSupportZoom(false);
|
||||
// webSettings.setDomStorageEnabled(true);
|
||||
// webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
// // 启用 WebView 内容的滚动
|
||||
// mBinding.webView.setVerticalScrollBarEnabled(true);
|
||||
// mBinding.webView.setScrollbarFadingEnabled(true);
|
||||
// webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
// webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
// mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
// mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||
// mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
// mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
// mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
//
|
||||
// mBinding.webView.requestFocus();
|
||||
// mBinding.webView.loadUrl(mUrl);
|
||||
|
||||
WebSettings webSettings = mBinding.webView.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||
//增加JSBridge
|
||||
mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||
// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||
webSettings.setBuiltInZoomControls(false);
|
||||
webSettings.setSupportZoom(false);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
// 启用 WebView 内容的滚动,但隐藏滚动条
|
||||
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示滚动条
|
||||
mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
// 确保内容可以滚动
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
|
||||
mBinding.webView.requestFocus();
|
||||
mBinding.webView.loadUrl(mUrl);
|
||||
}
|
||||
|
||||
private Resources getResources() {
|
||||
return getContext().getResources();
|
||||
}
|
||||
|
||||
public class WebAppInterface {
|
||||
Context mContext;
|
||||
|
||||
WebAppInterface(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
// 被 H5 调用的方法
|
||||
@JavascriptInterface
|
||||
public void showToast(String toast) {
|
||||
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void closeWeb() {
|
||||
LogUtils.e("value: ");
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void customerService() {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
|
||||
|
||||
// 判断当前版本是否支持拉起客服会话
|
||||
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||
req.corpId = "ww1de4300858c0b461"; // 企业ID
|
||||
req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void jumpRoomPage(String room_id) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getContext(), room_id,"",null);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void jumpWebPage(String objects) {
|
||||
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", objects).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void enterGroupChat(String group_id,String cover,String guild_name) {
|
||||
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void chatWithUser(String user_id,String nickname) {
|
||||
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void exchange(){
|
||||
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Withdrawal() {
|
||||
ARouter.getInstance().build(ARouteConstants.WITHDRAWAL_ACTIVITY).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void enterAuthent() {//实名认证
|
||||
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Recharge(){
|
||||
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.RoomCharmAdapter;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomCharmDialogContacts;
|
||||
import com.xscm.modulemain.databinding.DialogCharmFragmentBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomCharmDialogPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RoomUserCharmListBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/10
|
||||
*@description: 魅力弹框
|
||||
*/
|
||||
public class RoomCharmDialog extends BaseMvpDialogFragment<RoomCharmDialogPresenter, DialogCharmFragmentBinding> implements RoomCharmDialogContacts.View{
|
||||
|
||||
private String mRoomId;
|
||||
private String mUserId;
|
||||
private RoomCharmAdapter mAdapter;
|
||||
public static RoomCharmDialog newInstance(String roomId,String userId) {
|
||||
RoomCharmDialog fragment = new RoomCharmDialog();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("roomId", roomId);
|
||||
bundle.putString("userId", userId);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
mRoomId = arguments.getString("roomId");
|
||||
mUserId = arguments.getString("userId");
|
||||
}
|
||||
@Override
|
||||
protected RoomCharmDialogPresenter bindPresenter() {
|
||||
return new RoomCharmDialogPresenter(this, getActivity());
|
||||
}
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.5f;
|
||||
// 固定对话框的宽度和高度
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度设置为屏幕宽度
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; // 高度设置为内容高度
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.roomUserCharmList(mRoomId, mUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.rvCharmList.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mAdapter = new RoomCharmAdapter();
|
||||
mBinding.rvCharmList.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_charm_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomUserCharmList(List<RoomUserCharmListBean> roomUserCharmListBeans) {
|
||||
if (roomUserCharmListBeans!=null){
|
||||
mAdapter.setNewData(roomUserCharmListBeans);
|
||||
}else {
|
||||
mAdapter.setNewData(new ArrayList<>());
|
||||
ToastUtils.show("暂无数据");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomCloseContacts;
|
||||
import com.xscm.modulemain.databinding.RoomConcernDialogBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomClosePresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Setter;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/8/24
|
||||
*@description: 卡关系页面
|
||||
*/
|
||||
@Setter
|
||||
public class RoomConcernDialogFragment extends BaseMvpDialogFragment<RoomClosePresenter, RoomConcernDialogBinding> implements RoomCloseContacts.View {
|
||||
private int selectedPosition = -1;
|
||||
private BaseQuickAdapter<RoomRelationBean, BaseViewHolder> mAdapter;
|
||||
private FriendUserBean relationshipList;
|
||||
|
||||
public static RoomConcernDialogFragment newInstance(FriendUserBean relationshipList, OnConcernSelectedListener listener) {
|
||||
RoomConcernDialogFragment fragment = new RoomConcernDialogFragment(listener);
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("FriendUserBean", relationshipList);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
relationshipList = (FriendUserBean) arguments.getSerializable("FriendUserBean");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.room_concern_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.CENTER);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
|
||||
// 使用dp单位转换为像素
|
||||
lp.width = com.blankj.utilcode.util.ConvertUtils.dp2px(275); // 宽度275dp
|
||||
lp.height = com.blankj.utilcode.util.ConvertUtils.dp2px(452); // 高度452dp
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
@Override
|
||||
public void initView() {
|
||||
// getWindow().setLayout((int) (ScreenUtils.getScreenWidth() / 375.0 * 341), RadioGroup.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
ImageUtils.loadImageView(relationshipList.getUser1_avatar(), mBinding.image);
|
||||
ImageUtils.loadImageView(relationshipList.getUser2_avatar(), mBinding.image2);
|
||||
mBinding.tvName1.setText(relationshipList.getUser1_nickname());
|
||||
mBinding.tvName2.setText(relationshipList.getUser2_nickname());
|
||||
mBinding.tvZhi.setText(relationshipList.getHeart_value());
|
||||
mBinding.btnAction.setOnClickListener(this::onViewClicked);
|
||||
// mBinding.btnCancel.setOnClickListener(this::onViewClicked);
|
||||
mBinding.rlList.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||
mAdapter = new BaseQuickAdapter<RoomRelationBean, BaseViewHolder>(R.layout.room_concern_item) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomRelationBean item) {
|
||||
|
||||
TextView tvRelation = helper.getView(R.id.tv_relation);
|
||||
tvRelation.setText(item.getName());
|
||||
|
||||
// 根据当前选中的位置来设置颜色
|
||||
if (helper.getAdapterPosition() == selectedPosition) {
|
||||
tvRelation.setSelected(true);
|
||||
tvRelation.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.white));
|
||||
} else {
|
||||
tvRelation.setSelected(false);
|
||||
tvRelation.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.black));
|
||||
}
|
||||
|
||||
// 设置点击事件
|
||||
tvRelation.setOnClickListener(v -> {
|
||||
// 更新选中的位置
|
||||
int previousPosition = selectedPosition;
|
||||
selectedPosition = helper.getAdapterPosition();
|
||||
|
||||
// 通知Adapter数据集已更改,以刷新视图
|
||||
if (previousPosition != -1) {
|
||||
notifyItemChanged(previousPosition);
|
||||
}
|
||||
notifyItemChanged(selectedPosition);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
// mAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||
// selectedPosition = position;
|
||||
// });
|
||||
mBinding.rlList.setAdapter(mAdapter);
|
||||
mAdapter.bindToRecyclerView(mBinding.rlList);
|
||||
// mAdapter.setNewData(list);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomClosePresenter bindPresenter() {
|
||||
return new RoomClosePresenter(this, getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
MvpPre.roomRelationList("2");
|
||||
// MvpPre.getConcernList();
|
||||
|
||||
}
|
||||
|
||||
public OnConcernSelectedListener listener;
|
||||
|
||||
public void onViewClicked(View view) {
|
||||
if (view.getId() == R.id.btn_action) {//确认
|
||||
if (listener != null && selectedPosition != -1) {
|
||||
RoomRelationBean selectedDean = mAdapter.getItem(selectedPosition);
|
||||
listener.onConcernSelected(selectedDean, relationshipList);
|
||||
dismiss();
|
||||
}else {
|
||||
ToastUtils.show("请选择关系");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
// else if (view.getId() == R.id.btn_cancel) {//取消
|
||||
// dismiss();
|
||||
// }
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
|
||||
Dialog dialog = super.onCreateDialog(savedInstanceState);
|
||||
dialog.setCancelable(false); // 禁止通过返回键关闭对话框
|
||||
return dialog;
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
dialog.setCanceledOnTouchOutside(false); // 禁止点击对话框外部关闭对话框
|
||||
}
|
||||
}
|
||||
|
||||
public RoomConcernDialogFragment(OnConcernSelectedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomRelationList(List<RoomRelationBean> list) {
|
||||
mAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
public interface OnConcernSelectedListener {
|
||||
void onConcernSelected(RoomRelationBean selectedDean, FriendUserBean relationshipList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,939 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.GiftUserAdapter;
|
||||
import com.xscm.modulemain.databinding.RoomGiftDialogBinding;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.adapter.GiftTwoDetailsFragment;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftLabelBean;
|
||||
import com.xscm.moduleutil.bean.GiftNumBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackEvent;
|
||||
import com.xscm.moduleutil.bean.GiftPackListCount;
|
||||
import com.xscm.moduleutil.bean.RewardUserBean;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||
import com.xscm.moduleutil.event.GiftDoubleClickEvent;
|
||||
import com.xscm.moduleutil.event.GiftUserRefreshEvent;
|
||||
import com.xscm.moduleutil.event.RoomGiftGiveEvent;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.SystemUtils;
|
||||
import com.xscm.moduleutil.widget.dialog.KeyboardPopupWindow;
|
||||
import com.xscm.moduleutil.widget.dialog.SelectGiftNumPopupWindow;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/16
|
||||
* @description: 送礼物的dialog
|
||||
*/
|
||||
public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPresenter, RoomGiftDialogBinding> implements RewardGiftContacts.View {
|
||||
|
||||
private GiftUserAdapter gifyuseradapter;
|
||||
private SelectGiftNumPopupWindow mSelectGiftNumPopupWindow;
|
||||
private KeyboardPopupWindow mKeyboardPopupWindow;
|
||||
private List<GiftNumBean> mGiftNumList;
|
||||
private RoonGiftModel roonGiftModel = new RoonGiftModel();
|
||||
private GiftPackBean giftModel = null;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private String label_id;
|
||||
List<RewardUserBean> rewardUserBeanList;
|
||||
private List<Fragment> fragmentList = new ArrayList<>();
|
||||
private UserInfo userInfo;
|
||||
|
||||
private boolean all = false;
|
||||
private String roomId;
|
||||
private final List<String> oldSelectedIds = new LinkedList<>();
|
||||
private int jingp;//1:是点击的竞拍,2:是点击的送礼物
|
||||
private String heart_id = "";//交友房中,点击助力需要发送heart_id
|
||||
private String auction_id;
|
||||
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static RoomGiftDialogFragment show(RoomInfoResp roomInfoResp, UserInfo userInfo, String roomId, int jingp, String heart_id, FragmentManager fragmentManager) {
|
||||
RoomGiftDialogFragment dialogFragment = new RoomGiftDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("roomInfoResp", roomInfoResp);
|
||||
args.putSerializable("userInfo", userInfo);
|
||||
args.putString("roomId", roomId);
|
||||
args.putInt("jingp", jingp);//竞拍
|
||||
args.putString("heart_id", heart_id);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RewardGiftDialogFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
userInfo = (UserInfo) getArguments().getSerializable("userInfo");
|
||||
roomId = getArguments().getString("roomId");
|
||||
jingp = getArguments().getInt("jingp");
|
||||
heart_id = getArguments().getString("heart_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
// 清理资源,防止内存泄漏
|
||||
if (mSelectGiftNumPopupWindow != null) {
|
||||
mSelectGiftNumPopupWindow.dismiss();
|
||||
mSelectGiftNumPopupWindow = null;
|
||||
}
|
||||
|
||||
if (mKeyboardPopupWindow != null) {
|
||||
mKeyboardPopupWindow.dismiss();
|
||||
mKeyboardPopupWindow = null;
|
||||
}
|
||||
|
||||
if (currentDialog != null) {
|
||||
currentDialog.dismiss();
|
||||
currentDialog = null;
|
||||
}
|
||||
|
||||
// 清理适配器引用
|
||||
if (gifyuseradapter != null) {
|
||||
gifyuseradapter.setOnItemClickListener(null);
|
||||
gifyuseradapter = null;
|
||||
}
|
||||
|
||||
// 清理Fragment列表
|
||||
if (fragmentList != null) {
|
||||
fragmentList.clear();
|
||||
fragmentList = null;
|
||||
}
|
||||
|
||||
// 清理其他引用
|
||||
roomInfoResp = null;
|
||||
userInfo = null;
|
||||
rewardUserBeanList = null;
|
||||
giftLabelBeanList = null;
|
||||
roonGiftModel = null;
|
||||
giftModel = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Dialog dialog = getDialog();
|
||||
if (dialog != null) {
|
||||
// 获取屏幕高度
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int height = displayMetrics.heightPixels;
|
||||
|
||||
// 设置DialogFragment的高度为屏幕高度的70%
|
||||
dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, (int) (height * 0.7));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
// MvpPre.getRewardList("1", 1, 10);
|
||||
MvpPre.getGiftLabel("1");
|
||||
MvpPre.wallet();
|
||||
|
||||
mGiftNumList = new ArrayList<>();
|
||||
mGiftNumList.add(new GiftNumBean("20", "x20"));
|
||||
mGiftNumList.add(new GiftNumBean("15", "x15"));
|
||||
mGiftNumList.add(new GiftNumBean("10", "x10"));
|
||||
mGiftNumList.add(new GiftNumBean("5", "x5"));
|
||||
mGiftNumList.add(new GiftNumBean("1", "x1"));
|
||||
|
||||
rewardUserBeanList = new ArrayList<>();
|
||||
if (roomInfoResp == null) {
|
||||
RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
rewardUserBean.setUser_id(userInfo.getUser_id() + "");
|
||||
rewardUserBean.setNickname(userInfo.getNickname());
|
||||
rewardUserBean.setAvatar(userInfo.getAvatar());
|
||||
rewardUserBean.setPit_number(userInfo.getPit_number());
|
||||
rewardUserBean.setSelect(true);
|
||||
rewardUserBeanList.add(rewardUserBean);
|
||||
} else {
|
||||
|
||||
rewardUserBeanList = getSortedRewardUserList(roomInfoResp.getRoom_info().getPit_list(), "9", "10");
|
||||
}
|
||||
mBinding.rvGiftUser.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
gifyuseradapter = new GiftUserAdapter();
|
||||
mBinding.rvGiftUser.setAdapter(gifyuseradapter);
|
||||
gifyuseradapter.setNewData(rewardUserBeanList);
|
||||
|
||||
gifyuseradapter.setOnItemClickListener((adapter, view, position) -> {
|
||||
RewardUserBean item = (RewardUserBean) adapter.getItem(position);
|
||||
if (item != null) {
|
||||
item.setSelect(!item.isSelect());
|
||||
}
|
||||
// mBinding.tvOneKeyAllGive.setVisibility(currentPage == 1 && giftUserAdapter.getSelectCount() == 1 ?
|
||||
// View.VISIBLE : View.INVISIBLE);//选中了两个以上麦位,一键送礼隐藏
|
||||
all = gifyuseradapter.isAll();
|
||||
if (all) {
|
||||
mBinding.tvAllWheat.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBinding.tvAllWheat.setVisibility(View.VISIBLE);
|
||||
}
|
||||
gifyuseradapter.notifyItemChanged(position, item);
|
||||
oldSelectedIds.clear();
|
||||
oldSelectedIds.addAll(gifyuseradapter.getAllSelectedIds());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private List<RewardUserBean> getSortedRewardUserList(List<RoomPitBean> pitList, String... priorityPits) {
|
||||
List<RewardUserBean> result = new ArrayList<>();
|
||||
List<RoomPitBean> pitList2 = new ArrayList<>();
|
||||
List<RoomPitBean> pitList3 = new ArrayList<>();
|
||||
List<String> added = new ArrayList<>();
|
||||
if (roomInfoResp.getSong_pit_list() != null && roomInfoResp.getSong_pit_list().size() > 0) {
|
||||
pitList2.addAll(roomInfoResp.getSong_pit_list());
|
||||
// 使用 HashSet 进行去重
|
||||
Set<RoomPitBean> uniquePitSet = new HashSet<>(pitList);
|
||||
uniquePitSet.addAll(pitList2);
|
||||
// 将去重后的集合转换回 List
|
||||
pitList.clear();
|
||||
pitList.addAll(uniquePitSet);
|
||||
}
|
||||
|
||||
if (roomInfoResp.getRoom_auction() != null) {
|
||||
if (roomInfoResp.getRoom_auction().getAuction_list() != null && roomInfoResp.getRoom_auction().getAuction_list().size() > 0) {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_auction().getAuction_list().size(); i++) {
|
||||
RoomAuction.AuctionListBean auctionListBean = roomInfoResp.getRoom_auction().getAuction_list().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.setPit_number("1111");
|
||||
pitList3.add(pitBean);
|
||||
}
|
||||
// 使用 HashSet 进行去重
|
||||
Set<RoomPitBean> uniquePitSet = new HashSet<>(pitList);
|
||||
uniquePitSet.addAll(pitList3);
|
||||
// 将去重后的集合转换回 List
|
||||
pitList.clear();
|
||||
pitList.addAll(uniquePitSet);
|
||||
}
|
||||
|
||||
if (roomInfoResp.getRoom_auction().getAuction_user() != null) {
|
||||
if (roomInfoResp.getRoom_auction().getAuction_user().getUser_id() != null && !roomInfoResp.getRoom_auction().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
rewardUserBean.setUser_id(roomInfoResp.getRoom_auction().getAuction_user().getUser_id());
|
||||
rewardUserBean.setNickname(roomInfoResp.getRoom_auction().getAuction_user().getNickname());
|
||||
rewardUserBean.setAvatar(roomInfoResp.getRoom_auction().getAuction_user().getAvatar());
|
||||
rewardUserBean.setPit_number("888");
|
||||
result.add(rewardUserBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 优先添加指定麦位
|
||||
for (String targetPit : priorityPits) {
|
||||
for (RoomPitBean bean : pitList) {
|
||||
if (bean.getPit_number().equals(targetPit) &&
|
||||
!bean.getUser_id().equals("0") && !bean.getUser_id().equals("") &&
|
||||
!bean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
|
||||
RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
rewardUserBean.setUser_id(bean.getUser_id());
|
||||
rewardUserBean.setNickname(bean.getNickname());
|
||||
rewardUserBean.setAvatar(bean.getAvatar());
|
||||
rewardUserBean.setPit_number(bean.getPit_number());
|
||||
|
||||
result.add(rewardUserBean);
|
||||
added.add(bean.getPit_number());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 添加剩余的
|
||||
for (RoomPitBean bean : pitList) {
|
||||
String pitNumber = bean.getPit_number();
|
||||
if (!added.contains(pitNumber) &&
|
||||
!bean.getUser_id().equals("0") && !bean.getUser_id().equals("") &&
|
||||
!bean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
|
||||
RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
rewardUserBean.setUser_id(bean.getUser_id());
|
||||
rewardUserBean.setNickname(bean.getNickname());
|
||||
rewardUserBean.setAvatar(bean.getAvatar());
|
||||
rewardUserBean.setPit_number(bean.getPit_number());
|
||||
|
||||
result.add(rewardUserBean);
|
||||
}
|
||||
}
|
||||
|
||||
List<RewardUserBean> uniquePitSet = removeDuplicateByUserId(result);
|
||||
result.clear();
|
||||
result.addAll(uniquePitSet);
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: 2025/9/15 去重
|
||||
private List<RewardUserBean> removeDuplicateByUserId(List<RewardUserBean> list) {
|
||||
Set<String> userIdSet = new HashSet<>();
|
||||
List<RewardUserBean> uniqueList = new ArrayList<>();
|
||||
|
||||
for (RewardUserBean bean : list) {
|
||||
if (bean != null && bean.getUser_id() != null && !userIdSet.contains(bean.getUser_id())) {
|
||||
userIdSet.add(bean.getUser_id());
|
||||
uniqueList.add(bean);
|
||||
}
|
||||
}
|
||||
|
||||
return uniqueList;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// mBinding.rvGiftUser.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
// adapter = new BaseQuickAdapter<RewardUserBean, BaseViewHolder>(com.qxcm.moduleutil.R.layout.item_reward, null) {
|
||||
// @Override
|
||||
// protected void convert(BaseViewHolder helper, RewardUserBean item) {
|
||||
// ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(com.qxcm.moduleutil.R.id.im_reward));
|
||||
// }
|
||||
// };
|
||||
|
||||
mBinding.tvGiveCoinNum.setOnClickListener(this::onClisk);
|
||||
mBinding.tvGive.setOnClickListener(this::onClisk);
|
||||
mBinding.cz.setOnClickListener(this::onClisk);
|
||||
mBinding.tvAllWheat.setOnClickListener(this::onClisk);
|
||||
|
||||
float[] corners = {0f, 65f, 65f, 0f};
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvGive, ColorManager.getInstance().getPrimaryColorInt(), corners);
|
||||
mBinding.tvGive.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
mBinding.cz.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
|
||||
|
||||
ViewGroup.LayoutParams layoutParams = mBinding.llGiftRule.getLayoutParams();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; // 使用你定义的getWidth方法
|
||||
layoutParams.height = SystemUtils.getWidth(64); // 示例高度
|
||||
mBinding.llGiftRule.setLayoutParams(layoutParams);
|
||||
|
||||
|
||||
float[] corners2 = {56f, 56f, 56f, 56f};
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvBbQs, ColorManager.getInstance().getPrimaryColorInt(), corners2);
|
||||
mBinding.tvBbQs.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
mBinding.tvBbQs.setOnClickListener(this::onClisk);
|
||||
}
|
||||
|
||||
private void onClisk(View view1) {
|
||||
if (view1.getId() == R.id.tv_give_coin_num) {
|
||||
|
||||
if (mSelectGiftNumPopupWindow == null) {
|
||||
|
||||
mSelectGiftNumPopupWindow = new SelectGiftNumPopupWindow(getSelfActivity(), (adapter, view, position) -> {
|
||||
GiftNumBean giftNumBean = (GiftNumBean) adapter.getItem(position);
|
||||
if ("0".equals(giftNumBean.getNumber())) {//自定义
|
||||
mKeyboardPopupWindow = new KeyboardPopupWindow(getSelfActivity(), getView());
|
||||
mKeyboardPopupWindow.refreshKeyboardOutSideTouchable(false);//false开启键盘 ,true关闭键盘
|
||||
mKeyboardPopupWindow.addRoomPasswordListener(new KeyboardPopupWindow.KeyboardCompleteListener() {//监听自定键盘的完成
|
||||
@Override
|
||||
public void inputComplete(String inputContent) {
|
||||
mBinding.tvGiveCoinNum.setText(inputContent);
|
||||
mKeyboardPopupWindow.releaseResources();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mBinding.tvGiveCoinNum.setText(giftNumBean.getText());
|
||||
}
|
||||
mSelectGiftNumPopupWindow.dismiss();
|
||||
});
|
||||
}
|
||||
mSelectGiftNumPopupWindow.setData(mGiftNumList);
|
||||
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 190);
|
||||
|
||||
|
||||
} else if (view1.getId() == R.id.tv_give) {
|
||||
for (int i = 0; i < mGiftNumList.size(); i++) {
|
||||
if (mBinding.tvGiveCoinNum.getText().toString().equals(mGiftNumList.get(i).getText())) {
|
||||
giftNumber = mGiftNumList.get(i).getNumber();
|
||||
}
|
||||
}
|
||||
if (packType == 1) {
|
||||
giveGift(giftNumber);
|
||||
} else {
|
||||
giveGift(giftNumber);
|
||||
}
|
||||
} else if (view1.getId() == R.id.cz) {
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager(),"","");
|
||||
dismiss();
|
||||
} else if (view1.getId() == R.id.tv_all_wheat) {//全麦
|
||||
if (all) {
|
||||
gifyuseradapter.allElection(false);
|
||||
// mBinding.tvAllWheat.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
gifyuseradapter.allElection(true);
|
||||
// mBinding.tvAllWheat.setVisibility(View.GONE);
|
||||
}
|
||||
all = !all;
|
||||
oldSelectedIds.clear();
|
||||
oldSelectedIds.addAll(gifyuseradapter.getAllSelectedIds());
|
||||
} else if (view1.getId() == R.id.tv_bb_qs) {
|
||||
int count = gifyuseradapter.getSelectCount();
|
||||
if (count <=0) {
|
||||
ToastUtils.show("请选择打赏的用户");
|
||||
return;
|
||||
}
|
||||
if (gifyuseradapter.getUserIdCount() > 1) {
|
||||
ToastUtils.show("一键全送只能选择一个用户");
|
||||
return;
|
||||
}
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getAuction_id() != null) {
|
||||
auction_id =userInfo.getAuction_id();
|
||||
} else {
|
||||
auction_id = "";
|
||||
}
|
||||
}
|
||||
queren();
|
||||
}
|
||||
}
|
||||
private void queren() {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(getActivity(),
|
||||
"提示",
|
||||
"是否确认将背包礼物全部送出?",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
MvpPre.getGiftPack(roomId, gifyuseradapter.getUserIdToString(), heart_id, auction_id);
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
private String giftNumber = "";
|
||||
private RoomGiftGiveEvent roomGiftGiveEvent;
|
||||
|
||||
int packType;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftDoubleClickEvent(GiftDoubleClickEvent event) {
|
||||
getSelectedGift();
|
||||
packType = 1;
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void userRefresh(GiftUserRefreshEvent event) {
|
||||
if (event.gift == null || event.gift.getRule() == null) {
|
||||
mBinding.llGiftRule.setVisibility(View.GONE);
|
||||
} else {
|
||||
if (event.gift.getActivities_id() == 5) {
|
||||
|
||||
showGiftLotteryDialog(event.gift, roomId);
|
||||
return;
|
||||
}
|
||||
mBinding.llGiftRule.setVisibility(View.VISIBLE);
|
||||
setGiftDetail(event.gift);
|
||||
}
|
||||
if (event.addSelf) {
|
||||
roonGiftModel = event.gift;
|
||||
}
|
||||
}
|
||||
|
||||
private GiftLotteryDialog currentDialog;
|
||||
|
||||
private void showGiftLotteryDialog(RoonGiftModel gift, String roomId) {
|
||||
String userId = gifyuseradapter.getUserIdToString();
|
||||
if (userId == null || userId.isEmpty()) {
|
||||
ToastUtils.show("请先选择人员");
|
||||
gift.setChecked(false);
|
||||
|
||||
return;
|
||||
}
|
||||
// this.dismiss();
|
||||
// FragmentManager fm = getParentFragmentManager();
|
||||
// GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(gift.getGift_bag() + "", roomId, userId);
|
||||
// newDialog.show(fm, "GiftLotteryDialog");
|
||||
|
||||
try {
|
||||
// 直接显示对话框,移除有问题的 FragmentTransaction
|
||||
this.dismissAllowingStateLoss(); // 使用 dismissAllowingStateLoss 更安全
|
||||
|
||||
FragmentManager fm = getParentFragmentManager();
|
||||
if (fm != null && !fm.isDestroyed()) {
|
||||
if (jingp==1){
|
||||
auction_id= userInfo.getAuction_id() ;
|
||||
}
|
||||
if (auction_id==null || auction_id.isEmpty()){
|
||||
auction_id="";
|
||||
}
|
||||
GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(
|
||||
String.valueOf(gift.getGift_bag()), roomId, userId, heart_id,auction_id);
|
||||
newDialog.show(fm, "GiftLotteryDialog");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e("RoomGiftDialogFragment", "Error in showGiftLotteryDialog", e);
|
||||
ToastUtils.show("操作失败,请重试");
|
||||
}
|
||||
|
||||
// 如果当前dialog存在且正在显示,先关闭
|
||||
// if (currentDialog != null && currentDialog.isVisible()) {
|
||||
// currentDialog.dismiss();
|
||||
// }
|
||||
// currentDialog = GiftLotteryDialog.newInstance(gift.getGift_bag()+"", roomId, userId);
|
||||
// currentDialog.show(getChildFragmentManager(), "GiftLotteryDialog");
|
||||
}
|
||||
|
||||
|
||||
public void setGiftDetail(RoonGiftModel giftDetailResp) {
|
||||
if (giftDetailResp == null) {
|
||||
return;
|
||||
}
|
||||
mBinding.tvTitle.setText(giftDetailResp.getGift_bag_name());
|
||||
mBinding.tvIntroduce.setText(giftDetailResp.getRule());
|
||||
mBinding.ivWf.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", giftDetailResp.getRule_url()).withString("title", "盲盒规则").navigation();
|
||||
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", giftDetailResp.getRule_url());
|
||||
intent.putExtra("title", "盲盒规则");
|
||||
startActivity(intent);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private int getSelectedGift() {
|
||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||
|
||||
// 增加边界检查
|
||||
if (fragmentList == null || currentItem < 0 || currentItem >= fragmentList.size()) {
|
||||
return currentItem;
|
||||
}
|
||||
|
||||
if (currentItem < 1) { //比1小的是背包
|
||||
GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
||||
if (fragment != null && giftModel == null) {
|
||||
giftModel = fragment.mGiftList();
|
||||
}
|
||||
} else {
|
||||
GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
||||
if (fragment != null && roonGiftModel == null) {
|
||||
roonGiftModel = fragment.getGiftList();
|
||||
}
|
||||
}
|
||||
return currentItem;
|
||||
}
|
||||
|
||||
private void giveGift(String num) {
|
||||
getSelectedGift();
|
||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||
String userId = gifyuseradapter.getUserIdToString();
|
||||
String pit = gifyuseradapter.getUserPitToString();
|
||||
// if (currentItem < 1) {
|
||||
// if (giftModel == null) {
|
||||
// ToastUtils.show("请选择礼物");
|
||||
// return;
|
||||
// }
|
||||
// int count = gifyuseradapter.getSelectCount();
|
||||
// if (count <= 0) {
|
||||
// ToastUtils.show("请选择打赏对象");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (TextUtils.isEmpty(num)) {
|
||||
// ToastUtils.show("请选择打赏礼物数量");
|
||||
// return;
|
||||
// }
|
||||
// if (Integer.valueOf(num) <= 0) {
|
||||
// ToastUtils.show("请选择打赏礼物数量");
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
if (roonGiftModel == null|| roonGiftModel.getGift_id() == null) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
}
|
||||
int count = gifyuseradapter.getSelectCount();
|
||||
if (count <= 0) {
|
||||
ToastUtils.show("请选择打赏对象");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(num)) {
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
if (Integer.valueOf(num) <= 0) {
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
// }
|
||||
if (roonGiftModel != null && roonGiftModel.getGift_id() != null) {
|
||||
if (currentItem != 0) {
|
||||
//礼物打赏
|
||||
giftNumber = num;
|
||||
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getPit_number() != null) {
|
||||
if (userInfo.getPit_number().equals("888") || userInfo.getPit_number().equals("")) {
|
||||
if (userInfo.getPit_number().isEmpty() || jingp != 1) {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
} else {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, userInfo.getAuction_id());
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1");
|
||||
dismiss();
|
||||
}
|
||||
} else {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, heart_id);
|
||||
}
|
||||
} else {
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
}
|
||||
} else {
|
||||
if (all) {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", null, "");
|
||||
} else {
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
|
||||
}
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
|
||||
}
|
||||
} else if (currentItem == 0) {
|
||||
if (userInfo==null){
|
||||
giftNumber = num;
|
||||
beibaoId = roonGiftModel.getGift_id();
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "2", pit, heart_id);
|
||||
return;
|
||||
}
|
||||
if ( userInfo.getPit_number()!=null&& userInfo.getPit_number().equals("888") || userInfo.getPit_number().equals("")) {
|
||||
if (userInfo.getPit_number().isEmpty() || jingp != 1) {
|
||||
giftNumber = num;
|
||||
beibaoId = roonGiftModel.getGift_id();
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "2", pit, heart_id);
|
||||
}else {
|
||||
beibaoId = roonGiftModel.getGift_id();
|
||||
MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "2");
|
||||
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, userInfo.getAuction_id());
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
// dismiss();
|
||||
}
|
||||
} else{
|
||||
giftNumber = num;
|
||||
beibaoId = roonGiftModel.getGift_id();
|
||||
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "2", pit, heart_id);
|
||||
}
|
||||
|
||||
} else {
|
||||
//背包礼物打赏
|
||||
// giftNumber = num;
|
||||
// roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 1, giftModel, null);
|
||||
//
|
||||
// MvpPre.giveBackGift(userId, giftModel.getGift_id(), roomId, pit, num, giftModel, 1);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.show("数据错误");
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private String beibaoId;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_gift_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
if (rewardUserBeanList != null && !rewardUserBeanList.isEmpty()) {
|
||||
mBinding.rvGiftUser.setVisibility(View.VISIBLE);
|
||||
int limit = Math.min(rewardUserBeanList.size(), 6);
|
||||
List<RewardUserBean> limitedList = rewardUserBeanList.subList(0, limit);
|
||||
gifyuseradapter.setNewData(limitedList);
|
||||
} else {
|
||||
gifyuseradapter.setNewData(null);
|
||||
mBinding.rvGiftUser.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private List<GiftLabelBean> giftLabelBeanList;
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
if (giftLabelBeans == null) return;
|
||||
giftLabelBeanList = new ArrayList<>();
|
||||
giftLabelBeanList.addAll(giftLabelBeans);
|
||||
GiftLabelBean giftLabelBean = new GiftLabelBean();
|
||||
giftLabelBean.setId("0");
|
||||
giftLabelBean.setName("背包");
|
||||
giftLabelBeans.add(0, giftLabelBean);
|
||||
|
||||
if (SpUtil.getShelf()==1){
|
||||
for (GiftLabelBean giftLabelBean1 : giftLabelBeans){
|
||||
if (giftLabelBean1.getId().equals("2")){
|
||||
giftLabelBeans.remove(giftLabelBean1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans, fragmentList, roomId));
|
||||
mBinding.viewPager.setOffscreenPageLimit(0);
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(1);
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(1).getId(),1,roomId);
|
||||
mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
// 当页面切换时,控制 tv_bb_qs 按钮的显示
|
||||
updateTvBbQsVisibility(position);
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(position).getId(),1,roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
// 初始化时设置按钮可见性
|
||||
updateTvBbQsVisibility(1);
|
||||
}
|
||||
// 调用示例
|
||||
private void refreshCurrentGiftFragment(String id,int type,String roomId) {
|
||||
if (getCurrentGiftFragment()!=null){
|
||||
getCurrentGiftFragment().loadDataIfNeeded(id,type,roomId);
|
||||
}
|
||||
}
|
||||
|
||||
private GiftTwoDetailsFragment getCurrentGiftFragment() {
|
||||
int currentPosition = mBinding.viewPager.getCurrentItem();
|
||||
// 使用 ViewPager 的 adapter 获取当前 fragment
|
||||
MyFragmentPagerAdapter adapter = (MyFragmentPagerAdapter) mBinding.viewPager.getAdapter();
|
||||
if (adapter != null) {
|
||||
// 直接从 adapter 获取 fragment
|
||||
Fragment fragment = adapter.getItem(currentPosition);
|
||||
if (fragment instanceof GiftTwoDetailsFragment) {
|
||||
return (GiftTwoDetailsFragment) fragment;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// 控制 tv_bb_qs 按钮显示的方法
|
||||
private void updateTvBbQsVisibility(int currentPosition) {
|
||||
// 假设你希望在特定位置(例如位置1)显示按钮
|
||||
if (currentPosition == 0) { // 根据你的需求调整位置
|
||||
// 显示按钮
|
||||
if (mBinding.tvBbQs != null) {
|
||||
mBinding.tvBbQs.setVisibility(View.VISIBLE);
|
||||
mBinding.cz.setVisibility(View.GONE);
|
||||
MvpPre.getGiftPackListCount();
|
||||
}
|
||||
} else {
|
||||
// 隐藏按钮
|
||||
if (mBinding.tvBbQs != null) {
|
||||
mBinding.tvBbQs.setVisibility(View.GONE);
|
||||
mBinding.cz.setVisibility(View.VISIBLE);
|
||||
MvpPre.wallet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels, int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
// dismiss();
|
||||
|
||||
if (mBinding.viewPager.getCurrentItem() == 0) {
|
||||
if (MvpPre!=null) {
|
||||
MvpPre.getGiftPackListCount();
|
||||
}
|
||||
GiftPackEvent giftPackEvent = new GiftPackEvent();
|
||||
giftPackEvent.setBdid(beibaoId);
|
||||
EventBus.getDefault().post(giftPackEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (roomGiftGiveEvent != null) {
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
dismiss();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
mBinding.tvRewardGift.setText(walletBean.getCoin());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reward_zone() {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("打赏成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuctionJoin(RoomAuction.AuctionListBean auctionListBean) {
|
||||
// com.blankj.utilcode.util.ToastUtils.showShort("竞拍成功");
|
||||
if (roomGiftGiveEvent != null) {
|
||||
EventBus.getDefault().post(roomGiftGiveEvent);
|
||||
roomGiftGiveEvent = null;
|
||||
// dismiss();
|
||||
}
|
||||
if (mBinding.viewPager.getCurrentItem()==0) {
|
||||
GiftPackEvent giftPackEvent = new GiftPackEvent();
|
||||
giftPackEvent.setBdid(beibaoId);
|
||||
EventBus.getDefault().post(giftPackEvent);
|
||||
MvpPre.getGiftPackListCount();
|
||||
}
|
||||
// dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giftPack(List<GiftPackBean> giftPackBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftPack(String s) {
|
||||
if (s != null) {
|
||||
ToastUtils.show(s);
|
||||
dismiss();
|
||||
} else {
|
||||
ToastUtils.show("一键全清背包礼物失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftPackListCount(GiftPackListCount giftPackListCount) {
|
||||
if (giftPackListCount != null){
|
||||
mBinding.tvRewardGift.setText(giftPackListCount.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
private class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<GiftLabelBean> list;
|
||||
private List<Fragment> fragmentList;
|
||||
private String roomId;
|
||||
|
||||
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList, String roomId) {
|
||||
super(fm);
|
||||
this.list = list != null ? list : new ArrayList<>();
|
||||
// 不直接使用传入的 fragmentList,而是创建一个新的列表
|
||||
this.fragmentList = new ArrayList<>();
|
||||
// 初始化 fragmentList 的大小,用 null 填充
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
this.fragmentList.add(null);
|
||||
}
|
||||
this.roomId = roomId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// 边界检查
|
||||
if (position < 0 || list == null || position >= list.size()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 检查该位置是否已经有 Fragment 实例
|
||||
if (position < fragmentList.size() && fragmentList.get(position) != null) {
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
// 创建新的 Fragment
|
||||
GiftLabelBean model = list.get(position);
|
||||
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 1, roomId);
|
||||
// 确保 fragmentList 有足够的空间
|
||||
while (fragmentList.size() <= position) {
|
||||
fragmentList.add(null);
|
||||
}
|
||||
|
||||
// 在指定位置设置 Fragment 实例
|
||||
fragmentList.set(position, fragment);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
if (list == null || position < 0 || position >= list.size()) {
|
||||
return null;
|
||||
}
|
||||
GiftLabelBean model = list.get(position);
|
||||
return model.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.StringUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomHostContacts;
|
||||
import com.xscm.modulemain.databinding.RoomHostAddFragmentBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomHostPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.lihang.ShadowLayout;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.HostBean;
|
||||
import com.xscm.moduleutil.bean.RefreshEvent;
|
||||
import com.xscm.moduleutil.bean.RoomSearchResp;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/21
|
||||
*@description: 设置主持人
|
||||
*/
|
||||
public class RoomHostAddFragment extends BaseMvpDialogFragment<RoomHostPresenter, RoomHostAddFragmentBinding> implements RoomHostContacts.View {
|
||||
private String mRoomId ;
|
||||
private BaseQuickAdapter<RoomSearchResp, BaseViewHolder> mAdapter;
|
||||
|
||||
// TODO: Customize parameter initialization
|
||||
@SuppressWarnings("unused")
|
||||
public static RoomHostAddFragment newInstance(String roomId) {
|
||||
RoomHostAddFragment fragment = new RoomHostAddFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", roomId);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
mRoomId = arguments.getString("roomId");
|
||||
}
|
||||
// TODO: 2025/3/7 固定dialog显示的位置和大小
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
// 固定对话框的宽度和高度
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度设置为屏幕宽度
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; // 高度设置为内容高度
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomHostPresenter bindPresenter() {
|
||||
return new RoomHostPresenter(this, getContext());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
mBinding.editQuery.addTextChangedListener(new TextWatcher() {
|
||||
private Handler handler = new Handler();
|
||||
private final long DELAY = 1500; // 1秒延迟
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String keyWord = editable.toString();
|
||||
if (!StringUtils.isEmpty(keyWord)) {
|
||||
MvpPre.setUserHostList(keyWord,"1");
|
||||
}
|
||||
}
|
||||
}, DELAY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.rvHostAdd.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mAdapter = new BaseQuickAdapter<RoomSearchResp, BaseViewHolder>(R.layout.room_host_add_item, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomSearchResp item) {
|
||||
helper.setText(R.id.tv_name, item.getName());
|
||||
ImageUtils.loadHeadCC(item.getPicture(), helper.getView(R.id.image));
|
||||
helper.setText(R.id.tv_id, item.getCode());
|
||||
// if (item.getSex().equals("1")){
|
||||
// helper.setBackgroundRes(R.id.tv_gender, com.qxcm.moduleutil.R.mipmap.boyb);
|
||||
// }else {
|
||||
// helper.setBackgroundRes(R.id.tv_gender, com.qxcm.moduleutil.R.mipmap.girl);
|
||||
// }
|
||||
// helper.setText(R.id.tv_gender, item.getAge()+"");
|
||||
// ImageUtils.loadImageView(item.getLevel_icon(), helper.getView(R.id.iv_rd));
|
||||
LinearLayout llContainer = helper.getView(R.id.ll);
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
if (!item.getIcon().isEmpty()||item.getIcon().size()>0){
|
||||
for (String url : item.getIcon()) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_57),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView);
|
||||
|
||||
llContainer.addView(imageView);
|
||||
}
|
||||
}
|
||||
}
|
||||
ShadowLayout layout = helper.getView(R.id.shadow_layout);
|
||||
// layout.setShadowColor(R.color.picture_color_fa632d);
|
||||
layout.setShadowHiddenBottom(false);
|
||||
layout.setShadowHidden(false);
|
||||
layout.setShadowOffsetY(1);
|
||||
layout.setShadowOffsetX(1);
|
||||
|
||||
|
||||
|
||||
helper.getView(R.id.iv_add).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO: 2025/3/17 添加主持人
|
||||
MvpPre.postHostAdd(mRoomId, item.getId(), "1", "1");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
mBinding.rvHostAdd.setAdapter(mAdapter);
|
||||
mAdapter.bindToRecyclerView(mBinding.rvHostAdd);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_host_add_fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHostrList(List<HostBean> list) {
|
||||
// mAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUserHostList(List<RoomSearchResp> list) {
|
||||
mAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHostAdd(String s, String type, String is_add) {
|
||||
ToastUtils.show("添加成功");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void getUserHostList(List<RoomHostUserBean> list) {
|
||||
// mAdapter.setNewData(list);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void postHostAdd(String s) {
|
||||
// Logger.d("@@@@",s);
|
||||
// ToastUtils.showShort("添加成功");
|
||||
//
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public void setHostrList(List<HostBean> list) {
|
||||
//
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void postPresidedRatio(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postPresidedDel(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doDismiss() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDismiss(@NonNull DialogInterface dialog) {
|
||||
super.onDismiss(dialog);
|
||||
EventBus.getDefault().post(new RefreshEvent(mRoomId)); // 发送刷新事件
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomHostContacts;
|
||||
import com.xscm.modulemain.databinding.RoomFragmentItemListBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomHostPresenter;
|
||||
import com.lihang.ShadowLayout;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.HostBean;
|
||||
import com.xscm.moduleutil.bean.RefreshEvent;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.RoomSearchResp;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A fragment representing a list of Items.
|
||||
* 主持弹窗
|
||||
*/
|
||||
public class RoomHostFragment extends BaseMvpDialogFragment<RoomHostPresenter, RoomFragmentItemListBinding> implements RoomHostContacts.View {
|
||||
private String mRoomId;
|
||||
private BaseQuickAdapter<HostBean, BaseViewHolder> mAdapter;
|
||||
|
||||
// TODO: Customize parameter initialization
|
||||
@SuppressWarnings("unused")
|
||||
public static RoomHostFragment newInstance(String roomId) {
|
||||
RoomHostFragment fragment = new RoomHostFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("roomId", roomId);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
mRoomId = arguments.getString("roomId");
|
||||
}
|
||||
|
||||
// TODO: 2025/3/7 固定dialog显示的位置和大小
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
// 固定对话框的宽度和高度
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度设置为屏幕宽度
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; // 高度设置为内容高度
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomHostPresenter bindPresenter() {
|
||||
return new RoomHostPresenter(this, getContext());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.tvTj.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO: 2025/3/7 点击弹出设置主持人模式
|
||||
RoomHostAddFragment.newInstance(mRoomId).show(getChildFragmentManager(), "RoomHostAddFragment");
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rvHostList.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mAdapter = new BaseQuickAdapter<HostBean, BaseViewHolder>(R.layout.room_fragment_item, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, HostBean item) {
|
||||
helper.setText(R.id.tv_name, item.getNickname());
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.image));
|
||||
if (item.getRatio() == null || item.getRatio().isEmpty()) {
|
||||
helper.setText(R.id.tv_proportion, "未设置");
|
||||
} else {
|
||||
helper.setText(R.id.tv_proportion, item.getRatio() + "%");
|
||||
}
|
||||
helper.setText(R.id.tv_shouyi,item.getEarnings()!=null&&!item.getEarnings().isEmpty()?item.getEarnings():"0.00");
|
||||
// helper.setText(R.id.tv_income, "¥" + item.getEarnings());
|
||||
ShadowLayout layout = helper.getView(R.id.shadow_layout);
|
||||
// layout.setShadowColor(R.color.picture_color_fa632d);
|
||||
layout.setShadowHiddenBottom(false);
|
||||
layout.setShadowHidden(false);
|
||||
layout.setShadowOffsetY(1);
|
||||
layout.setShadowOffsetX(1);
|
||||
|
||||
TextView tv_sz=helper.getView(R.id.tv_sz);
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(tv_sz, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
tv_sz.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
helper.getView(R.id.tv_yc).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO: 2025/3/7 点击移除主持人
|
||||
MvpPre.postHostAdd(mRoomId, item.getUser_id(), "1", "2");
|
||||
}
|
||||
});
|
||||
|
||||
helper.getView(R.id.tv_sz).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// TODO: 2025/3/7 点击设置收益比例
|
||||
RoomHostIncomeDialog dialog = new RoomHostIncomeDialog(getContext());
|
||||
dialog.setListener(new RoomHostIncomeDialog.OnConfirmClickListener() {
|
||||
@Override
|
||||
public void onConfirm(String proportion) {
|
||||
MvpPre.setPresidedRatio(item.getRoom_id(),item.getUser_id(), proportion);
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
// dialog.setListener(new RoomHostIncomeDialog.OnConfirmClickListener() {
|
||||
// @Override
|
||||
// public void onConfirm(String proportion) {
|
||||
// // TODO: 2025/3/7 提交数据
|
||||
// MvpPre.setPresidedRatio(item.getRoom_id(),item.getId(), proportion);
|
||||
// }
|
||||
// });
|
||||
// dialog.show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
mBinding.rvHostList.setAdapter(mAdapter);
|
||||
mAdapter.bindToRecyclerView(mBinding.rvHostList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_fragment_item_list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setHostrList(List<HostBean> list) {
|
||||
mAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getUserHostList(List<RoomSearchResp> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHostAdd(String s, String type, String is_add) {
|
||||
MvpPre.clearHostList(mRoomId,"1");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void postPresidedRatio(String s) {
|
||||
ToastUtils.showShort("设置成功");
|
||||
// MvpPre.clearHostList(mRoomId);
|
||||
MvpPre.clearHostList(mRoomId,"1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postPresidedDel(String s) {
|
||||
ToastUtils.showShort("移除成功");
|
||||
// MvpPre.clearHostList(mRoomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doDismiss() {
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRefreshEvent(RefreshEvent refreshEvent) {
|
||||
// MvpPre.clearHostList(refreshEvent.getRoomId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MvpPre.clearHostList(mRoomId,"1");
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void refreshEvent(RoomMessageEvent event) {
|
||||
if (event.getMsgType() == 1007){
|
||||
MvpPre.clearHostList(mRoomId,"1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.RoomHostIncomeDialogBinding;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
import lombok.Setter;
|
||||
/**
|
||||
* @Author
|
||||
* @Time 2025/8/1 22:30
|
||||
* @Description 设置主持人收益比例
|
||||
*/
|
||||
@Setter
|
||||
public class RoomHostIncomeDialog extends BaseDialog<RoomHostIncomeDialogBinding> {
|
||||
|
||||
|
||||
public RoomHostIncomeDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public void setListener(OnConfirmClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.room_host_income_dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
getWindow().setLayout((int) (ScreenUtils.getScreenWidth() / 375.0 * 341), RadioGroup.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.btnAction.setOnClickListener(this::onViewClicked);
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.btnAction, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.btnAction.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
public OnConfirmClickListener listener;
|
||||
|
||||
public void onViewClicked(View view) {
|
||||
if (listener != null) {
|
||||
if (mBinding.edRoomName.getText().toString().trim().isEmpty()){
|
||||
ToastUtils.showShort("请输入收益比例");
|
||||
}else {
|
||||
listener.onConfirm(mBinding.edRoomName.getText().toString().trim());
|
||||
}
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public interface OnConfirmClickListener {
|
||||
void onConfirm(String proportion);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.RoomHostZbDialogBinding;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025年8月1日22:30:48$ $
|
||||
* @Description 转币$
|
||||
*/
|
||||
public class RoomHostZBDialog extends BaseDialog<RoomHostZbDialogBinding> {
|
||||
|
||||
|
||||
public RoomHostZBDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public void setListener(RoomHostIncomeDialog.OnConfirmClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.room_host_zb_dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
getWindow().setLayout((int) (ScreenUtils.getScreenWidth() / 375.0 * 341), RadioGroup.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.btnAction.setOnClickListener(this::onViewClicked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
public RoomHostIncomeDialog.OnConfirmClickListener listener;
|
||||
|
||||
public void onViewClicked(View view) {
|
||||
if (listener != null) {
|
||||
if (mBinding.edRoomName.getText().toString().trim().isEmpty()){
|
||||
ToastUtils.showShort("请输入需要转币的金额");
|
||||
}else {
|
||||
listener.onConfirm(mBinding.edRoomName.getText().toString().trim());
|
||||
}
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public interface OnConfirmClickListener {
|
||||
void onConfirm(String proportion);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.msg.NewsPresenter;
|
||||
import com.xscm.modulemain.databinding.RoomDialogMessageListBinding;
|
||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author
|
||||
* @Time 2025/7/28 16:11
|
||||
* @Description 房间里面点击消息列表弹出的对话框
|
||||
*/
|
||||
public class RoomMessageDialogFragment extends BaseMvpDialogFragment<NewsPresenter, RoomDialogMessageListBinding> {
|
||||
|
||||
private static final String TAG = "BaseDialogFragment";
|
||||
|
||||
public static RoomMessageDialogFragment show(FragmentManager fragmentManager) {
|
||||
RoomMessageDialogFragment dialogFragment = new RoomMessageDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RoomOnlineDialogFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
// 添加 tuiconversation 组件提供的经典版会话界面
|
||||
fragments.add(new TUIConversationFragment());
|
||||
|
||||
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(fragments, getChildFragmentManager()));
|
||||
mBinding.viewPager.setCurrentItem(0, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
Log.d(TAG, "(Start)启动了===========================RoomMessageDialogFragment");
|
||||
return R.layout.room_dialog_message_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected NewsPresenter bindPresenter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
|
||||
public void onViewClicked(View view) {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomContacts;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomPresenter;
|
||||
import com.xscm.modulemain.adapter.RoomOnlineAdapter;
|
||||
import com.xscm.modulemain.databinding.FragmentRoomOnlineDialogBinding;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RedPacketInfo;
|
||||
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomUserBean;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/10
|
||||
* @description: 在线列表弹框
|
||||
*/
|
||||
public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresenter, FragmentRoomOnlineDialogBinding> implements
|
||||
RoomContacts.View {
|
||||
private int page;
|
||||
private RoomOnlineAdapter roomOnlineAdapter;
|
||||
private RoomOnlineAdapter roomOnlineAdapter2;
|
||||
private String roomId;
|
||||
private String pit_number;
|
||||
private RoomUserBean hostUser;
|
||||
protected RoomInfoResp roomInfoResp;
|
||||
|
||||
@Override
|
||||
protected RoomPresenter bindPresenter() {
|
||||
return new RoomPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static RoomOnlineDialogFragment show(String id, String pit_number, RoomUserBean hostUser, RoomInfoResp roomInfoResp, FragmentManager fragmentManager) {
|
||||
RoomOnlineDialogFragment dialogFragment = new RoomOnlineDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); // 可选:传递参数
|
||||
args.putString("pit_number", pit_number);
|
||||
args.putSerializable("hostUser", hostUser); // 可选:传递参数
|
||||
args.putSerializable("roomInfoResp", roomInfoResp);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RoomOnlineDialogFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.6f);
|
||||
;
|
||||
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
roomId = getArguments().getString("roomId");
|
||||
pit_number = getArguments().getString("pit_number");
|
||||
hostUser = (RoomUserBean) getArguments().getSerializable("hostUser");
|
||||
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
// 添加延迟以避免过于频繁的请求
|
||||
page++;
|
||||
if (MvpPre != null && getArguments() != null) {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), page + "", "10");
|
||||
} else {
|
||||
refreshLayout.finishLoadMore(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
page = 1;
|
||||
if (MvpPre != null && getArguments() != null) {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
} else {
|
||||
refreshLayout.finishRefresh(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mBinding.rvComment.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
roomOnlineAdapter = new RoomOnlineAdapter(new ArrayList<RoomOnlineBean>());
|
||||
mBinding.rvComment.setAdapter(roomOnlineAdapter);
|
||||
|
||||
roomOnlineAdapter.setListener(new RoomOnlineAdapter.OnJoinButtonClickListener() {
|
||||
@Override
|
||||
public void onJoinButtonClick(RoomOnlineBean item) {
|
||||
MvpPre.hostUserPit(roomId, pit_number, item.getUser_id() + "", "1");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserInfoClick(RoomOnlineBean item) {
|
||||
// 使用 post 延迟执行,确保 dismiss 完成后再显示新对话框
|
||||
mBinding.getRoot().post(() -> {
|
||||
mBinding.getRoot().post(() -> {
|
||||
RoomUserInfoFragment.show(roomId, item.getUser_id() + "", pit_number, getHostUser(hostUser), false, 4, isNumberWhether(), getParentFragmentManager());
|
||||
});
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 在类中添加以下方法
|
||||
private void resetRefreshState() {
|
||||
if (mBinding != null && mBinding.srl != null) {
|
||||
mBinding.srl.resetNoMoreData();
|
||||
}
|
||||
page = 1;
|
||||
}
|
||||
|
||||
private int isNumberWhether() {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
if (roomInfoResp.getRoom_info().getPit_list().get(i).getPit_number().equals("9") && roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id() != null &&
|
||||
!roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id().equals("0") && !roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id().isEmpty())
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int getHostUser(RoomUserBean item) {
|
||||
if (item.getPit_number() == 9) {
|
||||
if (item.getIs_room_owner() == 1) {
|
||||
return 1;
|
||||
} else if (item.getIs_management() == 1) {
|
||||
return 2;
|
||||
} else if (item.getIs_host() == 1) {
|
||||
return 3;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
if (item.getIs_room_owner() == 1) {
|
||||
return 1;
|
||||
} else if (item.getIs_management() == 1) {
|
||||
return 2;
|
||||
} else if (item.getIs_host() == 1) {
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_room_online_dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void roomInfo(RoomInfoResp resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPasswordDialog() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterFail() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomOnline(RoomOnline onlineBean) {
|
||||
|
||||
try {
|
||||
// 确保在主线程中执行UI操作
|
||||
if (getActivity() == null || mBinding == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
getActivity().runOnUiThread(() -> {
|
||||
// 完成刷新或加载更多操作
|
||||
if (mBinding.srl != null) {
|
||||
if (page <= 1) {
|
||||
mBinding.srl.finishRefresh();
|
||||
} else {
|
||||
mBinding.srl.finishLoadMore();
|
||||
}
|
||||
}
|
||||
|
||||
List<RoomOnlineBean> roomOnlineBeanList = new ArrayList<>();
|
||||
// 处理第一页数据(刷新操作)
|
||||
if (page <= 1) {
|
||||
// 清空之前的数据
|
||||
roomOnlineAdapter.setNewData(new ArrayList<>());
|
||||
}
|
||||
|
||||
int type_pit;
|
||||
if (pit_number.isEmpty()) {
|
||||
type_pit = 1;
|
||||
} else {
|
||||
type_pit = 2;
|
||||
}
|
||||
if (onlineBean.getOn_pit() != null && onlineBean.getOn_pit().size() > 0) {
|
||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||
roomOnlineBean.setItemViewType(1);
|
||||
roomOnlineBean.setTypeNames("麦上用户");
|
||||
roomOnlineBeanList.add(roomOnlineBean);
|
||||
for (RoomOnlineBean roomOnlineBean1 : onlineBean.getOn_pit()) {
|
||||
roomOnlineBean1.setType(1);
|
||||
roomOnlineBean1.setType_pit(0);
|
||||
roomOnlineBean1.setItemViewType(2);
|
||||
roomOnlineBeanList.add(roomOnlineBean1);
|
||||
}
|
||||
|
||||
}
|
||||
if (onlineBean.getOff_pit() != null && onlineBean.getOff_pit().size() > 0) {
|
||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||
roomOnlineBean.setItemViewType(1);
|
||||
roomOnlineBean.setTypeNames("麦下用户");
|
||||
roomOnlineBeanList.add(roomOnlineBean);
|
||||
for (RoomOnlineBean roomOnlineBean2 : onlineBean.getOff_pit()) {
|
||||
roomOnlineBean2.setType(2);
|
||||
roomOnlineBean2.setType_pit(type_pit);
|
||||
roomOnlineBean2.setItemViewType(2);
|
||||
roomOnlineBeanList.add(roomOnlineBean2);
|
||||
}
|
||||
}
|
||||
|
||||
// 根据是刷新还是加载更多来处理数据
|
||||
if (page <= 1) {
|
||||
// 刷新操作,设置新数据
|
||||
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||
} else {
|
||||
// 加载更多操作,添加数据
|
||||
if (roomOnlineBeanList.size() > 0) {
|
||||
roomOnlineAdapter.addData(roomOnlineBeanList);
|
||||
} else {
|
||||
// 没有更多数据了
|
||||
if (mBinding.srl != null) {
|
||||
mBinding.srl.finishLoadMoreWithNoMoreData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 更新用户总数
|
||||
// 更新用户总数 - 仅在第一页刷新时更新总数
|
||||
if (page <= 1) {
|
||||
int total = 0;
|
||||
if (onlineBean.getOn_pit() != null) {
|
||||
total += onlineBean.getOn_pit().size();
|
||||
}
|
||||
if (onlineBean.getOff_pit() != null) {
|
||||
total += onlineBean.getOff_pit().size();
|
||||
}
|
||||
|
||||
// 只有当获取到有效数据时才更新总数显示
|
||||
if (onlineBean.getOn_pit() != null || onlineBean.getOff_pit() != null) {
|
||||
mBinding.tvNum.setText("在线用户(" + total + ")人");
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setOnlineNumber(total);
|
||||
}
|
||||
}
|
||||
// 如果两个列表都为null,保持之前的总数显示不变
|
||||
} else {
|
||||
// 加载更多时,更新总数显示
|
||||
int currentTotal = 0;
|
||||
List<RoomOnlineBean> currentData = roomOnlineAdapter.getData();
|
||||
for (RoomOnlineBean bean : currentData) {
|
||||
if (bean.getItemViewType() == 2) { // 只统计用户项,不统计标题项
|
||||
currentTotal++;
|
||||
}
|
||||
}
|
||||
|
||||
mBinding.tvNum.setText("在线用户(" + currentTotal + ")人");
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setOnlineNumber(currentTotal);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查是否需要禁用加载更多(如果当前页数据少于预期)
|
||||
if (onlineBean.getOn_pit() != null && onlineBean.getOff_pit() != null) {
|
||||
int currentCount = onlineBean.getOn_pit().size() + onlineBean.getOff_pit().size();
|
||||
if (currentCount < 10 && page > 1) { // 每页预期10条数据
|
||||
if (mBinding.srl != null) {
|
||||
mBinding.srl.finishLoadMoreWithNoMoreData();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
// 确保在异常情况下也能完成刷新操作
|
||||
if (getActivity() != null && mBinding != null && mBinding.srl != null) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (page <= 1) {
|
||||
mBinding.srl.finishRefresh(false);
|
||||
} else {
|
||||
mBinding.srl.finishLoadMore(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void getRoomOnline(List<RoomOnlineBean> onlineBean) {
|
||||
// roomOnlineAdapter.setNewData(onlineBean);
|
||||
// mBinding.tvNum.setText("在线用户("+onlineBean.size()+")人");
|
||||
// }
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// 每次恢复时重置刷新状态
|
||||
resetRefreshState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downPit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySong() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void agreeSong() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postRoomInfo(RoomInfoResp resp) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCharmRank(List<RoomCharmRankBean> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeSong() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hostUserPit() {
|
||||
ToastUtils.showShort("抱麦成功");
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quitRoom() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quitRoom2(String roomId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userGuanzSuccess(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPk() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearUserCharm() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOnlineStatus(List<UserOnlineStatusBean> list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void findRoom() {
|
||||
mBinding.srl.finishRefresh();
|
||||
mBinding.srl.finishLoadMore();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomRedPackets(List<RedPacketInfo> list) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.StringUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.lihang.ShadowLayout;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomPkContacts;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomPkPresenter;
|
||||
import com.xscm.modulemain.databinding.FragmentRoomPkBinding;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.room.RoomBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/7/3
|
||||
* @description:
|
||||
*/
|
||||
public class RoomPkDialogFragment extends BaseMvpDialogFragment<RoomPkPresenter, FragmentRoomPkBinding> implements RoomPkContacts.View {
|
||||
|
||||
private int page = 1;
|
||||
private String keyWord = "";
|
||||
|
||||
private String mRoomId;
|
||||
private String mUserId;
|
||||
private int is_pk;
|
||||
private BaseQuickAdapter<RoomBean, BaseViewHolder> mAdapter;
|
||||
|
||||
@Override
|
||||
protected RoomPkPresenter bindPresenter() {
|
||||
return new RoomPkPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static RoomPkDialogFragment newInstance(String roomId,String userId,int is_pk) {
|
||||
RoomPkDialogFragment fragment = new RoomPkDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", roomId);
|
||||
args.putString("userId", userId);
|
||||
args.putInt("is_pk", is_pk);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.searchPkRoom(keyWord, page + "", "15");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
mRoomId = getArguments().getString("roomId");
|
||||
mUserId = getArguments().getString("userId");
|
||||
is_pk = getArguments().getInt("is_pk");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.editQuery.addTextChangedListener(new TextWatcher() {
|
||||
private Handler handler = new Handler();
|
||||
private final long DELAY = 1500; // 1秒延迟
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
handler.removeCallbacksAndMessages(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
handler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
keyWord = editable.toString();
|
||||
if (!StringUtils.isEmpty(keyWord)) {
|
||||
if (MvpPre!=null) {
|
||||
MvpPre.searchPkRoom(keyWord, "1", "15");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, DELAY);
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.searchPkRoom(keyWord, page + "", "15");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.searchPkRoom(keyWord, "1", "15");
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rvPkAdd.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mAdapter = new BaseQuickAdapter<RoomBean, BaseViewHolder>(R.layout.room_host_add_item, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomBean item) {
|
||||
helper.setText(R.id.tv_name, item.getRoom_name());
|
||||
ImageUtils.loadHeadCC(item.getRoom_cover(), helper.getView(R.id.image));
|
||||
helper.setText(R.id.tv_id, item.getRoom_number());
|
||||
LinearLayout llContainer = helper.getView(R.id.ll);
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
ImageView ivAdd = helper.getView(R.id.iv_add);
|
||||
ivAdd.setImageResource(com.xscm.moduleutil.R.mipmap.yq_pk);
|
||||
ShadowLayout layout = helper.getView(R.id.shadow_layout);
|
||||
// layout.setShadowColor(R.color.picture_color_fa632d);
|
||||
layout.setShadowHiddenBottom(false);
|
||||
layout.setShadowHidden(false);
|
||||
layout.setShadowOffsetY(1);
|
||||
layout.setShadowOffsetX(1);
|
||||
|
||||
|
||||
helper.getView(R.id.iv_add).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//发起邀请
|
||||
MvpPre.sendPk(mRoomId, mUserId, item.getRoom_id());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
mBinding.rvPkAdd.setAdapter(mAdapter);
|
||||
mAdapter.bindToRecyclerView(mBinding.rvPkAdd);
|
||||
|
||||
mBinding.tvSz.setOnClickListener(v -> {
|
||||
LiveBattleSettingsDialog settingsDialog = new LiveBattleSettingsDialog(getActivity(),is_pk, new LiveBattleSettingsDialog.OnSettingsChangeListener() {
|
||||
@Override
|
||||
public void onFriendInvitationChanged(boolean isChecked) {
|
||||
// 处理好友邀请开关状态变化
|
||||
handleFriendInvitationChange(isChecked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecommendInvitationChanged(boolean isChecked) {
|
||||
// 处理推荐邀请开关状态变化
|
||||
handleRecommendInvitationChange(isChecked);
|
||||
}
|
||||
});
|
||||
settingsDialog.show();
|
||||
});
|
||||
|
||||
mBinding.imSjPk.setOnClickListener(v -> {
|
||||
MvpPre.sendPk(mRoomId, mUserId, "");
|
||||
});
|
||||
}
|
||||
private void handleFriendInvitationChange(boolean isChecked) {
|
||||
// 根据 isChecked 的值更新相关逻辑,并传递参数给服务器
|
||||
// 例如:
|
||||
// MvpPre.updateFriendInvitationSetting(isChecked);
|
||||
if (isChecked){
|
||||
MvpPre.refusePk(mRoomId, "1");
|
||||
}else {
|
||||
MvpPre.refusePk(mRoomId, "2");
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRecommendInvitationChange(boolean isChecked) {
|
||||
// 根据 isChecked 的值更新相关逻辑,并传递参数给服务器
|
||||
// 例如:
|
||||
// MvpPre.updateRecommendInvitationSetting(isChecked);
|
||||
}
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_room_pk;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.6f;
|
||||
// 固定对话框的宽度和高度
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度设置为屏幕宽度
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; // 高度设置为内容高度
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void searchPkRoom(List<RoomBean> roomBeans) {
|
||||
if (page==1) {
|
||||
mAdapter.setNewData(roomBeans);
|
||||
}else {
|
||||
if (roomBeans!=null) {
|
||||
mAdapter.addData(roomBeans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPk() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refusePk() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishLoading() {
|
||||
mBinding.srl.finishRefresh();
|
||||
mBinding.srl.finishLoadMore();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,513 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static com.xscm.moduleutil.bean.room.RoomSettingBean.QXRoomSettingTypeRoomOrderMic;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.activity.RoomActivity;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomSettingContacts;
|
||||
import com.xscm.modulemain.activity.room.fragment.RoomBackgroundDialogFragment;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomSettingPresenter;
|
||||
import com.xscm.modulemain.adapter.RoomSettingAdapter;
|
||||
import com.xscm.modulemain.databinding.DialogRoomSettingFragmentBinding;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.EffectEvent;
|
||||
import com.xscm.moduleutil.event.FloatingScreenEvent;
|
||||
import com.xscm.moduleutil.event.MusicEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.RoomSettingEvent;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomSettingBean;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/17
|
||||
* @description: 房间设置弹框
|
||||
*/
|
||||
public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresenter, DialogRoomSettingFragmentBinding> implements RoomSettingContacts.View {
|
||||
private String userId;
|
||||
private String roomId;
|
||||
RoomSettingAdapter adapter;
|
||||
List<RoomSettingBean> dataList;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private int read;
|
||||
private boolean isSelected;
|
||||
private boolean effectOn = false;//开启/关闭特效
|
||||
private boolean floatingScreen = false;//开启/关闭飘屏
|
||||
|
||||
@Override
|
||||
protected RoomSettingPresenter bindPresenter() {
|
||||
return new RoomSettingPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static RoomSettingFragment show(RoomInfoResp roomInfoResp, FragmentManager fragmentManager) {
|
||||
RoomSettingFragment dialogFragment = new RoomSettingFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putSerializable("roomInfoResp", roomInfoResp);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RoomSettingFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
// roomId=getArguments().getString("roomId");
|
||||
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
if (roomInfoResp==null){
|
||||
ToastUtils.show("房间信息为空");
|
||||
return;
|
||||
}
|
||||
roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
if (roomInfoResp.getUser_info().getIs_room_owner() != 0) {
|
||||
read = 1;
|
||||
} else if (roomInfoResp.getUser_info().getIs_management() != 0) {
|
||||
read = 2;
|
||||
} else if (roomInfoResp.getUser_info().getIs_host() != 0) {
|
||||
read = 3;
|
||||
} else {
|
||||
read = 4;
|
||||
}
|
||||
if (roomInfoResp.getUser_info().getPit_number() != 0) {
|
||||
isSelected = true;
|
||||
} else {
|
||||
isSelected = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
dataList = new ArrayList<>();
|
||||
effectOn = SpUtil.getOpenEffect() == 1;
|
||||
floatingScreen = SpUtil.getFloatingScreen() == 1;
|
||||
boolean b = roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1");
|
||||
LogUtils.e("effectOn=" + effectOn);
|
||||
// 添加标题和对应的内容项
|
||||
dataList.add(new RoomSettingBean("房间类型", null, null, null, -1, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("点唱", "ic_sing", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeSing, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("拍卖", "ic_auction", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeAuction, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("男神", "ic_boy", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeBoy, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("女神", "ic_girl", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeGirl, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("交友", "jiao_y", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU, read, isSelected, false, false));// 添加的新的房间类型 ,交友 ,是原来的男神女神类型
|
||||
dataList.add(new RoomSettingBean("互娱", "ic_jiaoy", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy, read, isSelected, false, false)); //原交友,更改互娱 2025年9月19日11:18:01
|
||||
dataList.add(new RoomSettingBean("练歌房", "ic_liang", null, null, RoomSettingBean.QXRoomSettingTypeRoomTypeLianG, read, isSelected, false, false)); //练歌房,原点歌房,同意的时候,走同意点歌的逻辑
|
||||
|
||||
|
||||
dataList.add(new RoomSettingBean("常用工具", null, null, null, -1, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("房间补贴", "ic_subsidy", null, null, RoomSettingBean.QXRoomSettingTypeRoomSubsidy, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("主持设置", "ic_compere", null, null, RoomSettingBean.QXRoomSettingTypeRoomCompere, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("清空消息", "ic_clear_message", null, null, RoomSettingBean.QXRoomSettingTypeRoomClearMessage, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("排麦模式", "ic_order_mic", null, null, QXRoomSettingTypeRoomOrderMic, read, isSelected, false, roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1")));//等于1的时候,是排麦模式,等于2的时候,是自由模式,这里判断是否是拍卖模式,
|
||||
dataList.add(new RoomSettingBean("背景音乐", "ic_bg_music", null, null, RoomSettingBean.QXRoomSettingTypeRoomBgMusic, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("背景图片", "ic_bg_image", null, null, RoomSettingBean.QXRoomSettingTypeRoomBgImage, read, isSelected, false, false));
|
||||
|
||||
dataList.add(new RoomSettingBean("更多操作", null, null, null, -1, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("发红包", "ic_red", null, null, RoomSettingBean.QXRoomSettingTypeRoomFloatingRed, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("离开房间", "ic_leave", null, null, RoomSettingBean.QXRoomSettingTypeRoomLeave, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("分享房间", "ic_share", null, null, RoomSettingBean.QXRoomSettingTypeRoomShare, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("调音台", "ic_my_dress", null, null, RoomSettingBean.QXRoomSettingTypeRoomMyDress, read, isSelected, false, false));
|
||||
dataList.add(new RoomSettingBean("房间设置", "ic_room_setting", null, null, RoomSettingBean.QXRoomSettingTypeRoomSetting, read, isSelected, false, false));
|
||||
// dataList.add(new RoomSettingBean("房间欢迎语", "ic_welcome", null, null, RoomSettingBean.QXRoomSettingTypeRoomWelcome,read,isSelected, false));
|
||||
dataList.add(new RoomSettingBean("关闭特效", "ic_close_effects", null, null, RoomSettingBean.QXRoomSettingTypeRoomCloseEffects, read, isSelected, false, effectOn));
|
||||
dataList.add(new RoomSettingBean("关闭飘屏", "ic_close_floating_screen", null, null, RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen, read, isSelected, false, floatingScreen));
|
||||
dataList.add(new RoomSettingBean("举报", "ic_report", null, null, RoomSettingBean.QXRoomSettingTypeRoomReport, read, isSelected, false, false));
|
||||
List<RoomSettingBean> filteredList = new ArrayList<>();
|
||||
// 更新 itemType
|
||||
for (RoomSettingBean bean : dataList) {
|
||||
bean.setRead(read);
|
||||
bean.setSelected(isSelected);
|
||||
// 根据角色和状态设置 isVisible
|
||||
if (isItemVisible(bean)) {
|
||||
bean.setStatus(true);
|
||||
} else {
|
||||
bean.setStatus(false);
|
||||
}
|
||||
|
||||
bean.updateItemType();
|
||||
|
||||
if (bean.isStatus()) {
|
||||
filteredList.add(bean);
|
||||
}
|
||||
}
|
||||
adapter = new RoomSettingAdapter(filteredList);
|
||||
mBinding.recycleView.setAdapter(adapter);
|
||||
// 动态设置 GridLayoutManager 的列数
|
||||
GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 6); // 默认每行 4 个 item
|
||||
|
||||
|
||||
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
RoomSettingBean item = filteredList.get(position);
|
||||
if (item.getItemType() == RoomSettingBean.ITEM_TYPE_DEFAULT) { // 标题项占满一行
|
||||
return layoutManager.getSpanCount();
|
||||
} else { // 内容项默认每行 4 个
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
});
|
||||
// 根据 itemType 动态调整列数
|
||||
mBinding.recycleView.setLayoutManager(layoutManager);
|
||||
|
||||
adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
RoomSettingBean bean = (RoomSettingBean) adapter.getItem(position);
|
||||
|
||||
// 示例:切换选择状态
|
||||
if (bean.getType() == QXRoomSettingTypeRoomOrderMic) {
|
||||
MvpPre.changeRoom(roomId, SpUtil.getUserId() + "", position, bean);
|
||||
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomClearMessage) {
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setText("清空消息");
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(123, roomId, t);
|
||||
EventBus.getDefault().post(roomMessageEvent);
|
||||
String json = GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomRoomMessage(
|
||||
roomId,
|
||||
binaryData
|
||||
);
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).clearData();
|
||||
}
|
||||
|
||||
}
|
||||
// else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomMyDress) {
|
||||
// TunerDialogFragment.show(roomId, getChildFragmentManager());
|
||||
// }
|
||||
else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomCompere) {//主持设置
|
||||
RoomHostFragment.newInstance(roomId).show(getChildFragmentManager(), "RoomHostFragment");
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomBgImage) {//背景图片
|
||||
RoomBackgroundDialogFragment.newInstance(roomId).show(getChildFragmentManager(), "RoomBackgroundDialogFragment");
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects) {//关闭特效
|
||||
if (effectOn) {
|
||||
//关闭
|
||||
effectOn = false;
|
||||
//保存到本地
|
||||
SpUtil.setOpenEffect(0);
|
||||
EventBus.getDefault().post(new EffectEvent(false));
|
||||
bean.setSelect(false);
|
||||
} else {
|
||||
//打开
|
||||
effectOn = true;
|
||||
SpUtil.setOpenEffect(1);
|
||||
EventBus.getDefault().post(new EffectEvent(true));
|
||||
bean.setSelect(true);
|
||||
}
|
||||
upAdapter();
|
||||
// adapter.notifyItemChanged(position);
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
||||
EventBus.getDefault().post(new MusicEvent());
|
||||
|
||||
dismiss();
|
||||
}
|
||||
// else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomLeave) {
|
||||
// EventBus.getDefault().post(new RoomOutEvent());
|
||||
// }
|
||||
else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeSing) {
|
||||
// MvpPre.changeRoomType(roomId, "1");
|
||||
queren("1");
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction) {
|
||||
// MvpPre.changeRoomType(roomId, "2");
|
||||
queren("2");
|
||||
}
|
||||
// else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy) {
|
||||
//// MvpPre.changeRoomType(roomId, "3");
|
||||
// queren("3");
|
||||
// }
|
||||
// else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl) {
|
||||
//// MvpPre.changeRoomType(roomId, "4");
|
||||
// queren("4");
|
||||
// }
|
||||
else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy) {
|
||||
// MvpPre.changeRoomType(roomId, "7");
|
||||
queren("7");
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU) {
|
||||
queren("8");
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomTypeLianG){
|
||||
queren("-1");
|
||||
}else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomSetting) {
|
||||
if (roomInfoResp != null) {
|
||||
ARouter.getInstance().build(ARouteConstants.CREATED_ROOM).withSerializable("roomInfoResp", roomInfoResp).navigation();
|
||||
} else {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("数据错误,请关闭重试");
|
||||
}
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomReport) {
|
||||
if (roomId != null) {
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId).navigation();
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + 2 + "&fromId=" + roomId);
|
||||
|
||||
startActivity(intent);
|
||||
}else {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("数据错误,请关闭重试");
|
||||
}
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomSubsidy) {
|
||||
ARouter.getInstance().build(ARouteConstants.ROOM_ALLOWANCE).withString("from", "我的界面").withString("roomId", roomInfoResp.getRoom_info().getRoom_id() + "").navigation();
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen) {//2025年9月22日14:10:25,添加飘屏关闭打开按钮
|
||||
if (floatingScreen) {
|
||||
//关闭
|
||||
floatingScreen = false;
|
||||
//保存到本地
|
||||
SpUtil.setFloatingScreen(0);
|
||||
EventBus.getDefault().post(new FloatingScreenEvent(false));
|
||||
bean.setSelect(false);
|
||||
} else {
|
||||
//打开
|
||||
floatingScreen = true;
|
||||
SpUtil.setFloatingScreen(1);
|
||||
EventBus.getDefault().post(new FloatingScreenEvent(true));
|
||||
bean.setSelect(true);
|
||||
}
|
||||
upAdapter();
|
||||
}
|
||||
else if (bean.getType()==RoomSettingBean.QXRoomSettingTypeRoomFloatingRed){
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).redDialogView();
|
||||
}
|
||||
dismiss();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: 2025/8/29 房间切换提示框
|
||||
private void queren(String type) {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(getActivity(),
|
||||
"提示",
|
||||
"即将修改房间类型为" + (type.equals("1") ? "点唱" : (type.equals("2") ? "拍卖" : (type.equals("3") ? "男神" : (type.equals("4") ? "女神" : (type.equals("7") ? "互娱" : (type.equals("8") ? "交友" :(type.equals("-1") ? "练歌房" : ""))))))),
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
if (type.equals("-1")) {
|
||||
MvpPre.agreeSong(roomId,"1");
|
||||
} else
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
MvpPre.changeRoomType(roomId, type);
|
||||
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
private void upAdapter() {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private boolean isItemVisible(RoomSettingBean bean) {
|
||||
int type = bean.getType();
|
||||
int roleLevel = bean.getRead(); // 角色等级
|
||||
boolean onMic = false; // 是否是特定房间
|
||||
|
||||
if ((roomInfoResp.getRoom_info().getType_id().equals("1") || roomInfoResp.getRoom_info().getType_id().equals("3")
|
||||
|| roomInfoResp.getRoom_info().getType_id().equals("4") || roomInfoResp.getRoom_info().getType_id().equals("8")) && roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
|
||||
onMic = true;
|
||||
}
|
||||
// 2025年9月22日14:18:50,因为声网sdk不对,和点唱有关系的所有,需要关闭
|
||||
// 房主显示全部
|
||||
if (roleLevel == 1) {
|
||||
if (onMic) {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (roleLevel == 2 || roleLevel == 3) { // type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl || 2025年9月19日11:21:04,将男神女神合并成互娱,最总是新添加一个标签
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeLianG ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic || type == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
|
||||
|
||||
if (onMic) {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (onMic) {
|
||||
// if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
// || type == RoomSettingBean.QXRoomSettingTypeRoomMyDress /*|| type == RoomSettingBean.QXRoomSettingTypeRoomTypeLianG*/) {
|
||||
// return false;
|
||||
// }
|
||||
// } else {
|
||||
// if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
// || type == RoomSettingBean.QXRoomSettingTypeRoomMyDress /*|| type == RoomSettingBean.QXRoomSettingTypeRoomTypeLianG*/) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport || type == RoomSettingBean.QXRoomSettingTypeRoomFloatingRed) {
|
||||
return true;
|
||||
} else {
|
||||
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomSubsidy
|
||||
// || type == RoomSettingBean.QXRoomSettingTypeRoomMyDress /*|| type == RoomSettingBean.QXRoomSettingTypeRoomTypeLianG*/) {
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else { // 普通用户只显示更多操作中的特定条目
|
||||
return type == RoomSettingBean.QXRoomSettingTypeRoomLeave ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomShare ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomReport ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomFloatingRed||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.cl.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PublishCommentDialogFragment.show(roomId, getChildFragmentManager());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRoomSettingEvent(RoomSettingEvent event) {
|
||||
if (event.getType() == 1014) {
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
RoomSettingBean bean = (RoomSettingBean) adapter.getItem(i);
|
||||
if (bean.getType() == QXRoomSettingTypeRoomOrderMic) {
|
||||
if (event.getRoom_up_pit_type() == 2) {
|
||||
bean.setStatus(true);
|
||||
adapter.notifyItemChanged(i);
|
||||
} else {
|
||||
bean.setStatus(false);
|
||||
adapter.notifyItemChanged(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_room_setting_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeRoomSuccess(String s, int position, RoomSettingBean bean) {
|
||||
if (bean.isSelect()) {
|
||||
bean.setSelect(false);
|
||||
adapter.notifyItemChanged(position);
|
||||
} else {
|
||||
bean.setSelect(true);
|
||||
adapter.notifyItemChanged(position);
|
||||
}
|
||||
// if (bean.getName().contains("排麦")) {
|
||||
// bean.setName("自由模式");
|
||||
// bean.setSelect(false);
|
||||
// adapter.notifyItemChanged(position);
|
||||
// } else {
|
||||
// bean.setName("排麦模式");
|
||||
// bean.setSelect(true);
|
||||
// adapter.notifyItemChanged(position);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeRoomType(String s) {
|
||||
ToastUtils.show(s);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void agreeSong(String s) {
|
||||
ToastUtils.show(s);
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,757 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.RoomUserContacts;
|
||||
import com.xscm.modulemain.databinding.FragmentRoomUserInfoBinding;
|
||||
import com.xscm.modulemain.activity.room.fragment.RelationshipFragment;
|
||||
import com.xscm.modulemain.activity.room.presenter.RoomUserPresenter;
|
||||
import com.example.zhouwei.library.CustomPopWindow;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RelationCardBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.TimeUtils;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/13
|
||||
* @description: 点击房间用户展示
|
||||
*/
|
||||
public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresenter, FragmentRoomUserInfoBinding> implements RoomUserContacts.View {
|
||||
|
||||
private String room_id, user_id, pit_number;
|
||||
private UserInfo userInfo;
|
||||
CustomPopWindow mCustomPopWindow;
|
||||
private String is_room_owner;//是否是房主
|
||||
private String is_host;//是否是主持
|
||||
private String is_management;//是否是管理
|
||||
private int type;//1:房主并且是在支持麦 2:管理员并且在支持麦 3:主持并且在支持麦 4:普通用户 [要查看的用户类型]
|
||||
private int close_type;//被查看的用户类型 1:房主 2:管理员 3:主持 4:普通用户 [要关闭的用户类型]
|
||||
private String value;
|
||||
private View contentView;
|
||||
boolean isPk;
|
||||
private int paim;//这是判断是否是拍卖模式 1:拍卖房 2:K歌房 3:语聊房 4:在线列表 5:聊天房,
|
||||
private int isNum;//这里是当是拍卖房的时候,这个参数就是当前拍卖的id
|
||||
private int guanType; // 1: 关系卡 2: 关系位
|
||||
|
||||
@Override
|
||||
protected RoomUserPresenter bindPresenter() {
|
||||
return new RoomUserPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static void show(String room_id, String user_id, String pit_number, int type, boolean isPk, int paim, int isNum, FragmentManager fragmentManager) {
|
||||
RoomUserInfoFragment dialogFragment = new RoomUserInfoFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", room_id); // 可选:传递参数
|
||||
args.putString("userId", user_id);
|
||||
args.putString("pit_number", pit_number);
|
||||
args.putInt("type", type);
|
||||
args.putBoolean("isPk", isPk);
|
||||
args.putInt("paim", paim);
|
||||
args.putInt("isNum", isNum);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RoomUserInfoFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
room_id = getArguments().getString("roomId");
|
||||
user_id = getArguments().getString("userId");
|
||||
pit_number = getArguments().getString("pit_number");
|
||||
type = getArguments().getInt("type");
|
||||
value = getArguments().getString("value");
|
||||
isPk = getArguments().getBoolean("isPk");
|
||||
paim = getArguments().getInt("paim");
|
||||
isNum = getArguments().getInt("isNum");
|
||||
if (isPk) {
|
||||
type = 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getRoomUserInfo(room_id, user_id);
|
||||
if (type == 0) {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
} else {
|
||||
mBinding.roomDian.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (isPk) {
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
if (isNum == 1) {
|
||||
mBinding.imGs.setVisibility(GONE);
|
||||
} else {
|
||||
mBinding.imGs.setVisibility(VISIBLE);
|
||||
}
|
||||
} else {
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
mBinding.imGs.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.ivAvatar.setOnClickListener(this::onClick);
|
||||
mBinding.roomMCz.setOnClickListener(this::onClick);
|
||||
mBinding.roomDian.setOnClickListener(this::onClick);
|
||||
mBinding.imRoomT.setOnClickListener(this::onClick);
|
||||
mBinding.imRoomLt.setOnClickListener(this::onClick);
|
||||
mBinding.imRoomGz.setOnClickListener(this::onClick);
|
||||
mBinding.imRoomSl.setOnClickListener(this::onClick);
|
||||
mBinding.roomLh.setOnClickListener(this::onClick);
|
||||
mBinding.roomRlGift.setOnClickListener(this::onClick);
|
||||
mBinding.roomJb.setOnClickListener(this::onClick);
|
||||
mBinding.tvZb.setOnClickListener(this::onClick);
|
||||
mBinding.imGs.setOnClickListener(this::onClick);
|
||||
|
||||
mBinding.textView1.setOnClickListener(this::onClick);
|
||||
mBinding.textView2.setOnClickListener(this::onClick);
|
||||
mBinding.moreButton.setOnClickListener(this::onClick);
|
||||
mBinding.imQml.setOnClickListener(this::onClick);
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.roomMCz, ColorManager.getInstance().getPrimaryColorInt(), 65);
|
||||
mBinding.roomMCz.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
mBinding.moreButton.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.room_m_cz) {
|
||||
if (mBinding.roomMCz.getText().equals("上麦")) {
|
||||
MvpPre.applyPit(room_id, "");
|
||||
} else if (mBinding.roomMCz.getText().equals("抱麦")) {
|
||||
MvpPre.hostUserPit(room_id, pit_number, user_id, "1");
|
||||
} else {
|
||||
if (user_id.equals(SpUtil.getUserId() + "")) {
|
||||
MvpPre.downPit(room_id, pit_number);
|
||||
} else {
|
||||
MvpPre.hostUserPit(room_id, pit_number, user_id, "2");
|
||||
}
|
||||
}
|
||||
} else if (id == R.id.room_dian) {
|
||||
contentView = LayoutInflater.from(getContext()).inflate(R.layout.pop_menu, null);
|
||||
//处理popWindow 显示内容
|
||||
handleLogic(contentView);
|
||||
//创建并显示popWindow
|
||||
mCustomPopWindow = new CustomPopWindow.PopupWindowBuilder(getContext())
|
||||
.setView(contentView)
|
||||
.create()
|
||||
.showAsDropDown(mBinding.roomMCz, 0, 20);
|
||||
} else if (id == R.id.im_room_t) {
|
||||
userInfo.setTa("1");
|
||||
EventBus.getDefault().post(userInfo);
|
||||
dismiss();
|
||||
} else if (id == R.id.im_room_lt) {
|
||||
Intent intent = new Intent(getActivity(), TUIC2CChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, "u" + userInfo.getUser_id());
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||
startActivity(intent);
|
||||
} else if (id == R.id.im_room_gz) {
|
||||
MvpPre.userGuanz(user_id, "1");
|
||||
} else if (id == R.id.im_room_sl) {
|
||||
if (userInfo != null) {
|
||||
if (pit_number == null) {
|
||||
pit_number = "";
|
||||
}
|
||||
userInfo.setPit_number(pit_number);
|
||||
RoomGiftDialogFragment.show(null, userInfo, room_id, 0, "", getParentFragmentManager());
|
||||
}
|
||||
dismiss();
|
||||
} else if (id == R.id.room_lh) {
|
||||
MvpPre.addBlackList(user_id);
|
||||
} else if (id == R.id.room_rl_gift) {
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", userInfo.getUser_id() + "").withInt("type", 1).navigation();
|
||||
|
||||
// UserGiftWallRoomFragment.newInstance(Integer.parseInt(user_id)).show(getChildFragmentManager(), "UserGiftWallRoomFragment");
|
||||
} else if (id == R.id.room_jb) {
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=1&fromId=" + user_id);
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
} else if (id == R.id.iv_avatar) {
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", userInfo.getUser_id() + "").navigation();
|
||||
dismiss();
|
||||
} else if (id == R.id.tv_zb) {
|
||||
RoomHostZBDialog dialog = new RoomHostZBDialog(getContext());
|
||||
dialog.setListener(new RoomHostIncomeDialog.OnConfirmClickListener() {
|
||||
@Override
|
||||
public void onConfirm(String proportion) {
|
||||
MvpPre.giveCoin(user_id, proportion);
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
} else if (id == R.id.more_button) {
|
||||
RelationshipFragment.show(user_id, guanType, getParentFragmentManager());
|
||||
dismiss();
|
||||
} else if (id == R.id.textView1) {
|
||||
dianj(1);
|
||||
} else if (id == R.id.textView2) {
|
||||
dianj(2);
|
||||
} else if (id == R.id.im_qml) {
|
||||
MvpPre.clearUserCharm(room_id, user_id);
|
||||
} else if (id == R.id.im_gs) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), room_id, "", null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理弹出显示内容、点击事件等逻辑
|
||||
*
|
||||
* @param contentView
|
||||
*/
|
||||
private void handleLogic(View contentView) {
|
||||
View.OnClickListener listener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mCustomPopWindow != null) {
|
||||
mCustomPopWindow.dissmiss();
|
||||
}
|
||||
String showContent = "";
|
||||
int id = v.getId();
|
||||
if (id == R.id.action_set_manager) {
|
||||
if (userInfo.getIs_manager().equals("1")) {
|
||||
MvpPre.postHostAdd(room_id, user_id, "2", "2");
|
||||
} else {
|
||||
MvpPre.postHostAdd(room_id, user_id, "2", "1");
|
||||
}
|
||||
} else if (id == R.id.action_set_host) {
|
||||
if (userInfo.getIs_host().equals("1")) {
|
||||
MvpPre.postHostAdd(room_id, user_id, "1", "2");
|
||||
} else {
|
||||
MvpPre.postHostAdd(room_id, user_id, "1", "1");
|
||||
}
|
||||
} else if (id == R.id.action_mute) {
|
||||
if (userInfo.getIs_mute_pit().equals("1")) {
|
||||
MvpPre.setMutePit(room_id, user_id, "4");
|
||||
} else {
|
||||
MvpPre.setMutePit(room_id, user_id, "2");
|
||||
}
|
||||
} else if (id == R.id.action_kick_out) {
|
||||
MvpPre.kickOutRoom(room_id, user_id);
|
||||
} else if (id == R.id.action_ban) {
|
||||
if (userInfo.getIs_mute().equals("1")) {
|
||||
MvpPre.setMutePit(room_id, user_id, "3");
|
||||
} else {
|
||||
MvpPre.setMutePit(room_id, user_id, "1");
|
||||
}
|
||||
} else if (id == R.id.action_report) {
|
||||
// showContent = "点击 Item菜单6";
|
||||
//TODO 举报功能
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||
Intent intent = new Intent(getActivity(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=1&fromId=" + user_id);
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
|
||||
dismiss();
|
||||
} else if (id == R.id.action_blacklist) {
|
||||
MvpPre.addBlackList(user_id);
|
||||
}
|
||||
ToastUtils.show(showContent);
|
||||
mCustomPopWindow.dissmiss();
|
||||
}
|
||||
};
|
||||
((TextView) contentView.findViewById(R.id.action_set_manager)).setText(getValue(type, "is_manager"));
|
||||
((TextView) contentView.findViewById(R.id.action_set_host)).setText(getValue(type, "is_host"));
|
||||
((TextView) contentView.findViewById(R.id.action_mute)).setText(getValue(type, "is_mute"));
|
||||
((TextView) contentView.findViewById(R.id.action_ban)).setText(getValue(type, "is_mute_pit"));
|
||||
|
||||
|
||||
contentView.findViewById(R.id.action_set_manager).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_set_host).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_mute).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_kick_out).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_ban).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_report).setOnClickListener(listener);
|
||||
contentView.findViewById(R.id.action_blacklist).setOnClickListener(listener);
|
||||
|
||||
if (type == 1) {
|
||||
contentView.findViewById(R.id.action_set_manager).setVisibility(VISIBLE);
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
contentView.findViewById(R.id.action_set_host).setVisibility(VISIBLE);
|
||||
} else if (type == 2) {
|
||||
contentView.findViewById(R.id.action_set_manager).setVisibility(GONE);
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
contentView.findViewById(R.id.action_set_host).setVisibility(VISIBLE);
|
||||
} else if (type == 3) {
|
||||
contentView.findViewById(R.id.action_set_manager).setVisibility(GONE);
|
||||
contentView.findViewById(R.id.action_set_host).setVisibility(GONE);
|
||||
contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
// if (type != 1) {
|
||||
// contentView.findViewById(R.id.action_set_manager).setVisibility(GONE);
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
// }
|
||||
// if (type != 1 && type != 2) {
|
||||
// contentView.findViewById(R.id.action_set_host).setVisibility(GONE);
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
// }
|
||||
// if (paim==1){
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(GONE);
|
||||
// }else {
|
||||
// contentView.findViewById(R.id.action_kick_out).setVisibility(VISIBLE);
|
||||
// }
|
||||
}
|
||||
|
||||
private String getValue(int type, String key) {
|
||||
Map<String, String> textMap = new HashMap<>();
|
||||
textMap.put("is_manager", userInfo.getIs_manager().equals("1") ? "取消管理" : "设为管理");
|
||||
textMap.put("is_host", userInfo.getIs_host().equals("1") ? "取消主持" : "设为主持");
|
||||
textMap.put("is_mute", userInfo.getIs_mute_pit().equals("1") ? "开麦" : "禁麦");
|
||||
textMap.put("is_mute_pit", userInfo.getIs_mute().equals("1") ? "解除禁言" : "禁言");
|
||||
|
||||
switch (type) {
|
||||
case 1://房主
|
||||
if ("is_manager".equals(key)) return textMap.get("is_manager");
|
||||
if ("is_host".equals(key)) return textMap.get("is_host");
|
||||
if ("is_mute".equals(key)) return textMap.get("is_mute");
|
||||
if ("is_mute_pit".equals(key)) return textMap.get("is_mute_pit");
|
||||
break;
|
||||
case 2:
|
||||
// if ("is_host".equals(key)) return textMap.get("is_host");
|
||||
if ("is_mute".equals(key)) return textMap.get("is_mute");
|
||||
if ("is_mute_pit".equals(key)) return textMap.get("is_mute_pit");
|
||||
break;
|
||||
case 3:
|
||||
if ("is_mute".equals(key)) return textMap.get("is_mute");
|
||||
if ("is_mute_pit".equals(key)) return textMap.get("is_mute_pit");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_room_user_info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomUserInfo(UserInfo userInfo1) {
|
||||
this.userInfo = userInfo1;
|
||||
// if (paim==1){
|
||||
// userInfo.setAuction_id(isNum+"");
|
||||
// }
|
||||
// ImageUtils.loadHeadCC(userInfo.getAvatar(), mBinding.ivAvatar);
|
||||
mBinding.ivAvatar.setData(userInfo.getAvatar(), "", userInfo.getSex() + "");
|
||||
mBinding.tvName.setText(userInfo.getNickname());
|
||||
mBinding.tvId.setText("ID:" + userInfo.getUser_code());
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("上麦");
|
||||
}
|
||||
|
||||
if (userInfo.getIs_follow() == 1) {
|
||||
mBinding.imRoomGz.setImageDrawable(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.room_ygz));
|
||||
} else {
|
||||
mBinding.imRoomGz.setImageDrawable(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.room_gz));
|
||||
}
|
||||
|
||||
// if (userInfo.getRoom_id().equals(room_id)){
|
||||
// mBinding.imGs.setVisibility(GONE);
|
||||
// }else {
|
||||
// mBinding.imGs.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
|
||||
if (userInfo.getIs_room_owner().equals("1")) {
|
||||
close_type = 1;
|
||||
} else if (userInfo.getIs_manager().equals("1")) {
|
||||
close_type = 2;
|
||||
} else if (userInfo.getIs_host().equals("1")) {
|
||||
close_type = 3;
|
||||
} else {
|
||||
close_type = 4;
|
||||
}
|
||||
|
||||
// if (user_id.equals(SpUtil.getUserId()+"")){
|
||||
// mBinding.tvGh.setVisibility(GONE);
|
||||
// }else {
|
||||
if (userInfo != null) {
|
||||
mBinding.tvGh.setVisibility(VISIBLE);
|
||||
mBinding.tvGh.setText("所属公会:" + ((userInfo.getGuild() != null && !userInfo.getGuild().isEmpty()) ? userInfo.getGuild() : "无"));
|
||||
} else {
|
||||
mBinding.tvGh.setVisibility(GONE);
|
||||
}
|
||||
// }
|
||||
mBinding.tvTs.setText(String.format("90天内累计收到 %s 个礼物", userInfo.getGift_num()));
|
||||
|
||||
updateUIBasedOnTypeAndUser();
|
||||
dianj(1);
|
||||
}
|
||||
|
||||
public void dianj(int type) {
|
||||
if (type == 1) {
|
||||
guanType = 1;
|
||||
setTextViewStyle(mBinding.textView2, false);
|
||||
setTextViewStyle(mBinding.textView1, true);
|
||||
if (userInfo.getQinmi() != null && !userInfo.getQinmi().equals("")) {
|
||||
mBinding.ll.setVisibility(VISIBLE);
|
||||
mBinding.ll.setBackgroundResource(com.xscm.moduleutil.R.mipmap.guxi_k);
|
||||
// mBinding.rlReqit.setBackgroundResource(com.qxcm.moduleutil.R.mipmap.regit_t);
|
||||
ImageUtils.loadHeadCC(userInfo.getQinmi().getAvatar1(), mBinding.userNav1);
|
||||
ImageUtils.loadHeadCC(userInfo.getQinmi().getAvatar2(), mBinding.userNav2);
|
||||
mBinding.tvNickname1.setText(userInfo.getQinmi().getNickname1());
|
||||
mBinding.tvNickname2.setText(userInfo.getQinmi().getNickname2());
|
||||
mBinding.tvRelation.setText(userInfo.getQinmi().getRelation_name());
|
||||
mBinding.tvTime.setText(TimeUtils.formatDuration2(Long.parseLong(userInfo.getQinmi().getEnd_time()) * 1000 - System.currentTimeMillis()));
|
||||
} else {
|
||||
mBinding.ll.setVisibility(GONE);
|
||||
}
|
||||
} else if (type == 2) {
|
||||
guanType = 2;
|
||||
setTextViewStyle(mBinding.textView2, true);
|
||||
setTextViewStyle(mBinding.textView1, false);
|
||||
if (userInfo.getZhenai() != null && !userInfo.getZhenai().equals("")) {
|
||||
mBinding.ll.setVisibility(VISIBLE);
|
||||
mBinding.ll.setBackgroundResource(com.xscm.moduleutil.R.mipmap.guxi_w);
|
||||
// mBinding.rlReqit.setBackgroundResource(com.qxcm.moduleutil.R.mipmap.guanxiw_z);
|
||||
ImageUtils.loadHeadCC(userInfo.getZhenai().getAvatar1(), mBinding.userNav1);
|
||||
ImageUtils.loadHeadCC(userInfo.getZhenai().getAvatar2(), mBinding.userNav2);
|
||||
mBinding.tvNickname1.setText(userInfo.getZhenai().getNickname1());
|
||||
mBinding.tvNickname2.setText(userInfo.getZhenai().getNickname2());
|
||||
mBinding.tvRelation.setText(userInfo.getZhenai().getRelation_name());
|
||||
mBinding.tvTime.setText(TimeUtils.formatDuration2(Long.parseLong(userInfo.getZhenai().getEnd_time()) * 1000 - System.currentTimeMillis()));
|
||||
} else {
|
||||
mBinding.ll.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setTextViewStyle(TextView textView, boolean isSelected) {
|
||||
if (isSelected) {
|
||||
textView.setTextColor(getResources().getColor(android.R.color.white));
|
||||
textView.setTextSize(16);
|
||||
} else {
|
||||
textView.setTextColor(getResources().getColor(android.R.color.darker_gray));
|
||||
textView.setTextSize(14);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void updateUIBasedOnTypeAndUser() {
|
||||
int userId = SpUtil.getUserId();
|
||||
boolean isSelf = userId == userInfo.getUser_id();
|
||||
// if (pit_number!=null && pit_number.equals("-1")){
|
||||
// type=0;
|
||||
// isSelf=false;
|
||||
// }
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
}
|
||||
if (paim == 1 && pit_number != null && (pit_number.equals("888") || pit_number.equals("111") || pit_number.equals("222") || pit_number.equals("333"))) {
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case 1: // 房主
|
||||
mBinding.roomDian.setVisibility(View.VISIBLE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
mBinding.imQml.setVisibility(VISIBLE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("抱麦");
|
||||
}
|
||||
if (isSelf) {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("上麦");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 2://管理员
|
||||
if (close_type == 1) { //管理员查看房主信息
|
||||
mBinding.roomDian.setVisibility(View.GONE);
|
||||
mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
mBinding.roomBo.setVisibility(VISIBLE);
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
|
||||
} else {
|
||||
mBinding.roomDian.setVisibility(View.VISIBLE);
|
||||
mBinding.roomJb.setVisibility(GONE);
|
||||
mBinding.roomLh.setVisibility(GONE);
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
// if (isNum==1){
|
||||
// mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
// }else {
|
||||
// mBinding.roomMCz.setVisibility(GONE);
|
||||
// }
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("抱麦");
|
||||
}
|
||||
}
|
||||
if (isSelf) {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("上麦");
|
||||
}
|
||||
}
|
||||
mBinding.imQml.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 3:
|
||||
if (close_type == 1 || close_type == 2) { //主持查看房主或者管理员信息
|
||||
mBinding.roomDian.setVisibility(View.GONE);
|
||||
mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
} else {
|
||||
mBinding.roomDian.setVisibility(View.VISIBLE);
|
||||
mBinding.roomJb.setVisibility(GONE);
|
||||
mBinding.roomLh.setVisibility(GONE);
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
// if (isNum==1){
|
||||
// mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
// }else {
|
||||
// mBinding.roomMCz.setVisibility(GONE);
|
||||
// }
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("抱麦");
|
||||
}
|
||||
}
|
||||
if (isSelf) {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("上麦");
|
||||
}
|
||||
}
|
||||
mBinding.imQml.setVisibility(VISIBLE);
|
||||
break;
|
||||
case 4:
|
||||
if (close_type == 1 || close_type == 2 || close_type == 3) {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
mBinding.imQml.setVisibility(VISIBLE);
|
||||
} else {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
mBinding.roomMCz.setVisibility(GONE);
|
||||
mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
mBinding.imQml.setVisibility(GONE);
|
||||
}
|
||||
if (isSelf) {
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
if (userInfo.getIs_in_pit() == 1) {
|
||||
mBinding.roomMCz.setText("下麦");
|
||||
} else {
|
||||
mBinding.roomMCz.setText("上麦");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
// 默认处理
|
||||
break;
|
||||
}
|
||||
|
||||
if (isPk) {
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downPit() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickOutRoom() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHostAdd(String s, String type, String is_add) {
|
||||
if (type.equals("2")) {
|
||||
if (is_add.equals("1")) {
|
||||
userInfo.setIs_manager("1");
|
||||
ToastUtils.show("添加管理员成功");
|
||||
handleLogic(contentView);
|
||||
} else {
|
||||
userInfo.setIs_manager("0");
|
||||
ToastUtils.show("取消管理员");
|
||||
handleLogic(contentView);
|
||||
}
|
||||
} else if (type.equals("1")) {
|
||||
if (is_add.equals("1")) {
|
||||
userInfo.setIs_host("1");
|
||||
ToastUtils.show("添加主持人成功");
|
||||
handleLogic(contentView);
|
||||
} else {
|
||||
userInfo.setIs_host("0");
|
||||
ToastUtils.show("取消主持人成功");
|
||||
handleLogic(contentView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMutePit(String user_id, String is_mute) {
|
||||
if (is_mute.equals("1")) {
|
||||
userInfo.setIs_mute("1");
|
||||
ToastUtils.show("禁麦成功");
|
||||
|
||||
} else if (is_mute.equals("3")) {
|
||||
userInfo.setIs_mute("0");
|
||||
} else if (is_mute.equals("2")) {
|
||||
userInfo.setIs_mute_pit("1");
|
||||
} else if (is_mute.equals("4")) {
|
||||
userInfo.setIs_mute_pit("0");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlackList() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userGuanzSuccess(String s) {
|
||||
if (userInfo.getIs_follow() == 1) {
|
||||
userInfo.setIs_follow(0);
|
||||
mBinding.imRoomGz.setImageDrawable(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.room_gz));
|
||||
} else {
|
||||
userInfo.setIs_follow(1);
|
||||
mBinding.imRoomGz.setImageDrawable(getResources().getDrawable(com.xscm.moduleutil.R.mipmap.room_ygz));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hostUserPit() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveCoin() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void relationCard(RelationCardBean list) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void topRelationCard(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRelationCard(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearUserCharm() {
|
||||
ToastUtils.show("清除成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.databinding.DialogRoomWheatGiftBinding;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.adapter.GiftTwoDetailsFragment;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftLabelBean;
|
||||
import com.xscm.moduleutil.bean.GiftNumBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackListCount;
|
||||
import com.xscm.moduleutil.bean.RewardUserBean;
|
||||
import com.xscm.moduleutil.bean.RoomWheatEvent;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.event.GiftDoubleClickEvent;
|
||||
import com.xscm.moduleutil.event.GiftUserRefreshEvent;
|
||||
import com.xscm.moduleutil.event.RoomGiftGiveEvent;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/17
|
||||
*@description: 设置插队礼物
|
||||
*/
|
||||
public class RoomWheatGiftSettingFragment extends BaseMvpDialogFragment<RewardGiftPresenter, DialogRoomWheatGiftBinding> implements RewardGiftContacts.View {
|
||||
private RoonGiftModel roonGiftModel = null;
|
||||
private List<Fragment> fragmentList = new ArrayList<>();
|
||||
private List<GiftNumBean> mGiftNumList;
|
||||
private String roomId;
|
||||
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static void show(String id, FragmentManager fragmentManager) {
|
||||
RoomWheatGiftSettingFragment dialogFragment = new RoomWheatGiftSettingFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RewardGiftDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
roomId = getArguments().getString("roomId");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.5f);
|
||||
;
|
||||
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
// MvpPre.getGiftList("0",3);
|
||||
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), fragmentList));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.tvWheatQx.setOnClickListener(this::onClisk);
|
||||
mBinding.tvWheatQd.setOnClickListener(this::onClisk);
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvWheatQd, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvWheatQd.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
|
||||
private void onClisk(View view1) {
|
||||
if (view1.getId() == R.id.tv_wheat_qd) {
|
||||
giveGift("1");
|
||||
} else if (view1.getId() == R.id.tv_wheat_qx) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private String giftNumber = "";
|
||||
private RoomGiftGiveEvent roomGiftGiveEvent;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftDoubleClickEvent(GiftDoubleClickEvent event) {
|
||||
getSelectedGift();
|
||||
giveGift("1");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void userRefresh(GiftUserRefreshEvent event) {
|
||||
roonGiftModel = event.gift;
|
||||
}
|
||||
|
||||
private int getSelectedGift() {
|
||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||
GiftTwoDetailsFragment fragment = (GiftTwoDetailsFragment) fragmentList.get(currentItem);
|
||||
roonGiftModel = fragment.getGiftList();
|
||||
return currentItem;
|
||||
}
|
||||
|
||||
private void giveGift(String num) {
|
||||
getSelectedGift();
|
||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||
if (currentItem < 1) {
|
||||
if (roonGiftModel == null) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (roonGiftModel == null) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentItem == 0) {
|
||||
//礼物打赏
|
||||
giftNumber = num;
|
||||
MvpPre.setRoomApply(roomId, roonGiftModel.getGift_id(),roonGiftModel.getGift_price());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_room_wheat_gift;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels, int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
// dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reward_zone() {
|
||||
EventBus.getDefault().post(new RoomWheatEvent());
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuctionJoin(RoomAuction.AuctionListBean auctionListBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giftPack(List<GiftPackBean> giftPackBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftPack(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftPackListCount(GiftPackListCount giftPackListCount) {
|
||||
|
||||
}
|
||||
|
||||
private static class MyFragmentPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
||||
private List<Fragment> fragmentList;
|
||||
|
||||
|
||||
public MyFragmentPagerAdapter(FragmentManager fm, List<Fragment> fragmentList) {
|
||||
super(fm);
|
||||
this.fragmentList = fragmentList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
Fragment fragment = GiftTwoDetailsFragment.newInstance("1", 0,"");
|
||||
fragmentList.add(fragment); // 保存 Fragment 实例
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.blankj.utilcode.util.ImageUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.CircleListBean;
|
||||
import com.xscm.moduleutil.databinding.RoomDialogShareBinding;
|
||||
import com.xscm.moduleutil.utils.BaseBottomSheetDialog;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.wx.WeChatShareUtils;
|
||||
import com.tencent.mm.opensdk.modelmsg.SendMessageToWX;
|
||||
|
||||
|
||||
/**
|
||||
* 房间分享弹窗
|
||||
*/
|
||||
public class ShareDialog extends BaseBottomSheetDialog<RoomDialogShareBinding> {
|
||||
public WeChatShareUtils weChatShareUtils;
|
||||
private Context mContext;
|
||||
private String mcontent;
|
||||
private String murl;
|
||||
private String ids;
|
||||
private int types;//1:用户 2:房间;3:动态
|
||||
private String mUserId;
|
||||
private CircleListBean bean;
|
||||
|
||||
public interface OnShareDataListener {
|
||||
void onShareDataLoaded(String id);
|
||||
}
|
||||
|
||||
private OnShareDataListener listener;
|
||||
|
||||
public void setOnShareDataListener(OnShareDataListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
private static final String TAG = "ShareDialog";
|
||||
|
||||
public ShareDialog(Context context, String content, String url, String id, int type,String userId,CircleListBean bean) {
|
||||
super(context);
|
||||
this.mcontent = content;
|
||||
this.murl = url;
|
||||
this.mContext = getContext();
|
||||
this.ids = id;
|
||||
this.types = type;
|
||||
this.mUserId = userId;
|
||||
this.bean = bean;
|
||||
Log.i(TAG, "(Start)启动了===========================ShareDialog");
|
||||
iniv();
|
||||
}
|
||||
|
||||
private void iniv() {
|
||||
if (types == 1) {//1是分享动态
|
||||
|
||||
} else if (types == 2) {//分享相册
|
||||
mBinding.tvQq.setVisibility(GONE);
|
||||
mBinding.tvQqq.setVisibility(GONE);
|
||||
mBinding.rl.setVisibility(GONE);
|
||||
}else if (types == 4){
|
||||
mBinding.tvJub.setVisibility(GONE);
|
||||
mBinding.tvCopy.setVisibility(GONE);
|
||||
}
|
||||
if (mUserId.equals(SpUtil.getUserId()+"")){
|
||||
mBinding.shanc.setVisibility(VISIBLE);
|
||||
}else {
|
||||
mBinding.shanc.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayout() {
|
||||
return R.layout.room_dialog_share;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
Window window = getWindow();
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
mBinding.tvQq.setOnClickListener(this::onClick);
|
||||
mBinding.tvWx.setOnClickListener(this::onClick);
|
||||
mBinding.tvWxq.setOnClickListener(this::onClick);
|
||||
mBinding.tvQqq.setOnClickListener(this::onClick);
|
||||
mBinding.tvClean.setOnClickListener(this::onClick);
|
||||
mBinding.tvCopy.setOnClickListener(this::onClick);
|
||||
mBinding.tvJub.setOnClickListener(this::onClick);
|
||||
mBinding.shanc.setOnClickListener(this::onClick);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
weChatShareUtils = WeChatShareUtils.getInstance(getContext());
|
||||
// if (mUserId.equals(SpUtil.getUserId()+"")){
|
||||
// mBinding.shanc.setVisibility(GONE);
|
||||
// }else {
|
||||
// mBinding.shanc.setVisibility(VISIBLE);
|
||||
// }
|
||||
}
|
||||
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
// String appName = CommonAppContext.getInstance().getResources().getString(R.string.app_name);
|
||||
|
||||
|
||||
if (R.id.tv_qq == id) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.D0108, "share_way", "QQ分享");
|
||||
// ShareUtil.shareWeb((Activity) view.getContext(), URLConstants.SHARE, String.format("我在%s玩呢,大家都在玩,快来展示您的精彩", appName)
|
||||
// , appName, "", R.mipmap.ic_launcher_new, SHARE_MEDIA.QQ);
|
||||
} else if (R.id.tv_wx == id) {
|
||||
// AppLogUtil.reportAppLog(AppLogEvent.D0108, "share_way", "微信分享");
|
||||
// ShareUtil.shareWeb((Activity) view.getContext(), URLConstants.SHARE, String.format("我在%s玩呢,大家都在玩,快来展示您的精彩", appName)
|
||||
// , appName, "", R.mipmap.ic_launcher_new, SHARE_MEDIA.WEIXIN);
|
||||
fun_handleShare(SendMessageToWX.Req.WXSceneSession);
|
||||
} else if (R.id.tv_wxq == id) {
|
||||
fun_handleShare1(SendMessageToWX.Req.WXSceneTimeline);
|
||||
} else if (R.id.tv_qqq == id) {
|
||||
|
||||
} else if (R.id.shanc == id) {
|
||||
if (listener != null) {
|
||||
listener.onShareDataLoaded(ids);
|
||||
}
|
||||
} else if (R.id.tv_jub == id) {
|
||||
if (types == 3) {
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + types + "&fromId=" + bean.getId());
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
}else if (types == 1){
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+"/web/index.html#/pages/feedback/report?id=" + SpUtil.getToken() + "&fromType=" + types + "&fromId=" + bean.getUser_id());
|
||||
intent.putExtra("title", "举报");
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
} else if (R.id.tv_copy == id) {
|
||||
ClipboardManager clipboard = (ClipboardManager)mContext.getSystemService( Context.CLIPBOARD_SERVICE);
|
||||
ClipData clip = ClipData.newPlainText("链接",bean.getShare_url() );
|
||||
if (clipboard != null) {
|
||||
clipboard.setPrimaryClip(clip);
|
||||
com.hjq.toast.ToastUtils.show("复制成功");
|
||||
} else {
|
||||
com.hjq.toast.ToastUtils.show("复制失败");
|
||||
}
|
||||
}
|
||||
|
||||
dismiss();
|
||||
}
|
||||
|
||||
// todo fun_handleShare 分享小程序类型 (只支持分享给微信好友)
|
||||
private void fun_handleShare(int scene) {
|
||||
if (weChatShareUtils.isSupportWX()) {
|
||||
String appName = mContext.getPackageManager().getApplicationLabel(mContext.getApplicationInfo()).toString();
|
||||
if (types == 2){
|
||||
com.xscm.moduleutil.utils.ImageUtils.loadBitmap(murl, new com.xscm.moduleutil.utils.ImageUtils.onLoadBitmap() {
|
||||
@Override
|
||||
public void onReady(Bitmap resource) {
|
||||
weChatShareUtils.sharePic(resource, scene);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
String shortContent = mcontent.length() > 20 ? mcontent.substring(0, 20) : mcontent;
|
||||
String desc = shortContent;
|
||||
String title = appName;
|
||||
String url = murl;
|
||||
Bitmap bitmap = ImageUtils.drawable2Bitmap(mContext.getResources().getDrawable(R.mipmap.ic_launcher));
|
||||
weChatShareUtils.shareUrl(url, title, bitmap, desc, scene);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("手机上微信版本不支持分享功能");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void fun_handleShare1(int scene) {
|
||||
if (weChatShareUtils.isSupportWX()) {
|
||||
String appName = mContext.getPackageManager().getApplicationLabel(mContext.getApplicationInfo()).toString();
|
||||
if (types == 2) {
|
||||
com.xscm.moduleutil.utils.ImageUtils.loadBitmap(murl, new com.xscm.moduleutil.utils.ImageUtils.onLoadBitmap() {
|
||||
@Override
|
||||
public void onReady(Bitmap resource) {
|
||||
weChatShareUtils.sharePic(resource, scene);
|
||||
}
|
||||
});
|
||||
}else {
|
||||
String shortContent = mcontent.length() > 20 ? mcontent.substring(0, 20) : mcontent;
|
||||
String desc = shortContent;
|
||||
String title = appName;
|
||||
String url = murl;
|
||||
// Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(),R.mipmap.ic_launcher);
|
||||
Bitmap bitmap = ImageUtils.drawable2Bitmap(mContext.getResources().getDrawable(R.mipmap.ic_launcher));
|
||||
weChatShareUtils.shareUrl(url, title, bitmap, desc, scene);
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("手机上微信版本不支持分享功能");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static com.xscm.moduleutil.utils.ImageUtils.copyAssetToFile;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.WheatContacts;
|
||||
import com.xscm.modulemain.activity.room.presenter.WheatPresenter;
|
||||
import com.xscm.modulemain.adapter.RoomOnlineAdapter;
|
||||
import com.xscm.modulemain.databinding.FragmentSoundDialogBinding;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/17
|
||||
*@description: 音效弹框
|
||||
*/
|
||||
public class SoundEffectsDialogFragment extends BaseMvpDialogFragment<WheatPresenter, FragmentSoundDialogBinding> implements
|
||||
WheatContacts.View {
|
||||
private int page;
|
||||
private RoomOnlineAdapter roomOnlineAdapter;
|
||||
@Override
|
||||
protected WheatPresenter bindPresenter() {
|
||||
return new WheatPresenter(this, getActivity());
|
||||
}
|
||||
public static SoundEffectsDialogFragment show(String id, FragmentManager fragmentManager) {
|
||||
SoundEffectsDialogFragment dialogFragment = new SoundEffectsDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "SoundEffectsDialogFragment");
|
||||
return dialogFragment;
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
// MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.4f);;
|
||||
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
// 用于记录选中的位置
|
||||
private int selectedPosition = -1;
|
||||
|
||||
// 所有点击项的集合
|
||||
private final List<View> clickableViews = new ArrayList<>();
|
||||
|
||||
// 背景资源
|
||||
private static final int BG_DEFAULT = com.xscm.moduleutil.R.mipmap.suound_bj;
|
||||
private static final int BG_SELECTED = com.xscm.moduleutil.R.mipmap.suound_bjs;
|
||||
private static final int BTN_BG_SELECTED = com.xscm.moduleutil.R.mipmap.y_won;
|
||||
private static final int BTN_BG_DEFAULT = com.xscm.moduleutil.R.mipmap.y_w;
|
||||
|
||||
private static final int TEXT_COLOR_SELECTED = com.xscm.moduleutil.R.color.color_FF333333;
|
||||
private static final int TEXT_COLOR_DEFAULT = com.xscm.moduleutil.R.color.white;
|
||||
|
||||
private final List<Button> buttonList = new ArrayList<>();
|
||||
private final List<TextView> textViewList = new ArrayList<>();
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
// 添加所有点击项到集合中
|
||||
clickableViews.add(mBinding.cl1);
|
||||
clickableViews.add(mBinding.cl2);
|
||||
clickableViews.add(mBinding.cl3);
|
||||
clickableViews.add(mBinding.cl4);
|
||||
clickableViews.add(mBinding.cl5);
|
||||
|
||||
// 初始化 Button 和 TextView 列表
|
||||
buttonList.add(mBinding.bottom1);
|
||||
buttonList.add(mBinding.bottom2);
|
||||
buttonList.add(mBinding.bottom3);
|
||||
buttonList.add(mBinding.bottom4);
|
||||
buttonList.add(mBinding.bottom5);
|
||||
|
||||
textViewList.add(mBinding.tv1);
|
||||
textViewList.add(mBinding.tv2);
|
||||
textViewList.add(mBinding.tv3);
|
||||
textViewList.add(mBinding.tv4);
|
||||
textViewList.add(mBinding.tv5);
|
||||
|
||||
// 设置统一点击监听
|
||||
for (int i = 0; i < clickableViews.size(); i++) {
|
||||
final int position = i;
|
||||
clickableViews.get(i).setOnClickListener(v -> handleItemClick(position));
|
||||
}
|
||||
|
||||
mBinding.tvSure.setOnClickListener(v -> {
|
||||
if (selectedPosition != -1){
|
||||
if (selectedPosition == 0){
|
||||
AgoraManager.getInstance(getActivity()).potexao(new File(getSavePath() + "xs.mp3").getPath());
|
||||
}else if (selectedPosition == 1){
|
||||
AgoraManager.getInstance(getActivity()).potexao(new File(getSavePath() + "hh.mp3").getPath());
|
||||
}else if (selectedPosition == 2){
|
||||
AgoraManager.getInstance(getActivity()).potexao(new File(getSavePath() + "gg.mp3").getPath());
|
||||
}else if (selectedPosition == 3){
|
||||
AgoraManager.getInstance(getActivity()).potexao(new File(getSavePath() + "zs.mp3").getPath());
|
||||
}else if (selectedPosition == 4){
|
||||
AgoraManager.getInstance(getActivity()).potexao(new File(getSavePath() + "mmd.mp3").getPath());
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
copyAssetToFile("gg.mp3", getSavePath(), "gg.mp3");
|
||||
copyAssetToFile("hh.mp3", getSavePath(), "hh.mp3");
|
||||
copyAssetToFile("mmd.mp3", getSavePath(), "mmd.mp3");
|
||||
copyAssetToFile("xs.mp3", getSavePath(), "xs.mp3");
|
||||
copyAssetToFile("zs.mp3", getSavePath(), "zs.mp3");
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvSure, ColorManager.getInstance().getPrimaryColorInt(),53);
|
||||
mBinding.tvSure.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
|
||||
private String getSavePath() {
|
||||
String path;
|
||||
if (Build.VERSION.SDK_INT > 29) {
|
||||
path = getActivity().getExternalFilesDir(null).getAbsolutePath() + "/app/effects/";
|
||||
} else {
|
||||
path = Environment.getExternalStorageDirectory().getPath() + "/app/effects/";
|
||||
}
|
||||
return path;
|
||||
}
|
||||
/**
|
||||
* 处理点击事件
|
||||
*/
|
||||
private void handleItemClick(int position) {
|
||||
if (selectedPosition == position) {
|
||||
// 再次点击已选项,取消选择
|
||||
selectedPosition = -1;
|
||||
resetBackgrounds();
|
||||
} else {
|
||||
// 更新选中项
|
||||
selectedPosition = position;
|
||||
updateBackgrounds(position);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 更新所有项的背景状态
|
||||
*/
|
||||
private void updateBackgrounds(int selectedPos) {
|
||||
for (int i = 0; i < clickableViews.size(); i++) {
|
||||
View view = clickableViews.get(i);
|
||||
Button btn = buttonList.get(i);
|
||||
TextView tv = textViewList.get(i);
|
||||
if (i == selectedPos) {
|
||||
view.setBackgroundResource(BG_SELECTED);
|
||||
btn.setBackgroundResource(BTN_BG_SELECTED);
|
||||
tv.setTextColor(ContextCompat.getColor(requireContext(), TEXT_COLOR_SELECTED));
|
||||
} else {
|
||||
view.setBackgroundResource(BG_DEFAULT);
|
||||
btn.setBackgroundResource(BTN_BG_DEFAULT);
|
||||
tv.setTextColor(ContextCompat.getColor(requireContext(), TEXT_COLOR_DEFAULT));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复所有项为默认背景
|
||||
*/
|
||||
private void resetBackgrounds() {
|
||||
for (int i = 0; i < clickableViews.size(); i++) {
|
||||
View view = clickableViews.get(i);
|
||||
Button btn = buttonList.get(i);
|
||||
TextView tv = textViewList.get(i);
|
||||
|
||||
view.setBackgroundResource(BG_DEFAULT);
|
||||
btn.setBackgroundResource(BTN_BG_DEFAULT);
|
||||
tv.setTextColor(ContextCompat.getColor(requireContext(), TEXT_COLOR_DEFAULT));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_sound_dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void roomApplyListBean(RoomApplyListBean roomApplyListBeans) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearApply() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void agreePit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,327 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.adapter.TunerListAdapter;
|
||||
import com.xscm.modulemain.activity.room.contacts.WheatContacts;
|
||||
import com.xscm.modulemain.databinding.RoomDialogTunerBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.WheatPresenter;
|
||||
import com.luck.picture.lib.decoration.GridSpacingItemDecoration;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.MixerResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.rtc.RtcConstants;
|
||||
import com.xscm.moduleutil.rtc.VolumeManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 调音台弹窗
|
||||
*/
|
||||
public class TunerDialogFragment extends BaseMvpDialogFragment<WheatPresenter, RoomDialogTunerBinding> implements WheatContacts.View {
|
||||
|
||||
private static final String TAG = "TunerSheetDialog";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
|
||||
private String roomId;
|
||||
private int tunerType;
|
||||
private TunerListAdapter tunerAdapter;
|
||||
private TunerListAdapter tunerAdapter2;
|
||||
|
||||
|
||||
public static void show(String id, FragmentManager fragmentManager) {
|
||||
TunerDialogFragment dialogFragment = new TunerDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "SoundEffectsDialogFragment");
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.5f);;
|
||||
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.room_dialog_tuner;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
// mBinding.rvEffectStyleList.setLayoutManager(new GridLayoutManager(mContext, 4));
|
||||
// mBinding.rvEffectStyleList.setAdapter(tunerAdapter = new TunerListAdapter());
|
||||
// mBinding.rvEffectStyleList.addItemDecoration(new GridSpacingItemDecoration(4, 30, true));
|
||||
// tunerAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
// @Override
|
||||
// public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
// MixerResp item = tunerAdapter.getItem(position);
|
||||
// tunerAdapter.setIndex(position);
|
||||
// MvpPre.setUserMixer(roomId, item.getId());
|
||||
// RtcManager.getInstance().setTone(item.getId());
|
||||
// }
|
||||
// });
|
||||
|
||||
// 初始化音量管理器
|
||||
VolumeManager volumeManager = VolumeManager.getInstance();
|
||||
String currentUserId = SpUtil.getUserId() + "";
|
||||
volumeManager.setCurrentUserId(currentUserId);
|
||||
|
||||
mBinding.swMonitoring.setChecked(SpUtil.getAuricularBack() == 1 ? true : false);//设置耳返开启还是关闭
|
||||
mBinding.swMonitoring.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
|
||||
AgoraManager.getInstance(getContext()).enableHeadphoneMonitor(b);
|
||||
//耳返设置完保存本地
|
||||
SpUtil.setAuricularBack(b ? 1 : 0);
|
||||
}
|
||||
});
|
||||
// int progress = SpUtil.getMusicVolume();
|
||||
// if (progress == 0) {
|
||||
// progress = 100;
|
||||
// }
|
||||
// mBinding.seekBar1.setProgress(progress);
|
||||
// 设置 seekBar1 的默认进度为 100
|
||||
// mBinding.seekBar1.setProgress(100);
|
||||
// 更新对应的 TextView 显示内容
|
||||
// mBinding.tvSeekbarValue.setText("人声" + progress + "%");
|
||||
|
||||
|
||||
// 获取新演唱者的音量设置
|
||||
int[] volumes = volumeManager.getUserVolumes(currentUserId);
|
||||
int musicVolume = volumes[0];
|
||||
int playoutVolume = volumes[1];
|
||||
updateVolumeUI(musicVolume, playoutVolume);
|
||||
|
||||
mBinding.seekBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
// 转换为百分比显示 (200代表100%,100代表50%)
|
||||
int percentage = (int) ((progress / 200.0) * 100);
|
||||
mBinding.tvSeekbarValue.setText("人声" + percentage + "%");
|
||||
SpUtil.setMusicVolume(progress); // 保存原始值(0-200)
|
||||
AgoraManager.getInstance(getContext()).setMusicVolume(progress); // 使用原始值(0-200)
|
||||
// 保存当前用户的音量设置
|
||||
volumeManager.saveCurrentVolumes(
|
||||
mBinding.seekBar1.getProgress(),
|
||||
mBinding.seekBar2.getProgress()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
});
|
||||
// int progress2 = SpUtil.gettPlayoutVolume();
|
||||
// if (progress2 == 0) {
|
||||
// progress2 = 100;
|
||||
// }
|
||||
// // 设置 seekBar1 的默认进度为 100
|
||||
// mBinding.seekBar2.setProgress(progress2);
|
||||
// // 更新对应的 TextView 显示内容
|
||||
// mBinding.tvSeekbarValue2.setText("伴奏" + progress2 + "%");
|
||||
|
||||
mBinding.seekBar2.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
mBinding.tvSeekbarValue2.setText("伴奏" + progress + "%");
|
||||
SpUtil.settPlayoutVolume(progress);
|
||||
AgoraManager.getInstance(getContext()).setPlayoutVolume(progress);
|
||||
// 保存当前用户的音量设置
|
||||
volumeManager.saveCurrentVolumes(
|
||||
mBinding.seekBar1.getProgress(),
|
||||
mBinding.seekBar2.getProgress()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
|
||||
}
|
||||
});
|
||||
mBinding.rvEffectStyleList.setLayoutManager(new GridLayoutManager(mContext, 5));
|
||||
mBinding.rvEffectStyleList.setAdapter(tunerAdapter = new TunerListAdapter(1));
|
||||
mBinding.rvEffectStyleList.addItemDecoration(new GridSpacingItemDecoration(5, 11, true));
|
||||
tunerAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
// 取消之前选中的项
|
||||
// if (tunerAdapter.get() >= 0) {
|
||||
// tunerAdapter.notifyItemChanged(tunerAdapter.getIndex());
|
||||
// }
|
||||
|
||||
// 设置当前项为选中状态
|
||||
tunerAdapter.setIndex(position);
|
||||
tunerAdapter.notifyItemChanged(position);
|
||||
|
||||
// 执行选中项的操作
|
||||
MixerResp item = tunerAdapter.getItem(position);
|
||||
// MvpPre.setUserMixer(roomId, item.getId());
|
||||
// RtcManager.getInstance().setTone(item.getId());
|
||||
AgoraManager.getInstance(mContext).setTone(item.getId());
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.rvEffectStyleList2.setLayoutManager(new GridLayoutManager(mContext, 5));
|
||||
mBinding.rvEffectStyleList2.setAdapter(tunerAdapter2 = new TunerListAdapter(2));
|
||||
mBinding.rvEffectStyleList2.addItemDecoration(new GridSpacingItemDecoration(5, 20, true));
|
||||
tunerAdapter2.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
// 取消之前选中的项
|
||||
// if (tunerAdapter.get() >= 0) {
|
||||
// tunerAdapter.notifyItemChanged(tunerAdapter.getIndex());
|
||||
// }
|
||||
// 设置当前项为选中状态
|
||||
tunerAdapter2.setIndex(position);
|
||||
tunerAdapter2.notifyItemChanged(position);
|
||||
// 设置当前项为选中状态
|
||||
|
||||
// 执行选中项的操作
|
||||
MixerResp item = tunerAdapter2.getItem(position);
|
||||
AgoraManager.getInstance(mContext).setTone(item.getId());
|
||||
// MvpPre.setUserMixer(roomId, item.getId());
|
||||
// RtcManager.getInstance().setTone(item.getId());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新音量UI显示
|
||||
* @param musicVolume 人声音量
|
||||
* @param playoutVolume 伴奏音量
|
||||
*/
|
||||
public void updateVolumeUI(int musicVolume, int playoutVolume) {
|
||||
// 更新人声音量
|
||||
int musicPercentage = (int) ((musicVolume / 200.0) * 100);
|
||||
mBinding.seekBar1.setMax(200);
|
||||
mBinding.seekBar1.setProgress(musicVolume);
|
||||
mBinding.tvSeekbarValue.setText("人声" + musicPercentage + "%");
|
||||
AgoraManager.getInstance(getContext()).setMusicVolume(musicVolume); // 使用原始值(0-200)
|
||||
// 更新伴奏音量
|
||||
mBinding.seekBar2.setProgress(playoutVolume);
|
||||
// int playoutPercentage = (int) ((playoutVolume / 200.0) * 100);
|
||||
mBinding.tvSeekbarValue2.setText("伴奏" + playoutVolume + "%");
|
||||
AgoraManager.getInstance(getContext()).setPlayoutVolume(playoutVolume);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected WheatPresenter bindPresenter() {
|
||||
return new WheatPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
// roomId = getArguments().getString("roomId");
|
||||
// tunerType = getArguments().getInt("tunerType");
|
||||
|
||||
List<MixerResp> mixerResps = new ArrayList<>();
|
||||
mixerResps.add(new MixerResp(RtcConstants.AUDIO_EFFECT_OFF, "原生", com.xscm.moduleutil.R.mipmap.yuansheng));
|
||||
mixerResps.add(new MixerResp(RtcConstants.AUDIO_EFFECT_CPJ, "唱片机", com.xscm.moduleutil.R.mipmap.changpian));
|
||||
// mixerResps.add(new MixerResp(RtcConstants.AUDIO_EFFECT_3W, "3维声音", com.qxcm.moduleutil.R.mipmap.sanwei));
|
||||
// mixerResps.add(new MixerResp(RtcConstants.AUDIO_EFFECT_XN, "虚拟环绕", com.qxcm.moduleutil.R.mipmap.xuni));
|
||||
mixerResps.add(new MixerResp(RtcConstants.AUDIO_EFFECT_KTV, "KTV", com.xscm.moduleutil.R.mipmap.ktv));
|
||||
tunerAdapter.setNewData(mixerResps);
|
||||
tunerAdapter.setIndex(0);
|
||||
|
||||
List<MixerResp> mixerResps2 = new ArrayList<>();
|
||||
mixerResps2.add(new MixerResp(RtcConstants.SOUNDEFFECTTYPE_CHANGE_VOICE1, "老人", com.xscm.moduleutil.R.mipmap.laoren));
|
||||
mixerResps2.add(new MixerResp(RtcConstants.SOUNDEFFECTTYPE_CHANGE_VOICE2, "猪八戒", com.xscm.moduleutil.R.mipmap.zubj));
|
||||
mixerResps2.add(new MixerResp(RtcConstants.SOUNDEFFECTTYPE_CHANGE_VOICE3, "叔叔", com.xscm.moduleutil.R.mipmap.dashu));
|
||||
mixerResps2.add(new MixerResp(RtcConstants.SOUNDEFFECTTYPE_CHANGE_VOICE4, "姐姐", com.xscm.moduleutil.R.mipmap.yujie));
|
||||
mixerResps2.add(new MixerResp(RtcConstants.SOUNDEFFECTTYPE_CHANGE_VOICE5, "女孩", com.xscm.moduleutil.R.mipmap.nvhai));
|
||||
tunerAdapter2.setNewData(mixerResps2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomApplyListBean(RoomApplyListBean roomApplyListBeans) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearApply() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void agreePit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// protected void initDialogStyle(Window window) {
|
||||
// super.initDialogStyle(window);
|
||||
// window.setGravity(Gravity.BOTTOM);
|
||||
// WindowManager.LayoutParams lp = window.getAttributes();
|
||||
// lp.dimAmount = 0.4f;
|
||||
// window.setAttributes(lp);
|
||||
// window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
// }
|
||||
|
||||
|
||||
// @Override
|
||||
// public void setMixerData(List<MixerResp> mixerResps) {
|
||||
// tunerAdapter.setNewData(mixerResps);
|
||||
// tunerAdapter.setIndex(tunerType);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.UserGiftWallConacts;
|
||||
import com.xscm.modulemain.databinding.MeFagmentUserGiftWallBinding;
|
||||
import com.xscm.modulemain.activity.room.presenter.UserGiftWallPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftUserWallBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 礼物墙
|
||||
*/
|
||||
public class UserGiftWallRoomFragment extends BaseMvpDialogFragment<UserGiftWallPresenter, MeFagmentUserGiftWallBinding> implements UserGiftWallConacts.View {
|
||||
|
||||
private int userId;
|
||||
|
||||
private BaseQuickAdapter<GiftUserWallBean.GiftWallBean, BaseViewHolder> mAdapter;
|
||||
|
||||
// TODO: Customize parameter initialization
|
||||
@SuppressWarnings("unused")
|
||||
public static UserGiftWallRoomFragment newInstance(int userId) {
|
||||
UserGiftWallRoomFragment fragment = new UserGiftWallRoomFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt("userId", userId);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
userId = arguments.getInt("userId");
|
||||
|
||||
|
||||
}
|
||||
|
||||
// TODO: 2025/3/7 固定dialog显示的位置和大小
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
WindowManager.LayoutParams lp = window.getAttributes();
|
||||
lp.dimAmount = 0.4f;
|
||||
// 固定对话框的宽度和高度
|
||||
lp.width = WindowManager.LayoutParams.MATCH_PARENT; // 宽度设置为屏幕宽度
|
||||
lp.height = WindowManager.LayoutParams.WRAP_CONTENT; // 高度设置为内容高度
|
||||
|
||||
window.setAttributes(lp);
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 4);
|
||||
mBinding.recyclerView.setLayoutManager(gridLayoutManager);
|
||||
mAdapter = new BaseQuickAdapter<GiftUserWallBean.GiftWallBean, BaseViewHolder>(R.layout.me_item_user_gift_wall, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftUserWallBean.GiftWallBean item) {
|
||||
helper.setText(R.id.tv_gift_name, item.getGift_name());
|
||||
if (item.getBase_image() == null || item.getBase_image().isEmpty()) {
|
||||
helper.setImageResource(R.id.image, com.xscm.moduleutil.R.mipmap.default_avatar);
|
||||
} else {
|
||||
ImageUtils.loadImageView(item.getBase_image(), helper.getView(R.id.image));
|
||||
}
|
||||
if (item.getBase_image() == null || item.getBase_image().isEmpty()) {
|
||||
helper.setImageResource(R.id.iv_gift_pic, com.xscm.moduleutil.R.mipmap.default_avatar);
|
||||
} else {
|
||||
ImageUtils.loadImageView(item.getBase_image(), helper.getView(R.id.iv_gift_pic));
|
||||
}
|
||||
// helper.setText(R.id.tv_price, item.getGiftPrice());
|
||||
helper.setText(R.id.tv_price33, item.getGift_price());
|
||||
helper.setText(R.id.tv_gift_values, "x" + item.getTotal_count());
|
||||
// if (item.getIs_show()==0){
|
||||
// helper.getView(R.id.cl_gift_item).setAlpha(0.2f);
|
||||
// }else {
|
||||
// helper.getView(R.id.cl_gift_item).setAlpha(1f);
|
||||
// }
|
||||
if (item.getTop_users() != null && item.getTop_users().size() > 0) {
|
||||
helper.getView(R.id.cl_gift_item).setBackgroundResource(com.xscm.moduleutil.R.mipmap.liang);
|
||||
} else {
|
||||
helper.getView(R.id.cl_gift_item).setBackgroundResource(com.xscm.moduleutil.R.mipmap.not_liang);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
mBinding.recyclerView.setAdapter(mAdapter);
|
||||
mAdapter.bindToRecyclerView(mBinding.recyclerView);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected UserGiftWallPresenter bindPresenter() {
|
||||
return new UserGiftWallPresenter(this, getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.giftWall(userId + "");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.me_fagment_user_gift_wall;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGiftWall(GiftUserWallBean data) {
|
||||
// if (data != null && data.size() > 0) {
|
||||
// if (homePageInfoActivity != null) {
|
||||
// homePageInfoActivity.setTab(2);
|
||||
// }
|
||||
// mUserGiftWallAdapter.setNewData(data);
|
||||
List<GiftUserWallBean.GiftWallBean> giftWallBeans = new ArrayList<>();
|
||||
giftWallBeans.addAll(data.getLiang());
|
||||
giftWallBeans.addAll(data.getNo_liang());
|
||||
mBinding.slGiftWall.setVisibility(View.VISIBLE);
|
||||
mAdapter.setNewData(giftWallBeans);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.modulemain.manager.RoomManager;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.databinding.WebViewDialogBinding;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||
import com.tencent.mm.opensdk.modelbiz.WXOpenCustomerServiceChat;
|
||||
import com.tencent.mm.opensdk.openapi.IWXAPI;
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory;
|
||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
|
||||
|
||||
/**
|
||||
* @Author lxj$
|
||||
* @Time 2025-8-8 09:20:18$ $
|
||||
* @Description 弹窗webview$
|
||||
*/
|
||||
public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
||||
|
||||
String mUrl;
|
||||
int type;//10:天空之境 11:岁月之城 12:时空之巅
|
||||
|
||||
public WebViewDialog(@NonNull Context context, Bundle args) {
|
||||
super(context, R.style.BaseDialogStyleH);
|
||||
this.mUrl = args.getString("url");
|
||||
this.type = args.getInt("type");
|
||||
initData1();
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
if (getWindow() != null) {
|
||||
// 获取屏幕尺寸
|
||||
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||
// 设置高度为屏幕高度的80%
|
||||
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = (int) (displayMetrics.heightPixels * 0.9);
|
||||
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.web_view_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
setCancelable(true);
|
||||
setCanceledOnTouchOutside(true);
|
||||
Window window = getWindow();
|
||||
assert window != null;
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT);
|
||||
mBinding.ivClose.setOnClickListener(v -> dismiss());
|
||||
|
||||
if (type==10){
|
||||
mBinding.gzCl.setBackgroundResource(R.mipmap.tkzj);
|
||||
mBinding.imGz.setImageResource(R.mipmap.tkzj_gz);
|
||||
mBinding.webView.setPadding(16, 0, 16, 0);
|
||||
}else if (type==11){
|
||||
mBinding.gzCl.setBackgroundResource(R.mipmap.syzc);
|
||||
mBinding.imGz.setImageResource(R.mipmap.syzc_gz);
|
||||
}else if (type==12){
|
||||
mBinding.gzCl.setBackgroundResource(R.mipmap.skzj);
|
||||
mBinding.imGz.setImageResource(R.mipmap.skzj_gz);
|
||||
}else if (type==13){
|
||||
mBinding.gzCl.setBackgroundResource(R.mipmap.xlh);
|
||||
mBinding.imGz.setImageResource(R.mipmap.xlh_gz);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void initData1() {
|
||||
// WebSettings webSettings = mBinding.webView.getSettings();
|
||||
// webSettings.setUseWideViewPort(true);
|
||||
// webSettings.setLoadWithOverviewMode(true);
|
||||
// webSettings.setJavaScriptEnabled(true);
|
||||
// webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||
// //增加JSBridge
|
||||
// mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||
//// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||
// webSettings.setBuiltInZoomControls(false);
|
||||
// webSettings.setSupportZoom(false);
|
||||
// webSettings.setDomStorageEnabled(true);
|
||||
// webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
// // 启用 WebView 内容的滚动
|
||||
// mBinding.webView.setVerticalScrollBarEnabled(true);
|
||||
// mBinding.webView.setScrollbarFadingEnabled(true);
|
||||
// webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
// webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
// mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
// mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||
// mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
// mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
// mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
//
|
||||
// mBinding.webView.requestFocus();
|
||||
// mBinding.webView.loadUrl(mUrl);
|
||||
|
||||
WebSettings webSettings = mBinding.webView.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
webSettings.setJavaScriptEnabled(true);
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||
//增加JSBridge
|
||||
mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||
// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||
webSettings.setBuiltInZoomControls(false);
|
||||
webSettings.setSupportZoom(false);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
// 启用 WebView 内容的滚动,但隐藏滚动条
|
||||
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示滚动条
|
||||
mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
// 确保内容可以滚动
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
|
||||
mBinding.webView.requestFocus();
|
||||
mBinding.webView.loadUrl(mUrl);
|
||||
}
|
||||
|
||||
private Resources getResources() {
|
||||
return getContext().getResources();
|
||||
}
|
||||
|
||||
public class WebAppInterface {
|
||||
Context mContext;
|
||||
|
||||
WebAppInterface(Context c) {
|
||||
mContext = c;
|
||||
}
|
||||
|
||||
// 被 H5 调用的方法
|
||||
@JavascriptInterface
|
||||
public void showToast(String toast) {
|
||||
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void closeWeb() {
|
||||
LogUtils.e("value: ");
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void customerService() {
|
||||
String appId = CommonAppContext.getInstance().getCurrentEnvironment().getWxAppId(); // 填移动应用(App)的 AppId
|
||||
IWXAPI api = WXAPIFactory.createWXAPI(mContext, appId);
|
||||
|
||||
// 判断当前版本是否支持拉起客服会话
|
||||
WXOpenCustomerServiceChat.Req req = new WXOpenCustomerServiceChat.Req();
|
||||
req.corpId = "ww1de4300858c0b461"; // 企业ID
|
||||
req.url = "https://work.weixin.qq.com/kfid/kfcb3d23a59c188a0e7"; // 客服URL
|
||||
api.sendReq(req);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void jumpRoomPage(String room_id) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getContext(), room_id,"",null);
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void jumpWebPage(String objects) {
|
||||
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).navigation();
|
||||
ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", objects).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void enterGroupChat(String group_id,String cover,String guild_name) {
|
||||
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void chatWithUser(String user_id,String nickname) {
|
||||
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
@JavascriptInterface
|
||||
public void exchange(){
|
||||
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Withdrawal() {
|
||||
ARouter.getInstance().build(ARouteConstants.WITHDRAWAL_ACTIVITY).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void enterAuthent() {//实名认证
|
||||
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void Recharge(){
|
||||
ARouter.getInstance().build(ARouteConstants.RECHARGE_ACTIVITY).navigation();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.modulemain.R;
|
||||
import com.xscm.modulemain.activity.room.contacts.WheatContacts;
|
||||
import com.xscm.modulemain.activity.room.presenter.WheatPresenter;
|
||||
import com.xscm.modulemain.adapter.WheatFeedingSelectAdapter;
|
||||
import com.xscm.modulemain.databinding.FragmentWheatFeedingDialogBinding;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RoomWheatEvent;
|
||||
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/10
|
||||
* @description: 上麦申请dialog弹框,等待申请
|
||||
*/
|
||||
public class WheatFeedingDialogFragment extends BaseMvpDialogFragment<WheatPresenter, FragmentWheatFeedingDialogBinding> implements
|
||||
WheatContacts.View {
|
||||
private int page;
|
||||
private int displayMode; // 用于决定显示模式的参数
|
||||
WheatFeedingSelectAdapter mSpecialAdapter;
|
||||
WheatFeedingSelectAdapter mRegularAdapter;
|
||||
private String roomId;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private RoomApplyListBean roomApplyListBeans;
|
||||
|
||||
@Override
|
||||
protected WheatPresenter bindPresenter() {
|
||||
return new WheatPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public static void show(String id, int displayMode, RoomInfoResp roomInfoResp, FragmentManager fragmentManager) {
|
||||
WheatFeedingDialogFragment dialogFragment = new WheatFeedingDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); // 可选:传递参数
|
||||
args.putInt("displayMode", displayMode);
|
||||
args.putSerializable("roomInfoResp", roomInfoResp);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "WheatFeedingDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
// 从 Bundle 中获取 displayMode 参数
|
||||
displayMode = getArguments().getInt("displayMode", 2); // 默认值为 0
|
||||
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
// 根据 displayMode 显示不同的控件
|
||||
updateViewBasedOnDisplayMode();
|
||||
roomId = getArguments().getString("roomId");
|
||||
MvpPre.roomApplyListBean(roomId);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onRoomApplyListEvent(RoomWheatEvent event) {
|
||||
MvpPre.roomApplyListBean(roomId);
|
||||
}
|
||||
|
||||
private void updateViewBasedOnDisplayMode() {
|
||||
switch (displayMode) {
|
||||
case 1: // 模式房主或者主持模式
|
||||
mBinding.tvLjsq.setVisibility(GONE);
|
||||
mBinding.tvQk.setVisibility(VISIBLE);
|
||||
mBinding.tvWheatRefuse.setVisibility(VISIBLE);
|
||||
mBinding.tvWheatAccept.setVisibility(VISIBLE);
|
||||
mBinding.tvWheatSq.setVisibility(GONE);
|
||||
mBinding.tv3.setVisibility(VISIBLE);
|
||||
mBinding.tv3.setText("设置");
|
||||
// ... 设置其他控件的可见性
|
||||
break;
|
||||
case 2: // 模式 2//观众模式
|
||||
mBinding.tvQk.setVisibility(GONE);
|
||||
mBinding.tvWheatRefuse.setVisibility(GONE);
|
||||
mBinding.tvWheatAccept.setVisibility(GONE);
|
||||
mBinding.tvWheatSq.setVisibility(GONE);
|
||||
mBinding.tvLjsq.setVisibility(VISIBLE);
|
||||
mBinding.tv3.setVisibility(GONE);
|
||||
break;
|
||||
// ... 其他模式
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDisplayMode(int newDisplayMode) {
|
||||
if (newDisplayMode == displayMode) {
|
||||
return; // 如果新旧模式相同,直接返回
|
||||
}
|
||||
|
||||
displayMode = newDisplayMode;
|
||||
updateViewBasedOnDisplayMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.6f);
|
||||
;
|
||||
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.tv3.setOnClickListener(this::onClick);
|
||||
mBinding.tvWheatAccept.setOnClickListener(this::onClick);
|
||||
mBinding.tvWheatRefuse.setOnClickListener(this::onClick);
|
||||
mBinding.tvWheatSq.setOnClickListener(this::onClick);
|
||||
mBinding.tvLjsq.setOnClickListener(this::onClick);
|
||||
mBinding.tvQk.setOnClickListener(this::onClick);
|
||||
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
|
||||
mBinding.recycleView2.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false));
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tv3, ColorManager.getInstance().getPrimaryColorInt(), 65);
|
||||
mBinding.tv3.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvQk, ColorManager.getInstance().getPrimaryColorInt(), 65);
|
||||
mBinding.tvQk.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvWheatAccept, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvWheatAccept.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_3) {
|
||||
if (mBinding.tv3.getText().equals("设置")) {
|
||||
RoomWheatGiftSettingFragment.show(roomId, getChildFragmentManager());
|
||||
}
|
||||
// else {
|
||||
// if (roomApplyListBeans!=null) {
|
||||
// MvpPre.roomGift(roomId, roomApplyListBeans.getGift_info().getGift_id(), "1", roomInfoResp.getRoom_info().getPit_list().get(8).getUser_id(), "1", "");
|
||||
// }
|
||||
// }
|
||||
} else if (id == R.id.tv_wheat_accept) {
|
||||
// MvpPre.agreePit(roomId,);
|
||||
up(1);
|
||||
} else if (id == R.id.tv_wheat_refuse) {
|
||||
// MvpPre.refusePit(roomId,);
|
||||
up(2);
|
||||
} else if (id == R.id.tv_wheat_sq) {
|
||||
ToastUtils.showShort("点击了申请");
|
||||
} else if (id == R.id.tv_ljsq) {
|
||||
MvpPre.applyPit(roomId, "");
|
||||
} else if (id == R.id.tv_qk) {
|
||||
MvpPre.clearApply(roomId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type 1:同意上麦 2:拒绝上麦
|
||||
*/
|
||||
private void up(int type) {
|
||||
List<String> stringList = new ArrayList<>();
|
||||
List<String> selectedTopics = mSpecialAdapter.getSelectedItems();
|
||||
List<String> selectedRegular = mRegularAdapter.getSelectedItems();
|
||||
// 返回结果给调用页面(可使用接口或 onActivityResult 等方式)
|
||||
Log.d("Selected Topics", selectedTopics.toString());
|
||||
if (selectedTopics.size() > 0) {
|
||||
stringList.addAll(selectedTopics);
|
||||
}
|
||||
if (selectedRegular.size() > 0) {
|
||||
stringList.addAll(selectedRegular);
|
||||
}
|
||||
if (selectedTopics.size() == 0 && selectedRegular.size() == 0) {
|
||||
ToastUtils.showShort("未选择需要上麦人员");
|
||||
return;
|
||||
}
|
||||
String string = TextUtils.join(",", stringList);
|
||||
if (type == 1) {
|
||||
MvpPre.agreePit(roomId, string);
|
||||
} else if (type == 2) {
|
||||
MvpPre.refusePit(roomId, string);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_wheat_feeding_dialog;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void roomApplyListBean(RoomApplyListBean roomApplyListBeans) {
|
||||
if (roomApplyListBeans.getSpecial() != null || !roomApplyListBeans.getSpecial().isEmpty()) {
|
||||
mBinding.tv1.setText("优先通道(" + roomApplyListBeans.getSpecial().size() + "/20)");
|
||||
mSpecialAdapter = new WheatFeedingSelectAdapter(roomApplyListBeans.getSpecial());
|
||||
mBinding.recycleView.setAdapter(mSpecialAdapter);
|
||||
mSpecialAdapter.setOnItemClickListener(new WheatFeedingSelectAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onTvBmClick(RoomApplyListBean.Special item, int position) {
|
||||
MvpPre.helpApply(roomId, item.getUser_id());
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
if (roomApplyListBeans.getRegular() != null || !roomApplyListBeans.getRegular().isEmpty()) {
|
||||
mBinding.tv4.setText("普通通道(" + roomApplyListBeans.getRegular().size() + "/20)");
|
||||
mRegularAdapter = new WheatFeedingSelectAdapter(roomApplyListBeans.getRegular());
|
||||
mBinding.recycleView2.setAdapter(mRegularAdapter);
|
||||
mRegularAdapter.setOnItemClickListener(new WheatFeedingSelectAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onTvBmClick(RoomApplyListBean.Special item, int position) {
|
||||
MvpPre.helpApply(roomId, item.getUser_id());
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (roomApplyListBeans.getGift_info() != null) {
|
||||
mBinding.tv2.setText("赠" + roomApplyListBeans.getGift_info().getGift_name() + "礼物插队");
|
||||
ImageUtils.loadHeadCC(roomApplyListBeans.getGift_info().getBase_image(), mBinding.im1);
|
||||
|
||||
}
|
||||
|
||||
this.roomApplyListBeans=roomApplyListBeans;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearApply() {
|
||||
MvpPre.roomApplyListBean(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void agreePit() {
|
||||
// MvpPre.roomApplyListBean(roomId);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit() {
|
||||
//
|
||||
// if (roomApplyListBeans!=null){
|
||||
// if ((roomApplyListBeans.getSpecial() != null && !roomApplyListBeans.getSpecial().isEmpty())
|
||||
// ||(roomApplyListBeans.getRegular() != null && !roomApplyListBeans.getRegular().isEmpty())){
|
||||
// MvpPre.roomApplyListBean(roomId);
|
||||
// }else {
|
||||
// dismiss();
|
||||
// }
|
||||
// }else {
|
||||
dismiss();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.xscm.modulemain.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.modulemain.activity.WebViewActivity;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.TeenagerInfo;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.databinding.IndexDialogYouthModelBinding;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
/**
|
||||
* 描述 describe 青少年模式弹窗
|
||||
*/
|
||||
public class YouthModelDialog extends BaseDialog<IndexDialogYouthModelBinding> {
|
||||
private TeenagerInfo teenagerInfo;
|
||||
|
||||
public YouthModelDialog(@NonNull Context context, TeenagerInfo teenagerInfo) {
|
||||
super(context);
|
||||
this.teenagerInfo = teenagerInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.index_dialog_youth_model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
setCancelable(false);
|
||||
setCanceledOnTouchOutside(false);
|
||||
Window window = getWindow();
|
||||
window.setLayout((int) (ScreenUtils.getScreenWidth() * 315.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
mBinding.ivClose.setOnClickListener(v -> dismiss());
|
||||
mBinding.tvIKnow.setOnClickListener(v -> {
|
||||
|
||||
ARouter.getInstance().build(ARouteConstants.UNDERAGE_ACTIVITY).withInt("type", 0).navigation();
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken()).navigation();
|
||||
// dismiss();
|
||||
});
|
||||
mBinding.tvOpen.setOnClickListener(v -> {
|
||||
// if (teenagerInfo.getHad_password() == 1) {
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.SET_YOUTH_PWD_ACTIVITY).withInt("type", SetYouthPasswordActivity.TYPE_OPEN).navigation();
|
||||
// } else {
|
||||
// ARouter.getInstance().build(ARouteConstants.SET_YOUTH_PWD_ACTIVITY).withInt("type", SetYouthPasswordActivity.SET_TYPE).navigation();
|
||||
// }
|
||||
|
||||
Intent intent = new Intent(getContext(), WebViewActivity.class);
|
||||
intent.putExtra("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken());
|
||||
getContext().startActivity(intent);
|
||||
// ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken()).navigation();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvIKnow, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvIKnow.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
public void setTeenagerInfo(TeenagerInfo teenagerInfo) {
|
||||
this.teenagerInfo = teenagerInfo;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user