修改名称。
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
import androidx.databinding.ViewDataBinding;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
|
||||
public abstract class BaseDialog<VDM extends ViewDataBinding> extends Dialog {
|
||||
|
||||
protected VDM mBinding;
|
||||
|
||||
public BaseDialog(@NonNull Context context) {
|
||||
this(context, R.style.BaseDialogStyle);
|
||||
}
|
||||
|
||||
public BaseDialog(@NonNull Context context, int themeResId) {
|
||||
super(context, themeResId);
|
||||
mBinding = DataBindingUtil.bind(LayoutInflater.from(context).inflate(getLayoutId(), null, false));
|
||||
if (mBinding != null) {
|
||||
setContentView(mBinding.getRoot());
|
||||
}
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
initView();
|
||||
initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
if (mBinding!=null){
|
||||
mBinding.unbind();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract int getLayoutId();
|
||||
|
||||
public abstract void initView();
|
||||
|
||||
public abstract void initData();
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.adapter.LikeListAdapter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.CircleListBean;
|
||||
import com.xscm.moduleutil.databinding.FragmentCommentDialogBinding;
|
||||
import com.xscm.moduleutil.presenter.CommentContacts;
|
||||
import com.xscm.moduleutil.presenter.CommentPresenter;
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 点赞列表弹窗
|
||||
*/
|
||||
public class CommentDialogFragment extends BaseMvpDialogFragment<CommentPresenter, FragmentCommentDialogBinding> implements
|
||||
CommentContacts.View {
|
||||
private int page;
|
||||
private LikeListAdapter likeListAdapter;
|
||||
@Override
|
||||
protected CommentPresenter bindPresenter() {
|
||||
return new CommentPresenter(this, getActivity());
|
||||
}
|
||||
public static void show(String id, FragmentManager fragmentManager) {
|
||||
CommentDialogFragment dialogFragment = new CommentDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("id", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "CommentDialogFragment");
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getCommentList(getArguments().getString("id"));
|
||||
}
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
Window window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int heightInDp = 450;
|
||||
int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
|
||||
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInPx);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void initView() {
|
||||
|
||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getCommentList(getArguments().getString("id"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.getCommentList(getArguments().getString("id"));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mBinding.rvComment.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
likeListAdapter = new LikeListAdapter();
|
||||
mBinding.rvComment.setAdapter(likeListAdapter);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_comment_dialog;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void getCommentList(List<CircleListBean.LikeList> likeLists) {
|
||||
mBinding.tvNum.setText("已有"+likeLists.size()+"人点赞");
|
||||
likeListAdapter.setNewData(likeLists);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
public class CommonDialog extends BaseDialog {
|
||||
|
||||
TextView tvContent;
|
||||
TextView textViewLeft;
|
||||
TextView textViewRight;
|
||||
|
||||
private OnClickListener mOnClickListener;
|
||||
|
||||
|
||||
public CommonDialog(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.dialog_common;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
getWindow().setLayout((int) (ScreenUtils.getScreenWidth() * 0.86), ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
tvContent = mBinding.getRoot().findViewById(R.id.tv_content);
|
||||
textViewLeft = mBinding.getRoot().findViewById(R.id.tv_left);
|
||||
textViewRight = mBinding.getRoot().findViewById(R.id.tv_right);
|
||||
textViewLeft.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
mOnClickListener.onLeftClick();
|
||||
}
|
||||
});
|
||||
textViewRight.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
mOnClickListener.onRightClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setContent(String content) {
|
||||
tvContent.setText(content);
|
||||
}
|
||||
|
||||
public void setLeftText(String leftText) {
|
||||
textViewLeft.setText(leftText);
|
||||
}
|
||||
|
||||
public void setRightText(String rightText) {
|
||||
textViewRight.setText(rightText);
|
||||
}
|
||||
|
||||
public void setmOnClickListener(OnClickListener onClickListener) {
|
||||
this.mOnClickListener = onClickListener;
|
||||
}
|
||||
|
||||
|
||||
public interface OnClickListener {
|
||||
void onLeftClick();
|
||||
|
||||
void onRightClick();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 项目名称 qipao-android
|
||||
* 包名:com.qpyy.room.widget
|
||||
* 创建人 黄强
|
||||
* 创建时间 2020/8/6 16:55
|
||||
* 描述 自定义数字键盘
|
||||
*/
|
||||
|
||||
public class KeyboardPopupWindow extends PopupWindow {
|
||||
private static final String TAG = "KeyboardPopupWindow";
|
||||
private Context context;
|
||||
private View anchorView;
|
||||
private View parentView;
|
||||
private EditText editText;
|
||||
private boolean isRandomSort = false;//数字是否随机排序
|
||||
private List<Integer> list = new ArrayList<>();
|
||||
private int[] commonButtonIds = new int[]{R.id.bt_keyboard1, R.id.bt_keyboard2, R.id.bt_keyboard3, R.id.bt_keyboard4,
|
||||
R.id.bt_keyboard5, R.id.bt_keyboard6, R.id.bt_keyboard7, R.id.bt_keyboard8, R.id.bt_keyboard9, R.id.bt_keyboard0};
|
||||
|
||||
private KeyboardCompleteListener mListener;
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @param anchorView
|
||||
* @param
|
||||
* @param
|
||||
*/
|
||||
public KeyboardPopupWindow(Context context, View anchorView) {
|
||||
this.context = context;
|
||||
this.anchorView = anchorView;
|
||||
this.isRandomSort = isRandomSort;
|
||||
if (context == null || anchorView == null) {
|
||||
return;
|
||||
}
|
||||
initConfig();
|
||||
initView();
|
||||
Log.d(TAG, "KeyboardPopupWindow: =====================打开了自定义键盘");
|
||||
}
|
||||
|
||||
|
||||
private void initConfig() {
|
||||
setOutsideTouchable(false);
|
||||
setFocusable(false);
|
||||
setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
forbidDefaultSoftKeyboard();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁止系统默认的软键盘弹出
|
||||
*/
|
||||
private void forbidDefaultSoftKeyboard() {
|
||||
if (editText == null) {
|
||||
return;
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT > 10) {//4.0以上,使用反射的方式禁止系统自带的软键盘弹出
|
||||
try {
|
||||
Class<EditText> cls = EditText.class;
|
||||
Method setShowSoftInputOnFocus;
|
||||
setShowSoftInputOnFocus = cls.getMethod("setShowSoftInputOnFocus", boolean.class);
|
||||
setShowSoftInputOnFocus.setAccessible(true);
|
||||
setShowSoftInputOnFocus.invoke(editText, false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新自定义的popupwindow是否outside可触摸反应:如果是不可触摸的,则显示该软键盘view
|
||||
*
|
||||
* @param isTouchable
|
||||
*/
|
||||
public void refreshKeyboardOutSideTouchable(boolean isTouchable) {
|
||||
setOutsideTouchable(isTouchable);
|
||||
if (!isTouchable) {
|
||||
show();
|
||||
} else {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
parentView = LayoutInflater.from(context).inflate(R.layout.room_custom_num_keyboard, null);
|
||||
initKeyboardView(parentView);
|
||||
setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
setContentView(parentView);
|
||||
this.setBackgroundDrawable(new BitmapDrawable());
|
||||
this.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
this.setFocusable(true);
|
||||
this.setOutsideTouchable(true);
|
||||
this.setTouchable(true);
|
||||
this.setAnimationStyle(R.style.mypopwindow_anim_style);
|
||||
}
|
||||
|
||||
private void initKeyboardView(View view) {
|
||||
//初始化编辑框
|
||||
editText = view.findViewById(R.id.et_keyboard_input);
|
||||
editText.setFocusable(false);//禁止编辑框获取焦点
|
||||
//①给数字键设置点击监听
|
||||
for (int i = 0; i < commonButtonIds.length; i++) {
|
||||
final Button button = view.findViewById(commonButtonIds[i]);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int curSelection = editText.getSelectionStart();
|
||||
int length = editText.getText().toString().length();
|
||||
if (curSelection < length) {
|
||||
String content = editText.getText().toString();
|
||||
editText.setText(content.substring(0, curSelection) + button.getText() + content.subSequence(curSelection, length));
|
||||
editText.setSelection(curSelection + 1);
|
||||
} else {
|
||||
if (length == 0 && button.getText().toString().equals("0") || equals("")) {
|
||||
return;
|
||||
}
|
||||
editText.setText(editText.getText().toString() + button.getText());
|
||||
editText.setSelection(editText.getText().toString().length());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//③给叉按键设置点击监听
|
||||
view.findViewById(R.id.rl_keyboard_cross).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int length = editText.getText().toString().length();
|
||||
int curSelection = editText.getSelectionStart();
|
||||
if (length > 0 && curSelection > 0 && curSelection <= length) {
|
||||
String content = editText.getText().toString();
|
||||
editText.setText(content.substring(0, curSelection - 1) + content.subSequence(curSelection, length));
|
||||
editText.setSelection(curSelection - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//③给叉按键设置点击监听
|
||||
view.findViewById(R.id.iv_keyboard_cross).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int length = editText.getText().toString().length();
|
||||
int curSelection = editText.getSelectionStart();
|
||||
if (length > 0 && curSelection > 0 && curSelection <= length) {
|
||||
String content = editText.getText().toString();
|
||||
editText.setText(content.substring(0, curSelection - 1) + content.subSequence(curSelection, length));
|
||||
editText.setSelection(curSelection - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//确定
|
||||
view.findViewById(R.id.bt_keyboard_ok).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Log.d(TAG, "onClick: 您输入的数量是:" + editText.getText().toString());
|
||||
mListener.inputComplete(editText.getText().toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void show() {
|
||||
if (!isShowing() && anchorView != null) {
|
||||
// doRandomSortOp();
|
||||
this.showAtLocation(anchorView, Gravity.BOTTOM, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机分布数字
|
||||
*/
|
||||
private void doRandomSortOp() {
|
||||
if (parentView == null) {
|
||||
return;
|
||||
}
|
||||
if (!isRandomSort) {
|
||||
for (int i = 0; i < commonButtonIds.length; i++) {
|
||||
final Button button = parentView.findViewById(commonButtonIds[i]);
|
||||
button.setText("" + i);
|
||||
}
|
||||
} else {
|
||||
list.clear();
|
||||
Random ran = new Random();
|
||||
while (list.size() < commonButtonIds.length) {
|
||||
int n = ran.nextInt(commonButtonIds.length);
|
||||
if (!list.contains(n))
|
||||
list.add(n);
|
||||
}
|
||||
for (int i = 0; i < commonButtonIds.length; i++) {
|
||||
final Button button = parentView.findViewById(commonButtonIds[i]);
|
||||
button.setText("" + list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void releaseResources() {
|
||||
this.dismiss();
|
||||
context = null;
|
||||
anchorView = null;
|
||||
if (list != null) {
|
||||
list.clear();
|
||||
list = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addRoomPasswordListener(KeyboardCompleteListener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public interface KeyboardCompleteListener {
|
||||
|
||||
void inputComplete(String inputContent);//输入完成
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.xscm.moduleutil.widget.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.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
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.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.GiftLabelBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackListCount;
|
||||
import com.xscm.moduleutil.bean.RewardUserBean;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.databinding.DialogRewardFragmentBinding;
|
||||
import com.xscm.moduleutil.databinding.FragmentRewardGiftDialogBinding;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
||||
import com.xscm.moduleutil.utils.ChatLauncher;
|
||||
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/6/16
|
||||
* @description: 广场中所有的打赏榜单列表
|
||||
*/
|
||||
public class RewardDialogFragment extends BaseMvpDialogFragment<RewardGiftPresenter, DialogRewardFragmentBinding> implements RewardGiftContacts.View {
|
||||
private String circle_id;
|
||||
private BaseQuickAdapter<RewardUserBean, BaseViewHolder> adapter;
|
||||
private int page;
|
||||
|
||||
public static void show(String id, FragmentManager fragmentManager) {
|
||||
RewardDialogFragment dialogFragment = new RewardDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("circle_id", id); // 可选:传递参数
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RewardDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
circle_id = getArguments().getString("circle_id");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window = getDialog().getWindow();
|
||||
if (window != null) {
|
||||
// 设置固定高度为 500dp
|
||||
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
int heightInDp = (int) (screenHeight * 0.8f);;
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getRewardList(circle_id, 1, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
MvpPre.getRewardList(circle_id, page, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
MvpPre.getRewardList(circle_id, page, 10);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mBinding.rvComment.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
adapter = new BaseQuickAdapter<RewardUserBean, BaseViewHolder>(R.layout.item_dialog_reward, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RewardUserBean item) {
|
||||
int position = helper.getLayoutPosition();
|
||||
|
||||
TextView tv_rank = helper.getView(R.id.rank_icon);
|
||||
|
||||
if (position < 3) {
|
||||
|
||||
switch (position) {
|
||||
case 0:
|
||||
|
||||
tv_rank.setBackground(getResources().getDrawable(R.mipmap.rewar_1));
|
||||
break;
|
||||
case 1:
|
||||
tv_rank.setBackground(getResources().getDrawable(R.mipmap.rewar_2));
|
||||
break;
|
||||
case 2:
|
||||
tv_rank.setBackground(getResources().getDrawable(R.mipmap.rewar_3));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
tv_rank.setText(String.valueOf(position + 1)); // 显示从1开始的序号
|
||||
}
|
||||
|
||||
// 绑定用户信息
|
||||
helper.setText(R.id.tvName, item.getNickname());
|
||||
helper.setText(R.id.tvPic, item.getTotal_price());
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.ivAvatar));
|
||||
helper.getView(R.id.tvScore).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ChatLauncher.getInstance().launchC2CChat(getActivity(), item.getUser_id());
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
mBinding.rvComment.setAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_reward_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
adapter.addData(rewardUserBeanList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels, int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reward_zone() {
|
||||
ToastUtils.showShort("打赏成功");
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,395 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
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 android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
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.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.databinding.FragmentRewardGiftDialogBinding;
|
||||
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||
import com.xscm.moduleutil.event.GiftRewardEvent;
|
||||
import com.xscm.moduleutil.event.GiftUserRefreshEvent;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftContacts;
|
||||
import com.xscm.moduleutil.presenter.RewardGiftPresenter;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
||||
|
||||
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/5/29
|
||||
* @description: 打赏礼物的fragment
|
||||
*/
|
||||
public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPresenter, FragmentRewardGiftDialogBinding> implements RewardGiftContacts.View {
|
||||
|
||||
private BaseQuickAdapter<RewardUserBean, BaseViewHolder> adapter;
|
||||
private SelectGiftNumPopupWindow mSelectGiftNumPopupWindow;
|
||||
private KeyboardPopupWindow mKeyboardPopupWindow;
|
||||
private List<GiftNumBean> mGiftNumList;
|
||||
private String circle_id;
|
||||
private RoonGiftModel roonGiftModel = null;
|
||||
private List<Fragment> fragmentList = new ArrayList<>();
|
||||
private String user_id;
|
||||
private String giftNumber = "";
|
||||
private int point;
|
||||
@Override
|
||||
protected RewardGiftPresenter bindPresenter() {
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
public static void show(String id,String userId,int point, FragmentManager fragmentManager) {
|
||||
RewardGiftDialogFragment dialogFragment = new RewardGiftDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("circle_id", id); // 可选:传递参数
|
||||
args.putString("user_id", userId);
|
||||
args.putInt("point",point);
|
||||
// 设置参数...
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RewardGiftDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
circle_id=getArguments().getString("circle_id");
|
||||
user_id=getArguments().getString("user_id");
|
||||
point=getArguments().getInt("point");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.getRewardList(circle_id, 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"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
adapter = new BaseQuickAdapter<RewardUserBean, BaseViewHolder>(com.xscm.moduleutil.R.layout.item_reward1, null) {
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RewardUserBean item) {
|
||||
GifAvatarOvalView gifAvatarOvalView = helper.getView(com.xscm.moduleutil.R.id.im_reward1);
|
||||
if (item!=null ) {
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(com.xscm.moduleutil.R.id.im_reward1));
|
||||
}
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.setAdapter(adapter);
|
||||
mBinding.tvGiveCoinNum.setOnClickListener(this::onClisk);
|
||||
mBinding.tvRewardNum.setOnClickListener(this::onClisk);
|
||||
mBinding.cz.setOnClickListener(this::onClisk);
|
||||
mBinding.tvGive.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());
|
||||
}
|
||||
|
||||
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.getNumber());
|
||||
}
|
||||
mSelectGiftNumPopupWindow.dismiss();
|
||||
});
|
||||
}
|
||||
mSelectGiftNumPopupWindow.setData(mGiftNumList);
|
||||
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 230);
|
||||
|
||||
}else if (view1.getId()== com.xscm.moduleutil.R.id.tv_reward_num){
|
||||
RewardDialogFragment.show(circle_id,getChildFragmentManager());
|
||||
}else if (view1.getId()== R.id.cz){
|
||||
RechargeDialogFragment.show("",null, getActivity().getSupportFragmentManager(),"0","0");
|
||||
}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();
|
||||
}
|
||||
}
|
||||
giveGift(giftNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_reward_gift_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRewardList(List<RewardUserBean> rewardUserBeanList) {
|
||||
if (rewardUserBeanList != null && !rewardUserBeanList.isEmpty()) {
|
||||
mBinding.recycleView.setVisibility(View.VISIBLE);
|
||||
mBinding.tvRewardNum.setVisibility(View.VISIBLE);
|
||||
mBinding.tvRewardTitle.setVisibility(View.INVISIBLE);
|
||||
mBinding.tvRewardNum.setText("已有" + String.valueOf(rewardUserBeanList.size()) + "个人打赏");
|
||||
int limit = Math.min(rewardUserBeanList.size(), 5);
|
||||
List<RewardUserBean> limitedList = rewardUserBeanList.subList(0, limit);
|
||||
adapter.setNewData(limitedList);
|
||||
} else {
|
||||
adapter.setNewData(null);
|
||||
mBinding.recycleView.setVisibility(View.INVISIBLE);
|
||||
mBinding.tvRewardNum.setVisibility(View.INVISIBLE);
|
||||
mBinding.tvRewardTitle.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
private List<GiftLabelBean> giftLabelBeanList;
|
||||
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
|
||||
if (giftLabelBeans == null) return;
|
||||
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,""));
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(0);
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(0).getId(),2,"");
|
||||
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 按钮的显示
|
||||
refreshCurrentGiftFragment(giftLabelBeans.get(position).getId(),2,"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
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;
|
||||
}
|
||||
private int getSelectedGift() {
|
||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||
return currentItem;
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void userRefresh(GiftUserRefreshEvent event) {
|
||||
if (event.addSelf) {
|
||||
roonGiftModel = event.gift;
|
||||
}
|
||||
}
|
||||
|
||||
private void giveGift(String num) {
|
||||
getSelectedGift();
|
||||
if (roonGiftModel == null) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(num)) {
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
if (Integer.valueOf(num) <= 0) {
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
|
||||
//礼物打赏
|
||||
giftNumber = num;
|
||||
MvpPre.reward_zone(circle_id, roonGiftModel.getGift_id(), num, "1");
|
||||
}
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels,int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wallet(WalletBean walletBean) {
|
||||
mBinding.tvRewardGift.setText(walletBean.getCoin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reward_zone() {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("打赏成功");
|
||||
EventBus.getDefault().post(new GiftRewardEvent(point,circle_id));
|
||||
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) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
}
|
||||
|
||||
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,41 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.GiftNumBean;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 展示礼物打赏数量的适配器
|
||||
*/
|
||||
public class SelectGiftNumAdapter extends BaseQuickAdapter<GiftNumBean, BaseViewHolder> {
|
||||
|
||||
public SelectGiftNumAdapter() {
|
||||
super(R.layout.room_rv_item_gift_num_windows);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, GiftNumBean item) {
|
||||
// helper.setText(R.id.tv_gift_mum, item.getNumber())
|
||||
helper.setText(R.id.tv_gift_name, item.getText());
|
||||
if ("0".equals(item.getNumber())) {
|
||||
// helper.setText(R.id.tv_custom, item.getText());
|
||||
// helper.setVisible(R.id.tv_custom,true);
|
||||
// helper.setVisible(R.id.tv_gift_mum, false).
|
||||
helper.setVisible(R.id.tv_gift_name, false);
|
||||
}else {
|
||||
// helper.setVisible(R.id.tv_custom,false);
|
||||
// helper.setVisible(R.id.tv_gift_mum, false)
|
||||
helper.setVisible(R.id.tv_gift_name, true);
|
||||
}
|
||||
if("1".equals(item.getNumber())){
|
||||
helper.getView(R.id.iv_split).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.xscm.moduleutil.widget.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.PopupWindow;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.GiftNumBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/5/30
|
||||
*@description: 选择礼物数量窗口
|
||||
*/
|
||||
public class SelectGiftNumPopupWindow extends PopupWindow {
|
||||
private View rootView;
|
||||
private SelectGiftNumAdapter selectGiftNumAdapter;
|
||||
|
||||
public SelectGiftNumPopupWindow(Context context, BaseQuickAdapter.OnItemClickListener onItemClickListener) {
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
rootView = inflater.inflate(R.layout.room_window_pop_gift, null);
|
||||
RecyclerView recyclerView = rootView.findViewById(R.id.rv_gift_num_window);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(context));
|
||||
recyclerView.setAdapter(selectGiftNumAdapter = new SelectGiftNumAdapter());
|
||||
|
||||
selectGiftNumAdapter.setOnItemClickListener(onItemClickListener);
|
||||
setContentView(rootView);
|
||||
this.setBackgroundDrawable(new BitmapDrawable());
|
||||
this.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
this.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
this.setFocusable(true);
|
||||
this.setOutsideTouchable(true);
|
||||
this.setTouchable(true);
|
||||
this.setAnimationStyle(R.style.mypopwindow_anim_style);
|
||||
}
|
||||
|
||||
|
||||
public void setData(List<GiftNumBean> data) {
|
||||
if (selectGiftNumAdapter != null) {
|
||||
selectGiftNumAdapter.setNewData(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user