修改BUG

This commit is contained in:
2025-09-02 23:03:08 +08:00
parent fe4ff5655a
commit 101eb87e5f
94 changed files with 2147 additions and 2203 deletions

View File

@@ -4,10 +4,10 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-08-26T10:07:07.466132Z"> <DropdownSelection timestamp="2025-09-02T13:10:06.742287700Z">
<Target type="DEFAULT_BOOT"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=52324642" /> <DeviceId pluginId="PhysicalDevice" identifier="serial=6705124a" />
</handle> </handle>
</Target> </Target>
</DropdownSelection> </DropdownSelection>

View File

@@ -30,7 +30,7 @@ isBuildModule=false
android.injected.testOnly=false android.injected.testOnly=false
APP_VERSION_NAME=1.0.0 APP_VERSION_NAME=1.0.0
APP_VERSION_CODE=103 APP_VERSION_CODE=108
org.gradle.jvm.toolchain.useLegacyAdapters=false org.gradle.jvm.toolchain.useLegacyAdapters=false
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15 #org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15

View File

@@ -6,16 +6,9 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_SPECIAL_USE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<application android:allowBackup="true"> <application android:allowBackup="true">
<service
android:name=".service.MyRoomService"
android:enabled="true"
android:exported="true"/>
<activity
android:name=".activity.QxActivity"
android:exported="false" />
<service <service
android:name=".http.FloatingWindowService" android:name=".http.FloatingWindowService"
@@ -36,14 +29,17 @@
android:name=".activity.news.OfficialNoticeActivity" android:name=".activity.news.OfficialNoticeActivity"
android:exported="false" /> android:exported="false" />
<service android:name="org.eclipse.paho.android.service.MqttService" /> <!-- <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" --> <service android:name="org.eclipse.paho.android.service.MqttService"
android:exported="false"/> <!-- <receiver android:name="org.eclipse.paho.android.service.AlarmPingSender$AlarmReceiver" -->
<!-- android:enabled="true" --> <!-- android:enabled="true" -->
<!-- android:exported="true" --> <!-- android:exported="true" -->
<!-- tools:ignore="Instantiatable" /> --> <!-- tools:ignore="Instantiatable" /> -->
<!-- <service android:name=".service.EMqttService" />--> <!-- <service android:name=".service.EMqttService" />-->
<!-- <service--> <service
<!-- android:name=".service.MyMqttService"--> android:name=".service.MyMqttService"
<!-- android:foregroundServiceType="dataSync" />--> android:enabled="true"
android:exported="false"
android:foregroundServiceType="dataSync" />
</application> </application>
</manifest> </manifest>

View File

@@ -75,7 +75,7 @@ public class OfficialNoticeActivity extends BaseMvpActivity<NewsPresenter, Activ
@Override @Override
public void onClick(View view) { public void onClick(View view) {
if (item.getRoom_id()>0){ if (item.getRoom_id()>0){
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("room_id", item.getRoom_id() + "").navigation(); ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
}else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){ }else if (item.getRoom_id() == 0 && item.getUrl() != null && !item.getUrl().isEmpty()){
ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation(); ARouter.getInstance().build(ARouteConstants.H5).withString("url", item.getUrl()).navigation();
} }

View File

@@ -109,13 +109,13 @@ public class CommonAppContext extends MultiDexApplication {
AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId()); AgoraManager.getInstance(this).init(currentEnvironment.getSwSdkAppId());
MessageListenerSingleton.getInstance(); MessageListenerSingleton.getInstance();
CrashReport.initCrashReport(this, "ac3ed4d89f", true);/*bugly初始化*/ CrashReport.initCrashReport(this, "ac3ed4d89f", true);/*bugly初始化*/
// ServiceUtils.startService(MyMqttService.class);/*Mqtt初始化*/ // // 启动 MQTT 服务
// 初始化MQTT服务 Intent mqttServiceIntent = new Intent(this, MyMqttService.class);
// 获取单例实例 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
MyMqttService mqttService = MyMqttService.getInstance(this); startForegroundService(mqttServiceIntent);
} else {
// 启动服务 startService(mqttServiceIntent);
mqttService.startService(); }
// 每次启动应用时重置状态 // 每次启动应用时重置状态
SpUtil.getInstance().setBooleanValue("youth_model_shown", false); SpUtil.getInstance().setBooleanValue("youth_model_shown", false);

View File

@@ -88,7 +88,9 @@ public class RoomMessageEvent {
private int online_number;//在线人数 private int online_number;//在线人数
private BlindBoxBean.XlhData xlh_Data; private BlindBoxBean.XlhData xlh_data;
private String from_pit_number;
private String to_pit_number;
} }
@Data @Data

View File

@@ -0,0 +1,16 @@
package com.xscm.moduleutil.bean;
import lombok.Data;
/**
*@author qx
*@data 2025/9/2
*@description: 巡乐会开始后推送的信息
*/
@Data
public class XLHBean {
private String text;
private String room_id;
private int from_type ;
}

View File

@@ -21,10 +21,17 @@ public class BlindBoxBean {
private String title; private String title;
private String rule_url; private String rule_url;
private String rule; private String rule;
private String box_price ; private int box_price ;///每一次抽奖的价格
private String xlh_end_time;///巡乐会结束时间
private int is_xlh; ///是否开启巡乐会 0 关闭 1 开启 private int is_xlh; ///是否开启巡乐会 0 关闭 1 开启
private Object xlh_data; private Object xlh_data;
private List<GiftBean> gift_list; private List<GiftBean> gift_list;
private GiveGift give_homeowner_gift;//房主礼物
private GiveGift locking_gift;//锁定礼物
private xlhUser xlh_user;//巡乐会中奖用户
public boolean isXlhDataArray() { public boolean isXlhDataArray() {
return xlh_data instanceof JsonArray || xlh_data instanceof List; return xlh_data instanceof JsonArray || xlh_data instanceof List;
} }
@@ -124,4 +131,18 @@ public class BlindBoxBean {
private int current_num;//当前已抽奖次数 private int current_num;//当前已抽奖次数
private int status; private int status;
} }
@Data
public static class GiveGift {
private int gift_id;
private String gift_name;
private String base_image;
private String gift_num;
}
@Data
public static class xlhUser {
private String user_id;
private String nickname;
private String avatar;
}
} }

View File

@@ -100,6 +100,9 @@ public class EMMessageInfo implements MultiItemEntity {
public static final int QXRoomMessageTypeMangH = 1056; public static final int QXRoomMessageTypeMangH = 1056;
///巡乐会 ///巡乐会
public static final int QXRoomMessageTypeXlh = 1057; public static final int QXRoomMessageTypeXlh = 1057;
///
public static final int QXRoomMessageTypehm = 1039;
private RoomMessageEvent emMessage; private RoomMessageEvent emMessage;
private int custom = 0; private int custom = 0;
@@ -154,6 +157,7 @@ public class EMMessageInfo implements MultiItemEntity {
case QXRoomMessageTypeRoomOMh: case QXRoomMessageTypeRoomOMh:
case QXRoomMessageTypeRoomFriendPartDidChanged: case QXRoomMessageTypeRoomFriendPartDidChanged:
case QXRoomMessageTypeSeatDidChanged: case QXRoomMessageTypeSeatDidChanged:
case QXRoomMessageTypehm:
return 1; return 1;
case QXRoomMessageTypeGift: case QXRoomMessageTypeGift:
return 3; return 3;

View File

@@ -40,7 +40,7 @@ public class RoomAuction implements Serializable {
} }
@Data @Data
public class AuctionListBean implements Serializable { public static class AuctionListBean implements Serializable {
private String user_id; private String user_id;
private String user_code; private String user_code;
private String nickname; private String nickname;

View File

@@ -63,7 +63,7 @@ public class PolicyDialog extends Dialog {
ds.setUnderlineText(true); ds.setUnderlineText(true);
} }
}; };
spanUtils.append("欢迎使用羽声\n").append("在使用我们的产品和服务之前,请您先阅读并了解").append("《用户协议》").setClickSpan(clickSpan).append("").append("《隐私协议》").setClickSpan(ysClickSpan).append("。我们将严格按照上述协议为" + spanUtils.append("欢迎使用秘地\n").append("在使用我们的产品和服务之前,请您先阅读并了解").append("《用户协议》").setClickSpan(clickSpan).append("").append("《隐私协议》").setClickSpan(ysClickSpan).append("。我们将严格按照上述协议为" +
"您提供服务,保护您的信息安全,点" + "您提供服务,保护您的信息安全,点" +
"击“同意”即表示您已阅读并同意全部" + "击“同意”即表示您已阅读并同意全部" +
"条款,可以继续使用我们的产品和服" + "条款,可以继续使用我们的产品和服" +

View File

@@ -4,8 +4,10 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
import android.os.Bundle;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.webkit.JavascriptInterface; import android.webkit.JavascriptInterface;
@@ -39,12 +41,27 @@ import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIGroupChatActivity;
public class WebViewDialog extends BaseDialog<WebViewDialogBinding> { public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
String mUrl; String mUrl;
int type;//10天空之境 11岁月之城 12时空之巅
public WebViewDialog(@NonNull Context context,String url) { public WebViewDialog(@NonNull Context context, Bundle args) {
super(context, R.style.BaseDialogStyleH); super(context, R.style.BaseDialogStyleH);
this.mUrl=url; this.mUrl = args.getString("url");
this.type = args.getInt("type");
initData1();
}
@Override
public void onStart() {
super.onStart();
if (getWindow() != null) {
// 获取屏幕尺寸
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
// 设置高度为屏幕高度的80%
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = (int) (displayMetrics.heightPixels * 0.7);
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(params);
}
} }
@Override @Override
public int getLayoutId() { public int getLayoutId() {
return R.layout.web_view_dialog; return R.layout.web_view_dialog;
@@ -52,19 +69,34 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
@Override @Override
public void initView() { public void initView() {
setCancelable(false); setCancelable(true);
setCanceledOnTouchOutside(false); setCanceledOnTouchOutside(true);
Window window = getWindow(); Window window = getWindow();
assert window != null; assert window != null;
window.setGravity(Gravity.BOTTOM); window.setGravity(Gravity.BOTTOM);
window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT); window.setLayout((int) (ScreenUtils.getScreenWidth() * 320.f / 375), WindowManager.LayoutParams.MATCH_PARENT);
mBinding.ivClose.setOnClickListener(v -> dismiss()); mBinding.ivClose.setOnClickListener(v -> dismiss());
//
}
if (type==10){
mBinding.gzCl.setBackgroundResource(R.mipmap.tkzj);
mBinding.imGz.setImageResource(R.mipmap.tkzj_gz);
}else if (type==11){
mBinding.gzCl.setBackgroundResource(R.mipmap.syzc);
mBinding.imGz.setImageResource(R.mipmap.syzc_gz);
}else if (type==12){
mBinding.gzCl.setBackgroundResource(R.mipmap.skzj);
mBinding.imGz.setImageResource(R.mipmap.skzj_gz);
}
}
@Override @Override
public void initData() { public void initData() {
}
public void initData1() {
WebSettings webSettings = mBinding.webView.getSettings(); WebSettings webSettings = mBinding.webView.getSettings();
webSettings.setUseWideViewPort(true); webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true); webSettings.setLoadWithOverviewMode(true);

View File

@@ -47,7 +47,7 @@ public class GiftLotteryAdapter extends BaseQuickAdapter<GiftBean, BaseViewHolde
helper.setText(R.id.tv_gift_time, item.getCreatetime()); helper.setText(R.id.tv_gift_time, item.getCreatetime());
ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_image)); ImageUtils.loadHeadCC(item.getBase_image(),helper.getView(R.id.iv_gift_image));
// 使用 SpannableString 给 "x4" 设置不同颜色 // 使用 SpannableString 给 "x4" 设置不同颜色
TextView giftNameTextView = helper.getView(R.id.tv_gift_name); TextView giftNameTextView = helper.getView(R.id.gift_name);
TextView nickNameTextView = helper.getView(R.id.tv_user_name); TextView nickNameTextView = helper.getView(R.id.tv_user_name);
if (giftNameTextView != null) { if (giftNameTextView != null) {
String baseName = item.getGift_name(); String baseName = item.getGift_name();

View File

@@ -34,5 +34,7 @@ public class GiftLotteryContacts {
void giftSend(String send_id); void giftSend(String send_id);
void wallet(); void wallet();
void xlh(String room_id);
} }
} }

View File

@@ -332,8 +332,13 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
} else if (id == R.id.sw_tex) {//特效 } else if (id == R.id.sw_tex) {//特效
isOpenSpecial = mBinding.mirroeSky.swTex.isChecked(); isOpenSpecial = mBinding.mirroeSky.swTex.isChecked();
} else if (id == R.id.tv_gz) {//规则 } else if (id == R.id.tv_gz) {//规则
WebViewDialog webViewDialog = new WebViewDialog(getActivity(), getRule_url); Bundle bundle = new Bundle();
webViewDialog.show(); bundle.putString("url", getRule_url);
bundle.putInt("type", type);
WebViewDialog dialog = new WebViewDialog(getActivity(), bundle);
dialog.show();
// WebViewDialog webViewDialog = new WebViewDialog(getActivity(), getRule_url);
// webViewDialog.show();
} else if (id == R.id.tv_jc) { } else if (id == R.id.tv_jc) {
if (giftLists != null && !giftLists.isEmpty()) { if (giftLists != null && !giftLists.isEmpty()) {
PrizePoolDialog prizePoolDialog = new PrizePoolDialog(getActivity()); PrizePoolDialog prizePoolDialog = new PrizePoolDialog(getActivity());
@@ -351,6 +356,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
giftLotteryDialogFragment = GiftLotteryDialogFragment.newInstance(giftBagId); giftLotteryDialogFragment = GiftLotteryDialogFragment.newInstance(giftBagId);
giftLotteryDialogFragment.show(getChildFragmentManager(), "GiftLotteryDialogFragment"); giftLotteryDialogFragment.show(getChildFragmentManager(), "GiftLotteryDialogFragment");
}else if (id == R.id.tv_start){
} }
} }
@@ -579,6 +586,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
@Override @Override
public void getGiftListSuccess(BlindBoxBean blindBoxBean) { public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
if (blindBoxBean != null && blindBoxBean.getGift_list() != null) { if (blindBoxBean != null && blindBoxBean.getGift_list() != null) {
upTitle(blindBoxBean.getBox_price());
giftLists = blindBoxBean.getGift_list(); giftLists = blindBoxBean.getGift_list();
getRule_url = blindBoxBean.getRule_url(); getRule_url = blindBoxBean.getRule_url();
// 确保数据数量不超过视图数量 // 确保数据数量不超过视图数量
@@ -617,6 +626,24 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
} }
} }
private void upTitle(int boxPrice){
if (type==10){
mBinding.mirroeSky.oneTitle.setText(boxPrice+"币一次");
mBinding.mirroeSky.tenTitle.setText((boxPrice*10)+"币十次");
mBinding.mirroeSky.hundredTitle.setText((boxPrice*100)+"币十次");
}else if (type==11){
mBinding.cityTime.oneTitle.setText(boxPrice+"币一次");
mBinding.cityTime.tenTitle.setText((boxPrice*10)+"币十次");
mBinding.cityTime.hundredTitle.setText((boxPrice*100)+"币十次");
}else if (type==12){
mBinding.pinnacleTime.oneTitle.setText(boxPrice+"币一次");
mBinding.pinnacleTime.tenTitle.setText((boxPrice*10)+"币十次");
mBinding.pinnacleTime.hundredTitle.setText((boxPrice*100)+"币十次");
}
}
private void UpView(BlindBoxBean.XlhData xlhData) { private void UpView(BlindBoxBean.XlhData xlhData) {
if (xlhData != null) { if (xlhData != null) {
@@ -739,7 +766,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onMusicPlay(RoomMessageEvent message) { public void onMusicPlay(RoomMessageEvent message) {
if (message.getMsgType() == 1056){ if (message.getMsgType() == 1056){
UpView(message.getText().getXlh_Data()); UpView(message.getText().getXlh_data());
} }
} }

View File

@@ -13,6 +13,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener; import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
@@ -39,6 +40,7 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
private String giftBagId; private String giftBagId;
private int type=1; private int type=1;
private GiftLotteryAdapter adapter; private GiftLotteryAdapter adapter;
private GiftRecordAdapte giftRecordAdapte;
private List<GiftBean> data=new ArrayList<>(); private List<GiftBean> data=new ArrayList<>();
@Override @Override
@@ -147,16 +149,11 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
columns = 3; columns = 3;
} }
adapter=new GiftLotteryAdapter(); adapter=new GiftLotteryAdapter();
giftRecordAdapte=new GiftRecordAdapte();
// PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL); // PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL);
GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 3); dianj(1);
mBinding.recyclerView.setLayoutManager(layoutManager);
mBinding.recyclerView.setOnFlingListener(null);
// 设置滚动辅助工具
PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
pageSnapHelper.attachToRecyclerView(mBinding.recyclerView);
mBinding.recyclerView.setAdapter(adapter);
} }
private void onClick(View view) { private void onClick(View view) {
@@ -169,10 +166,20 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
} }
public void dianj(int type1){ public void dianj(int type1){
if (type1==1) { if (type1==1) {
GridLayoutManager layoutManager = new GridLayoutManager(getActivity(), 3);
mBinding.recyclerView.setLayoutManager(layoutManager);
mBinding.recyclerView.setOnFlingListener(null);
// 设置滚动辅助工具
PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
pageSnapHelper.attachToRecyclerView(mBinding.recyclerView);
mBinding.recyclerView.setAdapter(adapter);
type=1; type=1;
setTextViewStyle(mBinding.textView2, false); setTextViewStyle(mBinding.textView2, false);
setTextViewStyle(mBinding.textView1, true); setTextViewStyle(mBinding.textView1, true);
}else if (type1==2){ }else if (type1==2){
mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false));
mBinding.recyclerView.setAdapter(giftRecordAdapte);
type=2; type=2;
setTextViewStyle(mBinding.textView2, true); setTextViewStyle(mBinding.textView2, true);
setTextViewStyle(mBinding.textView1, false); setTextViewStyle(mBinding.textView1, false);
@@ -227,15 +234,16 @@ public class GiftLotteryDialogFragment extends BaseMvpDialogFragment<GiftLottery
@Override @Override
public void getAllRecordSuccess(List<GiftBean> data) { public void getAllRecordSuccess(List<GiftBean> data) {
if (data != null){ if (data != null){
if (page==1){ if (page==1){
adapter.setNewData(data); giftRecordAdapte.setNewData(data);
}else { }else {
adapter.addData(data); giftRecordAdapte.addData(data);
} }
}else { }else {
if (page == 1) { if (page == 1) {
adapter.setNewData(null); giftRecordAdapte.setNewData(null);
} }
} }
} }

View File

@@ -125,4 +125,9 @@ public class GiftLotteryPresenter extends BasePresenter<GiftLotteryContacts.View
}); });
} }
@Override
public void xlh(String room_id) {
// api.xlh(room_id, new BaseObserver<String>() {)
}
} }

View File

@@ -5,6 +5,7 @@ import android.os.Bundle;
import android.view.WindowManager; import android.view.WindowManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.GridLayoutManager;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.adapter.GiftAdapter; import com.xscm.moduleutil.adapter.GiftAdapter;
@@ -48,7 +49,7 @@ public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
// 设置高度为屏幕高度的80% // 设置高度为屏幕高度的80%
android.view.WindowManager.LayoutParams params = getWindow().getAttributes(); android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
params.height = (int) (displayMetrics.heightPixels * 0.8); params.height = (int) (displayMetrics.heightPixels * 0.7);
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT; params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
getWindow().setAttributes(params); getWindow().setAttributes(params);
} }
@@ -94,13 +95,13 @@ public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
float density = mContext.getResources().getDisplayMetrics().density; float density = mContext.getResources().getDisplayMetrics().density;
if (density <= 2.0) { // 低密度屏幕如mdpi, hdpi if (density <= 2.0) { // 低密度屏幕如mdpi, hdpi
rows = 5; rows = 4;
columns = 3; columns = 3;
} else if (density <= 3.0) { // 中密度屏幕如xhdpi } else if (density <= 3.0) { // 中密度屏幕如xhdpi
rows = 5; rows = 4;
columns = 3; columns = 3;
} else { // 高密度屏幕如xxhdpi, xxxhdpi } else { // 高密度屏幕如xxhdpi, xxxhdpi
rows = 5; rows = 4;
columns = 3; columns = 3;
} }
@@ -108,12 +109,13 @@ public class PrizePoolDialog extends BaseDialog<DialogPrizePoolBinding> {
this.gift_list = newData; this.gift_list = newData;
if (mBinding != null && mContext != null) { if (mBinding != null && mContext != null) {
PrizePoolAdapter prizePoolAdapter = new PrizePoolAdapter(); PrizePoolAdapter prizePoolAdapter = new PrizePoolAdapter();
PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL); GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 3);
// PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL);
mBinding.gvGift.setLayoutManager(layoutManager); mBinding.gvGift.setLayoutManager(layoutManager);
mBinding.gvGift.setOnFlingListener(null); // mBinding.gvGift.setOnFlingListener(null);
// 设置滚动辅助工具 // 设置滚动辅助工具
PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper(); // PagerGridSnapHelper pageSnapHelper = new PagerGridSnapHelper();
pageSnapHelper.attachToRecyclerView(mBinding.gvGift); // pageSnapHelper.attachToRecyclerView(mBinding.gvGift);
mBinding.gvGift.setAdapter(prizePoolAdapter); mBinding.gvGift.setAdapter(prizePoolAdapter);
prizePoolAdapter.setNewData(gift_list); prizePoolAdapter.setNewData(gift_list);
} }

View File

@@ -0,0 +1,78 @@
package com.xscm.moduleutil.dialog.giftLottery;
import android.view.View;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
import com.xscm.moduleutil.bean.GiftBean;
import com.xscm.moduleutil.bean.WalletBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
import com.xscm.moduleutil.databinding.FragmentTourClubDialogBinding;
import java.util.List;
public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPresenter, FragmentTourClubDialogBinding> implements GiftLotteryContacts.View {
@Override
protected GiftLotteryPresenter bindPresenter() {
return new GiftLotteryPresenter(this, getActivity());
}
@Override
protected void initData() {
}
@Override
protected void initView() {
mBinding.tvJc.setOnClickListener(this::onClick);
}
private void onClick(View view) {
int id = view.getId();
if (id==R.id.tv_jc){
// if (giftLists != null && !giftLists.isEmpty()) {
// PrizePoolDialog prizePoolDialog = new PrizePoolDialog(getActivity());
// prizePoolDialog.updateData(giftLists, type);
// prizePoolDialog.show();
// } else {
// com.hjq.toast.ToastUtils.show("奖池数据加载中,请稍后再试");
// }
}
}
@Override
protected int getLayoutId() {
return R.layout.fragment_tour_club_dialog;
}
@Override
public void getGiftListSuccess(BlindBoxBean blindBoxBean) {
}
@Override
public void drawGiftListSuccess(BlindReslutBean blindReslutBean) {
}
@Override
public void getMyRecordSuccess(List<GiftBean> data) {
}
@Override
public void getAllRecordSuccess(List<GiftBean> data) {
}
@Override
public void finishRefreshLoadMore() {
}
@Override
public void wallet(WalletBean walletBean) {
}
}

View File

@@ -0,0 +1,43 @@
package com.xscm.moduleutil.dialog.giftLottery;
import android.content.Context;
import android.view.Window;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import com.blankj.utilcode.util.ScreenUtils;
import com.xscm.moduleutil.R;
import com.xscm.moduleutil.databinding.DialogHeavenGiftBinding;
import com.xscm.moduleutil.databinding.DialogXlhObtainBinding;
import com.xscm.moduleutil.widget.dialog.BaseDialog;
/**
*@author qx
*@data 2025/9/2
*@description: 巡乐会恭喜或得礼弹窗
*/
public class XlhObtainDialog extends BaseDialog<DialogXlhObtainBinding> {
public XlhObtainDialog(@NonNull Context context) {
super(context,R.style.BaseDialogStyleH);
}
@Override
public int getLayoutId() {
return R.layout.dialog_xlh_obtain;
}
@Override
public void initView() {
setCancelable(false);
setCanceledOnTouchOutside(false);
Window window = getWindow();
window.setLayout((int) (ScreenUtils.getScreenWidth() * 375.f / 375), WindowManager.LayoutParams.WRAP_CONTENT);
mBinding.xlhClose.setOnClickListener(v -> dismiss());
mBinding.ivAgain.setOnClickListener(v -> dismiss());///在玩一次
}
@Override
public void initData() {
}
}

View File

@@ -15,7 +15,9 @@ public class RoomGiftGiveEvent {
public RoonGiftModel roonGiftModel; public RoonGiftModel roonGiftModel;
public int send_type; public int send_type;
public String heart_id; public String heart_id;
public RoomGiftGiveEvent(String userId, String room_id, String pit, String num, int send_type, RoonGiftModel giftModel, RoonGiftModel roonGiftModel,String heart_id){ public String auction_id;
public RoomGiftGiveEvent(String userId, String room_id, String pit, String num, int send_type,
RoonGiftModel giftModel, RoonGiftModel roonGiftModel,String heart_id,String auction_id){
this.userId = userId; this.userId = userId;
this.room_id = room_id; this.room_id = room_id;
this.pit = pit; this.pit = pit;
@@ -24,6 +26,7 @@ public class RoomGiftGiveEvent {
this.giftModel = giftModel; this.giftModel = giftModel;
this.roonGiftModel = roonGiftModel; this.roonGiftModel = roonGiftModel;
this.heart_id = heart_id; this.heart_id = heart_id;
this.auction_id = auction_id;
} }

View File

@@ -1432,7 +1432,7 @@ public class RetrofitClient {
if (response.code() == 200) { if (response.code() == 200) {
BaseModel<String> baseModel = response.body(); BaseModel<String> baseModel = response.body();
if (baseModel.getCode() != 1) { if (baseModel.getCode() != 1) {
com.hjq.toast.ToastUtils.show(baseModel.getMsg()); // com.hjq.toast.ToastUtils.show(baseModel.getMsg());
} }
} }
} }

View File

@@ -78,6 +78,9 @@ public abstract class BasePresenter<V extends IView> implements IPresenter {
* @param disposable * @param disposable
*/ */
public void addDisposable(Disposable disposable) { public void addDisposable(Disposable disposable) {
if (mDisposables == null){
mDisposables = new CompositeDisposable();
}
mDisposables.add(disposable); mDisposables.add(disposable);
} }

View File

@@ -411,7 +411,9 @@ public class AgoraManager {
@SuppressLint("SuspiciousIndentation") @SuppressLint("SuspiciousIndentation")
public void setLocalAudioEnabled(boolean enabled, String userId) { public void setLocalAudioEnabled(boolean enabled, String userId) {
if (rtcEngine != null) { if (rtcEngine != null) {
rtcEngine.enableLocalAudio(enabled); // 启用/禁用音频采集 if (userId.equals(SpUtil.getUserId()+"")) {
rtcEngine.enableLocalAudio(enabled); // 启用/禁用音频采集
}
this.isLocalAudioEnabled = enabled; this.isLocalAudioEnabled = enabled;
if (!enabled) { if (!enabled) {
for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) { for (SoundLevelUpdateListener listener : soundLevelUpdateListeners) {

View File

@@ -3,12 +3,15 @@ package com.xscm.moduleutil.service;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel; import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.Service;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
import android.os.HandlerThread; import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper; import android.os.Looper;
import android.util.Log; import android.util.Log;
@@ -17,6 +20,8 @@ import com.alibaba.fastjson.JSONObject;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.XLHBean;
import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.event.RoomGiftRunable; import com.xscm.moduleutil.event.RoomGiftRunable;
import org.eclipse.paho.android.service.MqttAndroidClient; import org.eclipse.paho.android.service.MqttAndroidClient;
@@ -28,25 +33,23 @@ import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions; import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.greenrobot.eventbus.EventBus;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListener, MyEmqttSubscribeListener { public class MyMqttService extends Service implements MyEmqttConnectListener, MyEmqttMesgListener, MyEmqttSubscribeListener {
private final static String TAG = "lxj"; private final static String TAG = "lxj";
private static int qos = 2; private static int qos = 2;
private static String HOST = "tcp://1.13.181.248";//测试 // private static String HOST = "tcp://1.13.181.248";//测试
private static String HOST = "tcp://62.234.12.147";//正式
private static MqttAndroidClient mqttAndroidClient; private static MqttAndroidClient mqttAndroidClient;
private MqttConnectOptions mMqttConnectOptions; private MqttConnectOptions mMqttConnectOptions;
private static boolean b = true; private static boolean b = true;
// 使用单例模式
private static MyMqttService instance;
// 使用线程安全的集合存储监听器 // 使用线程安全的集合存储监听器
private static final CopyOnWriteArrayList<MyEmqttMesgListener> messageListeners = new CopyOnWriteArrayList<>(); private static final CopyOnWriteArrayList<MyEmqttMesgListener> messageListeners = new CopyOnWriteArrayList<>();
private static final CopyOnWriteArrayList<MyEmqttConnectListener> connectListeners = new CopyOnWriteArrayList<>(); private static final CopyOnWriteArrayList<MyEmqttConnectListener> connectListeners = new CopyOnWriteArrayList<>();
@@ -67,26 +70,12 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
// 服务状态 // 服务状态
private static boolean isServiceRunning = false; private static boolean isServiceRunning = false;
private Context mContext; private static final int NOTIFICATION_ID = 1;
private static final String CHANNEL_ID = "mqtt_channel";
// 私有构造函数 @Override
private MyMqttService(Context context) { public void onCreate() {
this.mContext = context.getApplicationContext(); super.onCreate();
initService();
}
public static MyMqttService getInstance(Context context) {
if (instance == null) {
synchronized (MyMqttService.class) {
if (instance == null) {
instance = new MyMqttService(context);
}
}
}
return instance;
}
private void initService() {
isServiceRunning = true; isServiceRunning = true;
// 创建专用的HandlerThread处理MQTT操作 // 创建专用的HandlerThread处理MQTT操作
@@ -96,6 +85,10 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
// 创建线程池处理消息 // 创建线程池处理消息
messageExecutorService = Executors.newCachedThreadPool(); messageExecutorService = Executors.newCachedThreadPool();
// 启动前台服务
startForegroundService();
try { try {
init(); init();
} catch (MqttException e) { } catch (MqttException e) {
@@ -103,23 +96,39 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
} }
} }
/** @Override
* 启动MQTT连接 public int onStartCommand(Intent intent, int flags, int startId) {
*/ return START_STICKY;
public void startService() {
b = true;
if (!isServiceRunning) {
initService();
}
} }
/** @Override
* 停止MQTT服务 public IBinder onBind(Intent intent) {
*/ return null;
public void stopService() { }
b = false;
isServiceRunning = false; private void startForegroundService() {
cleanup(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// 创建通知渠道
NotificationChannel channel = new NotificationChannel(
CHANNEL_ID,
"MQTT Service",
NotificationManager.IMPORTANCE_LOW
);
NotificationManager manager = getSystemService(NotificationManager.class);
if (manager != null) {
manager.createNotificationChannel(channel);
}
// 创建通知
Notification notification = new Notification.Builder(this, CHANNEL_ID)
.setContentTitle("消息服务")
.setContentText("正在接收实时消息")
.setSmallIcon(R.mipmap.default_avatar)
.setOngoing(true)
.build();
startForeground(NOTIFICATION_ID, notification);
}
} }
/** /**
@@ -127,13 +136,13 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
*/ */
private void init() throws MqttException { private void init() throws MqttException {
String CLIENTID = "android-" + MqttClient.generateClientId(); String CLIENTID = "android-" + MqttClient.generateClientId();
mqttAndroidClient = new MqttAndroidClient(mContext, HOST, CLIENTID); mqttAndroidClient = new MqttAndroidClient(this, HOST, CLIENTID);
mqttAndroidClient.setCallback(mqttCallback); //设置监听订阅消息的回调 mqttAndroidClient.setCallback(mqttCallback);
mMqttConnectOptions = new MqttConnectOptions(); mMqttConnectOptions = new MqttConnectOptions();
mMqttConnectOptions.setCleanSession(true); //设置是否清除缓存 mMqttConnectOptions.setCleanSession(true);
mMqttConnectOptions.setConnectionTimeout(10); //设置超时时间,单位:秒 mMqttConnectOptions.setConnectionTimeout(10);
mMqttConnectOptions.setKeepAliveInterval(10); //设置心跳包发送间隔,单位:秒 mMqttConnectOptions.setKeepAliveInterval(10);
mMqttConnectOptions.setUserName("public"); //设置用户名 mMqttConnectOptions.setUserName("public");
mMqttConnectOptions.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1); mMqttConnectOptions.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1);
if (mqttAndroidClient != null && !mqttAndroidClient.isConnected()) { if (mqttAndroidClient != null && !mqttAndroidClient.isConnected()) {
@@ -167,43 +176,19 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
Log.e(TAG, "MQTT连接异常", e); Log.e(TAG, "MQTT连接异常", e);
} }
} }
}, 5000); // 5秒后重试 }, 5000);
} else { } else {
Log.w(TAG, "达到最大重试次数,停止重试"); Log.w(TAG, "达到最大重试次数,停止重试");
retryCount = 0; retryCount = 0;
} }
} }
public static void closeConnection() {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
try {
if (mqttAndroidClient != null && mqttAndroidClient.isConnected()) {
IMqttToken disconnect = mqttAndroidClient.disconnect();
disconnect.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Logger.e(TAG, "断开链接", "断开链接成功");
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
Logger.e(TAG, "断开链接", "断开链接失败" + exception.getMessage());
}
});
}
} catch (Exception e) {
Log.e(TAG, "关闭连接异常", e);
}
});
}
/** /**
* 判断网络是否连接 * 判断网络是否连接
*/ */
private boolean isConnectIsNomarl() { private boolean isConnectIsNomarl() {
try { try {
ConnectivityManager connectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
if (connectivityManager != null) { if (connectivityManager != null) {
NetworkInfo info = connectivityManager.getActiveNetworkInfo(); NetworkInfo info = connectivityManager.getActiveNetworkInfo();
if (info != null && info.isAvailable()) { if (info != null && info.isAvailable()) {
@@ -221,110 +206,11 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
return false; return false;
} }
/**
* 发布 (模拟其他客户端发布消息)
*
* @param message 消息
*/
public static void publish(String topic, String message) {
if (mqttAndroidClient == null) {
Logger.e(TAG, "mqttAndroidClient is null", "发送失败");
return;
}
// 在后台线程执行发布操作
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
try {
//参数分别为:主题、消息的字节数组、服务质量、是否在服务器保留断开连接后的最后一条消息
IMqttDeliveryToken publish = mqttAndroidClient.publish(topic, message.getBytes(), qos, false);
publish.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Logger.e(TAG, "发送消息", "发送成功");
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
Logger.e(TAG, "发送消息", "发送失败: " + exception.getMessage());
}
});
} catch (Exception e) {
Logger.e(TAG, "发送消息", "发送异常: " + e.getMessage());
}
});
}
public static void subscribe(String topic) {
// 在后台线程执行订阅操作
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
try {
if (mqttAndroidClient != null && mqttAndroidClient.isConnected()) {
IMqttToken subToken = mqttAndroidClient.subscribe(topic, qos);
subToken.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
for (MyEmqttSubscribeListener listener : subscribeListeners) {
if (listener != null) {
listener.onSubscribeSuccess(topic);
}
}
Logger.e(TAG, "订阅成功:" + topic);
}
@Override
public void onFailure(IMqttToken asyncActionToken,
Throwable exception) {
for (MyEmqttSubscribeListener listener : subscribeListeners) {
if (listener != null &&
!TOPIC_BOSS.equals(topic) &&
!TOPIC_XLH.equals(topic)) {
listener.onSubscribeFailure();
}
}
Logger.e(TAG, "订阅失败:" + topic + ", error: " + exception.getMessage());
}
});
}
} catch (Exception e) {
Log.e(TAG, "订阅异常:" + topic, e);
}
});
}
public static void cleanSubscribe(String topic) {
// 在后台线程执行取消订阅操作
Handler handler = new Handler(Looper.getMainLooper());
handler.post(() -> {
try {
if (mqttAndroidClient != null && mqttAndroidClient.isConnected()) {
IMqttToken subToken = mqttAndroidClient.unsubscribe(topic);
subToken.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Logger.e(TAG, "取消成功" + topic);
}
@Override
public void onFailure(IMqttToken asyncActionToken,
Throwable exception) {
Logger.e(TAG, "取消失败" + topic + ", error: " + exception.getMessage());
}
});
}
} catch (Exception e) {
Log.e(TAG, "取消订阅异常:" + topic, e);
}
});
}
//MQTT是否连接成功的监听 //MQTT是否连接成功的监听
private IMqttActionListener iMqttActionListener = new IMqttActionListener() { private IMqttActionListener iMqttActionListener = new IMqttActionListener() {
@Override @Override
public void onSuccess(IMqttToken arg0) { public void onSuccess(IMqttToken arg0) {
retryCount = 0; // 重置重试计数 retryCount = 0;
// 通知所有连接监听器 // 通知所有连接监听器
for (MyEmqttConnectListener listener : connectListeners) { for (MyEmqttConnectListener listener : connectListeners) {
@@ -360,7 +246,6 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
//订阅主题的回调 //订阅主题的回调
private MqttCallback mqttCallback = new MqttCallback() { private MqttCallback mqttCallback = new MqttCallback() {
@Override @Override
public void messageArrived(String topic, MqttMessage message) throws Exception { public void messageArrived(String topic, MqttMessage message) throws Exception {
// 将消息处理放到后台线程执行 // 将消息处理放到后台线程执行
@@ -369,25 +254,9 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
String messageStr = message.toString(); String messageStr = message.toString();
Logger.e(TAG, "收到的消息", "主题:" + topic + " 收到的消息:" + messageStr); Logger.e(TAG, "收到的消息", "主题:" + topic + " 收到的消息:" + messageStr);
if (topic.equals(TOPIC_BOSS)) { if (topic.equals(TOPIC_BOSS)) {
// 处理消息 receiveMessage(topic, messageStr);
// receiveMessage(topic, messageStr);
// new Handler(Looper.getMainLooper()).post(() -> {
receiveMessage(topic, messageStr);
// });
// 通知监听器
// for (MyEmqttMesgListener listener : messageListeners) {
// if (listener != null) {
// // 切换到主线程通知
//// new Handler(Looper.getMainLooper()).post(() -> {
////// listener.messageArrived(topic, messageStr);
//// });
// }
// }
} else if (topic.equals(TOPIC_XLH)) { } else if (topic.equals(TOPIC_XLH)) {
// receiveXlhMessage(messageStr); receiveXlhMessage(messageStr);
// new Handler(Looper.getMainLooper()).post(() -> {
receiveXlhMessage(messageStr);
// });
} }
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "处理MQTT消息异常", e); Log.e(TAG, "处理MQTT消息异常", e);
@@ -426,26 +295,22 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
private void receiveXlhMessage(String messageStr) { private void receiveXlhMessage(String messageStr) {
try { try {
String newdata = messageStr; JSONObject jsonObject = JSON.parseObject(messageStr);
JSONObject jsonObject = JSON.parseObject(newdata);
int type = jsonObject.getIntValue("type"); int type = jsonObject.getIntValue("type");
String message = jsonObject.getString("msg"); String message = jsonObject.getString("msg");
XLHBean xlhBean=JSON.parseObject(message, XLHBean.class);
// 将事件处理放到主线程执行 // 将事件处理放到主线程执行
new Handler(Looper.getMainLooper()).post(() -> { new Handler(Looper.getMainLooper()).post(() -> {
processMessageType(type, message); // processMessageType(type, message);
EventBus.getDefault().post(xlhBean);
}); });
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "解析MQTT消息异常", e); Log.e(TAG, "解析MQTT消息异常", e);
} }
} }
private void receiveMessage(String topic, String data) { private void receiveMessage(String topic, String data) {
try { try {
String newdata = data; JSONObject jsonObject = JSON.parseObject(data);
JSONObject jsonObject = JSON.parseObject(newdata);
int type = jsonObject.getIntValue("type"); int type = jsonObject.getIntValue("type");
String message = jsonObject.getString("msg"); String message = jsonObject.getString("msg");
@@ -460,155 +325,134 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
private void processMessageType(int type, String message) { private void processMessageType(int type, String message) {
switch (type) { switch (type) {
case 3001://抢糖果游戏
break;
case 5001://延时一秒推送房间-人气变化
break;
case 5003://延时一秒推送房间-坐骑进场特效
break;
case 5004://延时一秒推送房间-爵位用户进场特效
break;
case 5005://推送房间-上麦申请人数变化
Logger.e("环信5005", message);
break;
case 5007://推送房间-用户是否禁言 1禁言2解禁
break;
case 5011://推送房间-是否封麦 1封麦2解封
break;
case 5013://推送房间-清空单个麦位心动值
case 5014://推送房间-清空所有麦位心动值
break;
case 5015://推送房间-设置房间管理员
break;
case 5016://推送房间-删除房间管理员
break;
case 5017://用户开关麦
break;
case 5019://推送所有人-横幅礼物通知 case 5019://推送所有人-横幅礼物通知
new RoomGiftRunable(message).run(); new RoomGiftRunable(message).run();
break; break;
case 5020://推送房间-聊天室礼物通知
Logger.e("环信5020", message);
break;
case 5030:
case 5021://推送所有人-小猫钓鱼钓到大礼物时通知
break;
case 5022://推送房间-房间密码变化通知 0取消密码1设置或修改密码
break;
case 5023://推送房间-房间心动值开关变化通知 1开2关
break;
case 5024://推送房间-上麦模式变化通知 1自由2排麦
break;
case 5025://推送房间-修改房间名称
break;
case 5027://推送房间-周星用户进场特效
break;
case 5028://推送房间-修改房间背景
break;
case 5029://推送房间-修改房间公告
break;
case 5032://推送房间-上麦
Logger.e("环信5032", message);
break;
case 5033://推送房间-下麦
Logger.e("环信5033", message);
break;
case 5034://踢出房间
Logger.e("环信5034", message);
break;
case 5035://推送单独用户-定向推向给上麦的用户
break;
case 5036://推送房间-用户禁麦 1禁麦2解禁
break;
case 5037://推送房间-用户进入房间
break;
case 5038://麦位倒计时
break;
case 5039://扔骰子
break;
case 5040://开通守护推送
break;
case 5041://发送表情
break;
case 5042://上传即构日志
break;
case 5043://公屏状态
break;
case 5044://开球
break;
case 5045://弃球
break;
case 5046://亮球
break;
case 5047://调音
break;
case 5050://推送
break;
case 5051://需求变化
break;
case 5054://房主模式切换
break;
case 5055://离开房间
Logger.e("环信5055", message);
break;
case 5056://房主加入
break;
case 5057://房间浇水礼物推送
break;
case 5058://切换相亲房状态
break;
case 5059://相亲房礼物动画
break;
case 5060://房间玫瑰爱神礼物推送
break;
case 5061://交友房心动值变化
Logger.e("环信5061", message);
break;
case 5062://交友房换麦
Logger.e("环信5062", message);
break;
case 5063://进入小黑屋
Logger.e("环信5063", message);
break;
case 5064://退出小黑屋
Logger.e("环信5064", message);
break;
case 5065://点击开始后进行提示弹框
Logger.e("环信5065", message);
break;
case 5066://cp对数
Logger.e("环信5066", message);
break;
case 5067://延迟时间
Logger.e("环信5067", message);
break;
case 5068://房间内广播
Logger.e("环信5068", message);
break;
case 5069://房间内换麦
Logger.e("环信5069", message);
break;
case 10001: //房间红包
break;
case 10002: //雨开始
break;
case 10003: //打开红包
break;
case 7001: //奖池进度更新
break;
case 7002://cp时间到
Logger.e("环信7002", message);
break;
case 5070:
Logger.e("环信5070", message);
break;
} }
} }
/**
* 发布 (模拟其他客户端发布消息)
*/
public static void publish(String topic, String message) {
if (mqttAndroidClient == null) {
Logger.e(TAG, "mqttAndroidClient is null", "发送失败");
return;
}
// 在后台线程执行发布操作
new Handler(Looper.getMainLooper()).post(() -> {
try {
IMqttDeliveryToken publish = mqttAndroidClient.publish(topic, message.getBytes(), qos, false);
publish.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Logger.e(TAG, "发送消息", "发送成功");
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
Logger.e(TAG, "发送消息", "发送失败: " + exception.getMessage());
}
});
} catch (Exception e) {
Logger.e(TAG, "发送消息", "发送异常: " + e.getMessage());
}
});
}
public static void subscribe(String topic) {
// 在后台线程执行订阅操作
new Handler(Looper.getMainLooper()).post(() -> {
try {
if (mqttAndroidClient != null && mqttAndroidClient.isConnected()) {
IMqttToken subToken = mqttAndroidClient.subscribe(topic, qos);
subToken.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
for (MyEmqttSubscribeListener listener : subscribeListeners) {
if (listener != null) {
listener.onSubscribeSuccess(topic);
}
}
Logger.e(TAG, "订阅成功:" + topic);
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
for (MyEmqttSubscribeListener listener : subscribeListeners) {
if (listener != null &&
!TOPIC_BOSS.equals(topic) &&
!TOPIC_XLH.equals(topic)) {
listener.onSubscribeFailure();
}
}
Logger.e(TAG, "订阅失败:" + topic + ", error: " + exception.getMessage());
}
});
}
} catch (Exception e) {
Log.e(TAG, "订阅异常:" + topic, e);
}
});
}
public static void cleanSubscribe(String topic) {
// 在后台线程执行取消订阅操作
new Handler(Looper.getMainLooper()).post(() -> {
try {
if (mqttAndroidClient != null && mqttAndroidClient.isConnected()) {
IMqttToken subToken = mqttAndroidClient.unsubscribe(topic);
subToken.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Logger.e(TAG, "取消成功" + topic);
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
Logger.e(TAG, "取消失败" + topic + ", error: " + exception.getMessage());
}
});
}
} catch (Exception e) {
Log.e(TAG, "取消订阅异常:" + topic, e);
}
});
}
public static void closeConnection() {
new Handler(Looper.getMainLooper()).post(() -> {
try {
if (mqttAndroidClient != null && mqttAndroidClient.isConnected()) {
IMqttToken disconnect = mqttAndroidClient.disconnect();
disconnect.setActionCallback(new IMqttActionListener() {
@Override
public void onSuccess(IMqttToken asyncActionToken) {
Logger.e(TAG, "断开链接", "断开链接成功");
}
@Override
public void onFailure(IMqttToken asyncActionToken, Throwable exception) {
Logger.e(TAG, "断开链接", "断开链接失败" + exception.getMessage());
}
});
}
} catch (Exception e) {
Log.e(TAG, "关闭连接异常", e);
}
});
}
/** /**
* 清理资源 * 清理资源
*/ */
public void cleanup() { @Override
public void onDestroy() {
super.onDestroy();
b = false;
isServiceRunning = false;
try { try {
// 清理资源 // 清理资源
if (messageExecutorService != null) { if (messageExecutorService != null) {
@@ -630,10 +474,13 @@ public class MyMqttService implements MyEmqttConnectListener, MyEmqttMesgListene
cleanSubscribe(TOPIC_BOSS); cleanSubscribe(TOPIC_BOSS);
cleanSubscribe(TOPIC_XLH); cleanSubscribe(TOPIC_XLH);
if (mqttAndroidClient != null) { if (mqttAndroidClient != null) {
mqttAndroidClient.disconnect(); //断开连接 mqttAndroidClient.disconnect();
mqttAndroidClient.unregisterResources(); mqttAndroidClient.unregisterResources();
mqttAndroidClient = null; mqttAndroidClient = null;
} }
// 停止前台服务
stopForeground(true);
Logger.e(TAG, "服务关闭", "资源释放成功"); Logger.e(TAG, "服务关闭", "资源释放成功");
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "服务关闭异常", e); Log.e(TAG, "服务关闭异常", e);

View File

@@ -4,6 +4,7 @@ import android.content.Context;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.bumptech.glide.Glide; import com.bumptech.glide.Glide;
import com.orhanobut.logger.Logger;
public class MemoryOptimizationUtils { public class MemoryOptimizationUtils {
private static final String TAG = "MemoryOptimization"; private static final String TAG = "MemoryOptimization";
@@ -22,18 +23,35 @@ public class MemoryOptimizationUtils {
// 内存使用超过85%认为是低内存 // 内存使用超过85%认为是低内存
return memoryUsage > 0.85; return memoryUsage > 0.85;
} }
private static long lastGCTime = 0;
private static final long MIN_GC_INTERVAL = 5000; // 5秒最小间隔
/** /**
* 强制进行垃圾回收 * 强制进行垃圾回收
*/ */
public static void forceGC() { public static void forceGC() {
try { long currentTime = System.currentTimeMillis();
LogUtils.d(TAG, "Forcing garbage collection");
Runtime.getRuntime().gc(); // 避免频繁调用GC
Thread.sleep(100); // 给GC一些时间 if (currentTime - lastGCTime < MIN_GC_INTERVAL) {
} catch (InterruptedException e) { Logger.d(TAG, "Skipping GC, too frequent");
Thread.currentThread().interrupt(); return;
} }
lastGCTime = currentTime;
// 使用异步方式调用GC
new Thread(() -> {
try {
// 在后台线程执行GC
System.gc();
Thread.sleep(100); // 给GC一些时间
Runtime.getRuntime().runFinalization();
Logger.d(TAG, "Garbage collection completed");
} catch (Exception e) {
Logger.e(TAG, "Error during GC: " + e.getMessage());
}
}).start();
} }
/** /**

View File

@@ -2,18 +2,18 @@ package com.xscm.moduleutil.utils.config;
public enum EnvironmentEnum { public enum EnvironmentEnum {
PRODUCTION(//生产环境 PRODUCTION(//生产环境
"http://chat.qxmier.com/", "http://md.xscmmidi.site/",
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=", "yIZtKT0bz5hhD3wb30p+n5+qoasPj0XGza1qRuYXhtm9nFJdf1fA5B4tB6MjGRQNrCIAmlRMiiUP2DhjsDcih9Szx8HmZADuwCI0YTnva6kibqgbuYOtU2zeem3phkbZe27vbZ94aCWAZulloMeXuAFHd0jSaCBxNctKTYLjGQUGnDt/IDQr6mvLHSbb19X9vgQBa2gsTHjt3HYh2EY7dRJA020SPDe35hKf54v826Vgd34isc+BERQ7dwSH0NJ16OqFP181nlGRZvFFbuab3mweFyDOXQTpuN4NbixO5QQ=",
"https://oss-cn-hangzhou.aliyuncs.com/", "https://oss-cn-beijing.aliyuncs.com/",
"LTAI5tJ2UYfFNF7K3F4e1siv", "LTAI5tKgrfcFQxH46ZwWYgFW",
"DhpCS82gaigZljYqsWsUWUAZ20dREz", "ZOjTqAJmUL563EKFKySrUwAHtx4hKt",
"qx-yusheng", "midi01",
"https://qx-yusheng.oss-cn-hangzhou.aliyuncs.com/", "https://midi01.oss-cn-beijing.aliyuncs.com/",
"wxc7681513be9f926b", "wxef1289d8a89b41d4",
1600101474, 1600101474,
"4a521d6f1c6343998b1c8fd425dea02a", "a3f0f0c78307434fa1c697c3429fbdcf",
"tcp://81.70.45.221", "tcp://81.70.45.221",
"https://vespa.qxmier.com"), "https://mdh.xscmmidi.site"),
TEST(//测试环境 TEST(//测试环境
"http://md.qxmier.com/", "http://md.qxmier.com/",
"6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=", "6rdWuz058oq5OahdbFiGEybUcdahd12J83L34Uc7MrPIrxtFG+rXiwDvRcqNvjwbClbbmvMrmxKVkIysFByBsl0Qe9kqd2w8T/nhK5G6eXXlk2V9AjYCieIU+jRnjZBB+Cfechr6rCGJ2aeBARIsXcRPW7wm9WFK9euh5T+v6Pyte68yNaNdcYCll3+U4/uCEog7HygCnMIbAU+kqoPdmn2H+51YOHW+VsnsHd4w1+I3f8Tt0xLIXGM4GWnQueZ5GR46GTWiSYMy8dCIh9SPIMRyC91GosVcfGPMJSdcXqc=",

View File

@@ -27,11 +27,11 @@ public class EnvironmentPrefs {
// 获取当前选择的环境,默认为 PRODUCTION // 获取当前选择的环境,默认为 PRODUCTION
public EnvironmentEnum getSelectedEnvironment() { public EnvironmentEnum getSelectedEnvironment() {
String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.TEST.name()); String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.PRODUCTION.name());
try { try {
return EnvironmentEnum.valueOf(envName); return EnvironmentEnum.valueOf(envName);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
return EnvironmentEnum.TEST; // 出错时默认返回生产环境 return EnvironmentEnum.PRODUCTION; // 出错时默认返回生产环境
} }
} }
} }

View File

@@ -22,6 +22,7 @@ import androidx.databinding.DataBindingUtil;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.PathUtils; import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.MediaItem;
import com.google.android.exoplayer2.ui.PlayerView; import com.google.android.exoplayer2.ui.PlayerView;
@@ -299,10 +300,42 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
clearQueue(); clearQueue();
return; return;
} }
// 异步处理URL解析等耗时操作
ThreadUtils.executeByIo(new ThreadUtils.SimpleTask<String>() {
@Override
public String doInBackground() throws Throwable {
// 在后台线程进行URL有效性检查或其他预处理
if (url == null || url.isEmpty()) {
return null;
}
return url; // 返回处理后的URL
}
@Override
public void onSuccess(String processedUrl) {
if (processedUrl != null) {
// 使用post方法确保在下一个UI循环中执行
mainHandler.post(() -> {
// 再次检查状态
if (!isDestroyed && !isPlaying) {
playQueue.add(new PlayItem(processedUrl, type2));
checkAndStartPlayback();
} else {
// 如果正在播放,添加到队列中
playQueue.add(new PlayItem(processedUrl, type2));
}
});
}
}
@Override
public void onFail(Throwable e) {
LogUtils.e("Error processing gift URL: " + e.getMessage());
}
});
// 添加到播放队列 // 添加到播放队列
// playQueue.offer(new PlayItem(url, type2)); // playQueue.offer(new PlayItem(url, type2));
playQueue.add(new PlayItem(url, type2)); // playQueue.add(new PlayItem(url, type2));
Logger.d("AvatarFrameView", "Added to queue, queue size: " + playQueue.size() + ", url: " + url); Logger.d("AvatarFrameView", "Added to queue, queue size: " + playQueue.size() + ", url: " + url);
// 如果当前没有在播放,则开始播放 // 如果当前没有在播放,则开始播放
@@ -310,7 +343,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
// playNextFromQueue(); // playNextFromQueue();
// } // }
// 改进播放检查逻辑 // 改进播放检查逻辑
checkAndStartPlayback(); // checkAndStartPlayback();
} }
@@ -829,43 +862,113 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
private void releaseResources() { private void releaseResources() {
LogUtils.d(TAG, "Releasing all resources"); LogUtils.d(TAG, "Releasing all resources");
// if (isDestroyed) return; if (isDestroyed) return;
// 使用异步线程处理耗时操作
new Thread(() -> {
try {
// 在后台线程处理文件操作和大对象清理
performHeavyCleanup();
try { // 回到主线程处理 UI 相关的清理
// 清理 SVGA 资源 mainHandler.post(() -> {
if (svgaSurface != null && svgaSurface.getDrawable() instanceof SVGADrawable) { performUICleanup();
SVGADrawable drawable = (SVGADrawable) svgaSurface.getDrawable(); });
if (drawable != null) { } catch (Exception e) {
try { Logger.e(TAG, "Error in async releaseResources: " + e.getMessage());
drawable.stop(); // 出错时仍在主线程清理 UI 资源
svgaSurface.clearAnimation(); mainHandler.post(() -> {
svgaSurface.setImageDrawable(null); performUICleanup();
} catch (Exception e) { });
LogUtils.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
}
}
} }
}).start();
// try {
// // 清理 SVGA 资源
// if (svgaSurface != null && svgaSurface.getDrawable() instanceof SVGADrawable) {
// SVGADrawable drawable = (SVGADrawable) svgaSurface.getDrawable();
// if (drawable != null) {
// try {
// drawable.stop();
// svgaSurface.clearAnimation();
// svgaSurface.setImageDrawable(null);
// } catch (Exception e) {
// LogUtils.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
// }
// }
// }
//
// // 停止并清理播放器
// if (mBinding != null && mBinding.playView != null) {
// mBinding.playView.stopPlay();
// }
//
// // 清理 ExoPlayer 资源
// if (exoPlayer != null) {
// try {
// exoPlayer.stop();
// exoPlayer.clearVideoSurface();
// } catch (Exception e) {
// LogUtils.e(TAG, "Error releasing ExoPlayer resources: " + e.getMessage());
// }
// }
// } catch (Exception e) {
// LogUtils.e(TAG, "Error in releaseResources: " + e.getMessage());
// }
}
/**
* 在后台线程执行耗时的清理操作
*/
private void performHeavyCleanup() {
try {
// 清理缓存文件(如果需要)
// 清理大对象引用等
// clearCacheFiles();
} catch (Exception e) {
Logger.e(TAG, "Error in performHeavyCleanup: " + e.getMessage());
}
}
/**
* 在主线程执行 UI 相关的清理操作
*/
private void performUICleanup() {
try {
// 停止并清理播放器 // 停止并清理播放器
if (mBinding != null && mBinding.playView != null) { if (mBinding != null && mBinding.playView != null) {
mBinding.playView.stopPlay(); try {
mBinding.playView.stopPlay();
} catch (Exception e) {
Logger.e(TAG, "Error stopping playView: " + e.getMessage());
}
} }
// 清理 ExoPlayer 资源 // 清理 ExoPlayer 资源
if (exoPlayer != null) { if (exoPlayer != null) {
try { try {
// 使用异步停止避免阻塞
exoPlayer.stop(); exoPlayer.stop();
exoPlayer.clearVideoSurface(); exoPlayer.clearVideoSurface();
} catch (Exception e) { } catch (Exception e) {
LogUtils.e(TAG, "Error releasing ExoPlayer resources: " + e.getMessage()); Logger.e(TAG, "Error releasing ExoPlayer resources: " + e.getMessage());
}
}
// 清理 SVGA 资源
if (svgaSurface != null) {
try {
svgaSurface.pauseAnimation();
svgaSurface.clearAnimation();
svgaSurface.setImageDrawable(null);
} catch (Exception e) {
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
} }
} }
} catch (Exception e) { } catch (Exception e) {
LogUtils.e(TAG, "Error in releaseResources: " + e.getMessage()); Logger.e(TAG, "Error in performUICleanup: " + e.getMessage());
} }
} }
/** /**
* 公共释放方法,用于外部主动释放资源 * 公共释放方法,用于外部主动释放资源
*/ */
@@ -877,7 +980,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
mainHandler.post(this::release); mainHandler.post(this::release);
return; return;
} }
// isDestroyed = true; isDestroyed = true;
try { try {
// 清空播放队列 // 清空播放队列
@@ -886,26 +989,36 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
// 释放所有资源 // 释放所有资源
releaseResources(); releaseResources();
// 释放 ExoPlayer // 延迟清理 ExoPlayer(避免主线程阻塞)
if (exoPlayer != null) { mainHandler.postDelayed(() -> {
try { if (exoPlayer != null) {
exoPlayer.stop(); try {
exoPlayer.release(); exoPlayer.release();
} catch (Exception e) { } catch (Exception e) {
LogUtils.e(TAG, "Error releasing ExoPlayer: " + e.getMessage()); Logger.e(TAG, "Error releasing ExoPlayer: " + e.getMessage());
}
exoPlayer = null;
} }
exoPlayer = null; }, 50);
}
// 清理 PlayerView // 延迟清理其他资源
if (playerView != null) { mainHandler.postDelayed(() -> {
try { // 清理 PlayerView
playerView.setPlayer(null); if (playerView != null) {
} catch (Exception e) { try {
LogUtils.e(TAG, "Error releasing PlayerView: " + e.getMessage()); playerView.setPlayer(null);
} catch (Exception e) {
Logger.e(TAG, "Error releasing PlayerView: " + e.getMessage());
}
playerView = null;
} }
playerView = null;
} // 清理 binding
if (mBinding != null) {
mBinding = null;
}
}, 100);
// 清理 SVGAImageView // 清理 SVGAImageView
if (svgaSurface != null) { if (svgaSurface != null) {
@@ -931,7 +1044,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
LogUtils.e(TAG, "Error in AvatarFrameView release: " + e.getMessage()); LogUtils.e(TAG, "Error in AvatarFrameView release: " + e.getMessage());
} finally { } finally {
// 建议进行垃圾回收 // 建议进行垃圾回收
MemoryOptimizationUtils.forceGC(); // MemoryOptimizationUtils.forceGC();
} }
} }
public void clearQueue() { public void clearQueue() {

View File

@@ -351,17 +351,15 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
// @Subscribe(threadMode = ThreadMode.MAIN) // @Subscribe(threadMode = ThreadMode.MAIN)
public void setOnlineStatus(UserOnlineStatusBean isOnline) { public void setOnlineStatus(UserOnlineStatusBean isOnline) {
// iv_on_line.setVisibility(isOnline ? GONE : VISIBLE); if (pitBean!=null) {
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) { if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
//// for (UserOnlineStatusBean userOnlineStatus : userOnlineStatusBean) { if (isOnline.getIs_online() == 1) {
if (pitBean.getUser_id().equals(isOnline.getUser_id())) { iv_on_line.setVisibility(GONE);
if (isOnline.getIs_online() == 1) { } else {
iv_on_line.setVisibility(GONE); iv_on_line.setVisibility(VISIBLE);
} else { }
iv_on_line.setVisibility(VISIBLE);
} }
//// }
} }
} }
} }

View File

@@ -5,20 +5,25 @@ import static com.liulishuo.okdownload.OkDownloadProvider.context;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.animation.DecelerateInterpolator; import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.alibaba.android.arouter.launcher.ARouter;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.petterp.floatingx.FloatingX; import com.petterp.floatingx.FloatingX;
import com.petterp.floatingx.assist.FxGravity; import com.petterp.floatingx.assist.FxGravity;
import com.petterp.floatingx.assist.helper.FxAppHelper; import com.petterp.floatingx.assist.helper.FxAppHelper;
import com.xscm.moduleutil.R; import com.xscm.moduleutil.R;
import com.xscm.moduleutil.bean.XLHBean;
import com.xscm.moduleutil.event.MqttBean; import com.xscm.moduleutil.event.MqttBean;
import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ImageUtils; import com.xscm.moduleutil.utils.ImageUtils;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@@ -39,7 +44,9 @@ public class PiaoPingManager {
private View piaoPingView; private View piaoPingView;
private boolean isPiaoPingShown = false; private boolean isPiaoPingShown = false;
private Queue<MqttBean> messageQueue = new ConcurrentLinkedQueue<>(); // 消息队列 private Queue<MqttBean> messageQueue = new ConcurrentLinkedQueue<>(); // 消息队列
private Queue<XLHBean> XLHmessageQueue = new ConcurrentLinkedQueue<>(); // 消息队列
private boolean isAnimating = false; // 动画状态标记 private boolean isAnimating = false; // 动画状态标记
private boolean XLHisAnimating = false; // 动画状态标记
private PiaoPingManager(Context context) { private PiaoPingManager(Context context) {
windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
if (windowManager == null) return; if (windowManager == null) return;
@@ -155,6 +162,8 @@ public class PiaoPingManager {
} }
messageQueue.clear(); messageQueue.clear();
isAnimating = false; // 重置动画状态 isAnimating = false; // 重置动画状态
XLHmessageQueue.clear();
XLHisAnimating = false;
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
@@ -164,5 +173,103 @@ public class PiaoPingManager {
// FxAppHelper fxAppHelper = FxAppHelper.builder().setContext( context).setLayout(R.layout.item_piaoping).build(); // FxAppHelper fxAppHelper = FxAppHelper.builder().setContext( context).setLayout(R.layout.item_piaoping).build();
// FloatingX.install(fxAppHelper).show(); // FloatingX.install(fxAppHelper).show();
} }
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(XLHBean event) {
showPiaoPingMessageXlh(event);
}
private void showPiaoPingMessageXlh(XLHBean event) {
// 创建 FloatingX 配置
// 添加到队列
XLHmessageQueue.offer(event);
// 如果当前没有动画正在进行,则开始处理
if (!XLHisAnimating) {
processNextMessageXlh();
}
}
private void processNextMessageXlh() {
if (XLHmessageQueue.isEmpty()) {
XLHisAnimating = false;
return;
}
XLHisAnimating = true;
XLHBean xlhBean = XLHmessageQueue.poll();
displayMessageXlh(xlhBean);
}
@SuppressLint({"MissingInflatedId", "LocalSuppress"})
private void displayMessageXlh(XLHBean xlhBean) {
// 获取悬浮窗视图并设置内容
View floatingView = LayoutInflater.from(context).inflate(R.layout.item_piaoping_xlh, new FrameLayout(context), false);
TextView textView = floatingView.findViewById(R.id.tv_name);
ImageView xlh_image = floatingView.findViewById(R.id.im_xlh);
// if (xlhBean.getFrom_type() == 1){
// xlh_image.setImageResource(R.mipmap.xlh_jjks);
// }else {
// xlh_image.setImageResource(R.mipmap.xlh_zsks);
// }
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ? context.getResources().getDrawable(R.mipmap.xlh_jjks) : context.getResources().getDrawable(R.mipmap.xlh_zsks));
textView.setText(xlhBean.getText());
// 先将视图放置在屏幕右侧外部,避免闪现问题
floatingView.setTranslationX(10000); // 先放到屏幕外
FxAppHelper fxAppHelper = FxAppHelper.builder()
.setContext(context)
.setLayoutView(floatingView)
.setGravity(FxGravity.RIGHT_OR_TOP)
.setX(0)
.setY(100)
.build();
FloatingX.install(fxAppHelper).show();
// 添加点击事件监听器
floatingView.setOnClickListener(v -> {
// 点击时执行跳转操作
handleItemClick(xlhBean);
});
// 首先从右侧滑入到屏幕中央
floatingView.post(() -> {
// 确保初始位置在屏幕右侧外部
floatingView.setTranslationX(floatingView.getWidth());
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
floatingView.getWidth(), 0f);
animator1.setDuration(1500); // 延长动画时间到1.5秒
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
animator1.start();
// 第二阶段延迟1秒后从当前位置向左滑出
floatingView.postDelayed(() -> {
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
0f, -floatingView.getWidth());
animator2.setDuration(1500); // 延长动画时间到1.5秒
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
animator2.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// 动画结束后移除悬浮窗
FloatingX.uninstallAll();
// 处理下一个消息
processNextMessageXlh();
}
});
animator2.start();
}, 4000); // 停留1秒
});
}
private void handleItemClick(XLHBean xlhBean) {
// 这里可以根据实际需求实现跳转逻辑
// 例如:跳转到礼物详情页面、用户主页等
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
}
} }

View File

@@ -71,7 +71,7 @@ public class RoomMakeWheatView extends BaseWheatView {
mIvRipple.stopAnimation(); mIvRipple.stopAnimation();
mIvRipple.setVisibility(VISIBLE); mIvRipple.setVisibility(VISIBLE);
mTvName.setText(bean.getNickname()); mTvName.setText(bean.getNickname());
ImageUtils.loadCenterCrop(bean.getAvatar(), mRiv); ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
if (TextUtils.isEmpty(pitBean.getDress_picture())) { if (TextUtils.isEmpty(pitBean.getDress_picture())) {
mIvFrame.setVisibility(INVISIBLE); mIvFrame.setVisibility(INVISIBLE);
} else { } else {

View File

@@ -23,7 +23,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
public ImageView mIvTagBoss; public ImageView mIvTagBoss;
public TextView mTvTime; public TextView mTvTime;
public TextView tv_time_pk; public TextView tv_time_pk;
public boolean isClickListenerSet = false;
private boolean showBoss;//显示老板标识 private boolean showBoss;//显示老板标识
public RoomSingSongWheatView(Context context) { public RoomSingSongWheatView(Context context) {

View File

@@ -227,6 +227,7 @@ public class WheatLayoutManager {
return metrics.widthPixels; return metrics.widthPixels;
} }
public void updateSingleWheat(RoomPitBean pitBean, int pitNumber) { public void updateSingleWheat(RoomPitBean pitBean, int pitNumber) {
if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return; if (pitList == null || pitList.isEmpty() || pitNumber < 1 || pitNumber > 10) return;
if (isSingleMode && this.currentSinglePit != pitNumber) return; if (isSingleMode && this.currentSinglePit != pitNumber) return;

View File

@@ -2,7 +2,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true"> <item android:state_selected="true">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="#FFFF00" /> <solid android:color="#6C49E4" />
<corners android:radius="8dp" /> <corners android:radius="8dp" />
</shape> </shape>
</item> </item>

View File

@@ -38,12 +38,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/one_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="10币一次" tools:text="10币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
@@ -68,12 +69,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/ten_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="100币一次" tools:text="100币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
@@ -96,12 +98,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/hundred_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="1000币一次" tools:text="1000币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -148,14 +151,14 @@
android:id="@+id/ll_yx" android:id="@+id/ll_yx"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_60" android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_17" android:layout_marginBottom="5dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toStartOf="@+id/ll_tx"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@+id/gift7"> app:layout_constraintStart_toStartOf="parent">
<TextView <TextView
@@ -170,12 +173,12 @@
<Switch <Switch
android:id="@+id/sw_lock_yx" android:id="@+id/sw_lock_yx"
tools:ignore="UseSwitchCompatOrMaterialXml"
android:layout_width="@dimen/dp_37" android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_5"
android:background="@drawable/room_tuner_selector_switch" android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent" android:thumb="@android:color/transparent" />
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout> </LinearLayout>
@@ -184,12 +187,13 @@
android:id="@+id/ll_tx" android:id="@+id/ll_tx"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_17" android:layout_marginBottom="@dimen/dp_5"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintStart_toEndOf="@+id/ll_yx" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintTop_toTopOf="@+id/ll_yx"> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/ll_yx">
<TextView <TextView
@@ -204,12 +208,12 @@
<Switch <Switch
android:id="@+id/sw_tex" android:id="@+id/sw_tex"
tools:ignore="UseSwitchCompatOrMaterialXml"
android:layout_width="@dimen/dp_37" android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_5"
android:background="@drawable/room_tuner_selector_switch" android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent" android:thumb="@android:color/transparent" />
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout> </LinearLayout>

View File

@@ -38,12 +38,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/one_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="10币一次" tools:text="10币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
@@ -68,12 +69,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/ten_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="100币一次" tools:text="100币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
@@ -96,12 +98,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/hundred_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="1000币一次" tools:text="1000币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -148,14 +151,14 @@
android:id="@+id/ll_yx" android:id="@+id/ll_yx"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_60" android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_17" android:layout_marginBottom="5dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toStartOf="@+id/ll_tx"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@+id/gift10"> app:layout_constraintStart_toStartOf="parent">
<TextView <TextView
@@ -184,12 +187,13 @@
android:id="@+id/ll_tx" android:id="@+id/ll_tx"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_17" android:layout_marginBottom="@dimen/dp_5"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintStart_toEndOf="@+id/ll_yx" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintTop_toTopOf="@+id/ll_yx"> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/ll_yx">
<TextView <TextView

View File

@@ -38,12 +38,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/one_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="10币一次" tools:text="10币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
@@ -68,12 +69,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/ten_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="100币一次" tools:text="100币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
@@ -96,12 +98,13 @@
android:textSize="@dimen/sp_12" /> android:textSize="@dimen/sp_12" />
<TextView <TextView
android:id="@+id/hundred_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_2" android:layout_marginBottom="@dimen/dp_2"
android:drawableLeft="@mipmap/jinb" android:drawableLeft="@mipmap/jinb"
android:gravity="center" android:gravity="center"
android:text="1000币一次" tools:text="1000币一次"
android:textSize="@dimen/sp_10" /> android:textSize="@dimen/sp_10" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
@@ -148,14 +151,14 @@
android:id="@+id/ll_yx" android:id="@+id/ll_yx"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/dp_60" android:layout_marginEnd="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_17" android:layout_marginBottom="5dp"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toStartOf="@+id/ll_tx"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintTop_toBottomOf="@+id/gift7"> app:layout_constraintStart_toStartOf="parent">
<TextView <TextView
@@ -170,12 +173,12 @@
<Switch <Switch
android:id="@+id/sw_lock_yx" android:id="@+id/sw_lock_yx"
tools:ignore="UseSwitchCompatOrMaterialXml"
android:layout_width="@dimen/dp_37" android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_5"
android:background="@drawable/room_tuner_selector_switch" android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent" android:thumb="@android:color/transparent" />
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout> </LinearLayout>
@@ -184,12 +187,13 @@
android:id="@+id/ll_tx" android:id="@+id/ll_tx"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20" android:layout_marginStart="@dimen/dp_10"
android:layout_marginBottom="@dimen/dp_17" android:layout_marginBottom="@dimen/dp_5"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
app:layout_constraintStart_toEndOf="@+id/ll_yx" app:layout_constraintBottom_toTopOf="@+id/lottery_buttons_layout"
app:layout_constraintTop_toTopOf="@+id/ll_yx"> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/ll_yx">
<TextView <TextView
@@ -204,12 +208,12 @@
<Switch <Switch
android:id="@+id/sw_tex" android:id="@+id/sw_tex"
tools:ignore="UseSwitchCompatOrMaterialXml"
android:layout_width="@dimen/dp_37" android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20" android:layout_height="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_5" android:layout_marginStart="@dimen/dp_5"
android:background="@drawable/room_tuner_selector_switch" android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent" android:thumb="@android:color/transparent" />
tools:ignore="UseSwitchCompatOrMaterialXml" />
</LinearLayout> </LinearLayout>

View File

@@ -22,12 +22,14 @@
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/gv_gift" android:id="@+id/gv_gift"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_marginStart="@dimen/dp_10" android:layout_marginStart="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_10" android:layout_marginEnd="@dimen/dp_10"
android:nestedScrollingEnabled="false" android:layout_marginTop="@dimen/dp_16"
android:nestedScrollingEnabled="true"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintTop_toBottomOf="@+id/im_jc" app:layout_constraintTop_toBottomOf="@+id/im_jc"
app:layout_constraintBottom_toBottomOf="parent"
app:spanCount="3" app:spanCount="3"
tools:listitem="@layout/item_prize_pool" /> tools:listitem="@layout/item_prize_pool" />

View File

@@ -3,9 +3,20 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/gz_cl"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_transparent"> android:background="@mipmap/tkzj">
<ImageView
android:id="@+id/im_gz"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_36"
android:src="@mipmap/tkzj_gz"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<WebView <WebView
android:id="@+id/web_view" android:id="@+id/web_view"
@@ -13,7 +24,7 @@
android:layout_height="@dimen/dp_600" android:layout_height="@dimen/dp_600"
android:background="@color/transparent" android:background="@color/transparent"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toBottomOf="@+id/im_gz"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
/> />
@@ -27,7 +38,7 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/web_view" app:layout_constraintTop_toBottomOf="@+id/web_view"
android:visibility="visible"/> android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 598 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 KiB

View File

@@ -22,7 +22,10 @@
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="android:textColor">@color/color_1F1C1F</item> <item name="android:textColor">@color/color_1F1C1F</item>
<item name="android:textColorHint">@color/color_FF999999</item> <item name="android:textColorHint">@color/color_FF999999</item>
<item name="android:windowBackground">@color/color_F9FAFA</item> <item name="android:windowBackground">@color/transparent</item>
<item name="android:windowTranslucentStatus">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowLightStatusBar">true</item>
<!-- <item name="android:windowAnimationStyle">@style/AnimFade</item>--> <!-- <item name="android:windowAnimationStyle">@style/AnimFade</item>-->
</style> </style>
@@ -32,7 +35,13 @@
<item name="android:windowNoTitle">true</item> <item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item><!-- 在中间弹框、背后有遮罩的效果 --> <item name="android:windowIsFloating">true</item><!-- 在中间弹框、背后有遮罩的效果 -->
</style> </style>
<style name="TransparentActivityTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
<style name="BaseDialogStyleH" parent="Theme.AppCompat.Dialog"> <style name="BaseDialogStyleH" parent="Theme.AppCompat.Dialog">
<item name="android:backgroundDimAmount">0.6</item> <item name="android:backgroundDimAmount">0.6</item>
<item name="android:windowBackground">@android:color/transparent</item> <item name="android:windowBackground">@android:color/transparent</item>

View File

@@ -165,10 +165,15 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
if (view.getId() == R.id.rl_1) { if (view.getId() == R.id.rl_1) {
dialog(); dialog();
}else if (view.getId()==R.id.tv_fb){ }else if (view.getId()==R.id.tv_fb){
if (mBinding.tvFb.getText().toString().equals("正在发布...")){
ToastUtils.showShort("请勿重复发布");
return;
}
if (mBinding.etG.getText().toString().isEmpty()){ if (mBinding.etG.getText().toString().isEmpty()){
ToastUtils.showShort("请输入发布内容"); ToastUtils.showShort("请输入发布内容");
return; return;
} }
mBinding.tvFb.setText( "正在发布...");
MvpPre.publishZone(TextUtils.join(",", uploadedUrls),mBinding.etG.getText().toString(),TextUtils.join(",", topicId),"",city1); MvpPre.publishZone(TextUtils.join(",", uploadedUrls),mBinding.etG.getText().toString(),TextUtils.join(",", topicId),"",city1);
} }
@@ -322,6 +327,7 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
@Override @Override
public void publishSuccess() { public void publishSuccess() {
mBinding.etG.setText( "立即发布");
ToastUtils.showShort("发布成功"); ToastUtils.showShort("发布成功");
finish(); finish();
} }

View File

@@ -58,6 +58,7 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MvpPre.getCategories(); MvpPre.getCategories();
MvpPre.getCircleList("1", "10"); MvpPre.getCircleList("1", "10");
} }
@@ -224,6 +225,7 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
@Override @Override
public void setCircleList(List<CircleListBean> list) { public void setCircleList(List<CircleListBean> list) {
if (page == 1) { if (page == 1) {
cirleListAdapter.setNewData(new ArrayList<>());
cirleListAdapter.setNewData(list); cirleListAdapter.setNewData(list);
}else { }else {
if (list!=null && list.size() > 0){ if (list!=null && list.size() > 0){

View File

@@ -25,6 +25,7 @@ import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;
import org.angmarch.views.NiceSpinner; import org.angmarch.views.NiceSpinner;
import org.angmarch.views.OnSpinnerItemSelectedListener; import org.angmarch.views.OnSpinnerItemSelectedListener;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@@ -61,10 +62,13 @@ public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, Fragm
mBinding.niceSpinner.setText(item); mBinding.niceSpinner.setText(item);
if (item.equals("只看女生")){ if (item.equals("只看女生")){
type="2"; type="2";
page=1;
}else if (item.equals("只看男生")){ }else if (item.equals("只看男生")){
type="1"; type="1";
page=1;
}else { }else {
type="0"; type="0";
page=1;
} }
MvpPre.getExpandColumn(type,"1", "10"); MvpPre.getExpandColumn(type,"1", "10");
// mBinding.niceSpinner.getItemAtPosition(position); // mBinding.niceSpinner.getItemAtPosition(position);
@@ -136,6 +140,7 @@ public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, Fragm
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
page=1;
MvpPre.getExpandColumn(type,"1", "10"); MvpPre.getExpandColumn(type,"1", "10");
} }
@Override @Override
@@ -160,11 +165,33 @@ public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, Fragm
@Override @Override
public void setExpandColumn(List<ExpandColumnBean> list) { public void setExpandColumn(List<ExpandColumnBean> list) {
if (page==1) { if (type.equals("2")) {
expandColumnAdapter.setNewData(list); if (page == 1) {
}else { expandColumnAdapter.setNewData(new ArrayList<>());
if (list!=null && list.size()>0){ expandColumnAdapter.setNewData(list);
expandColumnAdapter.addData(list); } else {
if (list != null && list.size() > 0) {
expandColumnAdapter.addData(list);
}
}
}else if (type.equals("1")){
if (page == 1) {
expandColumnAdapter.setNewData(new ArrayList<>());
expandColumnAdapter.setNewData(list);
} else {
if (list != null && list.size() > 0) {
expandColumnAdapter.addData(list);
}
}
}else if (type.equals("0")){
if (page == 1) {
expandColumnAdapter.setNewData(new ArrayList<>());
expandColumnAdapter.setNewData(list);
} else {
if (list != null && list.size() > 0) {
expandColumnAdapter.addData(list);
}
} }
} }
} }

View File

@@ -15,9 +15,10 @@
<activity <activity
android:name=".activity.RoomActivity" android:name=".activity.RoomActivity"
android:exported="false" android:exported="false"
android:launchMode="singleInstance" android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan" android:windowSoftInputMode="adjustPan"
android:enableOnBackInvokedCallback="false" android:enableOnBackInvokedCallback="false"
android:theme="@style/TransparentActivityTheme"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />

View File

@@ -56,7 +56,7 @@ public class WheatFeedingSelectAdapter extends RecyclerView.Adapter<WheatFeedin
if (newState) { if (newState) {
mSelectedPositions.add(position); mSelectedPositions.add(position);
} else { } else {
mSelectedPositions.remove(position); mSelectedPositions.remove(Integer.valueOf(position)); // 修改这里
} }
}); });
holder.tv_bm.setOnClickListener(v -> { holder.tv_bm.setOnClickListener(v -> {

View File

@@ -75,7 +75,6 @@ public class RoomConcernDialogFragment extends BaseMvpDialogFragment<RoomClosePr
window.setAttributes(lp); window.setAttributes(lp);
window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); window.addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
} }
@Override @Override
public void initView() { public void initView() {
// getWindow().setLayout((int) (ScreenUtils.getScreenWidth() / 375.0 * 341), RadioGroup.LayoutParams.WRAP_CONTENT); // getWindow().setLayout((int) (ScreenUtils.getScreenWidth() / 375.0 * 341), RadioGroup.LayoutParams.WRAP_CONTENT);
@@ -86,7 +85,7 @@ public class RoomConcernDialogFragment extends BaseMvpDialogFragment<RoomClosePr
mBinding.tvName2.setText(relationshipList.getUser2_nickname()); mBinding.tvName2.setText(relationshipList.getUser2_nickname());
mBinding.tvZhi.setText(relationshipList.getHeart_value()); mBinding.tvZhi.setText(relationshipList.getHeart_value());
mBinding.btnAction.setOnClickListener(this::onViewClicked); mBinding.btnAction.setOnClickListener(this::onViewClicked);
mBinding.btnCancel.setOnClickListener(this::onViewClicked); // mBinding.btnCancel.setOnClickListener(this::onViewClicked);
mBinding.rlList.setLayoutManager(new GridLayoutManager(getContext(), 3)); mBinding.rlList.setLayoutManager(new GridLayoutManager(getContext(), 3));
mAdapter = new BaseQuickAdapter<RoomRelationBean, BaseViewHolder>(R.layout.room_concern_item) { mAdapter = new BaseQuickAdapter<RoomRelationBean, BaseViewHolder>(R.layout.room_concern_item) {
@Override @Override
@@ -98,8 +97,10 @@ public class RoomConcernDialogFragment extends BaseMvpDialogFragment<RoomClosePr
// 根据当前选中的位置来设置颜色 // 根据当前选中的位置来设置颜色
if (helper.getAdapterPosition() == selectedPosition) { if (helper.getAdapterPosition() == selectedPosition) {
tvRelation.setSelected(true); tvRelation.setSelected(true);
tvRelation.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.white));
} else { } else {
tvRelation.setSelected(false); tvRelation.setSelected(false);
tvRelation.setTextColor(getResources().getColor(com.xscm.moduleutil.R.color.black));
} }
// 设置点击事件 // 设置点击事件
@@ -145,6 +146,7 @@ public class RoomConcernDialogFragment extends BaseMvpDialogFragment<RoomClosePr
if (listener != null && selectedPosition != -1) { if (listener != null && selectedPosition != -1) {
RoomRelationBean selectedDean = mAdapter.getItem(selectedPosition); RoomRelationBean selectedDean = mAdapter.getItem(selectedPosition);
listener.onConcernSelected(selectedDean, relationshipList); listener.onConcernSelected(selectedDean, relationshipList);
dismiss();
}else { }else {
ToastUtils.show("请选择关系"); ToastUtils.show("请选择关系");
return; return;
@@ -152,9 +154,10 @@ public class RoomConcernDialogFragment extends BaseMvpDialogFragment<RoomClosePr
} else if (view.getId() == R.id.btn_cancel) {//取消
dismiss();
} }
// else if (view.getId() == R.id.btn_cancel) {//取消
// dismiss();
// }
} }
public void dismiss() { public void dismiss() {

View File

@@ -358,45 +358,33 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void userRefresh(GiftUserRefreshEvent event) { public void userRefresh(GiftUserRefreshEvent event) {
if (event.gift==null||event.gift.getRule() == null) { if (event.gift == null || event.gift.getRule() == null) {
mBinding.llGiftRule.setVisibility(View.GONE); mBinding.llGiftRule.setVisibility(View.GONE);
} else { } else {
if (event.gift.getActivities_id() == 5) { if (event.gift.getActivities_id() == 5) {
this.dismiss();
showGiftLotteryDialog(event.gift, roomId); showGiftLotteryDialog(event.gift, roomId);
return; return;
// String userId = gifyuseradapter.getUserIdToString();
// if (userId == null || userId.isEmpty()) {
// ToastUtils.show("请先选择人员");
// return;
// } else {
// // 直接链式调用显示对话框
// GiftLotteryDialog.newInstance(event.gift.getGift_bag()+"", roomId, userId)
// .show(getChildFragmentManager(), "GiftLotteryDialog");
// return;
// }
} }
mBinding.llGiftRule.setVisibility(View.VISIBLE); mBinding.llGiftRule.setVisibility(View.VISIBLE);
setGiftDetail(event.gift); setGiftDetail(event.gift);
} }
// if (event.gift.isManghe()){
// mBinding.llGiftRule.setVisibility(View.VISIBLE);
// setGiftDetail(event.gift);
// }else {
// mBinding.llGiftRule.setVisibility(View.GONE);
// }
roonGiftModel = event.gift; roonGiftModel = event.gift;
} }
private GiftLotteryDialog currentDialog; private GiftLotteryDialog currentDialog;
private void showGiftLotteryDialog(RoonGiftModel gift, String roomId) { private void showGiftLotteryDialog(RoonGiftModel gift, String roomId) {
String userId = gifyuseradapter.getUserIdToString(); String userId = gifyuseradapter.getUserIdToString();
if (userId == null || userId.isEmpty()) { if (userId == null || userId.isEmpty()) {
ToastUtils.show("请先选择人员"); ToastUtils.show("请先选择人员");
gift.setChecked(false);
return; return;
} }
this.dismiss();
FragmentManager fm = getParentFragmentManager(); FragmentManager fm = getParentFragmentManager();
GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(gift.getGift_bag()+"", roomId, userId); GiftLotteryDialog newDialog = GiftLotteryDialog.newInstance(gift.getGift_bag() + "", roomId, userId);
newDialog.show(fm, "GiftLotteryDialog"); newDialog.show(fm, "GiftLotteryDialog");
fm.beginTransaction() fm.beginTransaction()
@@ -405,7 +393,6 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
.commit(); .commit();
// 如果当前dialog存在且正在显示先关闭 // 如果当前dialog存在且正在显示先关闭
// if (currentDialog != null && currentDialog.isVisible()) { // if (currentDialog != null && currentDialog.isVisible()) {
// currentDialog.dismiss(); // currentDialog.dismiss();
@@ -500,20 +487,26 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
if (currentItem != 0) { if (currentItem != 0) {
//礼物打赏 //礼物打赏
giftNumber = num; giftNumber = num;
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id);
if (userInfo != null) { if (userInfo != null) {
if (userInfo.getPit_number() != null) { if (userInfo.getPit_number() != null) {
if (userInfo.getPit_number().equals("888") || userInfo.getPit_number().equals("")) { if (userInfo.getPit_number().equals("888") || userInfo.getPit_number().equals("")) {
if (userInfo.getPit_number().isEmpty() || jingp != 1) { 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, ""); MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
} else { } 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"); MvpPre.roomAuctionJoin(userInfo.getAuction_id(), userInfo.getUser_id() + "", roonGiftModel.getGift_id(), num, "1");
dismiss(); dismiss();
} }
} else { } 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); MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, heart_id);
} }
} else { } else {
roomGiftGiveEvent = new RoomGiftGiveEvent(userId, roomId, pit, num, 0, null, roonGiftModel, heart_id, "");
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, ""); MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, "");
} }
} else { } else {
@@ -522,6 +515,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
} else { } else {
MvpPre.roomGift(roomId, roonGiftModel.getGift_id(), giftNumber, userId, "1", pit, ""); 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) { } else if (currentItem == 0) {
// if (all) { // if (all) {
@@ -565,7 +559,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
giftLabelBean.setId("0"); giftLabelBean.setId("0");
giftLabelBean.setName("背包"); giftLabelBean.setName("背包");
giftLabelBeans.add(0, giftLabelBean); giftLabelBeans.add(0, giftLabelBean);
mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans, fragmentList,roomId)); mBinding.viewPager.setAdapter(new MyFragmentPagerAdapter(getChildFragmentManager(), giftLabelBeans, fragmentList, roomId));
mBinding.viewPager.setOffscreenPageLimit(0); mBinding.viewPager.setOffscreenPageLimit(0);
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager); mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
mBinding.slidingTabLayout.setCurrentTab(1); mBinding.slidingTabLayout.setCurrentTab(1);
@@ -600,6 +594,11 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
@Override @Override
public void roomAuctionJoin(RoomAuction.AuctionListBean auctionListBean) { public void roomAuctionJoin(RoomAuction.AuctionListBean auctionListBean) {
com.blankj.utilcode.util.ToastUtils.showShort("竞拍成功"); com.blankj.utilcode.util.ToastUtils.showShort("竞拍成功");
if (roomGiftGiveEvent != null) {
EventBus.getDefault().post(roomGiftGiveEvent);
roomGiftGiveEvent = null;
dismiss();
}
dismiss(); dismiss();
} }
@@ -614,7 +613,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
private List<Fragment> fragmentList; private List<Fragment> fragmentList;
private String roomId; private String roomId;
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList,String roomId) { public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList, String roomId) {
super(fm); super(fm);
this.list = list; this.list = list;
this.fragmentList = fragmentList; this.fragmentList = fragmentList;

View File

@@ -296,6 +296,7 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
@Override @Override
public void hostUserPit() { public void hostUserPit() {
ToastUtils.showShort("抱麦成功"); ToastUtils.showShort("抱麦成功");
dismiss();
} }
@Override @Override

View File

@@ -18,6 +18,7 @@ import com.blankj.utilcode.util.GsonUtils;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseQuickAdapter;
import com.example.moduleroom.R; import com.example.moduleroom.R;
import com.example.moduleroom.activity.RoomActivity;
import com.example.moduleroom.adapter.RoomSettingAdapter; import com.example.moduleroom.adapter.RoomSettingAdapter;
import com.example.moduleroom.contacts.RoomSettingContacts; import com.example.moduleroom.contacts.RoomSettingContacts;
import com.example.moduleroom.databinding.DialogRoomSettingFragmentBinding; import com.example.moduleroom.databinding.DialogRoomSettingFragmentBinding;
@@ -217,6 +218,11 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
roomId, roomId,
binaryData binaryData
); );
if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).clearData();
}
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomMyDress) { } else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomMyDress) {
TunerDialogFragment.show(roomId, getChildFragmentManager()); TunerDialogFragment.show(roomId, getChildFragmentManager());
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomCompere) {//主持设置 } else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomCompere) {//主持设置
@@ -265,6 +271,9 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
ARouter.getInstance().build(ARouteConstants.CREATED_ROOM).withSerializable("roomInfoResp", roomInfoResp).navigation(); ARouter.getInstance().build(ARouteConstants.CREATED_ROOM).withSerializable("roomInfoResp", roomInfoResp).navigation();
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomReport) { } 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(); 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();
} }
} }
@@ -312,6 +321,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
} else if (roleLevel == 2 || roleLevel == 3) { } else if (roleLevel == 2 || roleLevel == 3) {
if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction || if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl || type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl ||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy ||
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) { || type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
if (onMic) { if (onMic) {

View File

@@ -61,7 +61,7 @@ public class TunerDialogFragment extends BaseMvpDialogFragment<WheatPresenter, R
if (window != null) { if (window != null) {
// 设置固定高度为 500dp // 设置固定高度为 500dp
int screenHeight = getResources().getDisplayMetrics().heightPixels; int screenHeight = getResources().getDisplayMetrics().heightPixels;
int heightInDp = (int) (screenHeight * 0.4f);; int heightInDp = (int) (screenHeight * 0.5f);;
// int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density); // int heightInPx = (int) (heightInDp * getResources().getDisplayMetrics().density);
window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp); window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, heightInDp);

View File

@@ -41,6 +41,7 @@ import com.xscm.moduleutil.bean.room.FriendUserBean;
import com.xscm.moduleutil.bean.room.RoomInfoResp; import com.xscm.moduleutil.bean.room.RoomInfoResp;
import com.xscm.moduleutil.bean.room.RoomPitBean; import com.xscm.moduleutil.bean.room.RoomPitBean;
import com.xscm.moduleutil.color.ThemeableDrawableUtils; import com.xscm.moduleutil.color.ThemeableDrawableUtils;
import com.xscm.moduleutil.dialog.ConfirmDialog;
import com.xscm.moduleutil.utils.ImageUtils; import com.xscm.moduleutil.utils.ImageUtils;
import com.xscm.moduleutil.utils.SpUtil; import com.xscm.moduleutil.utils.SpUtil;
import com.xscm.moduleutil.widget.RoomFriendshipWheatView; import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
@@ -228,6 +229,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
handleUserClick(pitBean); handleUserClick(pitBean);
} else { } else {
if (currentPartType.value == 2 || currentPartType.value == 3){ if (currentPartType.value == 2 || currentPartType.value == 3){
if (pitBean.getPit_number().equals("9") || pitBean.getPit_number().equals("10")){
handleEmptyPitClick(wheatView, pitBean);
}
return; return;
} }
// 麦位空闲,可以申请上麦等操作 // 麦位空闲,可以申请上麦等操作
@@ -263,7 +267,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
if (cheackWether(pitBean.getPit_number())) { if (cheackWether(pitBean.getPit_number())) {
showPopupMenu(wheatView); // v 是点击的按钮视图 showPopupMenu(wheatView); // v 是点击的按钮视图
} else if (pitBean.getPit_number().equals("10")) { } else if (pitBean.getPit_number().equals("10")) {
RoomOnlineDialogFragment.show(roomId, "9", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager()); RoomOnlineDialogFragment.show(roomId, "10", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
} else { } else {
MvpPre.applyPit(roomId, pitBean.getPit_number()); MvpPre.applyPit(roomId, pitBean.getPit_number());
} }
@@ -404,7 +408,8 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
}); });
mBinding.tvJs.setOnClickListener(v -> { mBinding.tvJs.setOnClickListener(v -> {
MvpPre.endFriend(String.valueOf(roomInfoResp.getFriend_info().getFriend_id()), roomId); queren();
}); });
mBinding.tvYs.setOnClickListener(v -> { mBinding.tvYs.setOnClickListener(v -> {
//点击延时按钮 //点击延时按钮
@@ -417,7 +422,21 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
// tvHand.setOnClickListener(v -> updateFriendshipState(FriendshipPartType.HAND)); // tvHand.setOnClickListener(v -> updateFriendshipState(FriendshipPartType.HAND));
} }
private void queren() {
// 创建并显示确认对话框
new ConfirmDialog(getActivity(),
"提示",
"是否要结束当前交友?",
"确认",
"取消",
v -> {
// 点击“确认”按钮时执行删除操作
MvpPre.endFriend(String.valueOf(roomInfoResp.getFriend_info().getFriend_id()), roomId);
},
v -> {
// 点击“取消”按钮时什么都不做
}, false, 0).show();
}
// TODO: 2025/8/21 交友房时间发生延时 // TODO: 2025/8/21 交友房时间发生延时
public void friendTimeDelayWithTime(long end_time) { public void friendTimeDelayWithTime(long end_time) {

View File

@@ -500,6 +500,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
public void handleRoomMessage(RoomMessageEvent message) { public void handleRoomMessage(RoomMessageEvent message) {
LogUtils.e("@@@", "handleRoomMessage: " + message); LogUtils.e("@@@", "handleRoomMessage: " + message);
LogUtils.e("@@@", "handleRoomMessage: roomId" + roomId); LogUtils.e("@@@", "handleRoomMessage: roomId" + roomId);
if (message.getRoomId() == null){
return;
}
if (!message.getRoomId().contains(roomId)) { if (!message.getRoomId().contains(roomId)) {
return; return;
} }
@@ -619,6 +622,14 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
}else if (message.getMsgType()==1056 || message.getMsgType()==1057){ }else if (message.getMsgType()==1056 || message.getMsgType()==1057){
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
return; return;
}else if (message.getMsgType() == 1025){
EventBus.getDefault().post(message);
return;
}else if (message.getMsgType() == 1039){
EventBus.getDefault().post(message);
easeChatAdapter.addData(new EMMessageInfo(message));
scrollToBottomIfNeed();
return;
} }
EventBus.getDefault().post(message); EventBus.getDefault().post(message);
// easeChatAdapter.addData(new EMMessageInfo(message)); // easeChatAdapter.addData(new EMMessageInfo(message));

View File

@@ -109,15 +109,22 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
// roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo"); // roomInfoResp = (RoomInfoResp) getArguments().getSerializable("roomInfo");
// type = getArguments().getInt("type"); // type = getArguments().getInt("type");
} }
///更新数据
public void upRoomInfo(RoomInfoResp roomInfoResp) {
this.roomInfoResp = roomInfoResp;
}
/// 更新数据
public void roomInfoUpdate(RoomInfoResp resp) { public void roomInfoUpdate(RoomInfoResp resp) {
roomInfoResp = resp; roomInfoResp = resp;
if (roomInfoResp.getRoom_info().getLabel_id().equals("1")){ if (roomInfoResp.getRoom_info().getLabel_id().equals("1")) {
type=1; type = 1;
}else if (roomInfoResp.getRoom_info().getLabel_id().equals("2")){ } else if (roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
type=2; type = 2;
} }
initOverlayButtons(); initOverlayButtons();
getTextView();
steView(type);
if (getActivity() instanceof RoomActivity) { if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).setvisibTop(true); ((RoomActivity) getActivity()).setvisibTop(true);
} }
@@ -125,10 +132,10 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
if (roomPitBean.getUser_id() != null && !roomPitBean.getUser_id().isEmpty() && !roomPitBean.getUser_id().equals("0")) { if (roomPitBean.getUser_id() != null && !roomPitBean.getUser_id().isEmpty() && !roomPitBean.getUser_id().equals("0")) {
roomPitBean.setIs_pm(1); roomPitBean.setIs_pm(1);
wheatView.setData(roomPitBean); wheatView.setData(roomPitBean);
if (imActionJs != null)
imActionJs.setVisibility(VISIBLE); imActionJs.setVisibility(VISIBLE);
}else { } else {
RoomPitBean pitBean =new RoomPitBean(); RoomPitBean pitBean = new RoomPitBean();
pitBean.setUser_id(""); pitBean.setUser_id("");
pitBean.setPit_number("9"); pitBean.setPit_number("9");
pitBean.setAvatar(""); pitBean.setAvatar("");
@@ -159,16 +166,21 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
} else { } else {
if (wheatView.pitBean != null) { if (wheatView.pitBean != null) {
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) { if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
imActionJs.setVisibility(VISIBLE); if (imActionJs != null && imActionYs != null) {
imActionYs.setVisibility(VISIBLE); imActionJs.setVisibility(VISIBLE);
imActionYs.setVisibility(VISIBLE);
}
} else { } else {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE);
}
}
} else {
if (imActionJs != null && imActionYs != null) {
imActionJs.setVisibility(INVISIBLE); imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE); imActionYs.setVisibility(INVISIBLE);
} }
} else {
imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE);
} }
mBinding.ivJp.setVisibility(VISIBLE); mBinding.ivJp.setVisibility(VISIBLE);
} }
@@ -199,15 +211,18 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
RoomPitBean roomPitBean2 = wheatView.pitBean; RoomPitBean roomPitBean2 = wheatView.pitBean;
if (roomPitBean2 != null && roomPitBean2.getUser_id() != null && !roomPitBean2.getUser_id().equals("0")) { if (roomPitBean2 != null && roomPitBean2.getUser_id() != null && !roomPitBean2.getUser_id().equals("0")) {
if (roomPitBean2.getUser_id().equals(SpUtil.getUserId() + "")) { if (roomPitBean2.getUser_id().equals(SpUtil.getUserId() + "")) {
imActionJs.setVisibility(VISIBLE); if (imActionJs != null && imActionYs != null) {
imActionYs.setVisibility(VISIBLE); imActionJs.setVisibility(VISIBLE);
imActionYs.setVisibility(VISIBLE);
}
} else { } else {
imActionJs.setVisibility(INVISIBLE); if (imActionJs != null && imActionYs != null) {
imActionYs.setVisibility(INVISIBLE); imActionJs.setVisibility(INVISIBLE);
imActionYs.setVisibility(INVISIBLE);
}
} }
} }
getTextView();
steView(type);
} }
@Override @Override
@@ -215,7 +230,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
return new RoomAuctionPresenterTow(this, getActivity()); return new RoomAuctionPresenterTow(this, getActivity());
} }
///主持上麦 /// 主持上麦
public void initOverlayButtons() { public void initOverlayButtons() {
// if (isButtonsInflated) return; // if (isButtonsInflated) return;
@@ -314,7 +329,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
userInfo.setUser_id(Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getUser_id())); userInfo.setUser_id(Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getUser_id()));
userInfo.setNickname(roomInfoResp.getRoom_auction().getAuction_user().getNickname()); userInfo.setNickname(roomInfoResp.getRoom_auction().getAuction_user().getNickname());
userInfo.setAvatar(roomInfoResp.getRoom_auction().getAuction_user().getAvatar()); userInfo.setAvatar(roomInfoResp.getRoom_auction().getAuction_user().getAvatar());
userInfo.setAuction_id(roomInfoResp.getRoom_auction().getAuction_user().getAuction_id()); userInfo.setAuction_id(roomInfoResp.getRoom_auction().getAuction_user()!= null ? roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() : "");
userInfo.setPit_number("888"); userInfo.setPit_number("888");
if (roomInfoResp.getRoom_info() != null && if (roomInfoResp.getRoom_info() != null &&
@@ -344,8 +359,10 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), 888 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager()); RoomOnlineDialogFragment.show(roomInfoResp.getRoom_info().getRoom_id(), 888 + "", roomInfoResp.getUser_info(), roomInfoResp, getChildFragmentManager());
} }
} else { } else {
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getAuction_id()), getChildFragmentManager()); if (roomInfoResp.getRoom_auction().getAuction_user() != null) {
RoomUserInfoFragment.show(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.getUserId(), wheatView2.pitNumber, getHostUser(), false, 1, Integer.parseInt(roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() != null ? roomInfoResp.getRoom_auction().getAuction_user().getAuction_id() : "0"), getChildFragmentManager());
}
} }
} else if (id == R.id.im_action_js) {//延时 } else if (id == R.id.im_action_js) {//延时
MvpPre.auctionDelay(SpUtil.getauctionId()); MvpPre.auctionDelay(SpUtil.getauctionId());
@@ -834,6 +851,31 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
} }
} }
public void event1003(RoomMessageEvent messageEvent) {
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean(messageEvent));
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
imActionJs.setVisibility(View.VISIBLE);
imActionYs.setVisibility(View.VISIBLE);
} else {
getvjs();
imActionYs.setVisibility(INVISIBLE);
}
}
}
public void event1004(RoomMessageEvent messageEvent) {
if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean2(messageEvent, "9"));
getvjs();
imActionYs.setVisibility(GONE);
} else if (messageEvent.getText().getPit_number().equals("888")) {
wheatView2.setData(getPitBean2(messageEvent, "888"));
}
}
public void event1022(RoomMessageEvent messageEvent) { public void event1022(RoomMessageEvent messageEvent) {
if (messageEvent.getText().getType() == 1) {//拍卖位上麦 if (messageEvent.getText().getType() == 1) {//拍卖位上麦
if (messageEvent.getText().getPit_number().equals("888")) { if (messageEvent.getText().getPit_number().equals("888")) {
@@ -841,6 +883,9 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
getvjs(); getvjs();
imActionYs.setVisibility(GONE); imActionYs.setVisibility(GONE);
} }
if (messageEvent.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
CardRelationshipFragment.show(roomInfoResp.getRoom_info().getRoom_id(), SpUtil.getUserId() + "", type + "", getActivity().getSupportFragmentManager());
}
} else if (messageEvent.getText().getType() == 2) {//拍卖位下麦 } else if (messageEvent.getText().getType() == 2) {//拍卖位下麦
if (messageEvent.getText().getPit_number().equals("9")) { if (messageEvent.getText().getPit_number().equals("9")) {
wheatView.setData(getPitBean2(messageEvent, "9")); wheatView.setData(getPitBean2(messageEvent, "9"));
@@ -850,6 +895,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
yinc(); yinc();
} }
} }
public void event1025(RoomMessageEvent messageEvent) { public void event1025(RoomMessageEvent messageEvent) {
if (messageEvent.getText().getRecipient() != null) {//成功 if (messageEvent.getText().getRecipient() != null) {//成功
CustomCenterDialogFragment.showWithAutoDismiss(messageEvent.getText().getRecipient(), messageEvent.getText().getAuction_user(), getActivity().getSupportFragmentManager()); CustomCenterDialogFragment.showWithAutoDismiss(messageEvent.getText().getRecipient(), messageEvent.getText().getAuction_user(), getActivity().getSupportFragmentManager());
@@ -867,6 +913,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
public void event1021(RoomMessageEvent messageEvent) { public void event1021(RoomMessageEvent messageEvent) {
mBinding.tvPB.setText("0"); mBinding.tvPB.setText("0");
} }
public void event1027(RoomMessageEvent messageEvent) { public void event1027(RoomMessageEvent messageEvent) {
type = messageEvent.getText().getType(); type = messageEvent.getText().getType();
// getTextView(); // getTextView();
@@ -882,9 +929,36 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
} }
public void event1024(RoomMessageEvent messageEvent) {
auctionList = messageEvent.getText().getAuction_list();
gexList();
}
public void event1023(RoomMessageEvent messageEvent) {
mBinding.ivJp.setVisibility(VISIBLE);
if (wheatView.pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
imActionYs.setVisibility(VISIBLE);
imActionJs.setVisibility(VISIBLE);
} else {
getvjs();
imActionYs.setVisibility(GONE);
}
if (messageEvent.getText().getAuction_user().getUser_id().equals(SpUtil.getUserId() + "")) {
mBinding.ivJp.setVisibility(INVISIBLE);
}
roomInfoResp.getRoom_auction().setAuction_user(messageEvent.getText().getAuction_user());
auctionId = messageEvent.getText().getAuction_user().getAuction_id();
SpUtil.setAuctionId(auctionId);
countDownTime(messageEvent.getText().getAuction_user().getDuration());
auctionUserBean = messageEvent.getText().getAuction_user();
gengv();
}
public void event1026(RoomMessageEvent messageEvent) { public void event1026(RoomMessageEvent messageEvent) {
countDownTime(messageEvent.getText().getDuration()); countDownTime(messageEvent.getText().getDuration());
} }
public void event1035(RoomMessageEvent messageEvent) { public void event1035(RoomMessageEvent messageEvent) {
RoomPitBean pitBean = mBinding.roomMakeWheat.pitBean; RoomPitBean pitBean = mBinding.roomMakeWheat.pitBean;
if (pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) { if (pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
@@ -1255,7 +1329,6 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
} }
/// ///
} }

View File

@@ -217,24 +217,6 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
protected void initData() { protected void initData() {
loadSubFragment(); loadSubFragment();
// V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
// @Override
// public void onSuccess(Long aLong) {
// if (aLong == 0) {
// mBinding.ivMessageDot.setVisibility(View.GONE);
// mBinding.ivMessageDot.setText("0");
// } else {
// mBinding.ivMessageDot.setVisibility(View.VISIBLE);
// }
// mBinding.ivMessageDot.setText(String.valueOf(aLong));
// }
//
// @Override
// public void onError(int code, String desc) {
//
// }
// });
// updateChildFragmentViews();
} }
// @Subscribe(threadMode = ThreadMode.MAIN) // @Subscribe(threadMode = ThreadMode.MAIN)
@@ -252,13 +234,16 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
// 定义一个可被外部调用的方法 // 定义一个可被外部调用的方法
public void refreshData(RoomInfoResp resp) { public void refreshData(RoomInfoResp resp) {
// 使用传入的参数刷新界面或逻辑 // 使用传入的参数刷新界面或逻辑
mRoomInfoResp = new RoomInfoResp();
mRoomInfoResp = resp; mRoomInfoResp = resp;
loadSubFragment(); loadSubFragment();
// 更新子Fragment视图 // 更新子Fragment视图
updateChildFragmentViews(); updateChildFragmentViews();
} }
private <T extends Fragment> T findFragmentByTag(Class<T> fragmentClass) {
return (T) getChildFragmentManager().findFragmentByTag(fragmentClass.getSimpleName());
}
public void updateChildFragmentViews() { public void updateChildFragmentViews() {
// 使用弱引用避免内存泄漏 // 使用弱引用避免内存泄漏
@@ -272,29 +257,23 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
String labelId = mRoomInfoResp.getRoom_info().getLabel_id(); String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
if ("7".equals(typeId)) { if ("7".equals(typeId)) {
// 保持 tag 使用一致性 FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) { if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp); friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
} }
} else if ("2".equals(typeId)) {
} else if ("2".equals(typeId)) {//拍卖房 RoomAuctionFragment auctionRoomFragment = findFragmentByTag(RoomAuctionFragment.class);
RoomAuctionFragment auctionRoomFragment = (RoomAuctionFragment) getChildFragmentManager()
.findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
if (auctionRoomFragment != null && auctionRoomFragment.isAdded()) { if (auctionRoomFragment != null && auctionRoomFragment.isAdded()) {
auctionRoomFragment.roomInfoUpdate(mRoomInfoResp); auctionRoomFragment.roomInfoUpdate(mRoomInfoResp);
} }
}else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId)){ } else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId)) {
if ("2".equals(labelId)){ if ("2".equals(labelId)) {
RoomKtvFragment roomKtvFragment = (RoomKtvFragment) getChildFragmentManager() RoomKtvFragment roomKtvFragment = findFragmentByTag(RoomKtvFragment.class);
.findFragmentByTag(RoomKtvFragment.class.getSimpleName());
if (roomKtvFragment != null && roomKtvFragment.isAdded()) { if (roomKtvFragment != null && roomKtvFragment.isAdded()) {
roomKtvFragment.roomInfoUpdate(mRoomInfoResp); roomKtvFragment.roomInfoUpdate(mRoomInfoResp);
} }
}else if ("1".equals(labelId)){ } else if ("1".equals(labelId)) {
SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager() SingSongFragment singSongFragment = findFragmentByTag(SingSongFragment.class);
.findFragmentByTag(SingSongFragment.class.getSimpleName());
if (singSongFragment != null && singSongFragment.isAdded()) { if (singSongFragment != null && singSongFragment.isAdded()) {
singSongFragment.roomInfoUpdate(mRoomInfoResp); singSongFragment.roomInfoUpdate(mRoomInfoResp);
} }
@@ -303,43 +282,15 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
} }
}); });
// // 根据当前房间类型更新对应的子Fragment
// if (mRoomInfoResp != null && mRoomInfoResp.getRoom_info() != null) {
// String typeId = mRoomInfoResp.getRoom_info().getType_id();
// String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
//
// if ("7".equals(typeId)) {
//// if ("1".equals(labelId)) {
//// // 更新SingSongFragment
//// SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager()
//// .findFragmentByTag(SingSongFragment.class.getSimpleName());
//// if (singSongFragment != null) {
//// singSongFragment.updateView(mRoomInfoResp);
//// }
//// } else if ("2".equals(labelId)) {
//// // 更新RoomKtvFragment
//// RoomKtvFragment roomKtvFragment = (RoomKtvFragment) getChildFragmentManager()
//// .findFragmentByTag(RoomKtvFragment.class.getSimpleName());
//// if (roomKtvFragment != null) {
//// roomKtvFragment.updateView(mRoomInfoResp);
//// }
//// }
// FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
// .findFragmentByTag(FriendshipRoomFragment.class.getName());
// if (friendshipRoomFragment != null) {
// friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
// }
// }
// // 其他类型房间的处理...
// }
} }
/// 给子fragment传递参数 /// 给子fragment传递参数
public void updateFriendshipState(int status, int friend_id, long end_time, FriendUserBean friendshipUserBean) { public void updateFriendshipState(int status, int friend_id, long end_time, FriendUserBean friendshipUserBean) {
// 保持 tag 使用一致性 // 保持 tag 使用一致性
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager() FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName()); // FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager()
// .findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) { if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
if (status == FriendshipRoomFragment.FriendshipPartType.WAIT.getValue()) if (status == FriendshipRoomFragment.FriendshipPartType.WAIT.getValue())
friendshipRoomFragment.upDataFriendship(FriendshipRoomFragment.FriendshipPartType.WAIT, friend_id, end_time, friendshipUserBean); friendshipRoomFragment.upDataFriendship(FriendshipRoomFragment.FriendshipPartType.WAIT, friend_id, end_time, friendshipUserBean);
@@ -352,8 +303,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
/// 交友房时间发生延时 /// 交友房时间发生延时
public void friendTimeDelayWithTime(long end_time) { public void friendTimeDelayWithTime(long end_time) {
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager() FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (friendshipRoomFragment != null) if (friendshipRoomFragment != null)
friendshipRoomFragment.friendTimeDelayWithTime(end_time); friendshipRoomFragment.friendTimeDelayWithTime(end_time);
@@ -361,24 +311,21 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
/// 心动值发生变化 /// 心动值发生变化
public void friendHeartNumberDidChanged(List<FriendInfo.HeartList> heartLists) { public void friendHeartNumberDidChanged(List<FriendInfo.HeartList> heartLists) {
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager() FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (friendshipRoomFragment != null) if (friendshipRoomFragment != null)
friendshipRoomFragment.friendHeartNumberDidChanged(heartLists); friendshipRoomFragment.friendHeartNumberDidChanged(heartLists);
} }
/// 交友房麦位发生变化 /// 交友房麦位发生变化
public void friendSeatDidChanged(List<RoomPitBean> pitArr) { public void friendSeatDidChanged(List<RoomPitBean> pitArr) {
FriendshipRoomFragment friendshipRoomFragment = (FriendshipRoomFragment) getChildFragmentManager() FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
.findFragmentByTag(FriendshipRoomFragment.class.getSimpleName());
if (friendshipRoomFragment != null) if (friendshipRoomFragment != null)
friendshipRoomFragment.friendSeatDidChanged(pitArr); friendshipRoomFragment.friendSeatDidChanged(pitArr);
} }
/// 小黑屋修改倒计时 /// 小黑屋修改倒计时
public void upCabinFragment(long time) { public void upCabinFragment(long time) {
RoomCabinFragment roomCabinFragment = (RoomCabinFragment) getChildFragmentManager() RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
.findFragmentByTag(RoomCabinFragment.class.getSimpleName());
if (roomCabinFragment != null) if (roomCabinFragment != null)
roomCabinFragment.upCabinFragment(time); roomCabinFragment.upCabinFragment(time);
} }
@@ -386,35 +333,42 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
private void loadSubFragment() { private void loadSubFragment() {
if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return; if (mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
String typeId = mRoomInfoResp.getRoom_info().getType_id();
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
if (mRoomInfoResp.getRoom_info().getType_id().equals("1")) {//点唱 Fragment newFragment = null;
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) {
replaceNestedFragment(SingSongFragment.newInstance(), R.id.container); if ("1".equals(typeId)) {
} else if (mRoomInfoResp.getRoom_info().getLabel_id().equals("2")) { if ("1".equals(labelId)) {
replaceNestedFragment(RoomKtvFragment.newInstance(), R.id.container); newFragment = SingSongFragment.newInstance();
} else if ("2".equals(labelId)) {
newFragment = RoomKtvFragment.newInstance();
} }
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {//拍卖 } else if ("2".equals(typeId)) {
replaceNestedFragment(RoomAuctionFragment.newInstance(), R.id.container); newFragment = RoomAuctionFragment.newInstance();
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) { } else if ("6".equals(typeId)) {
replaceNestedFragment(RoomCabinFragment.newInstance(mRoomInfoResp), R.id.container); newFragment = RoomCabinFragment.newInstance(mRoomInfoResp);
setviewyc(); setviewyc();
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("3")) {//男神 } else if ("3".equals(typeId)) {
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) { if ("1".equals(labelId)) {
replaceNestedFragment(SingSongFragment.newInstance(), R.id.container); newFragment = SingSongFragment.newInstance();
} else if (mRoomInfoResp.getRoom_info().getLabel_id().equals("2")) { } else if ("2".equals(labelId)) {
replaceNestedFragment(RoomKtvFragment.newInstance(), R.id.container); newFragment = RoomKtvFragment.newInstance();
} }
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("4")) {//女神 } else if ("4".equals(typeId)) {
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) { if ("1".equals(labelId)) {
replaceNestedFragment(SingSongFragment.newInstance(), R.id.container); newFragment = SingSongFragment.newInstance();
// replaceNestedFragment(RoomPkFragment.newInstance(mRoomInfoResp), R.id.container); } else if ("2".equals(labelId)) {
} else if (mRoomInfoResp.getRoom_info().getLabel_id().equals("2")) { newFragment = RoomKtvFragment.newInstance();
replaceNestedFragment(RoomKtvFragment.newInstance(), R.id.container);
} }
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) { } else if ("7".equals(typeId)) {
replaceNestedFragment(FriendshipRoomFragment.newInstance(), R.id.container); newFragment = FriendshipRoomFragment.newInstance();
} }
instView();
if (newFragment != null) {
replaceNestedFragment(newFragment, R.id.container);
}
// instView();
setview(); setview();
if (mRoomInfoResp.getUser_info().getPit_number() != 0) { if (mRoomInfoResp.getUser_info().getPit_number() != 0) {
@@ -460,30 +414,14 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
public void replaceNestedFragment(@NonNull Fragment newFragment, int containerId) { public void replaceNestedFragment(@NonNull Fragment newFragment, int containerId) {
String tag = newFragment.getClass().getSimpleName(); // 使用类名作为 tag String tag = newFragment.getClass().getSimpleName(); // 使用类名作为 tag
//
// FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
//
// // 查找当前容器中的 Fragment可选
// Fragment currentFragment = getChildFragmentManager().findFragmentById(containerId);
//
// if (currentFragment != null) {
// if (tag.equals(currentFragment.getClass().getName())) {
// return; // 跳过相同类型替换
// }
// transaction.remove(currentFragment); // 先移除旧 Fragment
// }
//
// // 添加新 Fragment 并带上 tag
// transaction.add(containerId, newFragment, tag)
// .commitAllowingStateLoss();
FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
// 可选:检查是否已有相同类型的 Fragment // 可选:检查是否已有相同类型的 Fragment
Fragment existing = getChildFragmentManager().findFragmentById(containerId); // Fragment existing = getChildFragmentManager().findFragmentById(containerId);
if (existing != null) { // if (existing != null) {
transaction.remove(existing); // transaction.remove(existing);
} // }
transaction.replace(containerId, newFragment,tag); transaction.replace(containerId, newFragment, tag);
transaction.commitAllowingStateLoss(); transaction.commitAllowingStateLoss();
} }
@@ -497,13 +435,13 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
mRoomInfoResp.getUser_info().setPit_number(0); mRoomInfoResp.getUser_info().setPit_number(0);
} }
if (isMine) { if (isMine) {
instView(); // instView();
} }
if (getActivity() instanceof RoomActivity) { if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).upRoomInfo(mRoomInfoResp); ((RoomActivity) getActivity()).upRoomInfo(mRoomInfoResp);
} }
updateSeatViewExchangedWithPitArray(mRoomInfoResp); // updateSeatViewExchangedWithPitArray(mRoomInfoResp);
} }
public void updateSeatViewExchangedWithPitArray(RoomInfoResp roomInfoResp) { public void updateSeatViewExchangedWithPitArray(RoomInfoResp roomInfoResp) {
@@ -511,6 +449,10 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
updateChildFragmentViews(); updateChildFragmentViews();
} }
public void upRoomInfo(RoomInfoResp roomInfoResp) {
mRoomInfoResp = roomInfoResp;
}
public void setview() {//这里是当进入电影放房的时候,如果是排麦模式,并且不是电影放的时候,就隐藏排麦视图 public void setview() {//这里是当进入电影放房的时候,如果是排麦模式,并且不是电影放的时候,就隐藏排麦视图
if (mRoomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1") && !mRoomInfoResp.getRoom_info().getType_id().equals("6")) { if (mRoomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1") && !mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
// mBinding.clFirstCharge.setVisibility(View.VISIBLE); // mBinding.clFirstCharge.setVisibility(View.VISIBLE);
@@ -593,25 +535,12 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
); );
// mBinding.tvFirst.setText(spannableStringBuilder);
((RoomActivity) getActivity()).tvFirst(spannableStringBuilder); ((RoomActivity) getActivity()).tvFirst(spannableStringBuilder);
((RoomActivity) getActivity()).setRoleType(roleType, pitNumber); ((RoomActivity) getActivity()).setRoleType(roleType, pitNumber);
} }
@Override @Override
protected void initView() { protected void initView() {
// mBinding.ivChat.setOnClickListener(this::onViewClicked);
// mBinding.llInput.setOnClickListener(this::onViewClicked);
// mBinding.rlMisc.setOnClickListener(this::onViewClicked);
// mBinding.rlGift.setOnClickListener(this::onViewClicked);
// mBinding.ivSoundEffects.setOnClickListener(this::onViewClicked);
// mBinding.ivWheatFeeding.setOnClickListener(this::onViewClicked);
// mBinding.clFirstCharge.setOnClickListener(this::onViewClicked);
// mBinding.rlMic.setOnClickListener(this::onViewClicked);
// mBinding.rlSett.setOnClickListener(this::onViewClicked);
// mBinding.rlVoive.setOnClickListener(this::onViewClicked);
// mBinding.rlMore.setOnClickListener(this::onViewClicked);
// mBinding.rlMessage.setOnClickListener(this::onViewClicked);
} }
public void mus() { public void mus() {
@@ -622,163 +551,10 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
} }
} }
private void onViewClicked(View view) {
int id = view.getId();
// if (id == R.id.iv_chat) {
// if (mRoomInfoResp.getUser_info().getIs_mute().equals("1")) {
// ToastUtils.show("您已经被禁言");
// } else {
//
//// mBinding.llInput.setVisibility(View.VISIBLE);
//// mBinding.inputMenu1.bringToFront(); // 强制将该 View 置于最上层
//// mBinding.inputMenu1.show();
// dialogDismiss();
//
// }
// }
// else if (id == R.id.ll_input) {
// mBinding.llInput.setVisibility(View.GONE);
// mBinding.inputMenu1.dismiss();
// }
// else if (id == R.id.rl_misc) {//设置点歌
// if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) {
// queren();
// } else {
// RequestDialogFragment.show(roomId, mRoomInfoResp, 1, getChildFragmentManager());
// }
// } else if (id == R.id.rl_gift) {//礼物
// RoomGiftDialogFragment.show(mRoomInfoResp, null, roomId, 0, "", getChildFragmentManager());
// } else
// if (id == R.id.iv_sound_effects) {
// SoundEffectsDialogFragment.show(roomId, getChildFragmentManager());
// } else if (id == R.id.cl_first_charge) {
// showWheatFeedingDialog(roomId, (mRoomInfoResp.getUser_info().getIs_room_owner() == 1 || mRoomInfoResp.getUser_info().getIs_host() == 1 || mRoomInfoResp.getUser_info().getIs_management() == 1) ? 1 : 2);
// } else
// if (id == R.id.iv_wheat_feeding) {//点击上麦操作
// if (mRoomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1")) {
//// showWheatFeedingDialog(roomId, mRoomInfoResp.getUser_info().getPit_number() == 9 ? 1 : 2);
// if (aBoolean) {
// MvpPre.applyPit(roomId, "");
//// aBoolean = false;
// } else {
// MvpPre.downPit(roomId, "");
//// aBoolean = true;
// }
// } else {
//
// if (aBoolean) {
//// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
// MvpPre.applyPit(roomId, "");
// aBoolean = false;
// } else {
//// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
// MvpPre.downPit(roomId, "");
// aBoolean = true;
// }
// }
// }
// else if (id == R.id.rl_mic) {
// if (mRoomInfoResp.getUser_info().getIs_mute_pit() != null && mRoomInfoResp.getUser_info().getIs_mute_pit().equals("1")) {
// ToastUtils.show("您被禁麦了");
// } else {
// if (isSwith) {
// switchMic(1);
// } else {
// switchMic(2);
// }
// }
// } else if (id == R.id.rl_sett) {//房间设置
// RoomSettingFragment.show(mRoomInfoResp, getChildFragmentManager());
// } else if (id == R.id.rl_voive) {
// if (voive) {
// mBinding.imVoive.setImageResource(com.xscm.moduleutil.R.mipmap.room_voice_g);
// voive = false;
// } else {
// mBinding.imVoive.setImageResource(com.xscm.moduleutil.R.mipmap.room_voice_kg);
// voive = true;
// }
// AgoraManager.getInstance(getActivity()).muteSpeaker(!voive);
// } else if (id == R.id.rl_more) {//点击PK
// RoomPkDialogFragment.newInstance(roomId, SpUtil.getUserId() + "", mRoomInfoResp.getRoom_info().getIs_pk()).show(getChildFragmentManager(), "RoomPkDialogFragment");
// } else if (id == R.id.rl_message) {
// RoomMessageDialogFragment.show(getChildFragmentManager());
//// RoomMessageDialogFragment.newInstance(roomId, SpUtil.getUserId() + "", mRoomInfoResp.getRoom_info().getIs_pk()).show(getChildFragmentManager(), "RoomMessageDialogFragment");
// }
}
private boolean canSend = true; private boolean canSend = true;
private CountDownTimer mCountDownTimer; private CountDownTimer mCountDownTimer;
@SuppressLint("MissingInflatedId")
public void dialogDismiss() {
// // 使用 AlertDialog.Builder
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
LayoutInflater inflater = getLayoutInflater();
View dialogView = inflater.inflate(com.xscm.moduleutil.R.layout.room_message_input_menu, null);
builder.setView(dialogView);
EditText etContent = dialogView.findViewById(com.xscm.moduleutil.R.id.et_content);
Button tvSend = dialogView.findViewById(com.xscm.moduleutil.R.id.tv_send);
// 创建 AlertDialog
final AlertDialog dialog = builder.create();
// 设置对话框在底部显示
Window window = dialog.getWindow();
if (window != null) {
window.setGravity(Gravity.BOTTOM);
window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN | WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
// dialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
// 设置对话框在底部显示
// dialog.getWindow().setGravity(Gravity.BOTTOM);
// 自动弹出键盘
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
tvSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!canSend) {
ToastUtils.show("消息发送较频繁~");
return;
}
String text = etContent.getText().toString();
if (TextUtils.isEmpty(text)) {
ToastUtils.show("请输入评论内容");
return;
}
EventBus.getDefault().post(new RoomInputEvent(text));
etContent.setText("");
countDownTimer();
dialog.dismiss();
}
});
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
etContent.requestFocus();
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(etContent, InputMethodManager.SHOW_IMPLICIT);
}
});
dialog.show();
}
private void countDownTimer() {
releaseCountDownTimer();
mCountDownTimer = new CountDownTimer(3 * 1000L, 1000L) {
@Override
public void onTick(long millisUntilFinished) {
canSend = false;
}
@Override
public void onFinish() {
canSend = true;
}
};
mCountDownTimer.start();
}
private void releaseCountDownTimer() { private void releaseCountDownTimer() {
if (mCountDownTimer != null) { if (mCountDownTimer != null) {
@@ -787,20 +563,6 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
} }
} }
// @Subscribe(threadMode = ThreadMode.MAIN)
// public void roomInfoEvent(RoomWheatEvent messageEvent) {
// if (messageEvent.getRoomId().equals(roomId)) {
// if (messageEvent.isOccupied()) {
// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
// aBoolean = false;
// } else {
// mBinding.ivWheatFeeding.setImageResource(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
// aBoolean = true;
// }
// }
// }
private void queren() { private void queren() {
// 创建并显示确认对话框 // 创建并显示确认对话框
new ConfirmDialog(getActivity(), new ConfirmDialog(getActivity(),
@@ -949,195 +711,50 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
} }
private boolean haveMe = false;
public void getVoiceStatus(RoomAuction.AuctionUserBean auctionUserBean, List<RoomAuction.AuctionListBean> auctionListBeans, String user_id) { public void getVoiceStatus(RoomAuction.AuctionUserBean auctionUserBean, List<RoomAuction.AuctionListBean> auctionListBeans, String user_id) {
if (auctionListBeans != null) { boolean haveMe = false;
for (int i = 0; i < auctionListBeans.size(); i++) {
if (i < 3) {
if (auctionListBeans.get(i).getUser_id().equals(SpUtil.getUserId() + "")) {
haveMe = true;
break;
} if (auctionListBeans != null) {
} for (int i = 0; i < Math.min(auctionListBeans.size(), 3); i++) {
} if (auctionListBeans.get(i).getUser_id().equals(SpUtil.getUserId() + "")) {
if (auctionUserBean != null) {
if (auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {//判断我是不是被拍卖者
haveMe = true; haveMe = true;
break;
} }
} }
if (user_id.equals(SpUtil.getUserId() + "")) {
if (!haveMe && auctionUserBean != null && auctionUserBean.getUser_id().equals(SpUtil.getUserId() + "")) {
haveMe = true; haveMe = true;
} }
if (!haveMe) { if (!haveMe && user_id.equals(SpUtil.getUserId() + "")) {
AgoraManager.getInstance(getContext()).ClientRole(false); haveMe = true;
// mBinding.rlMic.setVisibility(View.GONE); }
((RoomActivity) getActivity()).setrlMic(false);
AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, SpUtil.getUserId() + "");
// switchMic(2);
} else { if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).setrlMic(true); RoomActivity roomActivity = (RoomActivity) getActivity();
// mBinding.rlMic.setVisibility(View.VISIBLE); if (!haveMe) {
if (AgoraManager.getInstance(getContext()).isLocalAudioEnabled()) { AgoraManager.getInstance(getContext()).ClientRole(false);
roomActivity.setrlMic(false);
((RoomActivity) getActivity()).ivMic(com.xscm.moduleutil.R.mipmap.room_microphone); AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, SpUtil.getUserId() + "");
// mBinding.ivMic.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
} else { } else {
((RoomActivity) getActivity()).ivMic(com.xscm.moduleutil.R.mipmap.room_microphone_off); roomActivity.setrlMic(true);
// mBinding.ivMic.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone_off); if (AgoraManager.getInstance(getContext()).isLocalAudioEnabled()) {
roomActivity.ivMic(com.xscm.moduleutil.R.mipmap.room_microphone);
} else {
roomActivity.ivMic(com.xscm.moduleutil.R.mipmap.room_microphone_off);
}
} }
} }
} else { } else {
if (!user_id.equals(SpUtil.getUserId() + "")) { if (!user_id.equals(SpUtil.getUserId() + "") && getActivity() instanceof RoomActivity) {
AgoraManager.getInstance(getContext()).ClientRole(false); AgoraManager.getInstance(getContext()).ClientRole(false);
// mBinding.rlMic.setVisibility(View.GONE);
((RoomActivity) getActivity()).setrlMic(false); ((RoomActivity) getActivity()).setrlMic(false);
AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, SpUtil.getUserId() + ""); AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, SpUtil.getUserId() + "");
} }
} }
haveMe = false;
} }
// public void setRoleType(int roleType, int pit_number) {
// RelativeLayout rl_voive = mBinding.rlVoive;
// RelativeLayout rl_mic = mBinding.rlMic;
// RelativeLayout rl_more = mBinding.rlMore;
// RelativeLayout rl_misc = mBinding.rlMisc;
//
//
// // 默认隐藏所有按钮
// rl_voive.setVisibility(View.GONE);//声音
// rl_more.setVisibility(View.GONE);//PK
// rl_misc.setVisibility(View.GONE); //音乐
// rl_mic.setVisibility(View.GONE); // 麦克风
// //根据角色类型显示按钮
// switch (roleType) {
// case 2: // 主持人
// rl_voive.setVisibility(View.VISIBLE);
// rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
// rl_more.setVisibility((pit_number == 9 && pit_number != -11) ? View.VISIBLE : View.GONE);
// rl_misc.setVisibility(View.VISIBLE);
// break;
//
// case 1: // 房主
// rl_voive.setVisibility(View.VISIBLE);
// rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
// rl_more.setVisibility((pit_number == 9 && pit_number != -11) ? View.VISIBLE : View.GONE);
// rl_misc.setVisibility(View.VISIBLE);
// break;
//
// case 3://麦上用户
// rl_voive.setVisibility(View.VISIBLE);
// rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
// rl_more.setVisibility((pit_number == 9 && pit_number != -11) ? View.VISIBLE : View.GONE);
// rl_misc.setVisibility(View.VISIBLE);
// break;
//
// case 0: // 观众
// rl_voive.setVisibility(View.VISIBLE);
// rl_mic.setVisibility(pit_number != 0 ? View.VISIBLE : View.GONE);
// rl_misc.setVisibility(View.VISIBLE);
// break;
//
// case 5: // 房间管理员
// rl_voive.setVisibility(View.VISIBLE);
// rl_more.setVisibility(View.GONE);//PK
// rl_misc.setVisibility(View.GONE); //音乐
// break;
//
// default:
// break;
// }
//
// if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {
// rl_misc.setVisibility(View.GONE);
// rl_more.setVisibility(View.GONE);
// } else if (roleType != 5) {
// rl_misc.setVisibility(View.VISIBLE);
// if (mRoomInfoResp.getUser_info().getPit_number() == 9) {
// rl_more.setVisibility(View.VISIBLE);
// }
// }
// if ((mRoomInfoResp.getRoom_info().getType_id().equals("1") || mRoomInfoResp.getRoom_info().getType_id().equals("4") || mRoomInfoResp.getRoom_info().getType_id().equals("3")) && mRoomInfoResp.getRoom_info().getLabel_id().equals("2")) {
// rl_more.setVisibility(View.GONE);
// }
// if (mRoomInfoResp.getUser_info().getPit_number() > 0) {
// rl_mic.setVisibility(View.VISIBLE);
// ((RoomActivity) getActivity()).switchMic( 2);
//// switchMic(2);
// } else {
// if (pit_number == 888) {
//
// rl_mic.setVisibility(View.VISIBLE);
// switchMic(2);
// ((RoomActivity) getActivity()).switchMic( 2);
// } else {
// switchMic(2);
// rl_mic.setVisibility(View.GONE);
// }
// }
//
//// if (roleType == 5 ){
//// rl_misc.setVisibility(View.GONE);
//// rl_more.setVisibility(View.GONE);
//// }
//
//// for (int i = 0; i < mRoomInfoResp.getRoom_info().getPit_list().size(); i++) {
//// if (mRoomInfoResp.getRoom_info().getPit_list().get(i).getUser_id().equals(SpUtil.getUserId() + "")) {
//// rl_mic.setVisibility(View.VISIBLE);
//// }
//// }
//
// if (mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
// rl_voive.setVisibility(View.GONE);//声音
// rl_more.setVisibility(View.GONE);//PK
// rl_misc.setVisibility(View.GONE); //音乐
// rl_mic.setVisibility(View.GONE); // 麦克风
// mBinding.rlMessage.setVisibility(View.GONE);
// } else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
// rl_more.setVisibility(View.GONE);//PK
// rl_misc.setVisibility(View.GONE); //音乐
// }
//
//
// }
// /**
// * 设置是否打开麦克风
// *
// * @param type
// */
// // @Override
// public void switchMic(int type) {
//// mRoomInfoResp.getUser_info().setVoice(type);
// if (type == 1) {
// mBinding.ivMic.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone);
// AgoraManager.getInstance(getContext()).setLocalAudioEnabled(true, SpUtil.getUserId() + "");
// isSwith = false;
// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
// AgoraManager.getInstance(getActivity()).ClientRole(true);
// } else {
// mBinding.ivMic.setImageResource(com.xscm.moduleutil.R.mipmap.room_microphone_off);
// AgoraManager.getInstance(getContext()).setLocalAudioEnabled(false, SpUtil.getUserId() + "");
//// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(false);
//// AgoraManager.getInstance(getActivity()).ClientRole( false);
// isSwith = true;
//// AgoraManager.getInstance(getActivity()).muteLocalAudioStream(true);
//// AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false);
// isMute(1);
//
//
// }
// }
public void isMute(int is_mute) { public void isMute(int is_mute) {
RoomMessageEvent.text text = new RoomMessageEvent.text(); RoomMessageEvent.text text = new RoomMessageEvent.text();
text.setIs_mute(is_mute); text.setIs_mute(is_mute);
@@ -1243,6 +860,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
.findFragmentByTag(RoomAuctionFragment.class.getSimpleName()); .findFragmentByTag(RoomAuctionFragment.class.getSimpleName());
if (auctionFragment != null) { if (auctionFragment != null) {
auctionFragment.upRoomInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) { switch (messageEvent.getMsgType()) {
case 1022: case 1022:
auctionFragment.event1022(messageEvent); auctionFragment.event1022(messageEvent);
@@ -1265,6 +883,18 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
case 1027: case 1027:
auctionFragment.event1027(messageEvent); auctionFragment.event1027(messageEvent);
break; break;
case 1023:
auctionFragment.event1023(messageEvent);
break;
case 1024:
auctionFragment.event1024(messageEvent);
break;
case 1004:
auctionFragment.event1004(messageEvent);
break;
case 1003:
auctionFragment.event1003(messageEvent);
break;
default: default:
// 可以添加默认处理或日志记录 // 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType()); LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());
@@ -1307,9 +937,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
// TODO: 2025/8/30 点唱房模式 // TODO: 2025/8/30 点唱房模式
public void SingSongEvent(RoomMessageEvent messageEvent) { public void SingSongEvent(RoomMessageEvent messageEvent) {
SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager() SingSongFragment singSongFragment = (SingSongFragment) getChildFragmentManager()
.findFragmentByTag(SingSongFragment.class.getSimpleName()); .findFragmentByTag(SingSongFragment.class.getSimpleName());
if (singSongFragment != null) { if (singSongFragment != null) {
singSongFragment.upRoonInfo(mRoomInfoResp);
switch (messageEvent.getMsgType()) { switch (messageEvent.getMsgType()) {
case 1037: case 1037:
singSongFragment.event1037(messageEvent); singSongFragment.event1037(messageEvent);
@@ -1338,8 +970,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
case 1033: case 1033:
singSongFragment.event1033(messageEvent); singSongFragment.event1033(messageEvent);
break; break;
case 1035:
singSongFragment.event1035(messageEvent);
break;
case 1021:
singSongFragment.event1021(messageEvent);
default: default:
// 可以添加默认处理或日志记录 // 可以添加默认处理或日志记录
LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType()); LogUtils.w("Unhandled auction message type: " + messageEvent.getMsgType());

View File

@@ -102,7 +102,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
CountDownTimer mCountDownTimer; CountDownTimer mCountDownTimer;
CountDownTimer mCountDownTimersta; CountDownTimer mCountDownTimersta;
private RoomFragment parentFragment; private RoomFragment parentFragment;
List<RoomPitBean> pitList ; List<RoomPitBean> pitList;
public static SingSongFragment newInstance() { public static SingSongFragment newInstance() {
Bundle args = new Bundle(); Bundle args = new Bundle();
SingSongFragment fragment = new SingSongFragment(); SingSongFragment fragment = new SingSongFragment();
@@ -129,14 +130,14 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
private void upDtaView() { private void upDtaView() {
pitList= new ArrayList<>(); pitList = new ArrayList<>();
if (getActivity() instanceof RoomActivity) { if (getActivity() instanceof RoomActivity) {
((RoomActivity) getActivity()).setvisibTop(true); ((RoomActivity) getActivity()).setvisibTop(true);
} }
// 初始化 PopupWindow // 初始化 PopupWindow
initPopupWindow(); initPopupWindow();
isWhether(); isWhether();
parentFragment= (RoomFragment) getParentFragment(); parentFragment = (RoomFragment) getParentFragment();
} }
@@ -277,9 +278,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
return false; return false;
} else { } else {
if (roomInfoResp.getRoom_info().getPit_list().size() > 8) {
if (roomInfoResp.getRoom_info().getPit_list().get(8).getUser_id().equals(SpUtil.getUserId() + "") && !pitNumber.equals("10")) { if (roomInfoResp.getRoom_info().getPit_list().get(8).getUser_id().equals(SpUtil.getUserId() + "") && !pitNumber.equals("10")) {
return true; return true;
}
return false;
} }
return false; return false;
} }
@@ -314,7 +317,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
if (userIds.length() > 0 && roomId != null) { if (userIds.length() > 0 && roomId != null) {
MvpPre.userOnlineStatus(userIds.toString(), roomId); MvpPre.userOnlineStatus(userIds.toString(), roomId);
} else { } else {
updateWheatData(); // updateWheatData();
} }
} }
@@ -368,8 +371,27 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
private void upWheter() {
if (roomInfoResp.getPk_info() == null) {
if (!ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getPit_list()) && roomInfoResp.getRoom_info().getPit_list().size() == 10) {
wheatLayoutSingManager.setWheatData(roomInfoResp.getRoom_info().getPit_list());
}
// initWheatLayout();
} else {
mBinding.flexboxLayout.setVisibility(View.GONE);
mBinding.cl.setVisibility(View.VISIBLE);
MvpPre.postRoomInfo(roomInfoResp.getPk_info().getPk_room_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
}
if (roomInfoResp.getUser_info().getPit_number() != 9) {
mBinding.imMkf.setVisibility(GONE);
} else {
mBinding.imMkf.setVisibility(VISIBLE);
}
tzblChanged();
}
private void isWhether() { private void isWhether() {
if (roomInfoResp==null){ if (roomInfoResp == null) {
mBinding.flexboxLayout.setVisibility(View.VISIBLE); mBinding.flexboxLayout.setVisibility(View.VISIBLE);
mBinding.cl.setVisibility(View.GONE); mBinding.cl.setVisibility(View.GONE);
FlexboxLayout flexboxLayout = mBinding.flexboxLayout; FlexboxLayout flexboxLayout = mBinding.flexboxLayout;
@@ -417,28 +439,28 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
pitList.add(pitBean); pitList.add(pitBean);
} }
wheatLayoutSingManager.setWheatData(pitList); wheatLayoutSingManager.setWheatData(pitList);
}else { } else {
if (roomInfoResp.getPk_info() == null) { // if (roomInfoResp.getPk_info() == null) {
//
//
if (!ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getPit_list()) && roomInfoResp.getRoom_info().getPit_list().size() == 10) { // if (!ObjectUtils.isEmpty(roomInfoResp.getRoom_info().getPit_list()) && roomInfoResp.getRoom_info().getPit_list().size() == 10) {
wheatLayoutSingManager.setWheatData(roomInfoResp.getRoom_info().getPit_list()); // wheatLayoutSingManager.setWheatData(roomInfoResp.getRoom_info().getPit_list());
} // }
// initWheatLayout(); //// initWheatLayout();
} else { // } else {
mBinding.flexboxLayout.setVisibility(View.GONE); // mBinding.flexboxLayout.setVisibility(View.GONE);
mBinding.cl.setVisibility(View.VISIBLE); // mBinding.cl.setVisibility(View.VISIBLE);
MvpPre.postRoomInfo(roomInfoResp.getPk_info().getPk_room_id(), roomInfoResp.getUser_info().getPit_number() + "", 1); // MvpPre.postRoomInfo(roomInfoResp.getPk_info().getPk_room_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
//
} // }
//
if (roomInfoResp.getUser_info().getPit_number() != 9) { // if (roomInfoResp.getUser_info().getPit_number() != 9) {
mBinding.imMkf.setVisibility(GONE); // mBinding.imMkf.setVisibility(GONE);
} else { // } else {
mBinding.imMkf.setVisibility(VISIBLE); // mBinding.imMkf.setVisibility(VISIBLE);
} // }
//
tzblChanged(); // tzblChanged();
} }
mBinding.btSta.setOnClickListener(this::onClick); mBinding.btSta.setOnClickListener(this::onClick);
@@ -539,7 +561,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
public void roomInfoUpdate(RoomInfoResp resp) { public void roomInfoUpdate(RoomInfoResp resp) {
roomInfoResp = resp; roomInfoResp = resp;
roomId = roomInfoResp == null ? "" : roomInfoResp.getRoom_info().getRoom_id(); roomId = roomInfoResp == null ? "" : roomInfoResp.getRoom_info().getRoom_id();
isWhether(); // isWhether();
upWheter();
updateWheatData(); updateWheatData();
} }
@@ -568,7 +591,6 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onSwitchPitEvent(RoomUpPitBean event) { public void onSwitchPitEvent(RoomUpPitBean event) {
if (event.getPit_number() != null && !event.getPit_number().equals("")) { if (event.getPit_number() != null && !event.getPit_number().equals("")) {
@@ -695,9 +717,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
public void userOnlineStatus(List<UserOnlineStatusBean> list) { public void userOnlineStatus(List<UserOnlineStatusBean> list) {
if (list != null) { if (list != null) {
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
if ( roomInfoRespPk==null|| roomInfoRespPk.getPk_info() == null) { if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
wheatLayoutSingManager.updateSingleOnlineWheat(list.get(i)); wheatLayoutSingManager.updateSingleOnlineWheat(list.get(i));
}else{ } else {
wheatLayoutManager1.updateSingleOnlineWheat(list.get(i)); wheatLayoutManager1.updateSingleOnlineWheat(list.get(i));
} }
// EventBus.getDefault().post(list.get(i)); // EventBus.getDefault().post(list.get(i));
@@ -1151,8 +1173,16 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
// //
// } // }
// } // }
///推送的下麦1003
public void event1003(RoomMessageEvent message){ public void event1021(RoomMessageEvent message) {
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
pitBean.setCharm("0");
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
}
}
/// 推送的下麦1003
public void event1003(RoomMessageEvent message) {
boolean b = false; boolean b = false;
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1); RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1);
pitBean.setUser_id(message.getText().getFromUserInfo().getUser_id() + ""); pitBean.setUser_id(message.getText().getFromUserInfo().getUser_id() + "");
@@ -1179,8 +1209,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), true, b); parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), true, b);
} }
} }
///1004
public void event1004(RoomMessageEvent message){ /// 1004
public void event1004(RoomMessageEvent message) {
boolean b = false; boolean b = false;
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1); RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(Integer.parseInt(message.getText().getPit_number()) - 1);
pitBean.setUser_id(""); pitBean.setUser_id("");
@@ -1206,8 +1237,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), false, b); parentFragment.updateWheatStatus(pitBean, Integer.parseInt(message.getText().getPit_number()), false, b);
} }
} }
///1005
public void event1005(RoomMessageEvent message){ /// 1005
public void event1005(RoomMessageEvent message) {
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) { if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) { for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) { if (pitBean.getUser_id().equals(message.getText().getToUserInfo().getUser_id() + "")) {
@@ -1231,8 +1263,9 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
} }
} }
///1030
public void event1030(RoomMessageEvent message){ /// 1030
public void event1030(RoomMessageEvent message) {
MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3); MvpPre.postRoomInfo(message.getRoomId(), roomInfoResp.getUser_info().getPit_number() + "", 3);
if (message.getText().getType() == 1) { if (message.getText().getType() == 1) {
MvpPre.postRoomInfo(message.getText().getRoom_id(), roomInfoResp.getUser_info().getPit_number() + "", 1); MvpPre.postRoomInfo(message.getText().getRoom_id(), roomInfoResp.getUser_info().getPit_number() + "", 1);
@@ -1246,33 +1279,54 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
} }
} }
///1031
public void event1031(RoomMessageEvent message){ /// 1031
public void event1031(RoomMessageEvent message) {
countDownTime(Long.parseLong(message.getText().getPk_end_times()), 1); countDownTime(Long.parseLong(message.getText().getPk_end_times()), 1);
mBinding.btSta.setVisibility(INVISIBLE); mBinding.btSta.setVisibility(INVISIBLE);
} }
///1032
public void event1032(RoomMessageEvent message){ /// 1032
public void event1032(RoomMessageEvent message) {
showCountDownDialog(requireContext(), message); showCountDownDialog(requireContext(), message);
ivitTop(message); ivitTop(message);
} }
///1033
public void event1033(RoomMessageEvent message){ /// 1033
public void event1033(RoomMessageEvent message) {
AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId()); AgoraManager.getInstance(getContext()).leaveChannelEx(roomInfoRespPk.getRoom_info().getRoom_id(), SpUtil.getUserId());
MvpPre.postRoomInfo(roomId, "0", 2); MvpPre.postRoomInfo(roomId, "0", 2);
mBinding.imStart2.setVisibility(GONE); mBinding.imStart2.setVisibility(GONE);
mBinding.imStart.setVisibility(GONE); mBinding.imStart.setVisibility(GONE);
roomInfoRespPk = null; roomInfoRespPk = null;
} }
///1037
public void event1037(RoomMessageEvent message){ /// 1037
public void event1037(RoomMessageEvent message) {
if (message.getText().getPit_number().equals("9") && message.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) { if (message.getText().getPit_number().equals("9") && message.getText().getFromUserInfo().getUser_id() == SpUtil.getUserId()) {
queren(); queren();
} }
} }
///1015 public void upRoonInfo(RoomInfoResp resp) {
public void event1015(RoomMessageEvent message){ this.roomInfoResp = resp;
}
public void event1035(RoomMessageEvent message) {
for (RoomPitBean pitBean : roomInfoResp.getRoom_info().getPit_list()) {
if (pitBean.getUser_id().equals(message.getText().getFromUserInfo().getUser_id() + "")) {
pitBean.setCharm(message.getText().getFromUserInfo().getCharm());
pitBean.setAvatar(message.getText().getFromUserInfo().getAvatar());
pitBean.setNickname(message.getText().getFromUserInfo().getNickname());
pitBean.setSex(message.getText().getFromUserInfo().getSex() + "");
pitBean.setDress(message.getText().getFromUserInfo().getDress());
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
}
}
}
/// 1015
public void event1015(RoomMessageEvent message) {
String roomIdA = message.getText().getRoom_id_a(); String roomIdA = message.getText().getRoom_id_a();
String roomIdB = message.getText().getRoom_id_b(); String roomIdB = message.getText().getRoom_id_b();
String createValueA = message.getText().getCreate_value_a(); String createValueA = message.getText().getCreate_value_a();
@@ -1292,6 +1346,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
} }
} }
private void queren() { private void queren() {
// 创建并显示确认对话框 // 创建并显示确认对话框
new ConfirmDialog(getActivity(), new ConfirmDialog(getActivity(),
@@ -1443,9 +1498,16 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
public void onDestroyView() { public void onDestroyView() {
super.onDestroyView(); super.onDestroyView();
releaseCountDownTimer(); releaseCountDownTimer();
wheatLayoutSingManager.release(); if (wheatLayoutSingManager != null) {
wheatLayoutManager1.clear(); wheatLayoutSingManager.release();
wheatLayoutManager2.clear(); }
if (wheatLayoutManager1 != null) {
wheatLayoutManager1.clear();
}
if (wheatLayoutManager2 != null) {
wheatLayoutManager2.clear();
}
mBinding.flexboxLayout.removeAllViews(); mBinding.flexboxLayout.removeAllViews();
mBinding.flexboxLayout2.removeAllViews(); mBinding.flexboxLayout2.removeAllViews();
} }
@@ -1454,9 +1516,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
releaseCountDownTimer(); releaseCountDownTimer();
wheatLayoutSingManager.release(); if (wheatLayoutSingManager != null) {
wheatLayoutManager1.clear(); wheatLayoutSingManager.release();
wheatLayoutManager2.clear(); }
if (wheatLayoutManager1 != null) {
wheatLayoutManager1.clear();
}
if (wheatLayoutManager2 != null) {
wheatLayoutManager2.clear();
}
mBinding.flexboxLayout.removeAllViews(); mBinding.flexboxLayout.removeAllViews();
mBinding.flexboxLayout2.removeAllViews(); mBinding.flexboxLayout2.removeAllViews();
} }

View File

@@ -10,6 +10,7 @@ import com.xscm.moduleutil.bean.room.RoomInfoResp;
import com.xscm.moduleutil.bean.room.RoomOnline; import com.xscm.moduleutil.bean.room.RoomOnline;
import com.xscm.moduleutil.http.APIException; import com.xscm.moduleutil.http.APIException;
import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.listener.MessageListenerSingleton; import com.xscm.moduleutil.listener.MessageListenerSingleton;
import com.xscm.moduleutil.presenter.BasePresenter; import com.xscm.moduleutil.presenter.BasePresenter;
import com.xscm.moduleutil.rtc.AgoraManager; import com.xscm.moduleutil.rtc.AgoraManager;
@@ -147,6 +148,9 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
@Override @Override
public void applySong(String roomId) { public void applySong(String roomId) {
if (api== null){
api = RetrofitClient.getInstance();
}
api.applySong(roomId, new BaseObserver<String>() { api.applySong(roomId, new BaseObserver<String>() {
@Override @Override
@@ -166,6 +170,9 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
@Override @Override
public void agreeSong(String roomId, String type) { public void agreeSong(String roomId, String type) {
if (api== null){
api = RetrofitClient.getInstance();
}
api.agreeSong(roomId, type, new BaseObserver<String>() { api.agreeSong(roomId, type, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View File

@@ -5,6 +5,7 @@ import android.content.Context;
import com.example.moduleroom.contacts.RoomSettingContacts; import com.example.moduleroom.contacts.RoomSettingContacts;
import com.xscm.moduleutil.bean.room.RoomSettingBean; import com.xscm.moduleutil.bean.room.RoomSettingBean;
import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.presenter.BasePresenter; import com.xscm.moduleutil.presenter.BasePresenter;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@@ -20,6 +21,9 @@ public class RoomSettingPresenter extends BasePresenter<RoomSettingContacts.View
@Override @Override
public void changeRoom(String roomId, String userId, int position, RoomSettingBean bean) { public void changeRoom(String roomId, String userId, int position, RoomSettingBean bean) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.changeRoom(roomId, userId, new BaseObserver<String>() { api.changeRoom(roomId, userId, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -48,6 +52,9 @@ public class RoomSettingPresenter extends BasePresenter<RoomSettingContacts.View
@Override @Override
public void changeRoomType(String roomId, String type) { public void changeRoomType(String roomId, String type) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.changeRoomType(roomId, type, new BaseObserver<String>() { api.changeRoomType(roomId, type, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {

View File

@@ -6,6 +6,7 @@ import com.example.moduleroom.contacts.RoomUserContacts;
import com.xscm.moduleutil.bean.RelationCardBean; import com.xscm.moduleutil.bean.RelationCardBean;
import com.xscm.moduleutil.bean.UserInfo; import com.xscm.moduleutil.bean.UserInfo;
import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.http.RetrofitClient;
import com.xscm.moduleutil.presenter.BasePresenter; import com.xscm.moduleutil.presenter.BasePresenter;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
@@ -22,6 +23,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void getRoomUserInfo(String roomId, String userId) { public void getRoomUserInfo(String roomId, String userId) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.getRoomUserInfo(roomId, userId, new BaseObserver<UserInfo>() { api.getRoomUserInfo(roomId, userId, new BaseObserver<UserInfo>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -30,6 +34,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(UserInfo userInfo) { public void onNext(UserInfo userInfo) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().getRoomUserInfo(userInfo); MvpRef.get().getRoomUserInfo(userInfo);
} }
}); });
@@ -37,6 +44,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void downPit(String roomId, String pitNumber) { public void downPit(String roomId, String pitNumber) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.downPit(roomId, pitNumber, new BaseObserver<String>() { api.downPit(roomId, pitNumber, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -45,6 +55,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String string) { public void onNext(String string) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().downPit(); MvpRef.get().downPit();
} }
}); });
@@ -52,6 +65,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void hostUserPit(String roomId, String pitNumber, String userId, String type) { public void hostUserPit(String roomId, String pitNumber, String userId, String type) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.hostUserPit(roomId, pitNumber, userId, type, new BaseObserver<String>() { api.hostUserPit(roomId, pitNumber, userId, type, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -60,6 +76,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String string) { public void onNext(String string) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().hostUserPit(); MvpRef.get().hostUserPit();
} }
}); });
@@ -67,6 +86,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void giveCoin(String user_id, String coin) { public void giveCoin(String user_id, String coin) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.giveCoin(user_id, coin, new BaseObserver<String>() { api.giveCoin(user_id, coin, new BaseObserver<String>() {
@Override @Override
@@ -76,6 +98,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().giveCoin(); MvpRef.get().giveCoin();
} }
}); });
@@ -83,6 +108,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void relationCard(String user_id) { public void relationCard(String user_id) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.relationCard(user_id, new BaseObserver<RelationCardBean>() { api.relationCard(user_id, new BaseObserver<RelationCardBean>() {
@Override @Override
@@ -102,6 +130,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void topRelationCard(String id) { public void topRelationCard(String id) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.topRelationCard(id, new BaseObserver<String>() { api.topRelationCard(id, new BaseObserver<String>() {
@Override @Override
@@ -111,6 +142,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().topRelationCard(s); MvpRef.get().topRelationCard(s);
} }
}); });
@@ -118,6 +152,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void deleteRelationCard(String id) { public void deleteRelationCard(String id) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.deleteRelationCard(id, new BaseObserver<String>() { api.deleteRelationCard(id, new BaseObserver<String>() {
@Override @Override
@@ -137,6 +174,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void kickOutRoom(String roomId, String userId) { public void kickOutRoom(String roomId, String userId) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.kickOutRoom(roomId, userId, new BaseObserver<String>() { api.kickOutRoom(roomId, userId, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -145,6 +185,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String string) { public void onNext(String string) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().kickOutRoom(); MvpRef.get().kickOutRoom();
} }
}); });
@@ -152,6 +195,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void postHostAdd(String roomId, String userId, String type, String is_add) { public void postHostAdd(String roomId, String userId, String type, String is_add) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.postHostAdd(roomId, userId, type, is_add, new BaseObserver<String>() { api.postHostAdd(roomId, userId, type, is_add, new BaseObserver<String>() {
@@ -162,6 +208,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().postHostAdd(s, type, is_add); MvpRef.get().postHostAdd(s, type, is_add);
} }
@@ -170,6 +219,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void setMutePit(String roomId, String user_id, String is_mute) { public void setMutePit(String roomId, String user_id, String is_mute) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.setMutePit(roomId, user_id, is_mute, new BaseObserver<String>() { api.setMutePit(roomId, user_id, is_mute, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -178,6 +230,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String string) { public void onNext(String string) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().setMutePit(user_id, is_mute); MvpRef.get().setMutePit(user_id, is_mute);
} }
}); });
@@ -185,6 +240,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void addBlackList(String userId) { public void addBlackList(String userId) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.addBlackList(userId, new BaseObserver<String>() { api.addBlackList(userId, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -193,6 +251,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String string) { public void onNext(String string) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().addBlackList(); MvpRef.get().addBlackList();
} }
}); });
@@ -200,6 +261,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void userGuanz(String userId, String type) { public void userGuanz(String userId, String type) {
if (api==null){
api= RetrofitClient.getInstance();
}
api.userGuanz(userId, type, new BaseObserver<String>() { api.userGuanz(userId, type, new BaseObserver<String>() {
@Override @Override
public void onSubscribe(Disposable d) { public void onSubscribe(Disposable d) {
@@ -208,6 +272,9 @@ public class RoomUserPresenter extends BasePresenter<RoomUserContacts.View> impl
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef == null) {
MvpRef = new WeakReference<>(mView);
}
MvpRef.get().userGuanzSuccess(s); MvpRef.get().userGuanzSuccess(s);
} }
}); });

View File

@@ -7,11 +7,17 @@ import com.xscm.moduleutil.bean.room.RoomApplyListBean;
import com.xscm.moduleutil.http.BaseObserver; import com.xscm.moduleutil.http.BaseObserver;
import com.xscm.moduleutil.presenter.BasePresenter; import com.xscm.moduleutil.presenter.BasePresenter;
import java.lang.ref.WeakReference;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
public class WheatPresenter extends BasePresenter<WheatContacts.View> implements WheatContacts.IRoomPre { public class WheatPresenter extends BasePresenter<WheatContacts.View> implements WheatContacts.IRoomPre {
private WheatContacts.View mView;
public WheatPresenter(WheatContacts.View view, Context context) { public WheatPresenter(WheatContacts.View view, Context context) {
super(view, context); super(view, context);
this.mView = view;
} }
@Override @Override
@@ -25,6 +31,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(RoomApplyListBean roomApplyListBeans) { public void onNext(RoomApplyListBean roomApplyListBeans) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().roomApplyListBean(roomApplyListBeans); MvpRef.get().roomApplyListBean(roomApplyListBeans);
} }
}); });
@@ -40,6 +49,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().clearApply(); MvpRef.get().clearApply();
} }
}); });
@@ -55,6 +67,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().agreePit(); MvpRef.get().agreePit();
} }
}); });
@@ -70,6 +85,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().agreePit(); MvpRef.get().agreePit();
} }
}); });
@@ -85,6 +103,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().agreePit(); MvpRef.get().agreePit();
} }
}); });
@@ -100,6 +121,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().applyPit(); MvpRef.get().applyPit();
} }
}); });
@@ -116,6 +140,9 @@ public class WheatPresenter extends BasePresenter<WheatContacts.View> implements
@Override @Override
public void onNext(String s) { public void onNext(String s) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().giveGift(); MvpRef.get().giveGift();
} }
}); });

View File

@@ -66,7 +66,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21" android:layout_height="@dimen/dp_21"
android:text="知道了" android:text="知道了"
android:textColor="@color/color_FF333333" android:textColor="@color/white"
android:textSize="@dimen/sp_14" /> android:textSize="@dimen/sp_14" />
<TextView <TextView
@@ -75,6 +75,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:text="3" android:text="3"
android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp" />
</LinearLayout> </LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -228,7 +228,7 @@
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="12sp" android:textSize="12sp"
android:visibility="gone" android:visibility="gone"
app:layout_constraintStart_toEndOf="@+id/tv_ys" app:layout_constraintEnd_toStartOf="@+id/wheat_view5"
app:layout_constraintTop_toTopOf="@+id/tv_ys" app:layout_constraintTop_toTopOf="@+id/tv_ys"
app:layout_constraintBottom_toBottomOf="@+id/tv_ys" app:layout_constraintBottom_toBottomOf="@+id/tv_ys"
tools:visibility="visible" /> tools:visibility="visible" />
@@ -261,7 +261,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintStart_toEndOf="@+id/wheat_view2" app:layout_constraintStart_toEndOf="@+id/wheat_view2"
app:layout_constraintTop_toBottomOf="@+id/wheat_view2" app:layout_constraintTop_toBottomOf="@+id/wheat_view2"
android:layout_marginTop="-20dp" android:layout_marginTop="-10dp"
app:room_make_pic="@mipmap/jiaoy" app:room_make_pic="@mipmap/jiaoy"
app:room_make_wheat_number="3" /> app:room_make_wheat_number="3" />

View File

@@ -16,7 +16,7 @@
<FrameLayout <FrameLayout
android:id="@+id/container" android:id="@+id/container"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="match_parent"
android:clipChildren="false" android:clipChildren="false"
android:clipToPadding="false" android:clipToPadding="false"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"

View File

@@ -133,7 +133,7 @@
android:layout_marginTop="@dimen/dp_15" android:layout_marginTop="@dimen/dp_15"
android:background="@mipmap/za_s" android:background="@mipmap/za_s"
android:gravity="center" android:gravity="center"
android:text="0000" android:text="0"
android:textColor="#FFE8B0" android:textColor="#FFE8B0"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
@@ -491,14 +491,15 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<!-- <ViewStub--> <ViewStub
<!-- android:id="@+id/stub_buttons"--> android:id="@+id/stub_buttons"
<!-- android:layout_width="wrap_content"--> android:layout_width="wrap_content"
<!-- android:layout_height="wrap_content"--> android:layout_height="wrap_content"
<!-- android:layout="@layout/top_overlay_buttons"--> android:layout="@layout/top_overlay_buttons"
<!-- app:layout_constraintEnd_toEndOf="parent"--> app:layout_constraintEnd_toEndOf="parent"
<!-- app:layout_constraintTop_toTopOf="parent"--> app:layout_constraintTop_toTopOf="parent"
<!-- android:visibility="gone"/>--> android:layout_marginTop="-30dp"
android:visibility="gone"/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -6,155 +6,151 @@
<data> <data>
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/bg_room_gift" android:background="@drawable/bg_room_gift"
android:paddingTop="@dimen/dp_16"
android:paddingStart="@dimen/dp_16" android:paddingStart="@dimen/dp_16"
> android:paddingTop="@dimen/dp_16">
<TextView <TextView
android:id="@+id/tv_1" android:id="@+id/tv_1"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:text="优先通道(1/20)" android:text="优先通道(1/20)"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_16" android:textSize="@dimen/sp_16"
/> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.xscm.moduleutil.widget.GifAvatarOvalView <com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/im_1" android:id="@+id/im_1"
android:layout_width="@dimen/dp_24" android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24" android:layout_height="@dimen/dp_24"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toStartOf="@+id/tv_2"
android:src="@mipmap/default_avatar" android:src="@mipmap/default_avatar"
/> app:layout_constraintEnd_toStartOf="@+id/tv_2"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/tv_2" android:id="@+id/tv_2"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_19" android:layout_height="@dimen/dp_19"
app:layout_constraintEnd_toStartOf="@+id/tv_3"
android:layout_marginStart="@dimen/dp_2" android:layout_marginStart="@dimen/dp_2"
app:layout_constraintTop_toTopOf="parent"
android:text="赠送***礼物插队" android:text="赠送***礼物插队"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
/> app:layout_constraintEnd_toStartOf="@+id/tv_3"
app:layout_constraintTop_toTopOf="parent" />
<TextView <TextView
android:id="@+id/tv_3" android:id="@+id/tv_3"
android:layout_width="@dimen/dp_44" android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_24" android:layout_height="@dimen/dp_24"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_16" android:layout_marginEnd="@dimen/dp_16"
app:layout_constraintTop_toTopOf="parent"
android:text="赠送"
android:gravity="center" android:gravity="center"
android:text="赠送"
android:textColor="@color/color_FF333333" android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
/> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_view" android:id="@+id/recycle_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_114" android:layout_height="@dimen/dp_114"
app:layout_constraintTop_toBottomOf="@+id/tv_1" android:layout_marginTop="@dimen/dp_6"
android:layout_marginEnd="@dimen/dp_16" android:layout_marginEnd="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_6"/> app:layout_constraintTop_toBottomOf="@+id/tv_1" />
<TextView <TextView
android:id="@+id/tv_4" android:id="@+id/tv_4"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@+id/recycle_view"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_30" android:layout_marginTop="@dimen/dp_30"
android:text="等待上台(1/20)" android:text="等待上台(1/20)"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="@dimen/sp_16" android:textSize="@dimen/sp_16"
/> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/recycle_view" />
<TextView <TextView
android:id="@+id/tv_qk" android:id="@+id/tv_qk"
android:layout_width="@dimen/dp_44" android:layout_width="@dimen/dp_44"
android:layout_height="@dimen/dp_24" android:layout_height="@dimen/dp_24"
app:layout_constraintStart_toEndOf="@+id/tv_4"
app:layout_constraintTop_toTopOf="@+id/tv_4"
android:background="@drawable/bg_r65_all_0dffb9"
android:layout_marginStart="@dimen/dp_10" android:layout_marginStart="@dimen/dp_10"
android:text="清空" android:background="@drawable/bg_r65_all_0dffb9"
android:gravity="center" android:gravity="center"
android:text="清空"
android:textColor="@color/color_FF333333" android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_12" android:textSize="@dimen/sp_12"
/> app:layout_constraintStart_toEndOf="@+id/tv_4"
app:layout_constraintTop_toTopOf="@+id/tv_4" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_view2" android:id="@+id/recycle_view2"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_114" android:layout_height="@dimen/dp_114"
app:layout_constraintTop_toBottomOf="@+id/tv_4"
android:layout_marginTop="@dimen/dp_6" android:layout_marginTop="@dimen/dp_6"
android:layout_marginEnd="@dimen/dp_16" android:layout_marginEnd="@dimen/dp_16"
/> app:layout_constraintTop_toBottomOf="@+id/tv_4" />
<TextView <!-- 按钮容器 -->
android:id="@+id/tv_wheat_refuse" <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/dp_95" android:id="@+id/button_container"
android:layout_height="@dimen/dp_42" android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent" android:layout_marginTop="@dimen/dp_16"
android:background="@mipmap/wheat_refuse" android:layout_marginBottom="@dimen/dp_14"
android:layout_marginBottom="@dimen/dp_44" app:layout_constraintBottom_toBottomOf="parent">
android:layout_marginStart="@dimen/dp_16"/>
<TextView <TextView
android:id="@+id/tv_wheat_accept" android:id="@+id/tv_wheat_refuse"
android:layout_width="@dimen/dp_95" android:layout_width="@dimen/dp_95"
android:layout_height="@dimen/dp_42" android:layout_height="@dimen/dp_42"
app:layout_constraintBottom_toBottomOf="parent" android:background="@mipmap/wheat_refuse"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent"
android:layout_marginEnd="@dimen/dp_16" app:layout_constraintTop_toTopOf="parent" />
android:background="@drawable/bg_r53_0dffb9"
android:text="同意"
android:textSize="@dimen/sp_14"
android:gravity="center"
android:textColor="@color/color_FF333333"
android:layout_marginBottom="@dimen/dp_44"
/>
<TextView <TextView
android:id="@+id/tv_wheat_sq" android:id="@+id/tv_wheat_accept"
android:layout_width="@dimen/dp_95" android:layout_width="@dimen/dp_95"
android:layout_height="@dimen/dp_42" android:layout_height="@dimen/dp_42"
app:layout_constraintBottom_toBottomOf="parent" android:background="@drawable/bg_r53_0dffb9"
app:layout_constraintEnd_toEndOf="parent" android:gravity="center"
android:background="@drawable/bg_r53_33333" android:text="同意"
android:text="申请" android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
android:gravity="center" android:layout_marginEnd="@dimen/dp_20"
android:textColor="@color/white" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="@dimen/dp_44" app:layout_constraintTop_toTopOf="parent" />
android:layout_marginEnd="@dimen/dp_16"
android:visibility="gone"/>
<TextView <TextView
android:id="@+id/tv_ljsq" android:id="@+id/tv_wheat_sq"
android:layout_width="@dimen/dp_300" android:layout_width="@dimen/dp_95"
android:layout_height="@dimen/dp_42" android:layout_height="@dimen/dp_42"
app:layout_constraintBottom_toBottomOf="parent" android:background="@drawable/bg_r53_33333"
app:layout_constraintStart_toStartOf="parent" android:gravity="center"
android:background="@drawable/bg_r53_0dffb9" android:text="申请"
android:text="立即申请" android:textColor="@color/white"
android:textSize="@dimen/sp_14" android:textSize="@dimen/sp_14"
android:gravity="center" android:visibility="gone"
android:textColor="@color/color_FF333333" app:layout_constraintEnd_toEndOf="parent"
android:layout_marginBottom="@dimen/dp_44" app:layout_constraintTop_toTopOf="parent" />
android:layout_marginStart="@dimen/dp_16"
android:visibility="gone"/>
<TextView
android:id="@+id/tv_ljsq"
android:layout_width="@dimen/dp_300"
android:layout_height="@dimen/dp_42"
android:background="@drawable/bg_r53_0dffb9"
android:gravity="center"
android:text="立即申请"
android:textColor="@color/color_FF333333"
android:textSize="@dimen/sp_14"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@@ -15,9 +15,9 @@
<com.xscm.moduleutil.widget.GifAvatarOvalView <com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/image" android:id="@+id/image"
android:layout_width="46dp" android:layout_width="@dimen/dp_50"
android:layout_height="46dp" android:layout_height="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_40" android:layout_marginStart="@dimen/dp_28"
android:src="@mipmap/default_avatar" android:src="@mipmap/default_avatar"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@@ -33,46 +33,55 @@
android:gravity="center" android:gravity="center"
android:text="昵称" android:text="昵称"
android:textColor="@color/color_FF333333" android:textColor="@color/color_FF333333"
android:textSize="16sp" android:textSize="@dimen/sp_12"
app:layout_constraintEnd_toEndOf="@+id/image" app:layout_constraintEnd_toEndOf="@+id/image"
app:layout_constraintStart_toStartOf="@+id/image" app:layout_constraintStart_toStartOf="@+id/image"
app:layout_constraintTop_toBottomOf="@+id/image" /> app:layout_constraintTop_toBottomOf="@+id/image" />
<FrameLayout <!-- <FrameLayout-->
android:layout_width="@dimen/dp_150" <!-- android:layout_width="match_parent"-->
android:layout_height="wrap_content" <!-- android:layout_height="wrap_content"-->
android:layout_marginStart="@dimen/dp_40" <!-- app:layout_constraintBottom_toBottomOf="@+id/tv_name1"-->
app:layout_constraintBottom_toBottomOf="@+id/tv_name1" <!-- app:layout_constraintEnd_toStartOf="@+id/image2"-->
app:layout_constraintEnd_toStartOf="@+id/image2" <!-- app:layout_constraintStart_toEndOf="@+id/image"-->
app:layout_constraintStart_toStartOf="@+id/image" <!-- app:layout_constraintTop_toTopOf="@+id/image">-->
app:layout_constraintTop_toTopOf="@+id/image">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_60" android:layout_height="wrap_content"
android:scaleType="fitXY" android:scaleType="fitCenter"
android:src="@mipmap/kagx" /> android:src="@mipmap/kagx"
app:layout_constraintBottom_toBottomOf="@+id/image"
app:layout_constraintEnd_toStartOf="@+id/image2"
app:layout_constraintStart_toEndOf="@+id/image"
app:layout_constraintTop_toTopOf="@+id/image"/>
<TextView <TextView
android:id="@+id/tv_zhi" android:id="@+id/tv_zhi"
android:layout_width="@dimen/dp_65" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_12" android:layout_height="@dimen/dp_12"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_4" android:layout_marginStart="@dimen/dp_4"
android:background="@drawable/bg_r40_fe8ec8" android:background="@drawable/bg_r40_fe8ec8"
android:gravity="center" android:gravity="center"
android:text="关系" android:paddingStart="@dimen/dp_5"
android:paddingEnd="@dimen/dp_5"
tools:text="关系"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="10sp" /> android:textSize="10sp"
app:layout_constraintBottom_toBottomOf="@+id/image"
app:layout_constraintEnd_toStartOf="@+id/image2"
app:layout_constraintStart_toEndOf="@+id/image"
app:layout_constraintTop_toTopOf="@+id/image"/>
</FrameLayout> <!-- </FrameLayout>-->
<com.xscm.moduleutil.widget.GifAvatarOvalView <com.xscm.moduleutil.widget.GifAvatarOvalView
android:id="@+id/image2" android:id="@+id/image2"
android:layout_width="46dp" android:layout_width="@dimen/dp_50"
android:layout_height="46dp" android:layout_height="@dimen/dp_50"
android:layout_marginEnd="@dimen/dp_70" android:layout_marginEnd="@dimen/dp_28"
android:src="@mipmap/default_avatar" android:src="@mipmap/default_avatar"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
@@ -88,7 +97,7 @@
android:gravity="center" android:gravity="center"
android:text="昵称" android:text="昵称"
android:textColor="@color/color_FF333333" android:textColor="@color/color_FF333333"
android:textSize="16sp" android:textSize="@dimen/sp_12"
app:layout_constraintEnd_toEndOf="@+id/image2" app:layout_constraintEnd_toEndOf="@+id/image2"
app:layout_constraintStart_toStartOf="@+id/image2" app:layout_constraintStart_toStartOf="@+id/image2"
app:layout_constraintTop_toBottomOf="@+id/image2" /> app:layout_constraintTop_toBottomOf="@+id/image2" />
@@ -100,8 +109,9 @@
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="@dimen/dp_10"
android:text="关系列表" android:text="关系列表"
android:textColor="@color/color_FF333333" android:textColor="@color/color_FF333333"
android:textStyle="bold"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintStart_toStartOf="@+id/tv_name1" app:layout_constraintStart_toStartOf="@+id/image"
app:layout_constraintTop_toBottomOf="@+id/tv_name1" /> app:layout_constraintTop_toBottomOf="@+id/tv_name1" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
@@ -118,34 +128,35 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_10" android:layout_marginBottom="@dimen/dp_10"
android:orientation="horizontal" android:orientation="horizontal"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_list"> >
<Button <!-- <Button-->
android:id="@+id/btn_cancel" <!-- android:id="@+id/btn_cancel"-->
android:layout_width="0dp" <!-- android:layout_width="0dp"-->
android:layout_height="@dimen/dp_30" <!-- android:layout_height="@dimen/dp_30"-->
android:layout_marginStart="@dimen/dp_10" <!-- android:layout_marginStart="@dimen/dp_10"-->
android:layout_weight="1" <!-- android:layout_weight="1"-->
android:background="@drawable/bg_r45_0000" <!-- android:background="@drawable/bg_r45_0000"-->
android:text="取消" <!-- android:text="取消"-->
android:textColor="@color/color_FFFFF0F0" <!-- android:textColor="@color/color_FFFFF0F0"-->
android:textSize="12sp" /> <!-- android:textSize="12sp"-->
<!-- android:visibility="gone"/>-->
<View <!-- <View-->
android:layout_width="@dimen/dp_0" <!-- android:layout_width="@dimen/dp_0"-->
android:layout_height="match_parent" <!-- android:layout_height="match_parent"-->
android:layout_weight="1" /> <!-- android:layout_weight="1"-->
<!-- android:visibility="gone"/>-->
<Button <Button
android:id="@+id/btn_action" android:id="@+id/btn_action"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_30" android:layout_height="@dimen/dp_30"
android:layout_marginStart="@dimen/dp_10" android:layout_marginStart="@dimen/dp_10"
android:layout_marginEnd="@dimen/dp_40"
android:layout_weight="1"
android:background="@drawable/cs" android:background="@drawable/cs"
android:text="确认" android:text="确认"
android:textColor="@color/white" android:textColor="@color/white"

View File

@@ -18,144 +18,147 @@
android:paddingBottom="@dimen/dp_20"> android:paddingBottom="@dimen/dp_20">
<RelativeLayout
android:id="@+id/rl_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView <RelativeLayout
android:id="@+id/tv_title" android:id="@+id/rl_title"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentStart="true"
android:text="调音台"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_14"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_8"
android:layout_toLeftOf="@+id/sw_monitoring"
android:text="耳返"
android:textColor="@color/color_FFFFF0F0"
android:textSize="@dimen/sp_12" />
<Switch
android:id="@+id/sw_monitoring"
android:layout_width="@dimen/dp_37"
android:layout_height="@dimen/dp_20"
android:layout_alignParentEnd="true"
android:background="@drawable/room_tuner_selector_switch"
android:thumb="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintVertical_bias="0.005" app:layout_constraintTop_toTopOf="parent">
tools:ignore="UseSwitchCompatOrMaterialXml" />
</RelativeLayout>
<TextView
android:id="@+id/tv_seekbar_value"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21"
android:text="人声40%"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_14"
android:layout_marginTop="@dimen/dp_20"
app:layout_constraintStart_toStartOf="@+id/rl_title"
app:layout_constraintTop_toBottomOf="@+id/rl_title"
android:textAlignment="center"/>
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintTop_toBottomOf="@+id/tv_seekbar_value"
app:layout_constraintStart_toStartOf="@id/tv_seekbar_value"
app:layout_constraintEnd_toEndOf="@+id/rl_title"
android:max="100"
android:secondaryProgressTint="@color/colorAccent"
android:maxHeight="@dimen/dp_15"
android:minHeight="@dimen/dp_15"
android:splitTrack="false"
android:progressDrawable="@drawable/picture_layer_progress"
android:thumb="@drawable/picture_sb_thumb"/>
<TextView <TextView
android:id="@+id/tv_seekbar_value2" android:id="@+id/tv_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21" android:layout_height="wrap_content"
android:text="伴奏40%" android:layout_alignParentStart="true"
android:textColor="#FFFFFF" android:layout_centerInParent="true"
android:textSize="@dimen/sp_14" android:text="调音台"
android:layout_marginTop="@dimen/dp_20" android:textColor="@color/color_FFFFF0F0"
app:layout_constraintStart_toStartOf="@+id/seekBar1" android:textSize="@dimen/sp_14"
app:layout_constraintTop_toBottomOf="@+id/seekBar1" android:textStyle="bold" />
android:textAlignment="center"/>
<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:layout_constraintTop_toBottomOf="@+id/tv_seekbar_value2"
app:layout_constraintStart_toStartOf="@+id/tv_seekbar_value2"
app:layout_constraintEnd_toEndOf="@+id/rl_title"
android:max="100"
android:splitTrack="false"
android:secondaryProgressTint="@color/colorAccent"
android:maxHeight="@dimen/dp_15"
android:minHeight="@dimen/dp_15"
android:progressDrawable="@drawable/picture_layer_progress"
android:thumb="@drawable/picture_sb_thumb"/>
<TextView <TextView
android:id="@+id/tv_hunxiang" android:layout_width="wrap_content"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_height="@dimen/dp_21" android:layout_centerVertical="true"
android:text="混响" android:layout_marginRight="@dimen/dp_8"
android:textColor="#FFFFFF" android:layout_toLeftOf="@+id/sw_monitoring"
android:textSize="@dimen/sp_14" android:text="耳返"
android:layout_marginTop="@dimen/dp_20" android:textColor="@color/color_FFFFF0F0"
app:layout_constraintStart_toStartOf="@+id/seekBar2" android:textSize="@dimen/sp_12" />
app:layout_constraintTop_toBottomOf="@+id/seekBar2"
android:textAlignment="center"/>
<androidx.recyclerview.widget.RecyclerView <Switch
android:id="@+id/rv_effect_style_list" android:id="@+id/sw_monitoring"
android:layout_width="match_parent" android:layout_width="@dimen/dp_37"
android:layout_height="wrap_content" android:layout_height="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_10" android:layout_alignParentEnd="true"
app:layout_constraintTop_toBottomOf="@+id/tv_hunxiang" android:background="@drawable/room_tuner_selector_switch"
tools:listitem="@layout/room_rv_item_tuner" /> android:thumb="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.005"
tools:ignore="UseSwitchCompatOrMaterialXml" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/tv_biansheng" android:id="@+id/tv_seekbar_value"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21" android:layout_height="@dimen/dp_21"
android:text="变声" android:layout_marginTop="@dimen/dp_20"
android:textColor="#FFFFFF" android:text="人声40%"
android:textSize="@dimen/sp_14" android:textAlignment="center"
android:layout_marginTop="@dimen/dp_20" android:textColor="#FFFFFF"
app:layout_constraintStart_toStartOf="@+id/rv_effect_style_list" android:textSize="@dimen/sp_14"
app:layout_constraintTop_toBottomOf="@+id/rv_effect_style_list" app:layout_constraintStart_toStartOf="@+id/rl_title"
android:textAlignment="center" app:layout_constraintTop_toBottomOf="@+id/rl_title" />
android:visibility="gone"/>
<androidx.recyclerview.widget.RecyclerView <SeekBar
android:id="@+id/rv_effect_style_list2" android:id="@+id/seekBar1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10" android:layout_marginTop="10dp"
app:layout_constraintTop_toBottomOf="@+id/tv_biansheng" android:max="100"
tools:listitem="@layout/room_rv_item_tuner" android:maxHeight="@dimen/dp_15"
android:visibility="gone"/> android:minHeight="@dimen/dp_15"
android:progressDrawable="@drawable/picture_layer_progress"
android:secondaryProgressTint="@color/colorAccent"
android:splitTrack="false"
android:thumb="@drawable/picture_sb_thumb"
app:layout_constraintEnd_toEndOf="@+id/rl_title"
app:layout_constraintStart_toStartOf="@id/tv_seekbar_value"
app:layout_constraintTop_toBottomOf="@+id/tv_seekbar_value" />
<TextView
android:id="@+id/tv_seekbar_value2"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_20"
android:text="伴奏40%"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_14"
app:layout_constraintStart_toStartOf="@+id/seekBar1"
app:layout_constraintTop_toBottomOf="@+id/seekBar1" />
<SeekBar
android:id="@+id/seekBar2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:max="100"
android:maxHeight="@dimen/dp_15"
android:minHeight="@dimen/dp_15"
android:progressDrawable="@drawable/picture_layer_progress"
android:secondaryProgressTint="@color/colorAccent"
android:splitTrack="false"
android:thumb="@drawable/picture_sb_thumb"
app:layout_constraintEnd_toEndOf="@+id/rl_title"
app:layout_constraintStart_toStartOf="@+id/tv_seekbar_value2"
app:layout_constraintTop_toBottomOf="@+id/tv_seekbar_value2" />
<TextView
android:id="@+id/tv_hunxiang"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_20"
android:text="混响"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_14"
app:layout_constraintStart_toStartOf="@+id/seekBar2"
app:layout_constraintTop_toBottomOf="@+id/seekBar2" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_effect_style_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
app:layout_constraintTop_toBottomOf="@+id/tv_hunxiang"
tools:listitem="@layout/room_rv_item_tuner" />
<TextView
android:id="@+id/tv_biansheng"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_21"
android:layout_marginTop="@dimen/dp_20"
android:text="变声"
android:textAlignment="center"
android:textColor="#FFFFFF"
android:textSize="@dimen/sp_14"
android:visibility="gone"
app:layout_constraintStart_toStartOf="@+id/rv_effect_style_list"
app:layout_constraintTop_toBottomOf="@+id/rv_effect_style_list" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_effect_style_list2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:visibility="gone"
app:layout_constraintTop_toBottomOf="@+id/tv_biansheng"
tools:listitem="@layout/room_rv_item_tuner" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</layout> </layout>

View File

@@ -157,7 +157,7 @@
<RelativeLayout <RelativeLayout
android:id="@+id/btn_notice" android:id="@+id/btn_notice"
android:layout_width="@dimen/dp_55" android:layout_width="@dimen/dp_65"
android:layout_height="@dimen/dp_22" android:layout_height="@dimen/dp_22"
android:layout_alignTop="@id/btn_ranking" android:layout_alignTop="@id/btn_ranking"
android:layout_marginStart="@dimen/dp_12" android:layout_marginStart="@dimen/dp_12"

View File

@@ -8,6 +8,7 @@ import android.graphics.Color;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -256,25 +257,30 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
dialog.setContentView(com.xscm.moduleutil.R.layout.bottom_sheet_recyclerview); dialog.setContentView(com.xscm.moduleutil.R.layout.bottom_sheet_recyclerview);
RecyclerView recyclerView = dialog.findViewById(com.xscm.moduleutil.R.id.rv_options); RecyclerView recyclerView = dialog.findViewById(com.xscm.moduleutil.R.id.rv_options);
Button btnCancel = dialog.findViewById(com.xscm.moduleutil.R.id.btn_cancel); View btnCancel = dialog.findViewById(com.xscm.moduleutil.R.id.btn_cancel);
Button btnConfirm = dialog.findViewById(com.xscm.moduleutil.R.id.btn_confirm); View btnConfirm = dialog.findViewById(com.xscm.moduleutil.R.id.btn_confirm);
TextView tvTitle = dialog.findViewById(com.xscm.moduleutil.R.id.tv_title);
tvTitle.setText("选择相册");
assert recyclerView != null; assert recyclerView != null;
recyclerView.setLayoutManager(new GridLayoutManager(this,4)); recyclerView.setLayoutManager(new GridLayoutManager(this,4));
SingleChoiceAdapter sadapter = new SingleChoiceAdapter(); SingleChoiceAdapter sadapter = new SingleChoiceAdapter();
recyclerView.setAdapter(sadapter); recyclerView.setAdapter(sadapter);
sadapter.setNewData(data); sadapter.setNewData(data);
btnCancel.setOnClickListener(v -> dialog.dismiss()); // 添加空值检查以提高代码健壮性
if (btnCancel != null) {
btnCancel.setOnClickListener(v -> dialog.dismiss());
}
if (btnConfirm != null) {
btnConfirm.setOnClickListener(v -> {
AlbumBean selectedItem = sadapter.getSelectedItem();
btnConfirm.setOnClickListener(v -> { if (selectedItem != null) {
AlbumBean selectedItem = sadapter.getSelectedItem(); MvpPre.moveAlbum(adapter.getSelectedPhotoIdsAsString(), selectedItem.getId());
}
if (selectedItem != null) { dialog.dismiss();
MvpPre.moveAlbum(adapter.getSelectedPhotoIdsAsString(), selectedItem.getId()); });
}
dialog.dismiss();
});
}
dialog.show(); dialog.show();
} }
@@ -317,7 +323,11 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
private void updateZanButtonUI(AlbumBean albumBean) { private void updateZanButtonUI(AlbumBean albumBean) {
if (albumBean.getIs_like().equals("0")) { if (albumBean.getIs_like().equals("0")) {
mBinding.zanImage.setImageResource(com.xscm.moduleutil.R.mipmap.shousz); // 已点赞图标 mBinding.zanImage.setImageResource(com.xscm.moduleutil.R.mipmap.shousz); // 已点赞图标
mBinding.dyComment.setText(Integer.parseInt(albumBean.getLike_num()) - 1 + ""); if (Integer.parseInt(albumBean.getLike_num())==0){
mBinding.dyComment.setText("0");
}else {
mBinding.dyComment.setText(Integer.parseInt(albumBean.getLike_num()) - 1 + "");
}
} else { } else {
mBinding.zanImage.setImageResource(com.xscm.moduleutil.R.mipmap.showszc); // 未点赞图标 mBinding.zanImage.setImageResource(com.xscm.moduleutil.R.mipmap.showszc); // 未点赞图标
mBinding.dyComment.setText(Integer.parseInt(albumBean.getLike_num()) + 1 + ""); mBinding.dyComment.setText(Integer.parseInt(albumBean.getLike_num()) + 1 + "");

View File

@@ -89,6 +89,10 @@ public class WithdrawalActivity extends BaseMvpActivity<WithdrawalPresenter, Act
ToastUtils.show("请选择提现方式"); ToastUtils.show("请选择提现方式");
return; return;
} }
if (mBinding.etCustomAmount.getText().toString().equals("0")|| mBinding.etCustomAmount.getText().toString().equals("") || mBinding.etCustomAmount.getText().toString().isEmpty()){
ToastUtils.show("提现金额不能为0");
return;
}
showSecondaryVerificationDialog(); showSecondaryVerificationDialog();
}); });

View File

@@ -65,7 +65,8 @@ public class UserGiftWallFragment extends BaseMvpFragment<UserGiftWallPresenter,
rows = 6; rows = 6;
columns = 4; columns = 4;
} }
rows = 6;
columns = 4;
mUserGiftWallAdapter = new UserGiftWallAdapter(); mUserGiftWallAdapter = new UserGiftWallAdapter();
PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL); PagerGridLayoutManager layoutManager = new PagerGridLayoutManager(rows, columns, PagerGridLayoutManager.VERTICAL);
mBinding.recyclerView.setLayoutManager(layoutManager); mBinding.recyclerView.setLayoutManager(layoutManager);

View File

@@ -10,13 +10,16 @@ import com.xscm.moduleutil.presenter.BasePresenter;
import com.xscm.moduleutil.utils.oss.OSSOperUtils; import com.xscm.moduleutil.utils.oss.OSSOperUtils;
import java.io.File; import java.io.File;
import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
public class AlbumDetailPresenter extends BasePresenter<AlbumDetailConacts.View> implements AlbumDetailConacts.IMePre { public class AlbumDetailPresenter extends BasePresenter<AlbumDetailConacts.View> implements AlbumDetailConacts.IMePre {
private AlbumDetailConacts.View mView;
public AlbumDetailPresenter(AlbumDetailConacts.View view, Context context) { public AlbumDetailPresenter(AlbumDetailConacts.View view, Context context) {
super(view, context); super(view, context);
this.mView = view;
} }
@Override @Override
@@ -89,6 +92,9 @@ public class AlbumDetailPresenter extends BasePresenter<AlbumDetailConacts.View>
@Override @Override
public void onNext(List<AlbumBean> albumBeans) { public void onNext(List<AlbumBean> albumBeans) {
if (MvpRef==null){
MvpRef=new WeakReference<>(mView);
}
MvpRef.get().getAlbumList(albumBeans); MvpRef.get().getAlbumList(albumBeans);
} }
}); });

View File

@@ -10,23 +10,24 @@
</data> </data>
<androidx.constraintlayout.widget.ConstraintLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:orientation="vertical">
<com.xscm.moduleutil.widget.CustomTopBar <com.xscm.moduleutil.widget.CustomTopBar
android:id="@+id/top_bar" android:id="@+id/top_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" /> />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycle_view" android:id="@+id/recycle_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="match_parent"
app:layout_constraintTop_toBottomOf="@id/top_bar"
android:layout_marginTop="@dimen/dp_12" android:layout_marginTop="@dimen/dp_12"
/> />
</androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>
</layout> </layout>

View File

@@ -37,9 +37,11 @@ import com.xscm.moduleutil.event.RoomGiftRunable;
import com.xscm.moduleutil.utils.ARouteConstants; import com.xscm.moduleutil.utils.ARouteConstants;
import com.xscm.moduleutil.utils.ImageUtils; import com.xscm.moduleutil.utils.ImageUtils;
import com.stx.xhb.xbanner.XBanner; import com.stx.xhb.xbanner.XBanner;
import com.xscm.moduleutil.utils.logger.DataLogger;
import com.zhpan.bannerview.constants.PageStyle; import com.zhpan.bannerview.constants.PageStyle;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Logger;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@@ -194,37 +196,33 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
} }
@Subscribe(threadMode = ThreadMode.MAIN) // @Subscribe(threadMode = ThreadMode.MAIN)
public void onEvent(MqttBean event) { // public void onEvent(MqttBean event) {
if (event!=null) { //
// List<MqttBean> cachedMqttBeans = RoomGiftRunable.getMqttCache();
List<MqttBean> cachedMqttBeans = RoomGiftRunable.getMqttCache(); // if (cachedMqttBeans == null || cachedMqttBeans.isEmpty()) {
if (cachedMqttBeans == null || cachedMqttBeans.isEmpty()) { // mBinding.rl.setVisibility(GONE);
mBinding.rl.setVisibility(GONE); // } else {
} else { // mBinding.rl.setVisibility(View.VISIBLE);
mBinding.rl.setVisibility(View.VISIBLE); // }
} // if (mqttList == null) {
if (mqttList == null) { // mqttList = new ArrayList<>();
mqttList = new ArrayList<>(); // info = new ArrayList<>();
info = new ArrayList<>(); // }
} // mqttList.clear();
mqttList.clear(); // info.clear();
info.clear(); // // 处理缓存数据
// 处理缓存数据 // for (MqttBean mqttBean : cachedMqttBeans) {
for (MqttBean mqttBean : cachedMqttBeans) { // // 处理每一条 mqttBean 数据
// 处理每一条 mqttBean 数据 // mqttList.add(mqttBean.getList());
mqttList.add(mqttBean.getList()); // info.add(mqttBean.getList().getFromUserName() + "送给" + mqttBean.getList().getToUserName() + "\n" + mqttBean.getList().getGiftName());
info.add(mqttBean.getList().getFromUserName() + "送给" + mqttBean.getList().getToUserName() + "\n" + mqttBean.getList().getGiftName()); // }
} //
// mBinding.marqueeView.startWithList(info);
mBinding.marqueeView.startWithList(info); // }
}else {
mBinding.rl.setVisibility(View.GONE);
}
}
public void onEvent1() { public void onEvent1() {
try {
List<MqttBean> cachedMqttBeans = RoomGiftRunable.getMqttCache(); List<MqttBean> cachedMqttBeans = RoomGiftRunable.getMqttCache();
if (cachedMqttBeans == null || cachedMqttBeans.isEmpty()) { if (cachedMqttBeans == null || cachedMqttBeans.isEmpty()) {
mBinding.rl.setVisibility(GONE); mBinding.rl.setVisibility(GONE);
@@ -245,6 +243,10 @@ public class VoiceCategoryFragment extends BaseMvpFragment<VoiceCategoryPresente
} }
mBinding.marqueeView.startWithList(info); mBinding.marqueeView.startWithList(info);
}catch (Exception e){
DataLogger.LogUtil.d("onEvent1");
}
} }
// //

View File

@@ -112,18 +112,17 @@
<com.google.android.material.tabs.TabLayout <com.google.android.material.tabs.TabLayout
android:id="@+id/sliding_tab_layout" android:id="@+id/sliding_tab_layout"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="@dimen/dp_30" android:layout_height="@dimen/dp_30"
android:layout_marginLeft="@dimen/dp_16" android:layout_marginLeft="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_12" android:layout_marginTop="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_16" android:layout_marginRight="@dimen/dp_16"
app:tabIndicatorHeight="0dp" app:tabIndicatorHeight="0dp"
app:tabSelectedTextColor="@color/white" app:tabSelectedTextColor="@color/white"
app:tabTextColor="#F1ECFF" app:tabTextColor="#F1ECFF"
app:tabTextAppearance="@style/CustomTabTextAppearance" app:tabTextAppearance="@style/CustomTabTextAppearance"
app:tabIndicatorFullWidth="true" app:tabIndicatorFullWidth="true"
app:tabMode="fixed"/> app:tabMode="scrollable"/>
<!-- app:tl_indicator_corner_radius="@dimen/dp_3"--> <!-- app:tl_indicator_corner_radius="@dimen/dp_3"-->
<!-- app:tl_indicator_drawable="@mipmap/tab_dy"--> <!-- app:tl_indicator_drawable="@mipmap/tab_dy"-->
<!-- app:tl_indicator_height="@dimen/dp_6"--> <!-- app:tl_indicator_height="@dimen/dp_6"-->