首次提交信息
This commit is contained in:
1
moduleroom/.gitignore
vendored
Normal file
1
moduleroom/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
60
moduleroom/build.gradle
Normal file
60
moduleroom/build.gradle
Normal file
@@ -0,0 +1,60 @@
|
||||
plugins {
|
||||
alias(libs.plugins.android.library)
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.example.moduleroom'
|
||||
compileSdk 35
|
||||
|
||||
defaultConfig {
|
||||
minSdk 24
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
dataBinding {
|
||||
enable = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation libs.appcompat
|
||||
implementation libs.material
|
||||
implementation libs.activity
|
||||
implementation libs.constraintlayout
|
||||
testImplementation libs.junit
|
||||
androidTestImplementation libs.ext.junit
|
||||
androidTestImplementation libs.espresso.core
|
||||
|
||||
implementation project(':moduleUtil')
|
||||
implementation project(':moduletablayout')
|
||||
|
||||
implementation 'com.alibaba:arouter-api:1.5.2'
|
||||
//annotationProcessor
|
||||
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
|
||||
|
||||
implementation 'com.github.JessYanCoding:AndroidAutoSize:v1.2.1'
|
||||
|
||||
api project(':tuiconversation')
|
||||
api project(':tuichat')
|
||||
}
|
||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||
0
moduleroom/consumer-rules.pro
Normal file
0
moduleroom/consumer-rules.pro
Normal file
21
moduleroom/proguard-rules.pro
vendored
Normal file
21
moduleroom/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
44
moduleroom/src/main/AndroidManifest.xml
Normal file
44
moduleroom/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.moduleroom">
|
||||
|
||||
<application>
|
||||
|
||||
<meta-data
|
||||
android:name="design_width_in_dp"
|
||||
android:value="375" />
|
||||
|
||||
<meta-data
|
||||
android:name="design_height_in_dp"
|
||||
android:value="812" />
|
||||
|
||||
<activity
|
||||
android:name=".activity.RoomActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=".RoomTaskAffinity"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="true"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:enableOnBackInvokedCallback="false"
|
||||
android:theme="@style/TransparentActivityTheme"
|
||||
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||
/>
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".activity.RoomActivity"-->
|
||||
<!-- android:launchMode="singleInstancePerTask"-->
|
||||
<!-- android:windowSoftInputMode="adjustPan"-->
|
||||
<!-- android:enableOnBackInvokedCallback="false"-->
|
||||
<!-- android:theme="@style/TransparentActivityTheme"-->
|
||||
<!-- android:configChanges="orientation|screenSize|keyboardHidden"-->
|
||||
<!-- android:screenOrientation="portrait"-->
|
||||
<!-- android:exported="true"-->
|
||||
<!-- />-->
|
||||
|
||||
<service
|
||||
android:name=".service.MediaProjectionService"
|
||||
android:foregroundServiceType="mediaProjection">
|
||||
</service>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,275 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.RoomAutionTimeBean;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.ViewItem;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CardRelationAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private List<ViewItem> viewItems = new ArrayList<>();
|
||||
private int selectedRelationPosition = -1;
|
||||
private int selectedTimePosition = -1;
|
||||
private int selectedGiftPosition = -1;
|
||||
|
||||
public void submitList(List<ViewItem> items) {
|
||||
viewItems.clear();
|
||||
viewItems.addAll(items);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return viewItems.get(position).getType();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||
|
||||
switch (viewType) {
|
||||
case ViewItem.TYPE_TEXT:
|
||||
return new TextViewHolder(inflater.inflate(R.layout.item_text_view, parent, false));
|
||||
case ViewItem.TYPE_RELATION:
|
||||
return new RelationViewHolder(inflater.inflate(R.layout.item_relation, parent, false));
|
||||
case ViewItem.TYPE_IMAGE_SELECTION:
|
||||
return new RelationViewTimHolder(inflater.inflate(R.layout.item_relation, parent, false));
|
||||
case ViewItem.TYPE_GIFT:
|
||||
return new GiftViewHolder(inflater.inflate(R.layout.item_gift_card, parent, false));
|
||||
default:
|
||||
throw new IllegalArgumentException("Unknown view type");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
|
||||
ViewItem item = viewItems.get(position);
|
||||
|
||||
switch (item.getType()) {
|
||||
case ViewItem.TYPE_TEXT:
|
||||
((TextViewHolder) holder).bind((String) item.getData());
|
||||
break;
|
||||
case ViewItem.TYPE_RELATION:
|
||||
RoomRelationBean relationBean = (RoomRelationBean) item.getData();
|
||||
((RelationViewHolder) holder).bind(relationBean);
|
||||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
// 取消之前选中的 item
|
||||
if (selectedRelationPosition != -1) {
|
||||
ViewItem oldItem = viewItems.get(selectedRelationPosition);
|
||||
if (oldItem.getData() instanceof RoomRelationBean) {
|
||||
((RoomRelationBean) oldItem.getData()).setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前 item 为选中
|
||||
relationBean.setSelected(true);
|
||||
selectedRelationPosition = position;
|
||||
notifyDataSetChanged();
|
||||
});
|
||||
break;
|
||||
case ViewItem.TYPE_GIFT:
|
||||
RoonGiftModel giftModel = (RoonGiftModel) item.getData();
|
||||
((GiftViewHolder)holder).bind(giftModel);
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
|
||||
// 取消之前选中的 item
|
||||
if (selectedGiftPosition != -1) {
|
||||
ViewItem oldItem = viewItems.get(selectedGiftPosition);
|
||||
if (oldItem.getData() instanceof RoonGiftModel) {
|
||||
((RoonGiftModel) oldItem.getData()).setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前 item 为选中
|
||||
giftModel.setSelected(true);
|
||||
selectedGiftPosition = position;
|
||||
notifyDataSetChanged();
|
||||
|
||||
});
|
||||
break;
|
||||
case ViewItem.TYPE_IMAGE_SELECTION:
|
||||
|
||||
RoomAutionTimeBean roomAutionTimeBean = (RoomAutionTimeBean) item.getData();
|
||||
((RelationViewTimHolder)holder).bind(roomAutionTimeBean);
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
// 取消之前选中的 item
|
||||
if (selectedTimePosition != -1) {
|
||||
ViewItem oldItem = viewItems.get(selectedTimePosition);
|
||||
if (oldItem.getData() instanceof RoomAutionTimeBean) {
|
||||
((RoomAutionTimeBean) oldItem.getData()).setSelected(false);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置当前 item 为选中
|
||||
roomAutionTimeBean.setSelected(true);
|
||||
selectedTimePosition = position;
|
||||
notifyDataSetChanged();
|
||||
|
||||
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public interface OnItemSelectedListener {
|
||||
void onItemSelected(int viewType, int position);
|
||||
}
|
||||
|
||||
private OnItemSelectedListener listener;
|
||||
|
||||
public void setOnItemSelectedListener(OnItemSelectedListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public RoomRelationBean getSelectedRelation() {
|
||||
if (selectedRelationPosition != -1) {
|
||||
ViewItem item = viewItems.get(selectedRelationPosition);
|
||||
if (item.getData() instanceof RoomRelationBean) {
|
||||
return (RoomRelationBean) item.getData();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RoomAutionTimeBean getSelectedTime() {
|
||||
if (selectedTimePosition != -1) {
|
||||
ViewItem item = viewItems.get(selectedTimePosition);
|
||||
if (item.getData() instanceof RoomAutionTimeBean) {
|
||||
return (RoomAutionTimeBean) item.getData();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public RoonGiftModel getSelectedGift() {
|
||||
if (selectedGiftPosition != -1) {
|
||||
ViewItem item = viewItems.get(selectedGiftPosition);
|
||||
if (item.getData() instanceof RoonGiftModel) {
|
||||
return (RoonGiftModel) item.getData();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return viewItems.size();
|
||||
}
|
||||
|
||||
static class TextViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView textView;
|
||||
|
||||
TextViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
textView = itemView.findViewById(R.id.tv_name);
|
||||
}
|
||||
|
||||
void bind(String text) {
|
||||
textView.setText(text);
|
||||
}
|
||||
}
|
||||
|
||||
static class RelationViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView relationName;
|
||||
|
||||
RelationViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
relationName = itemView.findViewById(R.id.tv_name);
|
||||
}
|
||||
|
||||
void bind(RoomRelationBean bean) {
|
||||
relationName.setText(bean.getName());
|
||||
|
||||
if (bean.isSelected()) {
|
||||
relationName.setBackground(itemView.getResources().getDrawable(com.xscm.moduleutil.R.mipmap.gx_xz_bj));
|
||||
relationName.setTextColor(itemView.getResources().getColor(com.xscm.moduleutil.R.color.color_FF333333));
|
||||
} else {
|
||||
relationName.setBackground(itemView.getResources().getDrawable(com.xscm.moduleutil.R.mipmap.gux_bj));
|
||||
relationName.setTextColor(itemView.getResources().getColor(com.xscm.moduleutil.R.color.white));
|
||||
}
|
||||
}
|
||||
}
|
||||
static class RelationViewTimHolder extends RecyclerView.ViewHolder {
|
||||
TextView relationName;
|
||||
|
||||
RelationViewTimHolder(View itemView) {
|
||||
super(itemView);
|
||||
relationName = itemView.findViewById(R.id.tv_name);
|
||||
|
||||
}
|
||||
|
||||
void bind(RoomAutionTimeBean bean) {
|
||||
relationName.setText(bean.getDays()+"天");
|
||||
|
||||
if (bean.isSelected()) {
|
||||
relationName.setBackground(itemView.getResources().getDrawable(com.xscm.moduleutil.R.mipmap.gx_xz_bj));
|
||||
relationName.setTextColor(itemView.getResources().getColor(com.xscm.moduleutil.R.color.color_FF333333));
|
||||
} else {
|
||||
relationName.setBackground(itemView.getResources().getDrawable(com.xscm.moduleutil.R.mipmap.gux_bj));
|
||||
relationName.setTextColor(itemView.getResources().getColor(com.xscm.moduleutil.R.color.white));
|
||||
}
|
||||
}
|
||||
}
|
||||
static class GiftViewHolder extends RecyclerView.ViewHolder {
|
||||
TextView tv_gift_name;
|
||||
TextView tv_gift_price;
|
||||
ImageView iv_gift_pic;
|
||||
ConstraintLayout item_layout;
|
||||
ImageView ivDownOn;
|
||||
ConstraintLayout cl_iv_down_on;
|
||||
|
||||
|
||||
GiftViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
tv_gift_name = itemView.findViewById(R.id.tv_gift_name);
|
||||
tv_gift_price = itemView.findViewById(R.id.tv_gift_price);
|
||||
iv_gift_pic = itemView.findViewById(R.id.iv_gift_pic);
|
||||
item_layout = itemView.findViewById(R.id.cl_gift);
|
||||
ivDownOn = itemView.findViewById(R.id.iv_down_on);
|
||||
cl_iv_down_on = itemView.findViewById(R.id.cl_iv_down_on);
|
||||
}
|
||||
|
||||
void bind(RoonGiftModel bean) {
|
||||
tv_gift_name.setText(bean.getGift_name());
|
||||
//设置礼物价格
|
||||
String surplusTxt = bean.getGift_price();
|
||||
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(surplusTxt);
|
||||
//ForegroundColorSpan 为文字前景色,BackgroundColorSpan为文字背景色
|
||||
tv_gift_price.setText(stringBuilder);
|
||||
// viewHolder.item_layout.setTag(R.id.id_gift_tag, giftModel);
|
||||
|
||||
//加载礼物图片
|
||||
ImageUtils.loadImageView(bean.getBase_image(), iv_gift_pic);
|
||||
//设置选中后的样式
|
||||
|
||||
if (bean.isSelected()) {//被选中
|
||||
cl_iv_down_on.setBackgroundResource(com.xscm.moduleutil.R.mipmap.room_gift_bjx);
|
||||
ivDownOn.setVisibility(View.GONE);
|
||||
} else {
|
||||
ivDownOn.setVisibility(View.GONE);
|
||||
cl_iv_down_on.setBackgroundResource(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,541 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.GiftBean;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.room.EMMessageInfo;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author xf
|
||||
*/
|
||||
public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, BaseViewHolder> {
|
||||
|
||||
// private int[] a = {R.drawable.random0s, R.drawable.random1s, R.drawable.random2s, R.drawable.random3s, R.drawable.random4s, R.drawable.random5s, R.drawable.random6s, R.drawable.random7s, R.drawable.random8s, R.drawable.random9s};
|
||||
|
||||
private int listShowType = 1;
|
||||
public static int SHOW_TYPE_ALL = 1;
|
||||
public static int SHOW_TYPE_USER = 2;
|
||||
public static int SHOW_TYPE_SYSTEM = 3;
|
||||
|
||||
private List<EMMessageInfo> allMsgList;
|
||||
private List<EMMessageInfo> userMsgList;
|
||||
private List<EMMessageInfo> systemMsgList;
|
||||
private String messageNameColor = "#00C8FF";//名称的颜色
|
||||
private String messageGiftColor="#FFE309";//礼物的颜色
|
||||
|
||||
public EaseChatAdapter() {
|
||||
super(null);
|
||||
addItemType(1, com.xscm.moduleutil.R.layout.ease_row_received_message_system);//系统消息、官方公告
|
||||
addItemType(2, com.xscm.moduleutil.R.layout.ease_row_received_message_user_send);//用户发送的消息
|
||||
addItemType(3, com.xscm.moduleutil.R.layout.ease_row_received_message_user_send);//加入房间 、赠送礼物、上下麦、禁言 2025年6月12日15:42:08,让和聊天显示的是同一个额布局,后面需要修改
|
||||
// addItemType(3, com.qxcm.moduleutil.R.layout.ease_row_received_message_join_room);//加入房间 、赠送礼物、上下麦、禁言
|
||||
addItemType(4, com.xscm.moduleutil.R.layout.ease_row_received_message_new_user);//新用户注册
|
||||
addItemType(5, com.xscm.moduleutil.R.layout.ease_row_received_message_wagging);//摇签
|
||||
addItemType(6, com.xscm.moduleutil.R.layout.ease_row_received_message_expression);//表情
|
||||
// addItemType(8, com.qxcm.moduleutil.R.layout.ease_row_received_message_game);//球球大作战
|
||||
// addItemType(9, com.qxcm.moduleutil.R.layout.ease_row_received_message_demand);//派单需求
|
||||
// addItemType(10, com.qxcm.moduleutil.R.layout.ease_row_received_message_red_rain);//红包雨消息
|
||||
// addItemType(11, com.qxcm.moduleutil.R.layout.ease_row_received_message_red_rain);//红包雨消息结束
|
||||
|
||||
allMsgList = new ArrayList<>();
|
||||
userMsgList = new ArrayList<>();
|
||||
systemMsgList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void setShowType(int type) {
|
||||
if (type == listShowType) {
|
||||
return;
|
||||
}
|
||||
listShowType = type;
|
||||
List currData = new ArrayList();
|
||||
if (type == SHOW_TYPE_ALL) {
|
||||
currData.addAll(allMsgList);
|
||||
|
||||
} else if (type == SHOW_TYPE_USER) {
|
||||
currData.addAll(userMsgList);
|
||||
} else if (type == SHOW_TYPE_SYSTEM) {
|
||||
currData.addAll(systemMsgList);
|
||||
}
|
||||
setNewData(currData);
|
||||
//notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private SpannableStringBuilder getSpannable(RoomMessageEvent message) {
|
||||
// 在 Android 中实现类似的富文本功能
|
||||
SpannableStringBuilder spannable = new SpannableStringBuilder(message.getText().getText());
|
||||
|
||||
// 设置发送者昵称的颜色
|
||||
if (message.getText().getFromUserInfo() != null && !TextUtils.isEmpty(message.getText().getFromUserInfo().getNickname())) {
|
||||
String nickname = message.getText ().getFromUserInfo().getNickname();
|
||||
int startIndex = message.getText().getText().indexOf(nickname);
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + nickname.length();
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置接收者昵称的颜色
|
||||
if (message.getText().getToUserInfo() != null && !TextUtils.isEmpty(message.getText().getToUserInfo().getNickname())) {
|
||||
String nickname = message.getText().getToUserInfo().getNickname();
|
||||
int startIndex = message.getText().getText().indexOf(nickname);
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + nickname.length();
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// 处理礼物名称的颜色设置
|
||||
if (message.getText().getGiftInfo() != null && !TextUtils.isEmpty(message.getText().getGiftInfo().getGift_name())) {
|
||||
String[] giftNames = message.getText().getGiftInfo().getGift_name().split(",");
|
||||
for (String giftName : giftNames) {
|
||||
List<int[]> occurrences = findAllOccurrencesOfString(message.getText().getText(), giftName);
|
||||
for (int[] range : occurrences) {
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageGiftColor)), range[0], range[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理多个礼物信息的颜色设置
|
||||
if (message.getText().getGiftInfos() != null && !message.getText().getGiftInfos().isEmpty()) {
|
||||
for (GiftBean gift : message.getText().getGiftInfos()) {
|
||||
if (!TextUtils.isEmpty(gift.getGift_name())) {
|
||||
int startIndex = message.getText().getText().indexOf(gift.getGift_name());
|
||||
if (startIndex != -1) {
|
||||
int endIndex = startIndex + gift.getGift_name().length();
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageGiftColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理多个接收者信息的颜色设置
|
||||
if (message.getText().getToUserInfos() != null && !message.getText().getToUserInfos().isEmpty()) {
|
||||
for (int i = 0; i < message.getText().getToUserInfos().size(); i++) {
|
||||
UserInfo userModel = message.getText().getToUserInfos().get(i);
|
||||
if (!TextUtils.isEmpty(userModel.getNickname())) {
|
||||
List<int[]> occurrences = findAllOccurrencesOfString(message.getText().getText(), userModel.getNickname());
|
||||
for (int[] range : occurrences) {
|
||||
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), range[0], range[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return spannable;
|
||||
}
|
||||
/**
|
||||
* 查找字符串中所有子字符串出现的位置
|
||||
* @param text 原始文本
|
||||
* @param searchString 要查找的子字符串
|
||||
* @return 包含所有出现位置的列表,每个位置用 [start, end] 表示
|
||||
*/
|
||||
private List<int[]> findAllOccurrencesOfString(String text, String searchString) {
|
||||
List<int[]> occurrences = new ArrayList<>();
|
||||
if (TextUtils.isEmpty(text) || TextUtils.isEmpty(searchString)) {
|
||||
return occurrences;
|
||||
}
|
||||
|
||||
int index = text.indexOf(searchString);
|
||||
while (index >= 0) {
|
||||
occurrences.add(new int[]{index, index + searchString.length()});
|
||||
index = text.indexOf(searchString, index + searchString.length());
|
||||
}
|
||||
|
||||
return occurrences;
|
||||
}
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, EMMessageInfo item) {
|
||||
RoomMessageEvent emMessage = item.getEmMessage();
|
||||
//
|
||||
TextView tv_content= helper.getView(R.id.tv_content);
|
||||
|
||||
switch (helper.getItemViewType()) {
|
||||
case 1:
|
||||
helper.getView(R.id.tv_content).setVisibility(View.VISIBLE);
|
||||
helper.setText(R.id.tv_content, getSpannable(emMessage));
|
||||
// helper.setText(R.id.tv_content, emMessage.getText().getText());
|
||||
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
break;
|
||||
case 2:
|
||||
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, getSpannable(emMessage));
|
||||
// helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||
List<String> images = emMessage.getText().getFromUserInfo().getIcon();
|
||||
LinearLayout ll_images = helper.getView(com.xscm.moduleutil.R.id.line);
|
||||
ll_images.removeAllViews();
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(helper.itemView.getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_14)
|
||||
);
|
||||
params.setMargins(0, 0, helper.itemView.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);
|
||||
ll_images.addView(imageView);
|
||||
}
|
||||
}
|
||||
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
break;
|
||||
case 3:
|
||||
|
||||
if (emMessage.getText().getFromUserInfo()!=null && emMessage.getText().getFromUserInfo().getAvatar()!=null) {
|
||||
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
||||
}
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
||||
// helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, getSpannable(emMessage));
|
||||
List<String> images1 = emMessage.getText().getFromUserInfo().getIcon();
|
||||
LinearLayout ll_images1 = helper.getView(com.xscm.moduleutil.R.id.line);
|
||||
ll_images1.removeAllViews();
|
||||
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
if (images1 == null){
|
||||
return;
|
||||
}
|
||||
for (String url : images1) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(helper.itemView.getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_14)
|
||||
);
|
||||
params.setMargins(0, 0, helper.itemView.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);
|
||||
ll_images1.addView(imageView);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
// case 4:
|
||||
// TextView tvContent7 = helper.getView(R.id.tv_content);
|
||||
// ivNew = helper.getView(R.id.new_view);
|
||||
// ivNew.setNew(1);
|
||||
// tvContent7.setText(new SpanUtils().append(spanned).create());
|
||||
// break;
|
||||
// //抽签
|
||||
// case 5:
|
||||
// String number = emMessage.getStringAttribute("number", "");
|
||||
// ivRole = helper.getView(R.id.iv_role);
|
||||
// ivNew = helper.getView(R.id.iv_new);
|
||||
// ivGrade = helper.getView(R.id.iv_grade);
|
||||
// ivTitle = helper.getView(R.id.iv_title_label);
|
||||
// ivNHobility = helper.getView(R.id.iv_nobility);
|
||||
// tvName = helper.getView(R.id.tv_name);
|
||||
// TextView tvContent5 = helper.getView(R.id.tv_content);
|
||||
// ivRole.setRole(Integer.parseInt(role));
|
||||
// ivNew.setNew(Integer.parseInt(userIsNew));
|
||||
// ivGrade.setGrade(rankIcon);
|
||||
// //称号图标
|
||||
// try {
|
||||
// String s = user_title.substring(user_title.lastIndexOf("=") + 1);
|
||||
// int mWidth = (int) (Float.parseFloat(s) * 20);
|
||||
// int mHeight = 20;
|
||||
// ViewGroup.LayoutParams layoutParams = ivTitle.getLayoutParams();
|
||||
// layoutParams.width = ConvertUtils.dp2px(mWidth);
|
||||
// layoutParams.height = ConvertUtils.dp2px(mHeight);
|
||||
// ivTitle.setLayoutParams(layoutParams);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// ivTitle.setLabelView(user_title);
|
||||
// ivNHobility.setNobility(nobilityIcon);
|
||||
// ImageUtils.loadIcon(charmIcon, helper.getView(R.id.iv_charm));
|
||||
// tvName.setText(String.format("%s:", nickname));
|
||||
// tvContent5.setText(new SpanUtils().append(spanned).create());
|
||||
// GlideApp.with(mContext).load(String.format("http://soundriver.oss-cn-hangzhou.aliyuncs.com/custom/random%ss.webp", number)).into(new SimpleTarget<Drawable>() {
|
||||
// @Override
|
||||
// public void onResourceReady(@NonNull Drawable drawable, @Nullable Transition<? super Drawable> transition) {
|
||||
// if (drawable instanceof WebpDrawable) {
|
||||
// AppCompatImageView imageView = helper.getView(R.id.iv_wagginh);
|
||||
// imageView.setImageDrawable(drawable);
|
||||
// ((WebpDrawable) drawable).start();
|
||||
// ((WebpDrawable) drawable).setLoopCount(1);
|
||||
// ((WebpDrawable) drawable).registerAnimationCallback(new Animatable2Compat.AnimationCallback() {
|
||||
// @Override
|
||||
// public void onAnimationEnd(Drawable drawable) {
|
||||
// super.onAnimationEnd(drawable);
|
||||
// helper.setImageResource(R.id.iv_wagginh, a[Integer.parseInt(number)]);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// break;
|
||||
// //表情
|
||||
// case 6:
|
||||
// ivRole = helper.getView(R.id.iv_role);
|
||||
// ivNew = helper.getView(R.id.iv_new);
|
||||
// ivGrade = helper.getView(R.id.iv_grade);
|
||||
// ivTitle = helper.getView(R.id.iv_title_label);
|
||||
// ivNHobility = helper.getView(R.id.iv_nobility);
|
||||
// tvName = helper.getView(R.id.tv_name);
|
||||
// ivRole.setRole(Integer.parseInt(role));
|
||||
// ivNew.setNew(Integer.parseInt(userIsNew));
|
||||
// ivGrade.setGrade(rankIcon);
|
||||
// ivTitle.setLabelView(user_title);
|
||||
// ivNHobility.setNobility(nobilityIcon);
|
||||
// tvName.setText(Html.fromHtml(nickname));
|
||||
// ImageUtils.loadIcon(charmIcon, helper.getView(R.id.iv_charm));
|
||||
// ImageLoader.loadIcon(mContext, helper.getView(R.id.iv_expression), emoji_special);
|
||||
//
|
||||
// //称号图标
|
||||
// try {
|
||||
// String s = user_title.substring(user_title.lastIndexOf("=") + 1);
|
||||
// int mWidth = (int) (Float.parseFloat(s) * 20);
|
||||
// int mHeight = 20;
|
||||
// ViewGroup.LayoutParams layoutParams = ivTitle.getLayoutParams();
|
||||
// layoutParams.width = ConvertUtils.dp2px(mWidth);
|
||||
// layoutParams.height = ConvertUtils.dp2px(mHeight);
|
||||
// ivTitle.setLayoutParams(layoutParams);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// break;
|
||||
// //球球大作战
|
||||
// case 8:
|
||||
// String first = emMessage.getStringAttribute("first", "");
|
||||
// String second = emMessage.getStringAttribute("second", "");
|
||||
// String third = emMessage.getStringAttribute("third", "");
|
||||
//
|
||||
// ivRole = helper.getView(R.id.iv_role);
|
||||
// ivNew = helper.getView(R.id.iv_new);
|
||||
// ivGrade = helper.getView(R.id.iv_grade);
|
||||
// ivTitle = helper.getView(R.id.iv_title_label);
|
||||
// ivNHobility = helper.getView(R.id.iv_nobility);
|
||||
// tvName = helper.getView(R.id.tv_name);
|
||||
// TextView tvContent8 = helper.getView(R.id.tv_content);
|
||||
//
|
||||
// ivRole.setRole(Integer.parseInt(role));
|
||||
// ivNew.setNew(Integer.parseInt(userIsNew));
|
||||
// ivGrade.setGrade(rankIcon);
|
||||
// ivTitle.setLabelView(user_title);
|
||||
// ivNHobility.setNobility(nobilityIcon);
|
||||
// ImageUtils.loadIcon(charmIcon, helper.getView(R.id.iv_charm));
|
||||
// tvName.setText(Html.fromHtml(nickname));
|
||||
// if (emMessage.getIntAttribute("type", 0) == 6019) {//亮球
|
||||
// helper.setVisible(R.id.iv_qiu1, true);
|
||||
// helper.setVisible(R.id.iv_qiu2, true);
|
||||
// helper.setVisible(R.id.iv_qiu3, true);
|
||||
//
|
||||
// try {
|
||||
// helper.setImageResource(R.id.iv_qiu1, mContext.getResources().getIdentifier(first, "mipmap", mContext.getPackageName()));
|
||||
// helper.setImageResource(R.id.iv_qiu2, mContext.getResources().getIdentifier(second, "mipmap", mContext.getPackageName()));
|
||||
// helper.setImageResource(R.id.iv_qiu3, mContext.getResources().getIdentifier(third, "mipmap", mContext.getPackageName()));
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//
|
||||
// } else {
|
||||
// helper.setVisible(R.id.iv_qiu1, false);
|
||||
// helper.setVisible(R.id.iv_qiu2, false);
|
||||
// helper.setVisible(R.id.iv_qiu3, false);
|
||||
// }
|
||||
// spanUtils.append(spanned);
|
||||
// tvContent8.setText(spanUtils.create());
|
||||
// break;
|
||||
// case 10:
|
||||
// TextView tv = helper.getView(R.id.tv_content);
|
||||
// float height = tv.getTextSize();//获取字体高度
|
||||
// String bell = "<img src=\"" + R.drawable.ease_message_bell + "\"/>"; //前面加一个铃铛
|
||||
// Spanned sp = Html.fromHtml(bell + txtBody.getMessage(), source -> {
|
||||
// Drawable drawable;
|
||||
// drawable = mContext.getResources().getDrawable(Integer.parseInt(source));
|
||||
// drawable.setBounds(0, 0, (int) (height * 36f / 42f), (int) height); //等比例设置铃铛大小
|
||||
// return drawable;
|
||||
// }, null);
|
||||
// tv.setText(sp);
|
||||
// helper.setGone(R.id.tv_red_rain_detail, false);
|
||||
// break;
|
||||
// case 11:
|
||||
// TextView tv11 = helper.getView(R.id.tv_content);
|
||||
// float height11 = tv11.getTextSize();//获取字体高度
|
||||
// String bell11 = "<img src=\"" + R.drawable.ease_message_bell + "\"/>"; //前面加一个铃铛
|
||||
// Spanned sp11 = Html.fromHtml(bell11 + txtBody.getMessage(), source -> {
|
||||
// Drawable drawable;
|
||||
// drawable = mContext.getResources().getDrawable(Integer.parseInt(source));
|
||||
// drawable.setBounds(0, 0, (int) (height11 * 36f / 42f), (int) height11); //等比例设置铃铛大小
|
||||
// return drawable;
|
||||
// }, null);
|
||||
// tv11.setText(sp11);
|
||||
// helper.setGone(R.id.tv_red_rain_detail, true);
|
||||
// helper.addOnClickListener(R.id.tv_red_rain_detail);
|
||||
// break;
|
||||
// default:
|
||||
// helper.setText(R.id.tv_content, Html.fromHtml(txtBody.getMessage()));
|
||||
// break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull BaseViewHolder holder) {
|
||||
Logger.e("onViewRecycled", "onViewRecycled");
|
||||
ImageView ivEmoji = holder.getView(com.xscm.moduleutil.R.id.iv_expression);
|
||||
// ImageView ivGrade = holder.getView(com.qxcm.moduleutil.R.id.iv_grade);
|
||||
ImageView ivNobility = holder.getView(com.xscm.moduleutil.R.id.iv_nobility);
|
||||
ImageView ivCharm = holder.getView(com.xscm.moduleutil.R.id.iv_charm);
|
||||
// ImageView ivTitle = holder.getView(com.qxcm.moduleutil.R.id.iv_title_label);
|
||||
if (mContext instanceof Activity && (((Activity) mContext).isFinishing() || ((Activity) mContext).isDestroyed())) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (ivEmoji != null) {
|
||||
ivEmoji.setImageDrawable(null);
|
||||
Glide.with(ivEmoji.getContext()).clear(ivEmoji);
|
||||
}
|
||||
// if (ivGrade != null) {
|
||||
// ivGrade.setImageDrawable(null);
|
||||
// Glide.with(ivGrade.getContext()).clear(ivGrade);
|
||||
// }
|
||||
if (ivNobility != null) {
|
||||
ivNobility.setImageDrawable(null);
|
||||
Glide.with(ivNobility.getContext()).clear(ivNobility);
|
||||
}
|
||||
if (ivCharm != null) {
|
||||
ivCharm.setImageDrawable(null);
|
||||
Glide.with(ivCharm.getContext()).clear(ivCharm);
|
||||
}
|
||||
|
||||
// if (ivTitle != null) {
|
||||
// ivTitle.setImageDrawable(null);
|
||||
// Glide.with(ivTitle.getContext()).clear(ivTitle);
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除数据
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
public void clearData() {
|
||||
this.mData.clear();
|
||||
userMsgList.clear();
|
||||
systemMsgList.clear();
|
||||
allMsgList.clear();
|
||||
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void clearSomeData() {
|
||||
if (this.mData != null && mData.size() > 500) {
|
||||
List<EMMessageInfo> emMessageInfos = mData.subList(500, mData.size());
|
||||
setNewData(emMessageInfos);
|
||||
}
|
||||
|
||||
if (allMsgList.size() > 500) {
|
||||
allMsgList = allMsgList.subList(500, allMsgList.size());
|
||||
}
|
||||
|
||||
if (userMsgList.size() > 500) {
|
||||
userMsgList = userMsgList.subList(500, userMsgList.size());
|
||||
}
|
||||
|
||||
if (systemMsgList.size() > 500) {
|
||||
systemMsgList = systemMsgList.subList(500, systemMsgList.size());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addData(@NonNull EMMessageInfo data) {
|
||||
|
||||
// 添加到对应的存储列表
|
||||
addToStorageLists(data);
|
||||
|
||||
// 维护数据量限制
|
||||
maintainDataLimits();
|
||||
|
||||
// 根据显示类型决定是否添加到适配器
|
||||
if (shouldAddToAdapter(data)) {
|
||||
super.addData(data);
|
||||
// 确保适配器数据量也不超过限制
|
||||
if (mData.size() > 20) {
|
||||
int removeCount = mData.size() - 20;
|
||||
mData.subList(0, removeCount).clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private void addToStorageLists(EMMessageInfo data) {
|
||||
switch (data.getItemType()) {
|
||||
case 1: // 系统消息
|
||||
allMsgList.add(data);
|
||||
break;
|
||||
case 2: // 用户消息
|
||||
userMsgList.add(data);
|
||||
allMsgList.add(data);
|
||||
break;
|
||||
case 3: // 系统消息类型3
|
||||
systemMsgList.add(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void maintainDataLimits() {
|
||||
// 确保所有存储列表都不超过最大限制
|
||||
trimListToMaxSize(allMsgList);
|
||||
trimListToMaxSize(userMsgList);
|
||||
trimListToMaxSize(systemMsgList);
|
||||
}
|
||||
|
||||
private void trimListToMaxSize(List<EMMessageInfo> list) {
|
||||
if (list.size() > 20) {
|
||||
int removeCount = list.size() - 20;
|
||||
list.subList(0, removeCount).clear();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldAddToAdapter(EMMessageInfo data) {
|
||||
return (listShowType == SHOW_TYPE_ALL && (data.getItemType() == 1 || data.getItemType() == 2)) ||
|
||||
(listShowType == SHOW_TYPE_USER && data.getItemType() == 2) ||
|
||||
(listShowType == SHOW_TYPE_SYSTEM && data.getItemType() == 3);
|
||||
}
|
||||
@Override
|
||||
public void addData(@NonNull Collection<? extends EMMessageInfo> newData) {
|
||||
// super.addData(newData);
|
||||
if (newData == null || newData.size() == 0) {
|
||||
return;
|
||||
}
|
||||
List<EMMessageInfo> list = new ArrayList<>();
|
||||
list.addAll(newData);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
addData(list.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.RewardUserBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.BaseWheatView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称 qipao-android
|
||||
* 包名:com.qpyy.room.adapter
|
||||
* 创建人 黄强
|
||||
* 创建时间 2020/8/6 14:48
|
||||
* 描述 describe
|
||||
*/
|
||||
public class GiftUserAdapter extends BaseQuickAdapter<RewardUserBean, BaseViewHolder> {
|
||||
private int ownerModel = 0;
|
||||
|
||||
|
||||
public GiftUserAdapter() {
|
||||
super(R.layout.room_rv_item_gift_wheat);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RewardUserBean item) {
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.riv_gift_wheat_head_pic));
|
||||
ImageView rivPit = helper.getView(R.id.riv_pit);
|
||||
TextView tvPit = helper.getView(R.id.tv_pit);
|
||||
rivPit.setVisibility(item.isSelect() ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
if (TextUtils.isEmpty(item.getPit_number()) || "0".equals(item.getPit_number())) {
|
||||
helper.setVisible(R.id.tv_pit, false);
|
||||
} else {
|
||||
helper.setVisible(R.id.tv_pit, true);
|
||||
int pitNumber = Integer.parseInt(item.getPit_number());
|
||||
if (pitNumber > 10) {
|
||||
helper.setText(R.id.tv_pit, item.getNickname());
|
||||
} else {
|
||||
helper.setText(R.id.tv_pit, String.format("%s号麦", item.getPit_number()));
|
||||
}
|
||||
if (item.getPit_number().equals("10")) {
|
||||
helper.setText(R.id.tv_pit, "嘉宾");
|
||||
}
|
||||
if (BaseWheatView.WHEAT_HOST.equals(item.getPit_number())) {
|
||||
if (2 == ownerModel || 0 == ownerModel) {
|
||||
helper.setText(R.id.tv_pit, "主持人");
|
||||
} else {
|
||||
helper.setText(R.id.tv_pit, "房主");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (item.isSelect()) {
|
||||
helper.getView(R.id.tv_pit).setBackgroundResource(com.xscm.moduleutil.R.mipmap.gift_show);
|
||||
tvPit.setTextColor(Color.parseColor("#ffffff"));
|
||||
} else {
|
||||
helper.getView(R.id.tv_pit).setBackgroundResource(com.xscm.moduleutil.R.mipmap.gift_show_b);
|
||||
tvPit.setTextColor(Color.parseColor("#ff333333"));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAll() {
|
||||
int count = 0;
|
||||
List<RewardUserBean> data = getData();
|
||||
for (RewardUserBean item : data) {
|
||||
if (item.isSelect()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count > 0 && count == data.size();
|
||||
}
|
||||
|
||||
public void allElection(boolean b) {
|
||||
List<RewardUserBean> data = getData();
|
||||
for (RewardUserBean item : data) {
|
||||
item.setSelect(b);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public int getSelectCount() {
|
||||
int count = 1;
|
||||
List<RewardUserBean> data = getData();
|
||||
for (RewardUserBean item : data) {
|
||||
if (!item.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
if (item.isSelect()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
///获取当前选中的人数
|
||||
public int getUserIdCount(){
|
||||
int count = 0;
|
||||
List<RewardUserBean> data = getData();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
if (!data.get(i).getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
if (data.get(i).isSelect()) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public List<RewardUserBean> getSelectRoomPitUserModel() {
|
||||
List<RewardUserBean> selects = getData();
|
||||
List<RewardUserBean> data = getData();
|
||||
for (RewardUserBean item : data) {
|
||||
if (item.isSelect()) {
|
||||
selects.add(item);
|
||||
}
|
||||
}
|
||||
return selects;
|
||||
}
|
||||
|
||||
public String getUserIdToString() {
|
||||
List<RewardUserBean> data = getData();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
if (!data.get(i).getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
if (data.get(i).isSelect()) {
|
||||
if (sb.length() > 0) {//该步即不会第一位有逗号,也防止最后一位拼接逗号!
|
||||
sb.append(",");
|
||||
}
|
||||
sb.append(data.get(i).getUser_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public String getUserPitToString() {
|
||||
List<RewardUserBean> data = getData();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
if (data.get(i).isSelect()) {
|
||||
if (sb.length() > 0) {//该步即不会第一位有逗号,也防止最后一位拼接逗号!
|
||||
sb.append(",");
|
||||
}
|
||||
if (data != null && data.get(i) != null && data.get(i).getPit_number() != null) {
|
||||
sb.append(data.get(i).getPit_number());
|
||||
} else {
|
||||
sb.append("");
|
||||
}
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
public List<RewardUserBean> getGiftUser() {
|
||||
List<RewardUserBean> data = getData();
|
||||
List<RewardUserBean> giftUserList = new ArrayList<>();
|
||||
for (RewardUserBean item : data) {
|
||||
if (item.isSelect()) {
|
||||
giftUserList.add(item);
|
||||
}
|
||||
}
|
||||
return giftUserList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除所有选中
|
||||
*/
|
||||
public List<String> clearAllSelected() {
|
||||
List<String> ids = new ArrayList<>();
|
||||
List<RewardUserBean> data = getData();
|
||||
for (RewardUserBean item : data) {
|
||||
if (item.isSelect()) {
|
||||
ids.add(item.getUser_id());
|
||||
}
|
||||
item.setSelect(false);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
return ids;
|
||||
}
|
||||
|
||||
public void setOwnerModel(int ownerModel) {
|
||||
this.ownerModel = ownerModel;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public List<String> getAllSelectedIds() {
|
||||
List<String> ids = new ArrayList<>();
|
||||
List<RewardUserBean> data = getData();
|
||||
for (RewardUserBean item : data) {
|
||||
if (item.isSelect()) {
|
||||
|
||||
ids.add(item.getUser_id());
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.RoomAutionTimeBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PkTimeAdapter extends BaseQuickAdapter<RoomAutionTimeBean, BaseViewHolder> {
|
||||
private int selectedRelationPosition = -1;
|
||||
private List<RoomAutionTimeBean> viewItems = new ArrayList<>();
|
||||
public PkTimeAdapter() {
|
||||
super(R.layout.item_relation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomAutionTimeBean item) {
|
||||
TextView relationName = helper.getView(R.id.tv_name);
|
||||
relationName.setText( item.getDays()+"分钟");
|
||||
|
||||
if (item.isSelected()) {
|
||||
relationName.setBackground(helper.itemView.getResources().getDrawable(com.xscm.moduleutil.R.mipmap.pk_time_t));
|
||||
relationName.setTextColor(helper.itemView.getResources().getColor(com.xscm.moduleutil.R.color.color_0DFFB9));
|
||||
} else {
|
||||
relationName.setBackground(helper.itemView.getResources().getDrawable(com.xscm.moduleutil.R.mipmap.pk_time_f));
|
||||
relationName.setTextColor(helper.itemView.getResources().getColor(com.xscm.moduleutil.R.color.color_FF333333));
|
||||
}
|
||||
|
||||
helper.itemView.setOnClickListener(v -> {
|
||||
int currentPosition = helper.getLayoutPosition();
|
||||
if (selectedRelationPosition == currentPosition) return; // 避免重复点击
|
||||
|
||||
if (selectedRelationPosition != -1) {
|
||||
getData().get(selectedRelationPosition).setSelected(false);
|
||||
notifyItemChanged(selectedRelationPosition);
|
||||
}
|
||||
|
||||
item.setSelected(true);
|
||||
selectedRelationPosition = currentPosition;
|
||||
notifyItemChanged(currentPosition);
|
||||
});
|
||||
}
|
||||
|
||||
public RoomAutionTimeBean getSelectedTime() {
|
||||
if (selectedRelationPosition != -1 && selectedRelationPosition < getData().size()) {
|
||||
return getData().get(selectedRelationPosition);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import static com.xscm.moduleutil.utils.UtilConfig.getContext;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RankingAutcionAdapter extends BaseQuickAdapter<RoomAuction.AuctionListBean, BaseViewHolder> {
|
||||
|
||||
private static String GG = "0";
|
||||
private static String MM = "1";
|
||||
|
||||
public RankingAutcionAdapter() {
|
||||
super(R.layout.item_ranking_auction);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull BaseViewHolder holder) {
|
||||
Logger.e("onViewRecycled", "onViewRecycled");
|
||||
ImageView ivEmoji = holder.getView(R.id.room_item_head);
|
||||
ImageView ivGrade = holder.getView(R.id.room_item_grade);
|
||||
ImageView ivNobility = holder.getView(R.id.room_item_rank);
|
||||
if (ivEmoji != null) {
|
||||
ivEmoji.setImageDrawable(null);
|
||||
Glide.with(ivEmoji.getContext()).clear(ivEmoji);
|
||||
}
|
||||
if (ivGrade != null) {
|
||||
ivGrade.setImageDrawable(null);
|
||||
Glide.with(ivGrade.getContext()).clear(ivGrade);
|
||||
}
|
||||
if (ivNobility != null) {
|
||||
ivNobility.setImageDrawable(null);
|
||||
Glide.with(ivNobility.getContext()).clear(ivNobility);
|
||||
}
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomAuction.AuctionListBean item) {
|
||||
helper.setText(R.id.room_item_seq, String.valueOf(helper.getAdapterPosition() + 4));//从第四个开始设置值
|
||||
helper.setText(R.id.room_item_name, item.getNickname());
|
||||
helper.setText(R.id.room_item_pop, item.getGift_prices());
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.room_item_head));
|
||||
helper.addOnClickListener(R.id.room_item_head);
|
||||
|
||||
LinearLayout llContainer =helper.getView(R.id.lli);
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = item.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_37),
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import static com.xscm.moduleutil.utils.UtilConfig.getContext;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.CharmRankingResp;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/7/16
|
||||
*@description: 房间榜单适配器
|
||||
*/
|
||||
public class RankingCharmListAdapter extends BaseQuickAdapter<CharmRankingResp, BaseViewHolder> {
|
||||
|
||||
private static String GG = "0";
|
||||
private static String MM = "1";
|
||||
|
||||
public RankingCharmListAdapter() {
|
||||
super(R.layout.room_rv_item_ranking_rich);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, CharmRankingResp item) {
|
||||
//数据绑定赋值
|
||||
helper.setText(R.id.room_item_seq, String.valueOf(helper.getAdapterPosition() + 4));//从第四个开始设置值
|
||||
helper.setText(R.id.room_item_name, item.getNickname());
|
||||
helper.setText(R.id.room_item_pop, item.getTotal());
|
||||
// if (GG.equals(item.getSex())) {
|
||||
// helper.setBackgroundRes(R.id.room_item_pop, R.mipmap.room_bg_wheat_charm_gg_sr);
|
||||
// } else {
|
||||
// helper.setBackgroundRes(R.id.room_item_pop, R.mipmap.room_bg_wheat_charm_mm_sr);
|
||||
// }
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.room_item_head));
|
||||
// if (TextUtils.isEmpty(nobility)) {
|
||||
// helper.getView(R.id.room_item_grade).setVisibility(View.GONE);
|
||||
// } else {
|
||||
// helper.getView(R.id.room_item_grade).setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// if (TextUtils.isEmpty(status)) {
|
||||
// helper.getView(R.id.room_item_rank).setVisibility(View.GONE);
|
||||
// } else {
|
||||
// helper.getView(R.id.room_item_rank).setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// TextView textView = helper.getView(R.id.room_item_pop);
|
||||
// if (helper.getAdapterPosition() % 2 == 1) {
|
||||
// helper.getView(R.id.room_item_bg).setVisibility(View.GONE);//隔开隐藏背景
|
||||
// } else {
|
||||
// helper.getView(R.id.room_item_bg).setVisibility(View.VISIBLE);
|
||||
// }
|
||||
helper.addOnClickListener(R.id.room_item_head);
|
||||
LinearLayout ll = helper.getView(R.id.bnv_rank_list_rich);
|
||||
List<String> images = item.getIcon(); // 获取图片列表
|
||||
ll.removeAllViews();
|
||||
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_37),
|
||||
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);
|
||||
|
||||
ll.addView(imageView1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull BaseViewHolder holder) {
|
||||
Logger.e("onViewRecycled", "onViewRecycled");
|
||||
ImageView ivEmoji = holder.getView(R.id.room_item_head);
|
||||
ImageView ivGrade = holder.getView(R.id.room_item_grade);
|
||||
ImageView ivNobility = holder.getView(R.id.room_item_rank);
|
||||
if (ivEmoji != null) {
|
||||
ivEmoji.setImageDrawable(null);
|
||||
Glide.with(ivEmoji.getContext()).clear(ivEmoji);
|
||||
}
|
||||
if (ivGrade != null) {
|
||||
ivGrade.setImageDrawable(null);
|
||||
Glide.with(ivGrade.getContext()).clear(ivGrade);
|
||||
}
|
||||
if (ivNobility != null) {
|
||||
ivNobility.setImageDrawable(null);
|
||||
Glide.with(ivNobility.getContext()).clear(ivNobility);
|
||||
}
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.WealthRankingResp;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
import com.xscm.moduleutil.widget.BeautifulNameView;
|
||||
|
||||
/**
|
||||
* 项目名称 qipao-android
|
||||
* 包名:com.qpyy.room.adapter
|
||||
* 创建人 黄强
|
||||
* 创建时间 2020/7/25 10:37
|
||||
* 描述 describe
|
||||
*/
|
||||
public class RankingWealthListAdapter extends BaseQuickAdapter<WealthRankingResp.ListsBean, BaseViewHolder> {
|
||||
|
||||
public RankingWealthListAdapter() {
|
||||
super(R.layout.room_rv_item_ranking_rich);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, WealthRankingResp.ListsBean item) {
|
||||
//数据绑定赋值
|
||||
helper.setText(R.id.room_item_seq, String.valueOf(helper.getAdapterPosition() + 4));//从第四个开始设置值
|
||||
helper.setText(R.id.room_item_name, item.getNickname());
|
||||
// ((BeautifulNameView) helper.getView(R.id.bnv_rank_list_rich)).setText(String.format(mContext.getResources().getString(R.string.common_id_formatter), item.getUser_code()));
|
||||
// ((BeautifulNameView) helper.getView(R.id.bnv_rank_list_rich)).setTextColor(!TextUtils.isEmpty(item.getId_color()) ? Color.parseColor(item.getId_color()) : mContext.getResources().getColor(R.color.color_FFCCCCCC));
|
||||
((BeautifulNameView) helper.getView(R.id.bnv_rank_list_rich)).setPlay(!TextUtils.isEmpty(item.getId_color()));
|
||||
((BeautifulNameView) helper.getView(R.id.bnv_rank_list_rich)).setImgVisible("1".equals(item.getGood_number()));
|
||||
helper.setText(R.id.room_item_pop, item.getNumber_format());
|
||||
ImageUtils.loadHeadCC(item.getHead_picture(), helper.getView(R.id.room_item_head));
|
||||
String nobility = item.getLevel_icon();//等级
|
||||
String status = item.getNobility_icon();//爵位
|
||||
ImageUtils.loadImageView(item.getNobility_icon(), helper.getView(R.id.room_item_rank));
|
||||
ImageUtils.loadImageView(item.getLevel_icon(), helper.getView(R.id.room_item_grade));
|
||||
if (TextUtils.isEmpty(nobility)) {
|
||||
helper.getView(R.id.room_item_grade).setVisibility(View.GONE);
|
||||
} else {
|
||||
helper.getView(R.id.room_item_grade).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (TextUtils.isEmpty(status)) {
|
||||
helper.getView(R.id.room_item_rank).setVisibility(View.GONE);
|
||||
} else {
|
||||
helper.getView(R.id.room_item_rank).setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (helper.getAdapterPosition() % 2 == 1) {
|
||||
helper.getView(R.id.room_item_bg).setVisibility(View.GONE);//隔开隐藏背景
|
||||
} else {
|
||||
helper.getView(R.id.room_item_bg).setVisibility(View.VISIBLE);//隔开隐藏背景
|
||||
}
|
||||
helper.addOnClickListener(R.id.room_item_head);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRecycled(@NonNull BaseViewHolder holder) {
|
||||
Logger.e("onViewRecycled", "onViewRecycled");
|
||||
ImageView ivEmoji = holder.getView(R.id.room_item_head);
|
||||
ImageView ivGrade = holder.getView(R.id.room_item_grade);
|
||||
ImageView ivNobility = holder.getView(R.id.room_item_rank);
|
||||
if (ivEmoji != null) {
|
||||
ivEmoji.setImageDrawable(null);
|
||||
Glide.with(ivEmoji.getContext()).clear(ivEmoji);
|
||||
}
|
||||
if (ivGrade != null) {
|
||||
ivGrade.setImageDrawable(null);
|
||||
Glide.with(ivGrade.getContext()).clear(ivGrade);
|
||||
}
|
||||
if (ivNobility != null) {
|
||||
ivNobility.setImageDrawable(null);
|
||||
Glide.with(ivNobility.getContext()).clear(ivNobility);
|
||||
}
|
||||
super.onViewRecycled(holder);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.RelationshipBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.TimeUtils;
|
||||
|
||||
|
||||
public class RelationshipAdapter extends BaseQuickAdapter<RelationshipBean, com.chad.library.adapter.base.BaseViewHolder> {
|
||||
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public RelationshipAdapter() {
|
||||
super(R.layout.item_relationship);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void convert(com.chad.library.adapter.base.BaseViewHolder helper, RelationshipBean item) {
|
||||
if (item.getType() == 1){
|
||||
helper.getView(R.id.ll).setBackgroundResource(com.xscm.moduleutil.R.mipmap.guxi_k);
|
||||
}else if (item.getType() == 2){
|
||||
helper.getView(R.id.ll).setBackgroundResource(com.xscm.moduleutil.R.mipmap.guxi_w);
|
||||
}
|
||||
ImageUtils.loadHeadCC(item.getAvatar1(), helper.getView(R.id.user_nav1));
|
||||
ImageUtils.loadHeadCC(item.getAvatar2(), helper.getView(R.id.user_nav2));
|
||||
helper.setText(R.id.tv_nickname1, item.getNickname1());
|
||||
helper.setText(R.id.tv_nickname2, item.getNickname2());
|
||||
helper.setText(R.id.tv_relation, item.getRelation_name());
|
||||
LogUtils.e("lxj",Long.parseLong(item.getEnd_time())-System.currentTimeMillis());
|
||||
helper.setText(R.id.tv_time, TimeUtils.formatDuration2(Long.parseLong(item.getEnd_time())*1000-System.currentTimeMillis()));
|
||||
if (item.getUser_id1()== SpUtil.getUserId() || item.getUser_id2() == SpUtil.getUserId()){
|
||||
helper.getView(R.id.im_zhid).setVisibility(View.VISIBLE);
|
||||
helper.getView(R.id.im_shanchu).setVisibility(View.VISIBLE);
|
||||
}else {
|
||||
helper.getView(R.id.im_zhid).setVisibility(View.GONE);
|
||||
helper.getView(R.id.im_shanchu).setVisibility(View.GONE);
|
||||
}
|
||||
helper.getView(R.id.im_shanchu).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onItemClickListener!= null) {
|
||||
onItemClickListener.onItemClick(view, item, helper.getLayoutPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
helper.getView(R.id.im_zhid).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (onItemClickListener!= null) {
|
||||
onItemClickListener.onItemClick(view, item, helper.getLayoutPosition());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(View view, RelationshipBean data, int position);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import static com.xscm.moduleutil.utils.UtilConfig.getContext;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.RoomUserCharmListBean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.MeHeadView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/9/10
|
||||
*@description: 魅力详情适配器
|
||||
*/
|
||||
public class RoomCharmAdapter extends BaseQuickAdapter<RoomUserCharmListBean, BaseViewHolder> {
|
||||
public RoomCharmAdapter() {
|
||||
super(R.layout.item_charm_dialog);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomUserCharmListBean item) {
|
||||
helper.setText(R.id.tv_nick_name, item.getNickname());
|
||||
helper.setText(R.id.tv_charm, item.getCharm()+"");
|
||||
helper.setText(R.id.tv_user_id,"ID:"+item.getUser_code());
|
||||
MeHeadView headView = helper.getView(R.id.im_user);
|
||||
headView.setData(item.getAvatar(), "", "");
|
||||
|
||||
LinearLayout llContainer =helper.getView(R.id.ll_in);
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
if (item.getIcon() == null){
|
||||
return;
|
||||
}
|
||||
List<String> images = item.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_37),
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/23
|
||||
* @description: 在线列表适配器
|
||||
*/
|
||||
public class RoomOnlineAdapter extends BaseMultiItemQuickAdapter<RoomOnlineBean, BaseViewHolder> {
|
||||
/**
|
||||
* Same as QuickAdapter#QuickAdapter(Context,int) but with
|
||||
* some initialization data.
|
||||
*
|
||||
* @param data A new list is created out of this one to avoid mutable list
|
||||
*/
|
||||
public RoomOnlineAdapter(List<RoomOnlineBean> data) {
|
||||
super(data);
|
||||
addItemType(1, R.layout.item_room_online_text);
|
||||
addItemType(2, R.layout.item_onlie_room);
|
||||
}
|
||||
|
||||
|
||||
// 接口定义
|
||||
public interface OnJoinButtonClickListener {
|
||||
void onJoinButtonClick(RoomOnlineBean item);
|
||||
|
||||
void onUserInfoClick(RoomOnlineBean item);
|
||||
}
|
||||
|
||||
private OnJoinButtonClickListener listener;
|
||||
|
||||
public void setListener(OnJoinButtonClickListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomOnlineBean item) {
|
||||
if (item.getItemType() == 1) {
|
||||
helper.setText(R.id.maishang, item.getTypeNames());
|
||||
} else if (item.getItemType() == 2) {
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), helper.getView(R.id.like_avatar));
|
||||
helper.setText(R.id.tv_nickname, item.getNickname());
|
||||
ImageView imageView = helper.getView(R.id.im_i);
|
||||
TextView textView = helper.getView(R.id.tv_status);
|
||||
imageView.setVisibility(VISIBLE);
|
||||
if (item.getRole().equals("1")) {
|
||||
imageView.setImageResource(com.xscm.moduleutil.R.mipmap.fangz);
|
||||
} else if (item.getRole().equals("2")) {
|
||||
imageView.setImageResource(com.xscm.moduleutil.R.mipmap.gly);
|
||||
} else if (item.getRole().equals("3")) {
|
||||
imageView.setImageResource(com.xscm.moduleutil.R.mipmap.zc);
|
||||
} else if (item.getRole().equals("4")) {
|
||||
helper.getView(R.id.im_i).setVisibility(GONE);
|
||||
// imageView.setImageResource(com.qxcm.moduleutil.R.mipmap.jb);
|
||||
} else {
|
||||
helper.getView(R.id.im_i).setVisibility(GONE);
|
||||
}
|
||||
// if (item.getType() == 1){
|
||||
//
|
||||
// }
|
||||
if (item.getType() == 2 && item.getType_pit() == 1) {
|
||||
textView.setVisibility(GONE);
|
||||
} else {
|
||||
textView.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
// else if (item.getType() == 2 && item.getType_pit() == 2){
|
||||
// textView.setVisibility(VISIBLE);
|
||||
// }else if (item.getType() == 1 && item.getType_pit() == 0){
|
||||
// textView.setVisibility(GONE);
|
||||
// }
|
||||
|
||||
textView.setText(item.getPit_number() != 0 ? (item.getPit_number() == 9 ? "主持" : (item.getPit_number() == 10 ? "嘉宾" : item.getPit_number()+ "号麦")) : "抱麦");
|
||||
|
||||
textView.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||
|
||||
LinearLayout llContainer = helper.getView(R.id.line);
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = item.getIcon(); // 获取图片列表
|
||||
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(helper.itemView.getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, helper.itemView.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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
helper.getView(R.id.tv_status).setOnClickListener(v -> {
|
||||
if (textView.getText().toString().equals("抱麦")) {
|
||||
if (listener != null) {
|
||||
listener.onJoinButtonClick(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
helper.itemView.setOnClickListener(v -> {
|
||||
if (listener != null) {
|
||||
listener.onUserInfoClick(item);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.room.RoomSettingBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBean, BaseViewHolder> {
|
||||
|
||||
public RoomSettingAdapter(List<RoomSettingBean> data) {
|
||||
super(data);
|
||||
addItemType(RoomSettingBean.ITEM_TYPE_DEFAULT, R.layout.item_title);
|
||||
addItemType(RoomSettingBean.ITEM_TYPE_WITH_ICON, R.layout.item_setting);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder holder, RoomSettingBean item) {
|
||||
|
||||
if (item.getItemType() == RoomSettingBean.ITEM_TYPE_DEFAULT) {
|
||||
holder.setVisible(R.id.tv_title, true);
|
||||
holder.setText(R.id.tv_title, item.getName());
|
||||
} else {
|
||||
holder.setText(R.id.tv_name, getName(item.getType(), item.isSelect(), item.getName()));
|
||||
holder.setImageResource(R.id.iv_icon, getIconResId(item.getType(), item.isSelect()));
|
||||
}
|
||||
}
|
||||
|
||||
private String getName(int type, boolean isSelected, String name) {
|
||||
boolean b = isSelected;
|
||||
switch (type) {
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomOrderMic:
|
||||
return b ? "排麦模式" : "自由模式";
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomCloseEffects:
|
||||
return b ? "关闭特效" : "开启特效";
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||
return b ? "关闭飘屏" : "开启飘屏";
|
||||
default:
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
// 根据 type 获取对应的图标资源 ID
|
||||
private int getIconResId(int type, boolean isSelected) {
|
||||
boolean b = isSelected;
|
||||
switch (type) {
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomTypeSing:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_sing;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomTypeAuction:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_auction;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomTypeBoy:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_boy;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomTypeGirl:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_girl;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_jiaoy;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU:
|
||||
return com.xscm.moduleutil.R.mipmap.huyu;
|
||||
// 常用工具
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomSubsidy:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_subsidy;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomCompere:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_compere;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomClearMessage:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_clear_message;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomOrderMic:
|
||||
return b ? com.xscm.moduleutil.R.mipmap.ic_order_mic : com.xscm.moduleutil.R.mipmap.ic_order_mic_selected;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomBgMusic:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_bg_music;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomBgImage:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_bg_image;
|
||||
// 更多操作
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomLeave:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_leave;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomShare:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_share;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomMyDress:
|
||||
return com.xscm.moduleutil.R.mipmap.tiaoyint;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomSetting:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_room_setting;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomWelcome:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_welcome;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomCloseEffects:
|
||||
return b ? com.xscm.moduleutil.R.mipmap.ic_close_effects : com.xscm.moduleutil.R.mipmap.ic_open_effects;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomReport:
|
||||
return com.xscm.moduleutil.R.mipmap.ic_report;
|
||||
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||
return b ? com.xscm.moduleutil.R.mipmap.ic_close_floating_screen : com.xscm.moduleutil.R.mipmap.ic_open_floating_screen;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.xscm.moduleutil.bean.MixerResp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/22
|
||||
*@description: 混响选择
|
||||
*/
|
||||
public class TunerListAdapter extends BaseQuickAdapter<MixerResp, BaseViewHolder> {
|
||||
private int index = 0;
|
||||
private SparseBooleanArray selectedPositions = new SparseBooleanArray();
|
||||
private final List<Integer> mSelectedPositions = new ArrayList<>();
|
||||
int type;
|
||||
public TunerListAdapter(int type) {
|
||||
super(R.layout.room_rv_item_tuner);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
notifyDataSetChanged();
|
||||
// setIndex(0); // 默认选择第一个项
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, MixerResp item) {
|
||||
|
||||
int position = helper.getLayoutPosition();
|
||||
RoundedImageView rivPit = helper.getView(R.id.iv_tuner_pic);
|
||||
RoundedImageView rivPit2 = helper.getView(R.id.iv_tuner_pic2);
|
||||
View checkbox = helper.getView(R.id.v_checkbox);
|
||||
TextView tvName = helper.getView(R.id.name);
|
||||
|
||||
boolean isSelected = index == helper.getLayoutPosition();
|
||||
checkbox.setSelected(isSelected);
|
||||
|
||||
|
||||
if (type==1){
|
||||
tvName.setVisibility(View.GONE);
|
||||
rivPit.setVisibility(View.VISIBLE);
|
||||
rivPit.setImageResource(item.getImgUrtl());
|
||||
rivPit2.setVisibility(View.GONE);
|
||||
|
||||
}else {
|
||||
tvName.setVisibility(View.VISIBLE);
|
||||
tvName.setText(item.getName());
|
||||
rivPit.setVisibility(View.GONE);
|
||||
rivPit2.setVisibility(View.VISIBLE);
|
||||
rivPit2.setImageResource(item.getImgUrtl());
|
||||
}
|
||||
// 判断当前项是否被选中
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package com.example.moduleroom.adapter;
|
||||
|
||||
import android.util.SparseBooleanArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WheatFeedingSelectAdapter extends RecyclerView.Adapter<WheatFeedingSelectAdapter.ViewHolder> {
|
||||
|
||||
private final List<RoomApplyListBean.Special> mData;
|
||||
private final List<Integer> mSelectedPositions = new ArrayList<>();
|
||||
private SparseBooleanArray selectedPositions = new SparseBooleanArray();
|
||||
public WheatFeedingSelectAdapter(List<RoomApplyListBean.Special> data) {
|
||||
this.mData = data;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.item_wheat_feeding_select, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
|
||||
RoomApplyListBean.Special item = mData.get(position);
|
||||
boolean isSelected = selectedPositions.get(position, false);
|
||||
holder.nickname.setText(item.getNickname());
|
||||
holder.jin_e.setText(item.getRank_value());
|
||||
ImageUtils.loadHeadCC(item.getAvatar(), holder.userAvatar);
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(holder.tv_bm, ColorManager.getInstance().getPrimaryColorInt(), 65);
|
||||
holder.tv_bm.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
holder.checkbox.setSelected(isSelected);
|
||||
holder.checkbox.setOnClickListener(v -> {
|
||||
boolean newState = !isSelected;
|
||||
selectedPositions.put(position, newState);
|
||||
holder.checkbox.setSelected(newState);
|
||||
notifyItemChanged(position); // 刷新当前项
|
||||
if (newState) {
|
||||
mSelectedPositions.add(position);
|
||||
} else {
|
||||
mSelectedPositions.remove(Integer.valueOf(position)); // 修改这里
|
||||
}
|
||||
});
|
||||
holder.tv_bm.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onTvBmClick(item,position);
|
||||
}
|
||||
});
|
||||
// holder.itemView.setOnClickListener(v -> toggleSelection(position));
|
||||
|
||||
}
|
||||
public interface OnItemClickListener {
|
||||
void onTvBmClick(RoomApplyListBean.Special item,int position);
|
||||
}
|
||||
private OnItemClickListener onItemClickListener;
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
|
||||
|
||||
public void toggleSelection(int position) {
|
||||
if (mSelectedPositions.contains(position)) {
|
||||
mSelectedPositions.remove(Integer.valueOf(position));
|
||||
} else {
|
||||
mSelectedPositions.add(position);
|
||||
}
|
||||
notifyItemChanged(position);
|
||||
}
|
||||
|
||||
public List<String> getSelectedItems() {
|
||||
List<String> selected = new ArrayList<>();
|
||||
for (int pos : mSelectedPositions) {
|
||||
selected.add(mData.get(pos).getUser_id());
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mData.size();
|
||||
}
|
||||
|
||||
static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
RoundedImageView userAvatar;
|
||||
TextView nickname;
|
||||
TextView jin_e;
|
||||
TextView tv_bm;
|
||||
View checkbox ;
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
userAvatar = itemView.findViewById(R.id.user_avatar);
|
||||
nickname = itemView.findViewById(R.id.nick_name);
|
||||
jin_e = itemView.findViewById(R.id.jin_e);
|
||||
tv_bm = itemView.findViewById(R.id.tv_bm);
|
||||
checkbox = itemView.findViewById(R.id.v_checkbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BidListContacts {
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
void roomAuctionList(List<RoomAuction.AuctionListBean> auctionListBean);
|
||||
void setNo1(RoomAuction.AuctionListBean listsBean);
|
||||
void setNo2(RoomAuction.AuctionListBean listsBean);
|
||||
void setNo3(RoomAuction.AuctionListBean listsBean);
|
||||
void setCharmEmpty();
|
||||
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void roomAuctionList(String auction_id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.RoomTime;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class CardRelationshipContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void roomRelationList(List<RoomRelationBean> roomRelationBeans);
|
||||
void setGiftList(List<RoonGiftModel> roonGiftModels);
|
||||
void roomAuction(AuctionBean auctionBean);
|
||||
void roomAuctionTime(RoomTime roomTime);
|
||||
}
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void roomRelationList(String type);
|
||||
|
||||
void getGiftList(String id);
|
||||
|
||||
void roomAuction(String roomId, String userId,String giftId, String relation_id, String auction_type, String time_day);
|
||||
void roomAuctionTime(String gift_id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.CharmRankingResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/10
|
||||
*@description: 排行榜对应的接口
|
||||
*/
|
||||
public class DataListContacts {
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
//榜一更新
|
||||
void setNo1(CharmRankingResp listsBean);
|
||||
//榜二更新
|
||||
void setNo2(CharmRankingResp listsBean);
|
||||
//榜三更新
|
||||
void setNo3(CharmRankingResp listsBean);
|
||||
//魅力榜和魅力榜界面更新
|
||||
|
||||
void setCharmEmpty( List<CharmRankingResp> list);
|
||||
|
||||
void setWealthEmpty(List<CharmRankingResp> list);
|
||||
}
|
||||
public interface IRoomDataListPre extends IPresenter {
|
||||
|
||||
//定义魅力榜数据访问接口
|
||||
void getCharmListInfo(String roomId,String type, String time_type, String page, String page_limit);
|
||||
|
||||
//定义财富榜数据访问接口
|
||||
void getWealthListInfo(String roomId, String type, String time_type, String page, String page_limit);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
|
||||
public class FriendshipRoomContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void applyPit();
|
||||
|
||||
void endFriend(FriendUserBean friendUserBean);
|
||||
|
||||
void createRelation();
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void applyPit(String roomId, String pitNumber);
|
||||
|
||||
void startFriend(String roomId);
|
||||
|
||||
void delay(String friend_id,String room_id,String delay_times);
|
||||
|
||||
void endFriend(String friend_id,String room_id);
|
||||
|
||||
void createRelation(String room_id,String friend_id,String user1_id,String user2_id,String relation_id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
|
||||
public class PkTimeContract {
|
||||
public interface View extends IView<Activity> {
|
||||
void startPk();
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void startPk(String pk_id,String pk_times);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
|
||||
|
||||
public final class PublicScreenEaseChatContacts {
|
||||
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
}
|
||||
|
||||
public interface IPublicScreenEaseChatPre extends IPresenter {
|
||||
void logEmchat(int code,String msg,String toChatUsername);
|
||||
|
||||
void switchPublicScreen(String room_id,String status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.HeadlineBean;
|
||||
|
||||
public class PublishCommentContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void sendHeadine();
|
||||
void currentHeadline(HeadlineBean headlineBean);
|
||||
}
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void sendHeadine(String content,String money,String roomId);
|
||||
|
||||
void currentHeadline();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.MusicSongBean;
|
||||
import com.xscm.moduleutil.bean.SongMusicBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RequestContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void songList(List<MusicSongBean> musicSongBeans);
|
||||
|
||||
void upSong(String s);
|
||||
|
||||
void song(List<SongMusicBean> music);
|
||||
|
||||
}
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void songList(String roomId);
|
||||
|
||||
void upSong(String did,String type);
|
||||
|
||||
void song(String roomId,String user_id,String song_code,String song_name,String singer,String poster,String duration);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomAuctionContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void applyPit();
|
||||
|
||||
void roomAuction(AuctionBean auctionBean);
|
||||
|
||||
void auctionDelay();
|
||||
void auctionEnd();
|
||||
void auctionMode();
|
||||
void userOnlineStatus(List<UserOnlineStatusBean> list);
|
||||
|
||||
}
|
||||
|
||||
public interface IRoomDataListPre extends IPresenter {
|
||||
void applyPit(String roomId, String pitNumber);
|
||||
|
||||
void roomAuction(String roomId, String userId,String giftId, String relation_id, String auction_type, String time_day);
|
||||
|
||||
void auctionDelay(String auctionId);
|
||||
void auctionEnd(String auctionId,String roomId);
|
||||
|
||||
void auctionMode(String roomId,String labelId);
|
||||
void userOnlineStatus(String userId, String roomid);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.RoomBgBean;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class RoomBackgroundContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void getBackgroundList(RoomBgBean list);
|
||||
void upLoadSuccess(String url, int type, int index, int total);
|
||||
void uploadBgImage();
|
||||
void editRoom();
|
||||
}
|
||||
|
||||
public interface RoomBackgroudPre extends IPresenter {
|
||||
void getBackgroundList();
|
||||
|
||||
void uploadFile(File file, int type, int index, int sice);
|
||||
|
||||
void uploadBgImage(String id, String image_url);
|
||||
|
||||
void editRoom(String room_id, String room_name, String room_cover, String room_intro,String room_background_id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
|
||||
public class RoomCabinContacts {
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
void quitRoom();
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void quitRoom(String roomId, String userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.RoomUserCharmListBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomCharmDialogContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void roomUserCharmList(List<RoomUserCharmListBean> roomUserCharmListBeans);
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
|
||||
void roomUserCharmList(String room_id, String user_id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
|
||||
public class RoomChartsContacts {
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.GiftUserWallBean;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.room.CloseBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomConcernDean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomCloseContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
// TODO: 2025/3/10 获取亲密关系
|
||||
void roomRelationList(List<RoomRelationBean> list);
|
||||
|
||||
}
|
||||
|
||||
public interface IRoomToolPre extends IPresenter {
|
||||
// TODO: 2025/3/10 获取亲密关系
|
||||
void roomRelationList(String type);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
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 java.util.List;
|
||||
|
||||
public class RoomContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void roomInfo(RoomInfoResp resp);
|
||||
|
||||
void showPasswordDialog();
|
||||
|
||||
void enterFail();
|
||||
|
||||
void getRoomOnline(RoomOnline onlineBean);
|
||||
|
||||
void applyPit();
|
||||
|
||||
void downPit();
|
||||
|
||||
void applySong();
|
||||
|
||||
void agreeSong();
|
||||
|
||||
void postRoomInfo(RoomInfoResp resp);
|
||||
|
||||
void getCharmRank(List<RoomCharmRankBean> list);
|
||||
|
||||
void changeSong();
|
||||
|
||||
void hostUserPit();
|
||||
|
||||
void quitRoom();
|
||||
void quitRoom2(String roomId);
|
||||
|
||||
void userGuanzSuccess(String s);
|
||||
|
||||
void acceptPk();
|
||||
|
||||
void clearUserCharm();
|
||||
|
||||
void userOnlineStatus(List<UserOnlineStatusBean> list);
|
||||
|
||||
void findRoom();
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void getRoomIn(String roomId, String password);//加入房间
|
||||
|
||||
void getRoomOnline(String roomId, String page, String page_limit);
|
||||
|
||||
void applyPit(String roomId, String pitNumber);
|
||||
|
||||
void downPit(String roomId, String pitNumber);
|
||||
|
||||
void applySong(String roomId);
|
||||
|
||||
void agreeSong(String roomId, String type);//申请点唱模式 type:1同意 2拒绝
|
||||
|
||||
void endSong(String roomId);
|
||||
|
||||
void postRoomInfo(String roomId);
|
||||
|
||||
void getCharmRank(String roomId);
|
||||
|
||||
void changeSong(String roomId, String now_did);
|
||||
|
||||
void hostUserPit(String roomId, String pitNumber, String userId, String type);
|
||||
|
||||
void quitRoom(String roomId, String userId);
|
||||
void quitRoom2(String roomId, String userId);
|
||||
|
||||
void userGuanz(String userId, String type);
|
||||
|
||||
void acceptPk(String pkId, String type);
|
||||
|
||||
void clearUserCharm(String roomId, String userId);//清除魅力值
|
||||
|
||||
void userOnlineStatus(String userId, String roomid);
|
||||
|
||||
void auctionEnd(String auctionId,String roomId);
|
||||
|
||||
void auctionDelay(String auctionId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.HostBean;
|
||||
import com.xscm.moduleutil.bean.RoomSearchResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomHostContacts {
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
void setHostrList(List<HostBean> list);
|
||||
|
||||
void getUserHostList(List<RoomSearchResp> list);
|
||||
|
||||
void postHostAdd(String s,String type,String is_add);
|
||||
|
||||
void postPresidedRatio(String s);
|
||||
|
||||
void postPresidedDel(String s);
|
||||
void doDismiss();
|
||||
}
|
||||
|
||||
public interface IRoomToolPre extends IPresenter {
|
||||
void clearHostList(String roomId,String type);
|
||||
|
||||
void setUserHostList(String roomId,String type);
|
||||
void setPresidedRatio(String room_id,String id, String ratio);
|
||||
|
||||
void postHostAdd(String roomId, String userId,String type,String is_add);
|
||||
|
||||
// void presidedDel(String id);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
|
||||
|
||||
public final class RoomPasswordSetContacts {
|
||||
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
void roomPasswordSettingSuccess();
|
||||
}
|
||||
|
||||
public interface IRoomPasswordSetPre extends IPresenter {
|
||||
void setRoomPassword(String roomId, String password);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.room.RoomBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RoomPkContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void searchPkRoom(List<RoomBean> roomBeans);
|
||||
|
||||
void sendPk();
|
||||
void refusePk();
|
||||
|
||||
void finishLoading();
|
||||
}
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void searchPkRoom(String roomId,String page,String limit);
|
||||
|
||||
void sendPk(String roomIda,String createUserId, String roomIdb);
|
||||
|
||||
void refusePk(String roomId,String is_pk);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.room.RoomSettingBean;
|
||||
|
||||
public class RoomSettingContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void changeRoomSuccess(String s,int position,RoomSettingBean bean);
|
||||
|
||||
void changeRoomType(String s);
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
|
||||
void changeRoom(String roomId, String userId, int position, RoomSettingBean bean);
|
||||
|
||||
void changeRoomType(String roomId,String type);//修改房间类型 type:1点唱、2拍卖、3男神、4女神
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.RelationCardBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
|
||||
public class RoomUserContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void getRoomUserInfo(UserInfo userInfo);
|
||||
|
||||
void downPit();
|
||||
|
||||
void kickOutRoom();
|
||||
void postHostAdd(String s,String type,String is_add);
|
||||
void setMutePit(String pitNumber, String is_mute);
|
||||
void addBlackList();
|
||||
void userGuanzSuccess(String s);
|
||||
void hostUserPit();
|
||||
void giveCoin();
|
||||
void relationCard(RelationCardBean list);
|
||||
|
||||
void topRelationCard(String s);
|
||||
void deleteRelationCard(String s);
|
||||
void clearUserCharm();
|
||||
}
|
||||
|
||||
public interface ViewGx extends IView<Activity> {
|
||||
}
|
||||
|
||||
public interface IEmotionRoomPre extends IPresenter {
|
||||
void getRoomUserInfo(String roomId,String userId);
|
||||
|
||||
void downPit(String roomId, String pitNumber);//下麦
|
||||
|
||||
void kickOutRoom(String roomId, String userId);
|
||||
|
||||
void postHostAdd(String roomId, String userId,String type,String is_add);
|
||||
|
||||
void setMutePit(String roomId, String pitNumber,String is_mute);// 禁言 禁麦 \解禁
|
||||
|
||||
void addBlackList(String userId);
|
||||
void userGuanz(String userId,String type);
|
||||
|
||||
void hostUserPit(String roomId,String pitNumber,String userId,String type);
|
||||
|
||||
void giveCoin(String user_id,String coin);
|
||||
|
||||
void relationCard(String user_id);
|
||||
|
||||
void topRelationCard(String id);
|
||||
void deleteRelationCard(String id);
|
||||
|
||||
void clearUserCharm(String roomId,String userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SingSongContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void applyPit();
|
||||
void setMutePit(String pitNumber, String is_mute);
|
||||
void setLockPit(String pitNumber, String is_lock);
|
||||
|
||||
void postRoomInfo(RoomInfoResp resp);
|
||||
void postRoomInfoPk(RoomInfoResp resp);
|
||||
void postRoomInfoUp(RoomInfoResp resp);
|
||||
|
||||
void endPk();
|
||||
|
||||
void userOnlineStatus(List<UserOnlineStatusBean> list);
|
||||
}
|
||||
|
||||
public interface IEmotionRoomPre extends IPresenter {
|
||||
void applyPit(String roomId, String pitNumber);
|
||||
|
||||
void setMutePit(String roomId, String pitNumber,String is_mute);//禁麦
|
||||
|
||||
void setLockPit(String roomId, String pitNumber, String is_lock);
|
||||
|
||||
void postRoomInfo(String roomId,String number,int type);
|
||||
|
||||
void endPk(String pk_id,String type,String user_id);
|
||||
void userOnlineStatus(String userId, String roomid);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.GiftUserWallBean;
|
||||
|
||||
public final class UserGiftWallConacts {
|
||||
|
||||
|
||||
public interface View extends IView<Activity> {
|
||||
void setGiftWall(GiftUserWallBean data);
|
||||
}
|
||||
|
||||
|
||||
public interface IUserGiftWallPre extends IPresenter {
|
||||
void giftWall(String userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.example.moduleroom.contacts;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.room.RoomApplyListBean;
|
||||
|
||||
public class WheatContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void roomApplyListBean(RoomApplyListBean roomApplyListBeans);
|
||||
void clearApply();
|
||||
void agreePit();
|
||||
void applyPit();
|
||||
|
||||
void giveGift();
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
void roomApplyListBean(String roomId);
|
||||
|
||||
void clearApply(String roomId);//清空申请上面列表
|
||||
|
||||
void agreePit(String roomId,String userId);//同意上麦
|
||||
|
||||
void refusePit(String roomId,String userId);//拒绝上麦
|
||||
|
||||
void helpApply(String roomId,String userId);
|
||||
|
||||
void applyPit(String roomId, String pitNumber);
|
||||
|
||||
void roomGift(String room_id, String gift_id, String gift_num, String to_uid, String type, String pit_number);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RankingAutcionAdapter;
|
||||
import com.example.moduleroom.contacts.BidListContacts;
|
||||
import com.example.moduleroom.databinding.DialogRoomBidListBinding;
|
||||
import com.example.moduleroom.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_37),
|
||||
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_37),
|
||||
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_37),
|
||||
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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.CardRelationAdapter;
|
||||
import com.example.moduleroom.contacts.CardRelationshipContacts;
|
||||
import com.example.moduleroom.databinding.DialogCardRelationBinding;
|
||||
import com.example.moduleroom.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,160 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.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 != 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 = (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,106 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
/**
|
||||
* @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,135 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.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.example.moduleroom.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.PkTimeAdapter;
|
||||
import com.example.moduleroom.contacts.PkTimeContract;
|
||||
import com.example.moduleroom.databinding.FragmentPkTimeFragmentBinding;
|
||||
import com.example.moduleroom.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,121 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.PublishCommentContacts;
|
||||
import com.example.moduleroom.databinding.DialogPublishCommentBinding;
|
||||
import com.example.moduleroom.presenter.PublishCommentPresenter;
|
||||
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,189 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RequestContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRequestDialogBinding;
|
||||
import com.example.moduleroom.fragment.MusicSongListFragment;
|
||||
import com.example.moduleroom.fragment.RequestFragment;
|
||||
import com.example.moduleroom.presenter.RequestPresenter;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
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,91 @@
|
||||
package com.example.moduleroom.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RoomCharmAdapter;
|
||||
import com.example.moduleroom.contacts.RoomCharmDialogContacts;
|
||||
import com.example.moduleroom.databinding.DialogCharmFragmentBinding;
|
||||
import com.example.moduleroom.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,195 @@
|
||||
package com.example.moduleroom.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.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomCloseContacts;
|
||||
import com.example.moduleroom.databinding.RoomConcernDialogBinding;
|
||||
import com.example.moduleroom.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.bean.room.RoomConcernDean;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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,871 @@
|
||||
package com.example.moduleroom.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.GiftUserAdapter;
|
||||
import com.example.moduleroom.databinding.RoomGiftDialogBinding;
|
||||
import com.example.moduletablayout.listener.OnTabSelectListener;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.adapter.GiftTwoDetailsFragment;
|
||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
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.RoomTypeModel;
|
||||
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.RechargeDialogFragment;
|
||||
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||
import com.xscm.moduleutil.dialog.giftLottery.GiftLotteryDialog;
|
||||
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.ARouteConstants;
|
||||
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 = null;
|
||||
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);
|
||||
EventBus.getDefault().register(this);
|
||||
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();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@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());
|
||||
} 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 = "";
|
||||
}
|
||||
}
|
||||
MvpPre.getGiftPack(roomId, gifyuseradapter.getUserIdToString(), heart_id, auction_id);
|
||||
}
|
||||
}
|
||||
|
||||
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()) {
|
||||
GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(
|
||||
String.valueOf(gift.getGift_bag()), roomId, userId, heart_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();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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) {
|
||||
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 {
|
||||
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{
|
||||
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) {
|
||||
giftLabelBeanList = new ArrayList<>();
|
||||
giftLabelBeanList.addAll(giftLabelBeans);
|
||||
GiftLabelBean giftLabelBean = new GiftLabelBean();
|
||||
giftLabelBean.setId("0");
|
||||
giftLabelBean.setName("背包");
|
||||
giftLabelBeans.add(0, giftLabelBean);
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giftPack(List<GiftPackBean> giftPackBean) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftPack(String s) {
|
||||
if (s != null) {
|
||||
com.hjq.toast.ToastUtils.show(s);
|
||||
dismiss();
|
||||
} else {
|
||||
com.hjq.toast.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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomHostContacts;
|
||||
import com.example.moduleroom.databinding.RoomHostAddFragmentBinding;
|
||||
import com.example.moduleroom.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_37),
|
||||
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,225 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomHostContacts;
|
||||
import com.example.moduleroom.databinding.RoomFragmentItemListBinding;
|
||||
import com.example.moduleroom.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() {
|
||||
EventBus.getDefault().register(this); // 注册EventBus
|
||||
|
||||
// MvpPre.clearHostList(mRoomId, "1");
|
||||
}
|
||||
|
||||
@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();
|
||||
EventBus.getDefault().unregister(this); // 取消注册EventBus
|
||||
}
|
||||
|
||||
@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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.databinding.RoomDialogMessageListBinding;
|
||||
import com.xscm.moduleutil.activity.news.NewsPresenter;
|
||||
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,466 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.adapter.RoomOnlineAdapter;
|
||||
import com.example.moduleroom.contacts.RoomContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRoomOnlineDialogBinding;
|
||||
import com.example.moduleroom.presenter.RoomPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
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) {
|
||||
// 添加延迟以避免过于频繁的请求
|
||||
mBinding.getRoot().postDelayed(() -> {
|
||||
page++;
|
||||
if (MvpPre != null && getArguments() != null) {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), page + "", "10");
|
||||
} else {
|
||||
refreshLayout.finishLoadMore(false);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
// page = 1;
|
||||
// MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
|
||||
// 添加延迟以避免过于频繁的请求
|
||||
mBinding.getRoot().postDelayed(() -> {
|
||||
page = 1;
|
||||
if (MvpPre != null && getArguments() != null) {
|
||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||
} else {
|
||||
refreshLayout.finishRefresh(false);
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
mBinding.rvComment.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
roomOnlineAdapter = new RoomOnlineAdapter(new ArrayList<RoomOnlineBean>());
|
||||
mBinding.rvComment.setAdapter(roomOnlineAdapter);
|
||||
// mBinding.rvComment2.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
// roomOnlineAdapter2 = new RoomOnlineAdapter();
|
||||
// mBinding.rvComment2.setAdapter(roomOnlineAdapter2);
|
||||
|
||||
|
||||
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();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// roomOnlineAdapter2.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) {
|
||||
// RoomUserInfoFragment.show(roomId, item.getUser_id() + "", pit_number, getHostUser(hostUser), false, 4, isNumberWhether(), getChildFragmentManager());
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
// 在类中添加以下方法
|
||||
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<>());
|
||||
}
|
||||
|
||||
// roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||
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);
|
||||
}
|
||||
|
||||
// roomOnlineAdapter.setNewData(onlineBean.getOn_pit());
|
||||
}
|
||||
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);
|
||||
}
|
||||
// roomOnlineAdapter2.setNewData(onlineBean.getOff_pit());
|
||||
}
|
||||
|
||||
// 根据是刷新还是加载更多来处理数据
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomPkContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRoomPkBinding;
|
||||
import com.example.moduleroom.presenter.RoomPkPresenter;
|
||||
import com.lihang.ShadowLayout;
|
||||
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) {
|
||||
mAdapter.setNewData(roomBeans);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendPk() {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refusePk() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishLoading() {
|
||||
mBinding.srl.finishRefresh();
|
||||
mBinding.srl.finishLoadMore();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,470 @@
|
||||
package com.example.moduleroom.dialog;
|
||||
|
||||
import static com.xscm.moduleutil.bean.room.RoomSettingBean.QXRoomSettingTypeRoomOrderMic;
|
||||
|
||||
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.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.adapter.RoomSettingAdapter;
|
||||
import com.example.moduleroom.contacts.RoomSettingContacts;
|
||||
import com.example.moduleroom.databinding.DialogRoomSettingFragmentBinding;
|
||||
import com.example.moduleroom.fragment.RoomBackgroundDialogFragment;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
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.event.RoomOutEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.example.moduleroom.presenter.RoomSettingPresenter;
|
||||
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");
|
||||
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();
|
||||
EventBus.getDefault().register(this);
|
||||
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, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
|
||||
// 可选:设置动画样式(从底部弹出)
|
||||
window.setWindowAnimations(com.xscm.moduleutil.R.style.CommonShowDialogBottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@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("常用工具", 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_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.QXRoomSettingTypeRoomSetting) {
|
||||
ARouter.getInstance().build(ARouteConstants.CREATED_ROOM).withSerializable("roomInfoResp", roomInfoResp).navigation();
|
||||
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomReport) {
|
||||
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();
|
||||
} 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();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 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") ? "交友" : "")))))),
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
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) {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
if (type==RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||
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.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic || type == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen
|
||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
|
||||
if (onMic) {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
||||
return false;
|
||||
}
|
||||
}else {
|
||||
if (type==RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport
|
||||
) {
|
||||
return true;
|
||||
}else {
|
||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// else if (roleLevel == 3 ) {// 主持且在麦位上
|
||||
// if (type== RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
|
||||
// type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl||
|
||||
// type== RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic
|
||||
// || type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage) {
|
||||
// return true;
|
||||
// }
|
||||
// // 更多操作条目也显示
|
||||
// if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
||||
// type <= RoomSettingBean.QXRoomSettingTypeRoomReport) {
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
// else if (roleLevel == 3 && !onMic && type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) { // 主持但不在麦位上时,隐藏背景音乐
|
||||
// return false;
|
||||
// }
|
||||
else { // 普通用户只显示更多操作中的特定条目
|
||||
return type == RoomSettingBean.QXRoomSettingTypeRoomLeave ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomShare ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects ||
|
||||
type == RoomSettingBean.QXRoomSettingTypeRoomReport ||
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,733 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomUserContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRoomUserInfoBinding;
|
||||
import com.example.moduleroom.fragment.RelationshipFragment;
|
||||
import com.example.moduleroom.presenter.RoomUserPresenter;
|
||||
import com.example.zhouwei.library.CustomPopWindow;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@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.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("上麦")) {
|
||||
} 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) {
|
||||
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();
|
||||
}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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理弹出显示内容、点击事件等逻辑
|
||||
*
|
||||
* @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();
|
||||
} 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 (isSelf){
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
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 (isSelf){
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
}
|
||||
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 (isSelf){
|
||||
mBinding.roomDian.setVisibility(GONE);
|
||||
mBinding.roomJb.setVisibility(View.GONE);
|
||||
mBinding.roomLh.setVisibility(View.GONE);
|
||||
mBinding.roomBo.setVisibility(GONE);
|
||||
mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
// 默认处理
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// switch (type) {
|
||||
// case 1: // 房主
|
||||
// case 2: // 管理员
|
||||
// case 3: // 主持
|
||||
// if (isSelf) {
|
||||
// mBinding.roomDian.setVisibility(View.GONE);
|
||||
// mBinding.roomJb.setVisibility(View.GONE);
|
||||
// mBinding.roomLh.setVisibility(View.GONE);
|
||||
// mBinding.roomBo.setVisibility(View.GONE);
|
||||
// } else {
|
||||
// mBinding.roomDian.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomJb.setVisibility(View.GONE);
|
||||
// mBinding.roomLh.setVisibility(View.GONE);
|
||||
// mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// break;
|
||||
// case 4: // 普通用户
|
||||
// mBinding.roomDian.setVisibility(View.GONE);
|
||||
// if (isSelf) {
|
||||
// mBinding.roomJb.setVisibility(View.GONE);
|
||||
// mBinding.roomLh.setVisibility(View.GONE);
|
||||
// mBinding.roomBo.setVisibility(View.GONE);
|
||||
// mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomMCz.setVisibility(View.GONE);
|
||||
// }
|
||||
// break;
|
||||
// case 0:
|
||||
// mBinding.roomDian.setVisibility(View.GONE);
|
||||
// if (isSelf) {
|
||||
// mBinding.roomJb.setVisibility(View.GONE);
|
||||
// mBinding.roomLh.setVisibility(View.GONE);
|
||||
// mBinding.roomBo.setVisibility(View.GONE);
|
||||
// mBinding.roomMCz.setVisibility(View.VISIBLE);
|
||||
// } else {
|
||||
// mBinding.roomJb.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomLh.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomBo.setVisibility(View.VISIBLE);
|
||||
// mBinding.roomMCz.setVisibility(View.GONE);
|
||||
// }
|
||||
// default:
|
||||
// // 默认处理
|
||||
// break;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@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("清除成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.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();
|
||||
EventBus.getDefault().register(this);
|
||||
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();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@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,240 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RoomOnlineAdapter;
|
||||
import com.example.moduleroom.contacts.WheatContacts;
|
||||
import com.example.moduleroom.databinding.FragmentSoundDialogBinding;
|
||||
import com.example.moduleroom.presenter.WheatPresenter;
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.TunerListAdapter;
|
||||
import com.example.moduleroom.contacts.WheatContacts;
|
||||
import com.example.moduleroom.databinding.RoomDialogTunerBinding;
|
||||
import com.example.moduleroom.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.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());
|
||||
// }
|
||||
// });
|
||||
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 + "%");
|
||||
|
||||
|
||||
mBinding.seekBar1.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
mBinding.tvSeekbarValue.setText("人声" + progress + "%");
|
||||
SpUtil.setMusicVolume(progress);
|
||||
AgoraManager.getInstance(getContext()).setMusicVolume(progress);
|
||||
}
|
||||
|
||||
@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()).settPlayoutVolume(progress);
|
||||
}
|
||||
|
||||
@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());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@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.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.UserGiftWallConacts;
|
||||
import com.example.moduleroom.databinding.MeFagmentUserGiftWallBinding;
|
||||
import com.example.moduleroom.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,298 @@
|
||||
package com.example.moduleroom.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.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.WheatFeedingSelectAdapter;
|
||||
import com.example.moduleroom.contacts.WheatContacts;
|
||||
import com.example.moduleroom.databinding.FragmentWheatFeedingDialogBinding;
|
||||
import com.example.moduleroom.presenter.WheatPresenter;
|
||||
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();
|
||||
if (!EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,272 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RequestContacts;
|
||||
import com.example.moduleroom.databinding.FragmentMuiscSongBinding;
|
||||
import com.example.moduleroom.presenter.RequestPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.MusicSongBean;
|
||||
import com.xscm.moduleutil.bean.SongMusicBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
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.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.agora.musiccontentcenter.Music;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/19
|
||||
* @description: 点唱已点歌曲
|
||||
*/
|
||||
public class MusicSongListFragment extends BaseMvpFragment<RequestPresenter, FragmentMuiscSongBinding> implements RequestContacts.View {
|
||||
|
||||
public static final int TYPE_DATA = 1;//点歌
|
||||
public static final int TYPE_WEEK = 2;//已点
|
||||
private int type;
|
||||
private String roomId;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
BaseQuickAdapter<MusicSongBean, BaseViewHolder> adapter;
|
||||
private int page = 1;
|
||||
int status;
|
||||
|
||||
@Override
|
||||
public void songList(List<MusicSongBean> musicSongBeans) {
|
||||
|
||||
|
||||
if (roomInfoResp.getUser_info().getUser_id().equals(SpUtil.getUserId() + "") && roomInfoResp.getUser_info().getPit_number() == 9) {
|
||||
status = 1;
|
||||
}
|
||||
if (musicSongBeans != null) {
|
||||
for (MusicSongBean musicSongBean : musicSongBeans) {
|
||||
musicSongBean.setIs_hot(status);
|
||||
}
|
||||
}
|
||||
|
||||
// if (page==1){
|
||||
adapter.setNewData(musicSongBeans);
|
||||
|
||||
// }else {
|
||||
// adapter.addData(musicSongBeans);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void upSong(String S) {
|
||||
ToastUtils.showShort(S);
|
||||
MvpPre.songList(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void song(List<SongMusicBean> music) {
|
||||
com.hjq.toast.ToastUtils.show("操作成功");
|
||||
}
|
||||
|
||||
public interface OnRequestFragmentListener {
|
||||
void onCloseDialog();
|
||||
}
|
||||
|
||||
private OnRequestFragmentListener listener;
|
||||
|
||||
// 绑定监听器
|
||||
public void setOnRequestFragmentListener(OnRequestFragmentListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public static MusicSongListFragment newInstance(String roomId, RoomInfoResp roomInfoResp, int type) {
|
||||
Bundle args = new Bundle();
|
||||
MusicSongListFragment fragment = new MusicSongListFragment();
|
||||
args.putString("roomId", roomId);
|
||||
args.putInt("type", type);
|
||||
args.putSerializable("roomInfoResp", roomInfoResp);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
// if (!EventBus.getDefault().isRegistered( this)) {
|
||||
// EventBus.getDefault().register(this);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
if (EventBus.getDefault().isRegistered(this)) {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RequestPresenter bindPresenter() {
|
||||
return new RequestPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
roomId = getArguments().getString("roomId");
|
||||
type = getArguments().getInt("type");
|
||||
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
boolean b = AgoraManager.getInstance(getContext()).isBjMusic();
|
||||
if (b) {
|
||||
List<MusicSongBean> musicSongBeans = new ArrayList<>();
|
||||
List<Music> music = AgoraManager.getInstance(getContext()).getMusicList();
|
||||
if (music != null && music.size() > 0) {
|
||||
for (int i = 0; i < music.size(); i++) {
|
||||
MusicSongBean musicSongBean = new MusicSongBean();
|
||||
musicSongBean.setSong_code(String.valueOf(music.get(i).getSongCode()));
|
||||
musicSongBean.setSong_name(music.get(i).getName());
|
||||
musicSongBean.setSinger(music.get(i).getSinger());
|
||||
musicSongBean.setPoster(music.get(i).getPoster());
|
||||
musicSongBean.setDuration(music.get(i).getDurationS() + "");
|
||||
musicSongBeans.add(musicSongBean);
|
||||
}
|
||||
adapter.setNewData(musicSongBeans);
|
||||
}
|
||||
} else {
|
||||
MvpPre.songList(roomId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
// AgoraManager.getInstance(getContext()).searchMusic( mBinding.editQuery.getText().toString(),page);
|
||||
MvpPre.songList(roomId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
// AgoraManager.getInstance(getContext()).searchMusic( mBinding.editQuery.getText().toString(),page);
|
||||
MvpPre.songList(roomId);
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new BaseQuickAdapter<MusicSongBean, BaseViewHolder>(R.layout.item_song_list, null) {
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, MusicSongBean item) {
|
||||
|
||||
LogUtils.e("@@@", item);
|
||||
// 获取当前 item 的 position
|
||||
int position = helper.getLayoutPosition();
|
||||
ImageView muisSy = helper.getView(R.id.muis_sy);
|
||||
TextView muisPrice = helper.getView(R.id.muis_price);
|
||||
if (position == 0) {
|
||||
helper.setText(R.id.muis_price, "结束");
|
||||
|
||||
muisSy.setVisibility(View.GONE);
|
||||
} else if (position == 1) {
|
||||
|
||||
muisSy.setVisibility(View.GONE);
|
||||
muisPrice.setVisibility(View.GONE);
|
||||
} else {
|
||||
muisPrice.setVisibility(View.VISIBLE);
|
||||
helper.setText(R.id.muis_price, "置顶");
|
||||
muisSy.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
helper.setText(R.id.muis_name, item.getSong_name());
|
||||
if (item.getDuration().isEmpty()) {
|
||||
helper.setText(R.id.muis_desc, "00:00");
|
||||
} else {
|
||||
helper.setText(R.id.muis_desc, TimeUtils.formatDuration(Long.parseLong(item.getDuration()) * 1000));
|
||||
}
|
||||
helper.setText(R.id.muis_set, "\t" + item.getSinger());
|
||||
helper.setText(R.id.muis_nickname, item.getNickname());
|
||||
|
||||
ImageUtils.loadHeadCC(item.getPoster(), helper.getView(R.id.muis_avatar));
|
||||
|
||||
helper.getView(R.id.muis_price).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TextView textView = helper.getView(R.id.muis_price);
|
||||
if (textView.getText().toString().equals("置顶")) {
|
||||
MvpPre.upSong(item.getDid(), "2");
|
||||
} else {
|
||||
|
||||
}
|
||||
if (listener != null) {
|
||||
listener.onCloseDialog(); // 触发关闭 DialogFragment
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
helper.getView(R.id.muis_sy).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MvpPre.upSong(item.getDid(), "1");
|
||||
}
|
||||
});
|
||||
|
||||
if (item.getIs_hot() == 1) {
|
||||
helper.setVisible(R.id.muis_sy, true);
|
||||
helper.setVisible(R.id.muis_price, true);
|
||||
} else {
|
||||
helper.setVisible(R.id.muis_sy, false);
|
||||
helper.setVisible(R.id.muis_price, false);
|
||||
}
|
||||
|
||||
TextView muis_price=helper.getView(R.id.muis_price);
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(muis_price, ColorManager.getInstance().getPrimaryColorInt(), 34);
|
||||
muis_price.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_muisc_song;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,301 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RankingCharmListAdapter;
|
||||
import com.example.moduleroom.contacts.DataListContacts;
|
||||
import com.example.moduleroom.databinding.RoomRankingChildBinding;
|
||||
import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
||||
import com.example.moduleroom.presenter.DataListPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.CharmRankingResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.widget.CommonEmptyView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/10
|
||||
* @description:
|
||||
*/
|
||||
public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, RoomRankingChildBinding> implements DataListContacts.View {
|
||||
|
||||
private static final String TAG = "RankingChildFragment";
|
||||
|
||||
public static final int TYPE_DATA = 1;//日榜
|
||||
public static final int TYPE_WEEK = 2;//周榜
|
||||
public static final int TYPE_MON = 3;//月榜
|
||||
private String roomId;
|
||||
private int dataType;
|
||||
private int rankType = 1;
|
||||
private RankingCharmListAdapter cAdapter;//魅力适配器
|
||||
private RankingCharmListAdapter wAdapter;//财富适配器
|
||||
// private RankingWealthListAdapter wAdapter;//财富适配器
|
||||
private CommonEmptyView commonEmptyView;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
|
||||
/**
|
||||
* newInstance 初始化fragment
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static RankingChildFragment newInstance(String roomId, int dataType, int rankType, RoomInfoResp roomInfoResp) {
|
||||
RankingChildFragment rankingChildFragment = new RankingChildFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("roomId", roomId);
|
||||
bundle.putInt("dataType", dataType);
|
||||
bundle.putInt("rankType", rankType);
|
||||
bundle.putSerializable("roomInfoResp", roomInfoResp);
|
||||
rankingChildFragment.setArguments(bundle);
|
||||
return rankingChildFragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DataListPresenter bindPresenter() {
|
||||
return new DataListPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
roomId = getArguments().getString("roomId");
|
||||
dataType = getArguments().getInt("dataType");
|
||||
rankType = getArguments().getInt("rankType");
|
||||
roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
if (rankType == 1) {
|
||||
cAdapter = new RankingCharmListAdapter();
|
||||
mBinding.rankRecycleView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mBinding.rankRecycleView.setAdapter(cAdapter);
|
||||
cAdapter.bindToRecyclerView(mBinding.rankRecycleView);
|
||||
MvpPre.getCharmListInfo(roomId, rankType + "", dataType + "", "1", "20");
|
||||
} else {
|
||||
wAdapter = new RankingCharmListAdapter();
|
||||
mBinding.rankRecycleView.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
mBinding.rankRecycleView.setAdapter(wAdapter);
|
||||
wAdapter.bindToRecyclerView(mBinding.rankRecycleView);
|
||||
MvpPre.getWealthListInfo(roomId, rankType + "", dataType + "", "1", "20");
|
||||
}
|
||||
// onRefreshEvent(null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
if (rankType == 1) {
|
||||
setSexBg(mBinding.roomHeadTop1Label, "1");
|
||||
setSexBg(mBinding.roomHeadTop2Label, "1");
|
||||
setSexBg(mBinding.roomHeadTop3Label, "1");
|
||||
}
|
||||
commonEmptyView = new CommonEmptyView(getContext());
|
||||
commonEmptyView.setEmptyText("暂无上榜");
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化监听
|
||||
*/
|
||||
@Override
|
||||
protected void initListener() {
|
||||
super.initListener();
|
||||
if (rankType == 1) {
|
||||
cAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
if (view.getId() == R.id.room_item_head) {
|
||||
CharmRankingResp item = cAdapter.getItem(position);
|
||||
|
||||
RoomUserInfoFragment.show(roomId,item.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.USER_HOME_PAGE).withString("userId", item.getUser_id()).withBoolean("returnRoom", true).navigation();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
wAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
|
||||
@Override
|
||||
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
if (view.getId() == R.id.room_item_head) {
|
||||
CharmRankingResp item = wAdapter.getItem(position);
|
||||
|
||||
RoomUserInfoFragment.show(roomId,item.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
|
||||
// WealthRankingResp.ListsBean item = wAdapter.getItem(position);
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", item.getUser_id()).withBoolean("returnRoom", true).navigation();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 这是判断当前用户是否是麦上房主、管理员、主持,不在主持麦的都是不同用户
|
||||
* 2025-7-31 10:42:37,新添加的要求:根据角色不同,显示不同的按钮
|
||||
* 房主不论麦上麦下,有全部权限 管理员、主持:不论麦上麦下,有部分权限 用户:只有举报拉黑权限
|
||||
* 所有的是从下往上看数据的时候,只有举报和拉黑
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int getHostUser() {
|
||||
if (roomInfoResp.getUser_info().getPit_number() == 9) {
|
||||
if (roomInfoResp.getUser_info().getIs_room_owner() == 1) {
|
||||
return 1;
|
||||
} else if (roomInfoResp.getUser_info().getIs_management() == 1) {
|
||||
return 2;
|
||||
} else if (roomInfoResp.getUser_info().getIs_host() == 1) {
|
||||
return 3;
|
||||
} else {
|
||||
return 4;
|
||||
}
|
||||
} else {
|
||||
if (roomInfoResp.getUser_info().getIs_room_owner() == 1) {
|
||||
return 1;
|
||||
}
|
||||
if (roomInfoResp.getUser_info().getIs_management() == 1) {
|
||||
return 2;
|
||||
}
|
||||
if (roomInfoResp.getUser_info().getIs_host() == 1) {
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
Log.d(TAG, "(Start)启动了===========================RankingChildFragment");
|
||||
return R.layout.room_ranking_child;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setNo1(CharmRankingResp listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop1HeadIcon);
|
||||
mBinding.roomTop1Name.setText(listsBean.getNickname());
|
||||
mBinding.roomHeadTop1Label.setText(listsBean.getTotal());
|
||||
setview(listsBean.getIcon(), mBinding.llVip1);
|
||||
mBinding.roomRankTop1HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RoomUserInfoFragment.show(roomId,listsBean.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).withBoolean("returnRoom", true).navigation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNo2(CharmRankingResp listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop2HeadIcon);
|
||||
mBinding.roomTop2Name.setText(listsBean.getNickname());
|
||||
mBinding.roomHeadTop2Label.setText(listsBean.getTotal());
|
||||
setview(listsBean.getIcon(), mBinding.llVip2);
|
||||
mBinding.roomRankTop2HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RoomUserInfoFragment.show(roomId,listsBean.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).withBoolean("returnRoom", true).navigation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setview(List<String> item, LinearLayout llContainer) {
|
||||
List<String> images = item; // 获取图片列表
|
||||
|
||||
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_37),
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNo3(CharmRankingResp listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop3HeadIcon);
|
||||
mBinding.roomTop3Name.setText(listsBean.getNickname());
|
||||
mBinding.roomHeadTop3Label.setText(listsBean.getTotal());
|
||||
setview(listsBean.getIcon(), mBinding.llVip3);
|
||||
mBinding.roomRankTop3HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RoomUserInfoFragment.show(roomId,listsBean.getUser_id(), "", getHostUser(), true, 3, 0, getChildFragmentManager());
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.NEW_HOME_PAGE).withString("userId", listsBean.getUser_id()).withBoolean("returnRoom", true).navigation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCharmEmpty(List<CharmRankingResp> list) {
|
||||
if (list != null) {
|
||||
if (cAdapter==null){
|
||||
wAdapter.setNewData(list);
|
||||
}else {
|
||||
cAdapter.setNewData(list);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWealthEmpty(List<CharmRankingResp> list) {
|
||||
if (list != null){
|
||||
wAdapter.setNewData(list);
|
||||
}else {
|
||||
wAdapter.setEmptyView(commonEmptyView);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置头像男神女神热度背景
|
||||
*/
|
||||
private void setSexBg(View view, String sex) {
|
||||
// view.setBackgroundResource(UserBean.MALE.equals(sex) ? R.mipmap.room_bg_wheat_charm_gg_sr : R.mipmap.room_bg_wheat_charm_mm_sr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据性别设置字体颜色
|
||||
*/
|
||||
private void setSexColor(TextView view, String sex) {
|
||||
// view.setTextColor(UserBean.MALE.equals(sex) ? getContext().getResources().getColor(R.color.color_FF0091FF) : getContext().getResources().getColor(R.color.color_FFFA447D));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.databinding.RoomRankingParentBinding;
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/10
|
||||
*@description:
|
||||
*/
|
||||
public class RankingParentFragment extends BaseMvpFragment<IPresenter, RoomRankingParentBinding> {
|
||||
|
||||
//成员变量 + 全局变量
|
||||
public static final int TYPE_DATA = 1;//日榜
|
||||
public static final int TYPE_WEEK = 2;//周榜
|
||||
public static final int TYPE_MON = 3;//月榜
|
||||
private static String mRoomId;//房间ID
|
||||
private static int rankType = 1;//统计类型(魅力 / 财富)
|
||||
// private static int dataType = 1;//统计周期(日/周/月)
|
||||
private RoomInfoResp roomInfoResp;
|
||||
|
||||
public static RankingParentFragment newInstance(String roomId,int rankType,RoomInfoResp roomInfoResp) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", roomId);
|
||||
args.putInt("rankType", rankType);
|
||||
args.putSerializable("roomInfoResp", roomInfoResp);
|
||||
RankingParentFragment fragment = new RankingParentFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
mRoomId = arguments.getString("roomId");
|
||||
rankType = arguments.getInt("rankType");
|
||||
roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfoResp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IPresenter bindPresenter() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
List<Fragment> fragments = new ArrayList<>();
|
||||
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_DATA, rankType, roomInfoResp));
|
||||
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_WEEK, rankType, roomInfoResp));
|
||||
fragments.add(RankingChildFragment.newInstance(mRoomId, TYPE_MON, rankType, roomInfoResp));
|
||||
MyFragmentPagerAdapter myFragmentPagerAdapter = new MyFragmentPagerAdapter(fragments, getChildFragmentManager());
|
||||
mBinding.vpRankChild.setAdapter(myFragmentPagerAdapter);
|
||||
String[] title = new String[]{"日榜", "周榜", "月榜"};
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.vpRankChild, title);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_ranking_parent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
|
||||
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.View;
|
||||
import android.view.Window;
|
||||
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.RelationshipAdapter;
|
||||
import com.example.moduleroom.contacts.RoomUserContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRelationshipBinding;
|
||||
import com.example.moduleroom.presenter.RoomUserPresenter;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RelationCardBean;
|
||||
import com.xscm.moduleutil.bean.RelationshipBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/13
|
||||
* @description: 关系卡和关系位的fragemnt
|
||||
*/
|
||||
public class RelationshipFragment extends BaseMvpDialogFragment<RoomUserPresenter, FragmentRelationshipBinding> implements RoomUserContacts.View {
|
||||
|
||||
RelationshipAdapter adapter;
|
||||
private String userId;
|
||||
private int type;
|
||||
|
||||
public static void show(String user_id, int type, FragmentManager fragmentManager) {
|
||||
RelationshipFragment dialogFragment = new RelationshipFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("userId", user_id);
|
||||
args.putInt("type", type);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RelationshipFragment");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
userId = getArguments().getString("userId");
|
||||
type = getArguments().getInt("type");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomUserPresenter bindPresenter() {
|
||||
return new RoomUserPresenter(this, getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
MvpPre.relationCard(userId);
|
||||
|
||||
// List<RelationshipBean> list=new ArrayList<>();
|
||||
// for (int i = 0; i < 3; i++){
|
||||
//// RelationshipBean relationshipBean=new RelationshipBean();
|
||||
//// relationshipBean.setAvatar("https://img2.baidu.com/it/u=3879116093,1671048885&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500");
|
||||
//// relationshipBean.setAvatar2("https://img2.baidu.com/it/u=3879116093,1671048885&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500");
|
||||
//// relationshipBean.setNickname("名称1");
|
||||
//// relationshipBean.setNickname2("名称2");
|
||||
//// relationshipBean.setRelation("兄弟");
|
||||
//// relationshipBean.setTime("5天");
|
||||
//// list.add(relationshipBean);
|
||||
// }
|
||||
// adapter=new RelationshipAdapter();
|
||||
// mBinding.bannerViewPager
|
||||
// .setScrollDuration(0)
|
||||
// .setOrientation(ViewPager2.ORIENTATION_VERTICAL)
|
||||
// .setAutoPlay(false)
|
||||
// .setAdapter(adapter);
|
||||
//
|
||||
// mBinding.bannerViewPager.setIndicatorVisibility(View.GONE);
|
||||
// mBinding.bannerViewPager.create(list);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.rvHostList.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new RelationshipAdapter();
|
||||
mBinding.rvHostList.setAdapter(adapter);
|
||||
adapter.setOnItemClickListener(new RelationshipAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(View view, RelationshipBean data, int position) {
|
||||
if (view.getId() == R.id.im_zhid) {
|
||||
queren(1, data.getId(), "");
|
||||
} else if (view.getId() == R.id.im_shanchu) {
|
||||
queren(2, data.getId(), data.getDelete_me_coin());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void queren(int type, int id, String num) {
|
||||
if (type == 1) {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(getActivity(),
|
||||
"提示",
|
||||
"您确定要置顶本关系吗?",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
// MvpPre.applySong(roomId);
|
||||
MvpPre.topRelationCard(id + "");
|
||||
dismiss();
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
} else if (type == 2) {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(getActivity(),
|
||||
"提示",
|
||||
"您确定要删除本关系吗?解除关系需要" + num + "金币",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
// MvpPre.applySong(roomId);
|
||||
MvpPre.deleteRelationCard(id + "");
|
||||
dismiss();
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
}, false, 0).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_relationship;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRoomUserInfo(UserInfo userInfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downPit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kickOutRoom() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHostAdd(String s, String type, String is_add) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMutePit(String pitNumber, String is_mute) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBlackList() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userGuanzSuccess(String s) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hostUserPit() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void giveCoin() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void relationCard(RelationCardBean list) {
|
||||
if (list !=null) {
|
||||
if (type == 1) {
|
||||
if (list != null && list.getQinmi() != null) {
|
||||
for (int i = 0; i < list.getQinmi().size(); i++) {
|
||||
list.getQinmi().get(i).setType(1);
|
||||
}
|
||||
adapter.setNewData(list.getQinmi());
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (list != null && list.getZhenai() != null) {
|
||||
for (int i = 0; i < list.getZhenai().size(); i++) {
|
||||
list.getZhenai().get(i).setType(2);
|
||||
}
|
||||
adapter.setNewData(list.getZhenai());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void topRelationCard(String s) {
|
||||
MvpPre.relationCard(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRelationCard(String s) {
|
||||
MvpPre.relationCard(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearUserCharm() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RequestContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRequestBinding;
|
||||
import com.example.moduleroom.presenter.RequestPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||
import com.xscm.moduleutil.bean.MusicSongBean;
|
||||
import com.xscm.moduleutil.bean.SongMusicBean;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.rtc.MusicBean;
|
||||
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.scwang.smartrefresh.layout.api.RefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.agora.musiccontentcenter.Music;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/6/10
|
||||
* @description: 点唱viwPage的fragment
|
||||
*/
|
||||
public class RequestFragment extends BaseMvpFragment<RequestPresenter, FragmentRequestBinding> implements RequestContacts.View {
|
||||
|
||||
public static final int TYPE_DATA = 1;//点歌
|
||||
public static final int TYPE_WEEK = 2;//已点
|
||||
private int type;
|
||||
private String roomId;
|
||||
BaseQuickAdapter<Music, BaseViewHolder> adapter;
|
||||
private int page = 1;
|
||||
String input="";
|
||||
private int status;
|
||||
@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("操作成功");
|
||||
}
|
||||
|
||||
public interface OnRequestFragmentListener {
|
||||
void onCloseDialog(Music musicSongBean);
|
||||
}
|
||||
|
||||
private OnRequestFragmentListener listener;
|
||||
|
||||
// 绑定监听器
|
||||
public void setOnRequestFragmentListener(OnRequestFragmentListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public static RequestFragment newInstance(String roomId, int type,int status) {
|
||||
Bundle args = new Bundle();
|
||||
RequestFragment fragment = new RequestFragment();
|
||||
args.putString("roomId", roomId);
|
||||
args.putInt("type", type);
|
||||
args.putInt("status", status);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RequestPresenter bindPresenter() {
|
||||
return new RequestPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
roomId = getArguments().getString("roomId");
|
||||
type = getArguments().getInt("type");
|
||||
status = getArguments().getInt("status");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
// mBinding.editQuery.setOnFocusChangeListener((v, hasFocus) ->{
|
||||
// if (hasFocus) {
|
||||
// new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
// if ( mBinding.scrollView != null) {
|
||||
// mBinding.scrollView.post(() -> mBinding.scrollView.fullScroll(View.FOCUS_DOWN)); // 滚动到底部
|
||||
// }
|
||||
// }, 200);
|
||||
// }
|
||||
// });
|
||||
mBinding.editQuery.setText(SpUtil.getMusicName());
|
||||
|
||||
mBinding.editQuery.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
// SharedViewModel viewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
// onMusicSearchResultEvent(viewModel.getMusicBean());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
input = s.toString();
|
||||
SpUtil.setMusicName( input);
|
||||
AgoraManager.getInstance(getContext()).searchMusic(input, 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);/**/
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.smartRefreshLayout.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||
@Override
|
||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||
page++;
|
||||
AgoraManager.getInstance(getContext()).searchMusic(mBinding.editQuery.getText().toString(), page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||
page = 1;
|
||||
AgoraManager.getInstance(getContext()).searchMusic(mBinding.editQuery.getText().toString(), page);
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.recycleView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
adapter = new BaseQuickAdapter<Music, BaseViewHolder>(R.layout.item_reward, null) {
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, Music item) {
|
||||
LogUtils.e("@@@", item);
|
||||
helper.setText(R.id.muis_name, item.getName());
|
||||
helper.setText(R.id.muis_desc, TimeUtils.formatDuration(item.getReleaseTime().isEmpty() ? 0 : Long.parseLong(item.getReleaseTime())));
|
||||
helper.setText(R.id.muis_desc, "\t" + item.getSinger());
|
||||
ImageUtils.loadHeadCC(item.getPoster(), helper.getView(R.id.muis_avatar));
|
||||
|
||||
helper.getView(R.id.muis_price).setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (status==1) {
|
||||
// if (!AgoraManager.getInstance(getContext()).isBjMusic()) {
|
||||
MvpPre.song(roomId, SpUtil.getUserId() + "", item.getSongCode() + "", item.getName(), item.getSinger(), item.getPoster(), String.valueOf(item.getDurationS()));
|
||||
} else {
|
||||
if (AgoraManager.getInstance(getContext()).getMusicList()==null) {
|
||||
// AgoraManager.getInstance(getContext()).isPreload2(item.getSongCode(), 1);
|
||||
List<Music> music = new ArrayList<>();
|
||||
music.add(item);
|
||||
AgoraManager.getInstance(getContext()).setMusicList(music);
|
||||
EventBus.getDefault().post(item);
|
||||
AgoraManager.getInstance(getContext()).nextSong();
|
||||
} else {
|
||||
|
||||
List<Music> music = AgoraManager.getInstance(getContext()).getMusicList();
|
||||
music.add(item);
|
||||
AgoraManager.getInstance(getContext()).setMusicList(music);
|
||||
}
|
||||
// AgoraManager.getInstance(getContext()).isPreload(item.getSongCode(), 1);
|
||||
|
||||
}
|
||||
ToastUtils.show("添加成功");
|
||||
}
|
||||
});
|
||||
TextView muis_price=helper.getView(R.id.muis_price);
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(muis_price, ColorManager.getInstance().getPrimaryColorInt(), 34);
|
||||
muis_price.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
}
|
||||
};
|
||||
mBinding.recycleView.setAdapter(adapter);
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMusicSearchResultEvent(MusicBean music) {
|
||||
if (music.getMusicList() != null) {
|
||||
if (music.getPage() == 1) {
|
||||
adapter.setNewData(music.getMusicList());
|
||||
} else {
|
||||
adapter.addData(music.getMusicList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_request;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,352 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
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.widget.TextView;
|
||||
|
||||
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.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomBackgroundContacts;
|
||||
import com.example.moduleroom.databinding.RoomFragementDialogRoomBackgroundBinding;
|
||||
import com.example.moduleroom.presenter.RoomBackgroundPresenter;
|
||||
import com.luck.picture.lib.basic.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.RoomBgBean;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.utils.GlideEngine;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.widget.Constants;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/24
|
||||
*@description: 更换房间背景
|
||||
*/
|
||||
public class RoomBackgroundDialogFragment extends BaseMvpDialogFragment<RoomBackgroundPresenter, RoomFragementDialogRoomBackgroundBinding> implements RoomBackgroundContacts.View {
|
||||
|
||||
|
||||
private MyAdapter mAdapter;
|
||||
|
||||
private String roomId;
|
||||
private String picture;
|
||||
private boolean pictureChanged;
|
||||
private List<RoomBgBean.RoomBg> publicBgList = new ArrayList<>();
|
||||
private List<RoomBgBean.RoomBg> myBgList = new ArrayList<>();
|
||||
|
||||
|
||||
public static RoomBackgroundDialogFragment newInstance(String roomId) {
|
||||
RoomBackgroundDialogFragment fragment = new RoomBackgroundDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("roomId", roomId);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
mBinding.recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
|
||||
mAdapter = new MyAdapter();
|
||||
mAdapter.setCheckedPicture(picture);
|
||||
mBinding.recyclerView.setAdapter(mAdapter);
|
||||
|
||||
mAdapter.setOnItemClickListener(new MyAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onAddImageClick() {
|
||||
// 处理“添加图片”点击逻辑(例如打开相册)
|
||||
startChoosePhoto(1, PictureConfig.REQUEST_CAMERA, false, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackgroundClick(RoomBgBean.RoomBg item) {
|
||||
|
||||
queren1(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void queren1(RoomBgBean.RoomBg item) {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(getContext(),
|
||||
"温馨提示",
|
||||
"是否选择当前图片为背景图片",
|
||||
"确认",
|
||||
"取消",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
MvpPre.editRoom(roomId, "", "", "", item.getImage_url());
|
||||
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
|
||||
},false,0).show();
|
||||
}
|
||||
|
||||
private void startChoosePhoto(int mimeType, int requestCode, boolean isVideo, int type) {
|
||||
PictureSelector.create(this)
|
||||
.openGallery(mimeType)
|
||||
.isGif(isVideo)
|
||||
.setImageEngine(GlideEngine.createGlideEngine())
|
||||
.setMaxSelectNum(type)
|
||||
.isPreviewImage(true)
|
||||
.isDisplayCamera(false)
|
||||
.setOutputCameraDir(Constants.FILE_PATH)
|
||||
.isOriginalSkipCompress(true)
|
||||
.forResult(requestCode); //结果回调onActivityResult code
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK && data != null) {
|
||||
switch (requestCode) {
|
||||
|
||||
case PictureConfig.REQUEST_CAMERA:
|
||||
List<LocalMedia> localMediaList = PictureSelector.obtainSelectorList(data);
|
||||
|
||||
List<LocalMedia> localMedia1 = PictureSelector.obtainSelectorList(data);
|
||||
if (localMedia1 != null && localMedia1.size() != 0) {
|
||||
LocalMedia imgMedia = localMedia1.get(0);
|
||||
String url;
|
||||
if (imgMedia.isCompressed()) {
|
||||
url = imgMedia.getCompressPath();
|
||||
} else {
|
||||
url = imgMedia.getRealPath();
|
||||
}
|
||||
MvpPre.uploadFile(new File(url), 1, 1, 1);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upLoadSuccess(String url, int type, int index, int total) {
|
||||
MvpPre.uploadBgImage("", url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadBgImage() {
|
||||
MvpPre.getBackgroundList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editRoom() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.tvTitle.setOnClickListener(this::onViewClicked);
|
||||
mBinding.tvTitle2.setOnClickListener(this::onViewClicked);
|
||||
// 设置默认样式(可选)
|
||||
resetBackgroundTextStyles();
|
||||
}
|
||||
|
||||
private void setTextViewStyle(TextView tv, String colorHex, int textSizeSp) {
|
||||
tv.setTextColor(Color.parseColor(colorHex));
|
||||
tv.setTextSize(textSizeSp);
|
||||
}
|
||||
|
||||
private void resetBackgroundTextStyles() {
|
||||
setTextViewStyle(mBinding.tvTitle, "#333333", 16);
|
||||
setTextViewStyle(mBinding.tvTitle2, "#999999", 12);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
roomId = arguments.getString("roomId");
|
||||
picture = arguments.getString("picture");
|
||||
}
|
||||
|
||||
@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 initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
// window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
setCancelable(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_fragement_dialog_room_background;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomBackgroundPresenter bindPresenter() {
|
||||
return new RoomBackgroundPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
super.onAttach(context);
|
||||
pictureChanged = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDetach() {
|
||||
if (!pictureChanged) {
|
||||
EventBus.getDefault().post(new RoomBgBean());
|
||||
}
|
||||
super.onDetach();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
MvpPre.getBackgroundList();
|
||||
}
|
||||
|
||||
|
||||
public void onViewClicked(View view) {
|
||||
if (view.getId() == R.id.tv_title2) {
|
||||
// 点击“我的背景”
|
||||
setTextViewStyle(mBinding.tvTitle2, "#333333", 16);
|
||||
setTextViewStyle(mBinding.tvTitle, "#999999", 12);
|
||||
List<RoomBgBean.RoomBg> listWithAddBtn = new ArrayList<>();
|
||||
RoomBgBean.RoomBg addBg = new RoomBgBean.RoomBg();
|
||||
addBg.setAddButton(true);
|
||||
addBg.setImage_url(null); // 可选:设为空图 URL
|
||||
|
||||
// 插入到顶部
|
||||
listWithAddBtn.add(addBg);
|
||||
listWithAddBtn.addAll(myBgList);
|
||||
mAdapter.setNewData(listWithAddBtn);
|
||||
} else if (view.getId() == R.id.tv_title) {
|
||||
// 点击“公共背景”
|
||||
setTextViewStyle(mBinding.tvTitle, "#333333", 16); // 当前项大字体、深色
|
||||
setTextViewStyle(mBinding.tvTitle2, "#999999", 12);
|
||||
mAdapter.setNewData(publicBgList);
|
||||
}
|
||||
|
||||
// MvpPre.setBg(roomId, mAdapter.getCheckedPicture());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showLoadings(String content) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBackgroundList(RoomBgBean list) {
|
||||
publicBgList = list.getPublic_bg();
|
||||
myBgList = list.getPrivate_bg();
|
||||
|
||||
// 如果当前正在显示“我的背景”,则刷新 RecyclerView
|
||||
if (mBinding.tvTitle2.getCurrentTextColor() == Color.parseColor("#333333")) {
|
||||
List<RoomBgBean.RoomBg> listWithAddBtn = new ArrayList<>();
|
||||
RoomBgBean.RoomBg addBg = new RoomBgBean.RoomBg();
|
||||
addBg.setAddButton(true);
|
||||
listWithAddBtn.add(addBg);
|
||||
listWithAddBtn.addAll(myBgList);
|
||||
mAdapter.setNewData(listWithAddBtn); // 更新 adapter 数据并刷新
|
||||
}
|
||||
mAdapter.setNewData(publicBgList);
|
||||
}
|
||||
|
||||
private static class MyAdapter extends BaseQuickAdapter<RoomBgBean.RoomBg, BaseViewHolder> {
|
||||
public interface OnItemClickListener {
|
||||
void onAddImageClick(); // 点击“添加图片”按钮时触发
|
||||
void onBackgroundClick(RoomBgBean.RoomBg item); // 点击普通背景项时触发
|
||||
}
|
||||
private OnItemClickListener onItemClickListener;
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener listener) {
|
||||
this.onItemClickListener = listener;
|
||||
}
|
||||
MyAdapter() {
|
||||
super(R.layout.room_rv_item_room_bg);
|
||||
}
|
||||
|
||||
private String checkedPicture;
|
||||
|
||||
public void setCheckedPicture(String checkedPicture) {
|
||||
this.checkedPicture = checkedPicture;
|
||||
}
|
||||
|
||||
String getCheckedPicture() {
|
||||
return checkedPicture;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, RoomBgBean.RoomBg item) {
|
||||
if (item.isAddButton()) {
|
||||
// “添加图片”按钮样式
|
||||
helper.setImageResource(R.id.iv_bg, com.xscm.moduleutil.R.mipmap.add_img); // 添加图片图标
|
||||
helper.itemView.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onAddImageClick();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// 普通图片项
|
||||
ImageUtils.loadHeadCC(item.getImage_url(), helper.getView(R.id.iv_bg));
|
||||
helper.itemView.setOnClickListener(v -> {
|
||||
if (onItemClickListener != null) {
|
||||
onItemClickListener.onBackgroundClick(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// // 设置点击事件
|
||||
// helper.itemView.setOnClickListener(v -> {
|
||||
// if (item.isAddButton()) {
|
||||
// // 跳转选择图片(比如打开系统相册)
|
||||
// chooseImage();
|
||||
// } else {
|
||||
// // 选择某张图片作为背景
|
||||
// checkedPicture = item.getImage_url();
|
||||
// EventBus.getDefault().post(new RoomBgBean());
|
||||
// notifyDataSetChanged();
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
public void closeDialog(View view) {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,824 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import static android.view.View.GONE;
|
||||
import static android.view.View.VISIBLE;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.projection.MediaProjection;
|
||||
import android.media.projection.MediaProjectionManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.SurfaceView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.blankj.utilcode.util.TimeUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.contacts.RoomCabinContacts;
|
||||
import com.example.moduleroom.databinding.RoomCabinFragmentBinding;
|
||||
import com.example.moduleroom.dialog.ExitRoomBottomSheet;
|
||||
import com.example.moduleroom.dialog.RoomGiftDialogFragment;
|
||||
import com.example.moduleroom.presenter.RoomCabinPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xscm.moduleutil.base.BaseRoomFragment;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.room.RoomCpUserBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.event.CabinEvent;
|
||||
import com.xscm.moduleutil.event.RoomBeckoningEvent;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
|
||||
import io.agora.rtc2.Constants;
|
||||
import io.agora.rtc2.IRtcEngineEventHandler;
|
||||
import io.agora.rtc2.RtcEngine;
|
||||
import io.agora.rtc2.RtcEngineEx;
|
||||
import io.agora.rtc2.ScreenCaptureParameters;
|
||||
import io.agora.rtc2.video.VideoCanvas;
|
||||
|
||||
/**
|
||||
* @author qx
|
||||
* @data 2025/7/1
|
||||
* @description: 电影房
|
||||
*/
|
||||
public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, RoomCabinFragmentBinding> implements RoomCabinContacts.View {
|
||||
private static final String LABEL_ID_MOVIE = "5";
|
||||
protected String roomId;
|
||||
protected String pitNumber;//当前点击的麦序
|
||||
protected CommonDialog commonDialog;
|
||||
CountDownTimer mCountDownTimer;
|
||||
private RoomInfoResp roomInfoResp;
|
||||
private int remainingTime;
|
||||
private boolean isShow = false;
|
||||
private RoomCpUserBean cpUserBean;
|
||||
private boolean isMicPlace = false;
|
||||
private RtcEngineEx engine;
|
||||
private String label_id="";
|
||||
|
||||
private int remoteUid = -1;
|
||||
private final ScreenCaptureParameters screenCaptureParameters = new ScreenCaptureParameters();
|
||||
|
||||
|
||||
public static RoomCabinFragment newInstance() {
|
||||
Bundle args = new Bundle();
|
||||
RoomCabinFragment fragment = new RoomCabinFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
// roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfoResp");
|
||||
// if (roomInfoResp != null) {
|
||||
// roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
// cpUserBean = roomInfoResp.getCp_user();
|
||||
// label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
// }
|
||||
}
|
||||
private boolean isLandscape;
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||
// ((RoomActivity) getActivity()).setvisibTop(false);
|
||||
// }
|
||||
}
|
||||
|
||||
private void enableNotifications() {
|
||||
if (NotificationManagerCompat.from(requireContext()).areNotificationsEnabled()) {
|
||||
Log.d("RoomCabinFragment", "Notifications enable!");
|
||||
return;
|
||||
}
|
||||
Log.d("RoomCabinFragment", "Notifications not enable!");
|
||||
new AlertDialog.Builder(requireContext())
|
||||
.setTitle("提示")
|
||||
.setMessage("请打开通知权限,防止后台共享屏幕中断")
|
||||
.setPositiveButton("设置", (dialog, which) -> {
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, requireContext().getPackageName());
|
||||
intent.putExtra(Settings.EXTRA_CHANNEL_ID, requireContext().getApplicationInfo().uid);
|
||||
} else {
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
}
|
||||
startActivity(intent);
|
||||
dialog.dismiss();
|
||||
})
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomCabinPresenter bindPresenter() {
|
||||
return new RoomCabinPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
if (roomInfoResp == null) return;
|
||||
|
||||
|
||||
}
|
||||
private SharedViewModel sharedViewModel;
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||
// if (data != null) {
|
||||
// // 处理数据
|
||||
// roomInfoUpdate(data);
|
||||
// }
|
||||
// });
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
super.initView();
|
||||
|
||||
mBinding.im1.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!isShow) {
|
||||
switchMic(2);
|
||||
isMute(1);
|
||||
} else {
|
||||
switchMic(1);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
mBinding.im2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RoomPitBean roomPitBean = mBinding.roomMakeWheat2.pitBean;
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setUser_id(Integer.parseInt(roomPitBean.getUser_id()!=null ? roomPitBean.getUser_id() : "0"));
|
||||
userInfo.setNickname(roomPitBean.getNickname());
|
||||
userInfo.setAvatar(roomPitBean.getAvatar());
|
||||
userInfo.setPit_number("");
|
||||
RoomGiftDialogFragment.show(null, userInfo, roomInfoResp.getRoom_info().getRoom_id(),0,"", getParentFragmentManager());
|
||||
|
||||
}
|
||||
});
|
||||
isShow = true;
|
||||
switchMic(2);
|
||||
|
||||
mBinding.im3.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!isMicPlace) {
|
||||
joinChannel();
|
||||
isMicPlace = true;
|
||||
mBinding.im3.setImageResource(com.xscm.moduleutil.R.mipmap.clogs_car);
|
||||
|
||||
} else {
|
||||
isMicPlace = false;
|
||||
ToastUtils.show("将停止屏幕共享");
|
||||
AgoraManager.getInstance(getActivity()).stopScreenCapture();
|
||||
mBinding.im3.setImageResource(com.xscm.moduleutil.R.mipmap.gongxiang);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
|
||||
mBinding.im3.setVisibility(VISIBLE);
|
||||
// setvkk(false);
|
||||
}else {
|
||||
mBinding.im3.setVisibility(GONE);
|
||||
}
|
||||
|
||||
// if (label_id!=null&& label_id.equals(LABEL_ID_MOVIE)){
|
||||
// mBinding.im3.setVisibility(GONE);
|
||||
// }
|
||||
}
|
||||
|
||||
public void handleMsgType1028(RoomMessageEvent messageEvent){
|
||||
if (messageEvent.getMsgType()==1028){
|
||||
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());
|
||||
}
|
||||
}
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp){
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
// if (roomInfoResp != null) {
|
||||
// roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
// cpUserBean = roomInfoResp.getCp_user();
|
||||
// label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
// }
|
||||
// if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
|
||||
// mBinding.im3.setVisibility(VISIBLE);
|
||||
//// setvkk(false);
|
||||
// }else {
|
||||
// mBinding.im3.setVisibility(GONE);
|
||||
// }
|
||||
//
|
||||
// mBinding.ivExit.setOnClickListener(this::onHeartLineClicked);
|
||||
//
|
||||
// // 获取当前用户 ID
|
||||
// String currentUserId = SpUtil.getUserId() + "";
|
||||
//
|
||||
//// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||
// RoomPitBean selfBean = new RoomPitBean(); // 自己的 bean
|
||||
// RoomPitBean otherBean = new RoomPitBean(); // 另一个用户的 bean
|
||||
//
|
||||
// boolean isSelfFirst = false;
|
||||
//
|
||||
//// 判断当前用户是 user_id 还是 user_id1
|
||||
// if (cpUserBean != null) {
|
||||
// if (currentUserId.equals(cpUserBean.getUser_id())) {
|
||||
// // 当前用户是 user_id
|
||||
// selfBean.setUser_id(cpUserBean.getUser_id());
|
||||
// selfBean.setUser_code(cpUserBean.getUser_code());
|
||||
// selfBean.setNickname(cpUserBean.getNickname());
|
||||
// selfBean.setAvatar(cpUserBean.getAvatar());
|
||||
// selfBean.setDress(cpUserBean.getDress());
|
||||
// selfBean.setPit_number("000");
|
||||
//
|
||||
// otherBean.setUser_id(cpUserBean.getUser_id1());
|
||||
// otherBean.setUser_code(cpUserBean.getUser_code1());
|
||||
// otherBean.setNickname(cpUserBean.getNickname1());
|
||||
// otherBean.setAvatar(cpUserBean.getAvatar1());
|
||||
// otherBean.setDress(cpUserBean.getDress1());
|
||||
// otherBean.setPit_number("000");
|
||||
//
|
||||
//
|
||||
// } else if (currentUserId.equals(cpUserBean.getUser_id1())) {
|
||||
// // 当前用户是 user_id1,则交换位置
|
||||
// selfBean.setUser_id(cpUserBean.getUser_id1());
|
||||
// selfBean.setUser_code(cpUserBean.getUser_code1());
|
||||
// selfBean.setNickname(cpUserBean.getNickname1());
|
||||
// selfBean.setAvatar(cpUserBean.getAvatar1());
|
||||
// selfBean.setDress(cpUserBean.getDress1());
|
||||
// selfBean.setPit_number("000");
|
||||
//
|
||||
// otherBean.setUser_id(cpUserBean.getUser_id());
|
||||
// otherBean.setUser_code(cpUserBean.getUser_code());
|
||||
// otherBean.setNickname(cpUserBean.getNickname());
|
||||
// otherBean.setAvatar(cpUserBean.getAvatar());
|
||||
// otherBean.setDress(cpUserBean.getDress());
|
||||
// otherBean.setPit_number("000");
|
||||
// }
|
||||
// }
|
||||
//// 不论谁是自己,始终将自己放在 roomMakeWheat1
|
||||
// mBinding.roomMakeWheat1.setData(selfBean);
|
||||
//// 将另一个用户的数据放在 roomMakeWheat2
|
||||
// mBinding.roomMakeWheat2.setData(otherBean);
|
||||
// mBinding.tvMainTitle.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||
// mBinding.tvHeartValue2.setText(roomInfoResp.getRoom_info().getHot_value());
|
||||
// if (cpUserBean != null) {
|
||||
// countDownTime(Long.parseLong(cpUserBean.getTime_day()));
|
||||
// }
|
||||
// mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
||||
}
|
||||
|
||||
public void upCabinFragment(long time){
|
||||
countDownTime( time);
|
||||
}
|
||||
|
||||
private void setvkk(boolean isShow){
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setDiany(isShow);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isFullscreen = false;
|
||||
|
||||
|
||||
public void switchMic(int type) {
|
||||
|
||||
if (type == 1) {
|
||||
mBinding.im1.setImageResource(com.xscm.moduleutil.R.mipmap.close_m);
|
||||
AgoraManager.getInstance(getActivity()).ClientRole(true);
|
||||
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(true,SpUtil.getUserId()+"");
|
||||
isShow = false;
|
||||
|
||||
} else {
|
||||
mBinding.im1.setImageResource(com.xscm.moduleutil.R.mipmap.op_m);
|
||||
AgoraManager.getInstance(getActivity()).ClientRole(true);
|
||||
AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(false,SpUtil.getUserId()+"");
|
||||
isShow = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void isMute(int is_mute) {
|
||||
RoomMessageEvent.text text = new RoomMessageEvent.text();
|
||||
text.setIs_mute(is_mute);
|
||||
String s = com.blankj.utilcode.util.GsonUtils.toJson(text);
|
||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||
t.setFromUserInfo(SpUtil.getUserInfo());
|
||||
t.setText(s);
|
||||
RoomMessageEvent roomMessageEvent = new RoomMessageEvent(126, roomInfoResp.getRoom_info().getRoom_id(), t);
|
||||
String json = com.blankj.utilcode.util.GsonUtils.toJson(roomMessageEvent);
|
||||
// 转换为 byte[]
|
||||
byte[] binaryData = json.getBytes(StandardCharsets.UTF_8);
|
||||
// 创建自定义消息
|
||||
MessageListenerSingleton.getInstance().sendCustomRoomMessage(
|
||||
roomId + "",
|
||||
binaryData
|
||||
);
|
||||
}
|
||||
|
||||
public void roomInfoEvent(RoomMessageEvent messageEvent) {
|
||||
if (messageEvent.getMsgType() == 1028) {
|
||||
mBinding.tvHeartValue2.setText(messageEvent.getText().getHot_value());
|
||||
}
|
||||
}
|
||||
|
||||
private void onHeartLineClicked(View view) {
|
||||
if (view.getId() == R.id.iv_exit) {
|
||||
// EventBus.getDefault().post(new RoomOutEvent());
|
||||
// ARouter.getInstance().build(ARouteConstants.LIVE_ROOM).withString("form","首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
||||
ExitRoomBottomSheet bottomSheet = ExitRoomBottomSheet.newInstance(false,true,true);
|
||||
|
||||
bottomSheet.setOnOptionSelectedListener(new ExitRoomBottomSheet.OnOptionSelectedListener() {
|
||||
@Override
|
||||
public void onMinimize() {
|
||||
// 处理最小化逻辑,比如不销毁 Activity,仅移至后台
|
||||
// CommonAppContext.getInstance().isShow = false;
|
||||
// ARouter.getInstance().build(ARouteConstants.ME).navigation();//栈顶复用
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).moveTaskToBack(true);
|
||||
// }
|
||||
|
||||
// 在Activity中
|
||||
// Intent serviceIntent = new Intent(getContext(), FloatingWindowService.class);
|
||||
|
||||
// 判断是否已有浮窗正在显示
|
||||
// if (!EasyFloat.isShow("testFloat")) {
|
||||
// // 启动前台服务以维持浮窗
|
||||
// Context context = requireContext();
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// // Android 12+ 需要指定 foregroundServiceType
|
||||
// Intent serviceIntent = new Intent(context, FloatingWindowService.class);
|
||||
// serviceIntent.setAction("ACTION_START_FLOAT");
|
||||
// context.startForegroundService(serviceIntent);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExitRoom() {
|
||||
// 调用退出房间方法
|
||||
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
||||
MvpPre.quitRoom(roomId, SpUtil.getUserId() + "");
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", AgoraManager.getInstance(getActivity()).getLastRoomId()).navigation();
|
||||
return;
|
||||
}
|
||||
if (roomInfoResp != null) {
|
||||
MvpPre.quitRoom(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
// 用户点击取消,不做任何事
|
||||
}
|
||||
});
|
||||
bottomSheet.show(getChildFragmentManager(), "ExitRoomBottomSheet");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/3/12 倒计时
|
||||
public void countDownTime(long time) {
|
||||
try {
|
||||
if (time <= 0) {
|
||||
setTime(0);
|
||||
releaseCountDownTimer();
|
||||
return;
|
||||
}
|
||||
releaseCountDownTimer();
|
||||
// 获取当前时间的毫秒值
|
||||
long currentTime = System.currentTimeMillis() / 1000L;
|
||||
// 计算倒计时的总秒数
|
||||
long countDownTime = (time - currentTime);
|
||||
Logger.d("小黑屋", "countDownTime = " + countDownTime);
|
||||
if (countDownTime <= 0) {
|
||||
setTime(0);
|
||||
releaseCountDownTimer();
|
||||
return;
|
||||
}
|
||||
mCountDownTimer = new CountDownTimer(countDownTime * 1000L, 1000L) {
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
int time1 = (int) (millisUntilFinished / 1000);
|
||||
// pitBean.setCount_down(time1);
|
||||
setTime(time1);
|
||||
remainingTime = time1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
setTime(0);
|
||||
remainingTime = 0;
|
||||
}
|
||||
};
|
||||
mCountDownTimer.start();
|
||||
} catch (Exception e) {
|
||||
Logger.e("countDownTime", e);
|
||||
}
|
||||
}
|
||||
|
||||
private String formatTime(int totalSeconds) {
|
||||
int days = totalSeconds / (24 * 3600);
|
||||
int remaining = totalSeconds % (24 * 3600);
|
||||
|
||||
int hours = remaining / 3600;
|
||||
remaining %= 3600;
|
||||
|
||||
int minutes = remaining / 60;
|
||||
int seconds = remaining % 60;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
if (days > 0) {
|
||||
sb.append(days).append("天");
|
||||
}
|
||||
|
||||
if (hours > 0 || days > 0) {
|
||||
sb.append(hours).append("小时");
|
||||
}
|
||||
|
||||
if (minutes > 0 || hours > 0 || days > 0) {
|
||||
sb.append(minutes).append("分");
|
||||
}
|
||||
|
||||
sb.append(seconds).append("秒");
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("DefaultLocale")
|
||||
public void setTime(int time) {
|
||||
if (time == 0) {
|
||||
mBinding.datingTime.setText("00:00:00");
|
||||
}
|
||||
String formattedTime = formatTime(time);
|
||||
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
||||
mBinding.datingTime.setText("倒计时:" + formattedTime);
|
||||
}else {
|
||||
mBinding.datingTime.setText("到期时间:" + formattedTime);
|
||||
}
|
||||
mBinding.datingTime.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
private void releaseCountDownTimer() {
|
||||
if (mCountDownTimer != null) {
|
||||
mCountDownTimer.cancel();
|
||||
mCountDownTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateWheatData() {
|
||||
if (roomInfoResp != null && !ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getPit_list())) {
|
||||
for (RoomPitBean bean : roomInfoResp.getRoom_info().getPit_list()) {
|
||||
EventBus.getDefault().post(bean);
|
||||
}
|
||||
}
|
||||
if (roomInfoResp != null) {
|
||||
RoomBeckoningEvent event = new RoomBeckoningEvent(roomId, roomInfoResp.getRoom_info().getCardiac() == 1);
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.room_cabin_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomInfoUpdate(RoomInfoResp resp) {
|
||||
roomInfoResp = resp;
|
||||
// updateWheatData();
|
||||
|
||||
if (roomInfoResp != null) {
|
||||
roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||
cpUserBean = roomInfoResp.getCp_user();
|
||||
label_id = roomInfoResp.getRoom_info().getLabel_id();
|
||||
}
|
||||
if (roomInfoResp != null && roomInfoResp.getRoom_owner().getUser_id().equals(SpUtil.getUserId()+"")){
|
||||
mBinding.im3.setVisibility(VISIBLE);
|
||||
// setvkk(false);
|
||||
}else {
|
||||
mBinding.im3.setVisibility(GONE);
|
||||
}
|
||||
|
||||
mBinding.ivExit.setOnClickListener(this::onHeartLineClicked);
|
||||
|
||||
// 获取当前用户 ID
|
||||
String currentUserId = SpUtil.getUserId() + "";
|
||||
|
||||
// 定义两个 RoomPitBean 对象,分别用于显示在 roomMakeWheat1 和 roomMakeWheat2
|
||||
RoomPitBean selfBean = new RoomPitBean(); // 自己的 bean
|
||||
RoomPitBean otherBean = new RoomPitBean(); // 另一个用户的 bean
|
||||
|
||||
boolean isSelfFirst = false;
|
||||
|
||||
// 判断当前用户是 user_id 还是 user_id1
|
||||
if (cpUserBean != null) {
|
||||
if (currentUserId.equals(cpUserBean.getUser_id())) {
|
||||
// 当前用户是 user_id
|
||||
selfBean.setUser_id(cpUserBean.getUser_id());
|
||||
selfBean.setUser_code(cpUserBean.getUser_code());
|
||||
selfBean.setNickname(cpUserBean.getNickname());
|
||||
selfBean.setAvatar(cpUserBean.getAvatar());
|
||||
selfBean.setDress(cpUserBean.getDress());
|
||||
selfBean.setPit_number("000");
|
||||
|
||||
otherBean.setUser_id(cpUserBean.getUser_id1());
|
||||
otherBean.setUser_code(cpUserBean.getUser_code1());
|
||||
otherBean.setNickname(cpUserBean.getNickname1());
|
||||
otherBean.setAvatar(cpUserBean.getAvatar1());
|
||||
otherBean.setDress(cpUserBean.getDress1());
|
||||
otherBean.setPit_number("000");
|
||||
|
||||
|
||||
} else if (currentUserId.equals(cpUserBean.getUser_id1())) {
|
||||
// 当前用户是 user_id1,则交换位置
|
||||
selfBean.setUser_id(cpUserBean.getUser_id1());
|
||||
selfBean.setUser_code(cpUserBean.getUser_code1());
|
||||
selfBean.setNickname(cpUserBean.getNickname1());
|
||||
selfBean.setAvatar(cpUserBean.getAvatar1());
|
||||
selfBean.setDress(cpUserBean.getDress1());
|
||||
selfBean.setPit_number("000");
|
||||
|
||||
otherBean.setUser_id(cpUserBean.getUser_id());
|
||||
otherBean.setUser_code(cpUserBean.getUser_code());
|
||||
otherBean.setNickname(cpUserBean.getNickname());
|
||||
otherBean.setAvatar(cpUserBean.getAvatar());
|
||||
otherBean.setDress(cpUserBean.getDress());
|
||||
otherBean.setPit_number("000");
|
||||
}
|
||||
}
|
||||
// 不论谁是自己,始终将自己放在 roomMakeWheat1
|
||||
mBinding.roomMakeWheat1.setData(selfBean);
|
||||
// 将另一个用户的数据放在 roomMakeWheat2
|
||||
mBinding.roomMakeWheat2.setData(otherBean);
|
||||
mBinding.tvMainTitle.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||
mBinding.tvHeartValue2.setText(roomInfoResp.getRoom_info().getHot_value());
|
||||
if (cpUserBean != null) {
|
||||
countDownTime(Long.parseLong(cpUserBean.getTime_day()));
|
||||
}
|
||||
mediaProjectionManager = (MediaProjectionManager) getContext().getSystemService(Context.MEDIA_PROJECTION_SERVICE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWheatViews() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unRegisterWheatViews() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initListener() {
|
||||
super.initListener();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void hideAllWheatMaozi() {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void showWheatMaoziHuangguan(int wheat) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWheatMaoziBianbian(int... wheats) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] collectCurrentCardiacValues() {
|
||||
int[] cvs = new int[8];
|
||||
return cvs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quitRoom() {
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
LogUtils.e("lxj", "退出房间时间:" + TimeUtils.date2String(new Date())+":退出的roomId"+roomId);
|
||||
MessageListenerSingleton.getInstance().quitGroup(roomId);
|
||||
((RoomActivity) getActivity()).quit();
|
||||
((RoomActivity) getActivity()).quitRoom2(roomId);
|
||||
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
||||
((RoomActivity) getActivity()).jiaR();
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", AgoraManager.getInstance(getActivity()).getLastRoomId()).navigation();
|
||||
return;
|
||||
}else {
|
||||
((RoomActivity) getActivity()).performExitRoom(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private MediaProjection[] mediaProjection = new MediaProjection[1];
|
||||
private MediaProjectionManager mediaProjectionManager;
|
||||
private final ActivityResultLauncher<Intent> mediaProjectionLauncher = registerForActivityResult(
|
||||
new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == Activity.RESULT_OK) {
|
||||
try {
|
||||
mediaProjection[0] = mediaProjectionManager
|
||||
.getMediaProjection(result.getResultCode(), result.getData());
|
||||
joinChannel();
|
||||
} catch (Exception e) {
|
||||
Log.e("RoomCabinFragment", "error msg: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
private void isConfig() {
|
||||
|
||||
enableNotifications();
|
||||
}
|
||||
|
||||
|
||||
private void joinChannel() {
|
||||
|
||||
AgoraManager.getInstance(getContext()).updateChannelMediaOptions();
|
||||
AgoraManager.getInstance(getContext()).post();
|
||||
}
|
||||
|
||||
/**
|
||||
* IRtcEngineEventHandler is an abstract class providing default implementation.
|
||||
* The SDK uses this class to report to the app on SDK runtime events.
|
||||
*/
|
||||
private final IRtcEngineEventHandler iRtcEngineEventHandler = new IRtcEngineEventHandler() {
|
||||
/**
|
||||
* Error code description can be found at:
|
||||
* en: https://api-ref.agora.io/en/video-sdk/android/4.x/API/class_irtcengineeventhandler.html#callback_irtcengineeventhandler_onerror
|
||||
* cn: https://docs.agora.io/cn/video-call-4.x/API%20Reference/java_ng/API/class_irtcengineeventhandler.html#callback_irtcengineeventhandler_onerror
|
||||
*/
|
||||
@Override
|
||||
public void onError(int err) {
|
||||
Log.e("RoomCabinFragment", String.format("onError code %d message %s", err, RtcEngine.getErrorDescription(err)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onJoinChannelSuccess(String channel, int uid, int elapsed) {
|
||||
Log.i("RoomCabinFragment", String.format("onJoinChannelSuccess channel %s uid %d", channel, uid));
|
||||
}
|
||||
|
||||
/// 本地视频状态回调
|
||||
@Override
|
||||
public void onLocalVideoStateChanged(Constants.VideoSourceType source, int state, int error) {
|
||||
super.onLocalVideoStateChanged(source, state, error);
|
||||
Log.i("RoomCabinFragment", "onLocalVideoStateChanged source=" + source + ", state=" + state + ", error=" + error);
|
||||
if (source == Constants.VideoSourceType.VIDEO_SOURCE_SCREEN_PRIMARY) {
|
||||
if (state == Constants.LOCAL_VIDEO_STREAM_STATE_ENCODING) {
|
||||
if (error == Constants.ERR_OK) {
|
||||
Logger.d("onLocalVideoStateChanged", "Screen sharing start successfully.");
|
||||
}
|
||||
} else if (state == Constants.LOCAL_VIDEO_STREAM_STATE_FAILED) {
|
||||
if (error == Constants.ERR_SCREEN_CAPTURE_SYSTEM_NOT_SUPPORTED) {
|
||||
Logger.e("onLocalVideoStateChanged", "Screen sharing has been cancelled");
|
||||
} else {
|
||||
Logger.e("onLocalVideoStateChanged", "Screen sharing failed. Error code: " + error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///报告远端视频状态
|
||||
@Override
|
||||
public void onRemoteVideoStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
super.onRemoteVideoStateChanged(uid, state, reason, elapsed);
|
||||
Log.i("RoomCabinFragment", "onRemoteVideoStateChanged:uid->" + uid + ", state->" + state);
|
||||
}
|
||||
|
||||
///远端视频统计
|
||||
@Override
|
||||
public void onRemoteVideoStats(RemoteVideoStats stats) {
|
||||
super.onRemoteVideoStats(stats);
|
||||
Log.d("RoomCabinFragment", "onRemoteVideoStats: width:" + stats.width + " x height:" + stats.height);
|
||||
}
|
||||
///加入频道
|
||||
@Override
|
||||
public void onUserJoined(int uid, int elapsed) {
|
||||
super.onUserJoined(uid, elapsed);
|
||||
Log.i("RoomCabinFragment", "onUserJoined->" + uid);
|
||||
if (remoteUid > 0) {
|
||||
return;
|
||||
}
|
||||
remoteUid = uid;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
SurfaceView renderView = new SurfaceView(getContext());
|
||||
engine.setupRemoteVideo(new VideoCanvas(renderView, Constants.RENDER_MODE_FIT, uid));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 当远程用户(通信)/主机(直播)离开频道时触发。
|
||||
* *@参数 uid 要更改音频状态的用户的ID。
|
||||
* @参数 reason 用户离线的原因:
|
||||
* 用户离线退出(0):用户离开了当前频道。USER OFFLINE DROPPED(1):SDK超时,用户在一定时间内未接收到数据包,因此被标记为离线状态。如果用户在通话中退出,且消息未传递到SDK(因为信道不可靠),SDK 将假定用户已离线。
|
||||
* 用户离线成为观众(仅限直播)。客户端角色从主持人变为观众。
|
||||
* @param uid
|
||||
* @param reason
|
||||
*/
|
||||
@Override
|
||||
public void onUserOffline(int uid, int reason) {
|
||||
Log.i("RoomCabinFragment", String.format("user %d offline! reason:%d", uid, reason));
|
||||
// showLongToast(String.format("user %d offline! reason:%d", uid, reason));
|
||||
if (remoteUid == uid) {
|
||||
remoteUid = -1;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
engine.setupRemoteVideo(new VideoCanvas(null, Constants.RENDER_MODE_FIT, uid));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocalAudioStats(LocalAudioStats stats) {
|
||||
super.onLocalAudioStats(stats);
|
||||
Log.d("RoomCabinFragment", "onLocalAudioStats: " + stats.numChannels + " x " + stats.sentSampleRate + " Hz");
|
||||
}
|
||||
|
||||
///报告远端视频流状态监护
|
||||
@Override
|
||||
public void onRemoteAudioStateChanged(int uid, int state, int reason, int elapsed) {
|
||||
super.onRemoteAudioStateChanged(uid, state, reason, elapsed);
|
||||
Log.i("RoomCabinFragment", "onRemoteAudioStateChanged: uid->" + uid + ", state->" + state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstRemoteAudioFrame(int uid, int elapsed) {
|
||||
super.onFirstRemoteAudioFrame(uid, elapsed);
|
||||
Log.i("RoomCabinFragment", "onFirstRemoteAudioFrame: uid->" + uid);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@Subscribe (threadMode = ThreadMode.MAIN)
|
||||
public void roomInfoEvent(CabinEvent messageEvent) {
|
||||
if (messageEvent.isJoined()){
|
||||
isMicPlace=true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
releaseResources();
|
||||
}
|
||||
|
||||
public void releaseResources(){
|
||||
releaseCountDownTimer();
|
||||
if (mediaProjection[0] != null) {
|
||||
mediaProjection[0].stop();
|
||||
mediaProjection[0] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.blankj.utilcode.util.FragmentUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomChartsContacts;
|
||||
import com.example.moduleroom.databinding.FragmentRoomChartsBinding;
|
||||
import com.example.moduleroom.presenter.RoomChartsPresenter;
|
||||
import com.example.moduletablayout.listener.CustomTabEntity;
|
||||
import com.example.moduletablayout.listener.OnTabSelectListener;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/10
|
||||
*@description: 房间排行榜
|
||||
*/
|
||||
public class RoomChartsFragment extends BaseMvpDialogFragment<RoomChartsPresenter, FragmentRoomChartsBinding> implements RoomChartsContacts.View {
|
||||
private String mRoomId;
|
||||
public static final int TYPE_CHARM = 1;//财富榜
|
||||
public static final int TYPE_WEALTH = 2;//魅力榜
|
||||
private int type = TYPE_CHARM;
|
||||
private int childType = RankingChildFragment.TYPE_DATA;
|
||||
private RoomInfoResp mRoomInfoResp;
|
||||
|
||||
public static RoomChartsFragment newInstance(String roomId,RoomInfoResp roomInfoResp) {
|
||||
RoomChartsFragment roomRankingFragment = new RoomChartsFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("roomId", roomId);
|
||||
bundle.putSerializable("roomInfoResp", roomInfoResp);
|
||||
roomRankingFragment.setArguments(bundle);
|
||||
return roomRankingFragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected RoomChartsPresenter bindPresenter() {
|
||||
return new RoomChartsPresenter( this,getActivity());
|
||||
}
|
||||
@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 onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
mRoomId = getArguments().getString("roomId");
|
||||
mRoomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfoResp");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
FragmentUtils.add(getChildFragmentManager(), RankingChildFragment.newInstance(mRoomId, childType, type, mRoomInfoResp), R.id.fl_content);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView() {
|
||||
mBinding.slidingTabLayout.setOnTabSelectListener(new OnTabSelectListener() {
|
||||
@Override
|
||||
public void onTabSelect(int position) {
|
||||
childType = ++position;
|
||||
refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselect(int position) {
|
||||
|
||||
}
|
||||
});
|
||||
ArrayList<CustomTabEntity> tabItems = new ArrayList<>();
|
||||
tabItems.add(new TabItem("小时榜"));
|
||||
tabItems.add(new TabItem("日榜"));
|
||||
tabItems.add(new TabItem("周榜"));
|
||||
mBinding.slidingTabLayout.setTabData(tabItems);
|
||||
String[] title = new String[]{"小时榜", "日榜", "周榜"};
|
||||
// mBinding.slidingTabLayout.setViewPager(mBinding.vpRankChild, title);
|
||||
|
||||
// List<Fragment> fragments = new ArrayList<>();
|
||||
// fragments.add(RankingChildFragment.newInstance(mRoomId, childType, type));
|
||||
// fragments.add(RankingChildFragment.newInstance(mRoomId, childType, type));
|
||||
// fragments.add(RankingChildFragment.newInstance(mRoomId, childType, type));
|
||||
// MyFragmentPagerAdapter myFragmentPagerAdapter = new MyFragmentPagerAdapter(fragments, getChildFragmentManager());
|
||||
// mBinding.vpRankChild.setAdapter(myFragmentPagerAdapter);
|
||||
// mBinding.vpRankChild.setCurrentItem(0);
|
||||
// mBinding.slidingTabLayout.setViewPager(mBinding.vpRankChild, title);
|
||||
|
||||
mBinding.tvCharm.setOnClickListener(this::onViewClicked);
|
||||
mBinding.tvWealth.setOnClickListener(this::onViewClicked);
|
||||
}
|
||||
private void refresh() {
|
||||
FragmentUtils.replace(getChildFragmentManager(), RankingChildFragment.newInstance(mRoomId, childType, type, mRoomInfoResp), R.id.fl_content);
|
||||
}
|
||||
|
||||
public static class TabItem implements CustomTabEntity {
|
||||
private String title;
|
||||
|
||||
public TabItem(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabSelectedIcon() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTabUnselectedIcon() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public void onViewClicked(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_charm) {
|
||||
type = TYPE_WEALTH;//魅力
|
||||
mBinding.tvCharm.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.white));
|
||||
mBinding.tvWealth.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.color_DADADA));
|
||||
mBinding.tvCharm.setTextSize(18);
|
||||
mBinding.tvWealth.setTextSize(16);
|
||||
} else {
|
||||
type = TYPE_CHARM;//财富
|
||||
mBinding.tvWealth.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.white));
|
||||
mBinding.tvCharm.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.color_DADADA));
|
||||
mBinding.tvWealth.setTextSize(18);
|
||||
mBinding.tvCharm.setTextSize(16);
|
||||
}
|
||||
refresh();
|
||||
}
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_room_charts;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/10
|
||||
*@description: 房间公告展示
|
||||
*/
|
||||
public class RoomNoticeDialogFragment extends BaseDialog {
|
||||
private Context mContext;
|
||||
private TextView tvTile;
|
||||
private TextView tvContent;
|
||||
private ImageView ivClose;
|
||||
String title, content;
|
||||
|
||||
public RoomNoticeDialogFragment(@NonNull Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.fragment_room_notice_dialog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
getWindow().setLayout((int) (ScreenUtils.getScreenWidth() * 0.86), ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
tvTile=findViewById(R.id.tv_title);
|
||||
tvContent=findViewById(R.id.tv_content);
|
||||
ivClose=findViewById(R.id.iv_close);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
|
||||
ivClose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
tvContent.setText(content);
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
tvTile.setText(title);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
package com.example.moduleroom.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.contacts.RoomPasswordSetContacts;
|
||||
import com.example.moduleroom.databinding.RoomDialogRoomPwSettingBinding;
|
||||
import com.example.moduleroom.presenter.RoomPasswordSetPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
import com.xscm.moduleutil.event.PasswordInputEvent;
|
||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/9
|
||||
*@description: 输入密码弹窗
|
||||
*/
|
||||
public class RoomPasswordSetDialogFragment extends BaseMvpDialogFragment<RoomPasswordSetPresenter, RoomDialogRoomPwSettingBinding> implements RoomPasswordSetContacts.View {
|
||||
|
||||
private static final String TAG = "RoomPasswordSetDialogFragment";
|
||||
|
||||
|
||||
private boolean hidePwd;
|
||||
private String roomId;
|
||||
|
||||
public static RoomPasswordSetDialogFragment newInstance(boolean hidePwd, String roomId) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("hidePwd", hidePwd);
|
||||
args.putString("roomId", roomId);
|
||||
RoomPasswordSetDialogFragment fragment = new RoomPasswordSetDialogFragment();
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initArgs(Bundle arguments) {
|
||||
super.initArgs(arguments);
|
||||
this.hidePwd = arguments.getBoolean("hidePwd");
|
||||
this.roomId = arguments.getString("roomId");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.room_dialog_room_pw_setting;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
//是否隐藏密码
|
||||
if (hidePwd) {
|
||||
mBinding.txTitle.setText("请输入房间密码");
|
||||
mBinding.useHintTxt.setVisibility(View.INVISIBLE);
|
||||
mBinding.gpvPswView.setPasswordVisibility(false);
|
||||
} else {
|
||||
mBinding.txTitle.setText("请设置房间密码");
|
||||
mBinding.useHintTxt.setVisibility(View.VISIBLE);
|
||||
mBinding.gpvPswView.setPasswordVisibility(true);
|
||||
}
|
||||
mBinding.btPw.setOnClickListener(this::onViewClicked);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initDialogStyle(Window window) {
|
||||
super.initDialogStyle(window);
|
||||
int width = (int) (ScreenUtils.getScreenWidth() * 341.0 / 375);
|
||||
window.setLayout(width, WindowManager.LayoutParams.WRAP_CONTENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected RoomPasswordSetPresenter bindPresenter() {
|
||||
return new RoomPasswordSetPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (hidePwd) {
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
}
|
||||
}
|
||||
|
||||
public void onViewClicked(View view) {
|
||||
String passWord = mBinding.gpvPswView.getPassWord();
|
||||
if (passWord.length() != 4 && passWord.length() > 0) {
|
||||
ToastUtils.show("请输入完整的密码");
|
||||
return;
|
||||
}
|
||||
if (hidePwd) {
|
||||
EventBus.getDefault().post(new PasswordInputEvent(passWord));
|
||||
hidePwd = false;
|
||||
dismiss();
|
||||
} else {
|
||||
MvpPre.setRoomPassword(roomId, passWord);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomPasswordSettingSuccess() {
|
||||
ToastUtils.show("密码设置成功");
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public void show(FragmentManager manager) {
|
||||
show(manager, TAG);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.example.moduleroom.contacts.BidListContacts;
|
||||
import com.xscm.moduleutil.bean.room.RoomAuction;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class BidListPresenter extends BasePresenter<BidListContacts.View> implements BidListContacts.IRoomPre {
|
||||
public BidListPresenter(BidListContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuctionList(String auction_id) {
|
||||
api.roomAuctionList(auction_id, new BaseObserver<List<RoomAuction.AuctionListBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<RoomAuction.AuctionListBean> auctionListBeans) {
|
||||
List<RoomAuction.AuctionListBean> lists = auctionListBeans;
|
||||
if (!ObjectUtils.isEmpty(lists)) {//lists判空
|
||||
//榜一
|
||||
if (lists.size() > 0) {
|
||||
MvpRef.get().setNo1(lists.get(0));
|
||||
}
|
||||
//榜二
|
||||
if (lists.size() > 1) {
|
||||
MvpRef.get().setNo2(lists.get(1));
|
||||
}
|
||||
//榜三
|
||||
if (lists.size() > 2) {
|
||||
MvpRef.get().setNo3(lists.get(2));
|
||||
}
|
||||
//第四名及后
|
||||
if (lists.size() > 3) {
|
||||
MvpRef.get().roomAuctionList(lists.subList(3, lists.size()));
|
||||
}
|
||||
}else {
|
||||
MvpRef.get().setCharmEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.CardRelationshipContacts;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.RoomTime;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class CardRelationshipPresenter extends BasePresenter<CardRelationshipContacts.View> implements CardRelationshipContacts.IRoomPre{
|
||||
public CardRelationshipPresenter(CardRelationshipContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomRelationList(String type) {
|
||||
api.roomRelationList(type, new BaseObserver<List<RoomRelationBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<RoomRelationBean> roomRelationBeans) {
|
||||
MvpRef.get().roomRelationList(roomRelationBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getGiftList(String id) {
|
||||
api.getGiftList(Integer.parseInt(id),"", new BaseObserver<List<RoonGiftModel>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<RoonGiftModel> roonGiftModels) {
|
||||
MvpRef.get().setGiftList(roonGiftModels);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuction(String roomId, String userId, String giftId, String relation_id, String auction_type, String time_day) {
|
||||
api.roomAuction(roomId,userId,giftId,relation_id,auction_type,time_day, new BaseObserver<AuctionBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable( d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AuctionBean auctionBean) {
|
||||
MvpRef.get().roomAuction(auctionBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuctionTime(String gift_id) {
|
||||
api.roomAuctionTime(gift_id, new BaseObserver<RoomTime>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomTime roomTime) {
|
||||
MvpRef.get().roomAuctionTime(roomTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.blankj.utilcode.util.ObjectUtils;
|
||||
import com.example.moduleroom.contacts.DataListContacts;
|
||||
import com.xscm.moduleutil.base.BaseRoomPresenter;
|
||||
import com.xscm.moduleutil.bean.CharmRankingResp;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
/**
|
||||
*@author qx
|
||||
*@data 2025/6/10
|
||||
*@description: 排行榜
|
||||
*/
|
||||
public class DataListPresenter extends BaseRoomPresenter<DataListContacts.View> implements DataListContacts.IRoomDataListPre {
|
||||
private static final String TAG = "DataListPresenter";
|
||||
|
||||
public DataListPresenter(DataListContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getCharmListInfo(String roomId, String type, String time_type, String page, String page_limit) {
|
||||
|
||||
api.getRoomRank(roomId, type,time_type,page,page_limit, new BaseObserver<List<CharmRankingResp>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<CharmRankingResp> charmRankingResp) {
|
||||
if (!ObjectUtils.isEmpty(charmRankingResp)){
|
||||
if (charmRankingResp.size()>0){
|
||||
MvpRef.get().setNo1(charmRankingResp.get(0));
|
||||
}
|
||||
if (charmRankingResp.size()>1){
|
||||
MvpRef.get().setNo2(charmRankingResp.get(1));
|
||||
}
|
||||
if (charmRankingResp.size()>2){
|
||||
MvpRef.get().setNo3(charmRankingResp.get(2));
|
||||
}
|
||||
if (charmRankingResp.size()>3) {
|
||||
MvpRef.get().setCharmEmpty(charmRankingResp.subList(3, charmRankingResp.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getWealthListInfo(String roomId, String type, String time_type, String page, String page_limit) {
|
||||
api.getRoomRank(roomId, type,time_type,page,page_limit, new BaseObserver<List<CharmRankingResp>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<CharmRankingResp> charmRankingResp) {
|
||||
if (!ObjectUtils.isEmpty(charmRankingResp)){
|
||||
if (charmRankingResp.size()>0){
|
||||
MvpRef.get().setNo1(charmRankingResp.get(0));
|
||||
}
|
||||
if (charmRankingResp.size()>1){
|
||||
MvpRef.get().setNo2(charmRankingResp.get(1));
|
||||
}
|
||||
if (charmRankingResp.size()>2){
|
||||
MvpRef.get().setNo3(charmRankingResp.get(2));
|
||||
}
|
||||
if (charmRankingResp.size()>3) {
|
||||
MvpRef.get().setWealthEmpty(charmRankingResp.subList(3, charmRankingResp.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.FriendshipRoomContacts;
|
||||
import com.xscm.moduleutil.base.BaseRoomPresenter;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class FriendshipRoomPresenter extends BaseRoomPresenter<FriendshipRoomContacts.View> implements FriendshipRoomContacts.IRoomPre{
|
||||
FriendshipRoomContacts.View mView;
|
||||
|
||||
public FriendshipRoomPresenter(FriendshipRoomContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
@Override
|
||||
public void applyPit(String roomId, String pitNumber) {
|
||||
api.applyPit(roomId, pitNumber, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().applyPit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startFriend(String roomId) {
|
||||
api.startFriend(roomId, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable( d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delay(String friend_id, String room_id, String delay_times) {
|
||||
api.delay(friend_id, room_id, delay_times, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endFriend(String friend_id, String room_id) {
|
||||
api.endFriend(friend_id, room_id, new BaseObserver<FriendUserBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(FriendUserBean friendUserBean) {
|
||||
MvpRef.get().endFriend(friendUserBean);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: 2025/8/24 交友房选择关系
|
||||
@Override
|
||||
public void createRelation(String room_id, String friend_id, String user1_id, String user2_id, String relation_id) {
|
||||
api.createRelation(room_id,friend_id,user1_id,user2_id,relation_id, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().createRelation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.PkTimeContract;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class PkTimePresenter extends BasePresenter<PkTimeContract.View> implements PkTimeContract.IRoomPre{
|
||||
public PkTimePresenter(PkTimeContract.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startPk(String pk_id, String pk_times) {
|
||||
api.startPk(pk_id, pk_times, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
// MvpRef.get().startPk();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
import com.example.moduleroom.contacts.PublicScreenEaseChatContacts;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
public class PublicScreenEaseChatPresenter extends BasePresenter<PublicScreenEaseChatContacts.View> implements PublicScreenEaseChatContacts.IPublicScreenEaseChatPre {
|
||||
public PublicScreenEaseChatPresenter(PublicScreenEaseChatContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void logEmchat(int code, String msg, String toChatUsername) {
|
||||
// ApiClient.getInstance().logEmchat(code, msg, toChatUsername, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchPublicScreen(String room_id, String status) {
|
||||
// ApiClient.getInstance().switchPublicScreen(room_id, status, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
public void sendFace(String roomId, String face_id, String pit, int type) {
|
||||
// ApiClient.getInstance().sendFace(roomId, face_id, pit, type, new BaseObserver<String>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
// addDisposable(d);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(String s) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.PublishCommentContacts;
|
||||
import com.xscm.moduleutil.bean.HeadlineBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class PublishCommentPresenter extends BasePresenter<PublishCommentContacts.View> implements PublishCommentContacts.IRoomPre {
|
||||
public PublishCommentPresenter(PublishCommentContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendHeadine(String content, String money,String roomId) {
|
||||
api.sendHeadine(content, money,roomId, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().sendHeadine();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void currentHeadline() {
|
||||
api.currentHeadline(new BaseObserver<HeadlineBean>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(HeadlineBean headlineBean) {
|
||||
MvpRef.get().currentHeadline(headlineBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RequestContacts;
|
||||
import com.xscm.moduleutil.bean.MusicSongBean;
|
||||
import com.xscm.moduleutil.bean.SongMusicBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RequestPresenter extends BasePresenter<RequestContacts.View> implements RequestContacts.IRoomPre{
|
||||
public RequestPresenter(RequestContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void songList(String roomId) {
|
||||
api.songList(roomId, new BaseObserver<List<MusicSongBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<MusicSongBean> musicSongBeans) {
|
||||
MvpRef.get().songList(musicSongBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upSong(String did, String type) {
|
||||
api.upSong(did, type, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().upSong(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void song(String roomId, String user_id, String song_code, String song_name, String singer, String poster, String duration) {
|
||||
api.song(roomId, user_id, song_code, song_name, singer, poster, duration, new BaseObserver<List<SongMusicBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<SongMusicBean> songMusicBeans) {
|
||||
MvpRef.get().song(songMusicBeans);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RoomAuctionContacts;
|
||||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomAuctionPresenter extends BasePresenter<RoomAuctionContacts.View> implements RoomAuctionContacts.IRoomDataListPre {
|
||||
public RoomAuctionPresenter(RoomAuctionContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit(String roomId, String pitNumber) {
|
||||
api.applyPit(roomId, pitNumber, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().applyPit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuction(String roomId, String userId, String giftId, String relation_id, String auction_type, String time_day) {
|
||||
api.roomAuction(roomId,userId,giftId,relation_id,auction_type,time_day, new BaseObserver<AuctionBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable( d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AuctionBean auctionBean) {
|
||||
MvpRef.get().roomAuction(auctionBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionDelay(String auctionId) {
|
||||
RetrofitClient.getInstance().auctionDelay(auctionId, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
MvpRef.get().auctionDelay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionEnd(String auctionId,String roomId) {
|
||||
RetrofitClient.getInstance().auctionEnd(auctionId,roomId, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().auctionEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionMode(String roomId, String labelId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOnlineStatus(String userId, String roomid) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RoomAuctionContacts;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.AuctionBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.View> implements RoomAuctionContacts.IRoomDataListPre {
|
||||
public RoomAuctionPresenterTow(RoomAuctionContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyPit(String roomId, String pitNumber) {
|
||||
api.applyPit(roomId, pitNumber, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
MvpRef.get().applyPit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void roomAuction(String roomId, String userId, String giftId, String relation_id, String auction_type, String time_day) {
|
||||
api.roomAuction(roomId,userId,giftId,relation_id,auction_type,time_day, new BaseObserver<AuctionBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable( d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(AuctionBean auctionBean) {
|
||||
MvpRef.get().roomAuction(auctionBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionDelay(String auctionId) {
|
||||
RetrofitClient.getInstance().auctionDelay(auctionId, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
// MvpRef.get().auctionDelay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionEnd(String auctionId,String roomId) {
|
||||
RetrofitClient.getInstance().auctionEnd(auctionId,roomId, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
// MvpRef.get().auctionEnd();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void auctionMode(String roomId, String labelId) {
|
||||
RetrofitClient.getInstance().auctionMode(roomId, labelId, new BaseObserver<String>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void userOnlineStatus(String userId, String roomid) {
|
||||
api.userOnlineStatus(userId, roomid, new BaseObserver<List<UserOnlineStatusBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserOnlineStatusBean> userOnlineStatusBean) {
|
||||
MvpRef.get().userOnlineStatus(userOnlineStatusBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RoomBackgroundContacts;
|
||||
import com.xscm.moduleutil.bean.RoomBgBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
import com.xscm.moduleutil.utils.oss.OSSOperUtils;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomBackgroundPresenter extends BasePresenter<RoomBackgroundContacts.View> implements RoomBackgroundContacts.RoomBackgroudPre {
|
||||
public RoomBackgroundPresenter(RoomBackgroundContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getBackgroundList() {
|
||||
api.getBackgroundList(new BaseObserver<RoomBgBean>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(RoomBgBean roomBgBeans) {
|
||||
MvpRef.get().getBackgroundList(roomBgBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadFile(File file, int type, int index, int size) {
|
||||
String url = OSSOperUtils.getPath(file, type);
|
||||
OSSOperUtils.newInstance().putObjectMethod(url, file.getPath(), new OSSOperUtils.OssCallback() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().upLoadSuccess(OSSOperUtils.AliYunOSSURLFile + url, type, index, size);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFail() {
|
||||
if (isViewAttach()) {
|
||||
MvpRef.get().disLoadings();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadBgImage(String id, String image_url) {
|
||||
api.uploadBgImage(id, image_url, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String string) {
|
||||
MvpRef.get().uploadBgImage();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editRoom(String room_id, String room_name, String room_cover, String room_intro, String room_background) {
|
||||
api.editRoom(room_id, room_name, room_cover, room_intro, room_background, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String string) {
|
||||
MvpRef.get().editRoom();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RoomCabinContacts;
|
||||
import com.xscm.moduleutil.base.BaseRoomPresenter;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomCabinPresenter extends BaseRoomPresenter<RoomCabinContacts.View> implements RoomCabinContacts.IRoomPre{
|
||||
public RoomCabinPresenter(RoomCabinContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quitRoom(String roomId, String userId) {
|
||||
api.quitRoom(roomId, userId, new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String string) {
|
||||
MvpRef.get().quitRoom();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.BidListContacts;
|
||||
import com.example.moduleroom.contacts.RoomCharmDialogContacts;
|
||||
import com.xscm.moduleutil.bean.RoomUserCharmListBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomCharmDialogPresenter extends BasePresenter<RoomCharmDialogContacts.View> implements RoomCharmDialogContacts.IRoomPre {
|
||||
|
||||
RoomCharmDialogContacts.View mView;
|
||||
|
||||
public RoomCharmDialogPresenter(RoomCharmDialogContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void roomUserCharmList(String room_id, String user_id) {
|
||||
api.roomUserCharmList(room_id, user_id,new BaseObserver<List<RoomUserCharmListBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<RoomUserCharmListBean> roomUserCharmListBeans) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().roomUserCharmList(roomUserCharmListBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.RoomChartsContacts;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
public class RoomChartsPresenter extends BasePresenter<RoomChartsContacts.View> implements RoomChartsContacts.IRoomPre {
|
||||
public RoomChartsPresenter(RoomChartsContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.example.moduleroom.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
import com.example.moduleroom.contacts.RoomCloseContacts;
|
||||
import com.xscm.moduleutil.bean.RoomRelationBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
public class RoomClosePresenter extends BasePresenter<RoomCloseContacts.View> implements RoomCloseContacts.IRoomToolPre {
|
||||
RoomCloseContacts.View mView;
|
||||
|
||||
public RoomClosePresenter(RoomCloseContacts.View view, Context context) {
|
||||
super(view, context);
|
||||
mView = view;
|
||||
}
|
||||
@Override
|
||||
public void roomRelationList(String type) {
|
||||
api.roomRelationList(type, new BaseObserver<List<RoomRelationBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<RoomRelationBean> roomRelationBeans) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().roomRelationList(roomRelationBeans);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user