1:修改BUG
@@ -55,7 +55,7 @@ android {
|
|||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled true
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ android {
|
|||||||
|
|
||||||
debug {
|
debug {
|
||||||
debuggable true
|
debuggable true
|
||||||
minifyEnabled true
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
|
|
||||||
|
|||||||
@@ -5,12 +5,15 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.PersistableBundle;
|
import android.os.PersistableBundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
import com.xscm.modulelogin.activity.ImproveInfoActivity;
|
||||||
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
import com.xscm.moduleutil.activity.BaseAppCompatActivity;
|
||||||
|
import com.xscm.moduleutil.base.AppStateListener;
|
||||||
|
import com.xscm.moduleutil.base.AppStateManager;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
import com.xscm.moduleutil.dialog.PolicyDialog;
|
import com.xscm.moduleutil.dialog.PolicyDialog;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
@@ -20,23 +23,36 @@ import com.xscm.midi.databinding.ActivityLaunchPageBinding;
|
|||||||
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
|
public class LaunchPageActivity extends BaseAppCompatActivity<ActivityLaunchPageBinding> {
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
private PolicyDialog policyDialog;
|
private PolicyDialog policyDialog;
|
||||||
|
private AppStateListener appStateListener;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
|
||||||
super.onCreate(savedInstanceState, persistentState);
|
super.onCreate(savedInstanceState, persistentState);
|
||||||
|
|
||||||
|
// 获取Application实例并设置监听器
|
||||||
|
CommonAppContext app = (CommonAppContext) getApplication();
|
||||||
|
appStateListener = AppStateManager.getInstance();
|
||||||
|
app.setAppStateListener(appStateListener);
|
||||||
|
|
||||||
if (!isTaskRoot()) {
|
if (!isTaskRoot()) {
|
||||||
// if (shouldRestoreRoom()){
|
|
||||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) {
|
if (SpUtil.getUnderagePassword() != null && !SpUtil.getUnderagePassword().isEmpty()) {
|
||||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/feedback/teenage?id=" + SpUtil.getToken())
|
||||||
.withString("type","1").navigation();//type==1:青少年模式
|
.withString("type", "1").navigation();//type==1:青少年模式
|
||||||
|
} else {
|
||||||
|
// 如果没有设置青少年模式,应该导航到首页
|
||||||
|
try {
|
||||||
|
ARouter.getInstance().build(ARouteConstants.ME).navigation();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e("LaunchPageActivity", "导航到首页失败", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
finish();
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// if (shouldRestoreRoom()) {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.0 KiB |
@@ -94,7 +94,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:src="@drawable/screen"
|
android:src="@mipmap/screen"
|
||||||
android:scaleType="centerCrop"
|
android:scaleType="centerCrop"
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
|
|||||||
BIN
app/src/main/res/mipmap-xhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 228 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 549 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/screen.png
Normal file
|
After Width: | Height: | Size: 1.0 MiB |
@@ -20,7 +20,7 @@
|
|||||||
<style name="AppTheme.NoActionBar">
|
<style name="AppTheme.NoActionBar">
|
||||||
<item name="windowActionBar">false</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="android:windowBackground">@drawable/screen</item>
|
<item name="android:windowBackground">@mipmap/screen</item>
|
||||||
</style>
|
</style>
|
||||||
<!-- 在 styles.xml 中添加透明主题 -->
|
<!-- 在 styles.xml 中添加透明主题 -->
|
||||||
<style name="TransparentTheme" parent="AppTheme">
|
<style name="TransparentTheme" parent="AppTheme">
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ isBuildModule=false
|
|||||||
#org.gradle.deamon=false
|
#org.gradle.deamon=false
|
||||||
android.injected.testOnly=false
|
android.injected.testOnly=false
|
||||||
|
|
||||||
APP_VERSION_NAME=1.0.2
|
APP_VERSION_NAME=1.0.3
|
||||||
APP_VERSION_CODE=148
|
APP_VERSION_CODE=152
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public class ImproveInfoActivity extends BaseMvpActivity<ImproveInfoPresenter, A
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(1)
|
.setMaxSelectNum(1)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
.forResult(requestCode); //结果回调onActivityResult code
|
.forResult(requestCode); //结果回调onActivityResult code
|
||||||
|
|||||||
@@ -4,25 +4,25 @@ import static androidx.core.content.ContextCompat.getSystemService;
|
|||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.PixelFormat;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.util.DisplayMetrics;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.animation.AccelerateInterpolator;
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.animation.DecelerateInterpolator;
|
import android.view.animation.DecelerateInterpolator;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
@@ -44,15 +44,14 @@ import com.hjq.toast.ToastUtils;
|
|||||||
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
||||||
import com.xscm.moduleutil.R;
|
import com.xscm.moduleutil.R;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.XLHBean;
|
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.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.BackgroundManager;
|
import com.xscm.moduleutil.utils.BackgroundManager;
|
||||||
import com.xscm.moduleutil.utils.ColorManager;
|
import com.xscm.moduleutil.utils.ColorManager;
|
||||||
import com.xscm.moduleutil.utils.DialogUtils;
|
|
||||||
import com.xscm.moduleutil.utils.DisplayUtil;
|
import com.xscm.moduleutil.utils.DisplayUtil;
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
import com.xscm.moduleutil.utils.LanguageUtil;
|
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -67,10 +66,6 @@ import java.util.Map;
|
|||||||
public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends AppCompatActivity
|
public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends AppCompatActivity
|
||||||
implements BackgroundManager.BackgroundUpdateListener, ColorManager.ColorChangeListener {
|
implements BackgroundManager.BackgroundUpdateListener, ColorManager.ColorChangeListener {
|
||||||
|
|
||||||
// @Override
|
|
||||||
// protected void attachBaseContext(Context newBase) {
|
|
||||||
// super.attachBaseContext(LanguageUtil.attachBaseContext(newBase));
|
|
||||||
// }
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context newBase) {
|
protected void attachBaseContext(Context newBase) {
|
||||||
// 设置字体缩放比例为1.0f,即不跟随系统字体大小变化
|
// 设置字体缩放比例为1.0f,即不跟随系统字体大小变化
|
||||||
@@ -398,11 +393,6 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在类中添加以下成员变量
|
|
||||||
private final List<MqttBean> messageQueue = new ArrayList<>(); // 消息队列
|
|
||||||
private boolean isPlaying = false; // 播放状态标志
|
|
||||||
private boolean isPlaying2 = false; // 播放状态标志
|
|
||||||
private final Object queueLock = new Object(); // 队列同步锁
|
|
||||||
|
|
||||||
/// 礼物特效
|
/// 礼物特效
|
||||||
// 在类中添加以下成员变量
|
// 在类中添加以下成员变量
|
||||||
@@ -420,14 +410,17 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
public void onMessageReceived(MqttBean mqttBean) {
|
public void onMessageReceived(MqttBean mqttBean) {
|
||||||
LogUtils.e("收到MQTT", mqttBean);
|
LogUtils.e("收到MQTT", mqttBean);
|
||||||
if (mqttBean == null) return;
|
if (mqttBean == null) return;
|
||||||
|
if (SpUtil.getFloatingScreen() == 1) {
|
||||||
|
synchronized (mqttQueueLock) {
|
||||||
|
|
||||||
synchronized (mqttQueueLock) {
|
mqttMessageQueue.addAll(mqttBean.getList());
|
||||||
|
if (!isMqttPlaying) {
|
||||||
mqttMessageQueue.addAll(mqttBean.getList());
|
isMqttPlaying = true;
|
||||||
if (!isMqttPlaying) {
|
processNextMqttMessage();
|
||||||
isMqttPlaying = true;
|
}
|
||||||
processNextMqttMessage();
|
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
mqttMessageQueue.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,13 +429,16 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
public void onEvent(XLHBean event) {
|
public void onEvent(XLHBean event) {
|
||||||
LogUtils.e("收到XLH", event);
|
LogUtils.e("收到XLH", event);
|
||||||
if (event == null) return;
|
if (event == null) return;
|
||||||
|
if (SpUtil.getFloatingScreen() == 1) {
|
||||||
synchronized (xlhQueueLock) {
|
synchronized (xlhQueueLock) {
|
||||||
xlhMessageQueue.add(event);
|
xlhMessageQueue.add(event);
|
||||||
if (!isXlhPlaying) {
|
if (!isXlhPlaying) {
|
||||||
isXlhPlaying = true;
|
isXlhPlaying = true;
|
||||||
processNextXlhMessage();
|
processNextXlhMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
xlhMessageQueue.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,11 +562,15 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetAndStartMqttAnimation(View view, Runnable onAnimationEnd) {
|
private void resetAndStartMqttAnimation(View view, Runnable onAnimationEnd) {
|
||||||
try {
|
try {
|
||||||
view.setTranslationX(view.getWidth());
|
int screenWidth = getScreenWidth();
|
||||||
|
// 设置初始位置:在屏幕右侧外部(完全不可见)
|
||||||
|
view.setTranslationX(screenWidth);
|
||||||
|
|
||||||
|
|
||||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
|
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
|
||||||
|
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", getScreenWidth(), (getScreenWidth() - view.getMeasuredWidth()) / 2f);
|
||||||
animator1.setDuration(1500);
|
animator1.setDuration(1500);
|
||||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
|
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||||
animator1.start();
|
animator1.start();
|
||||||
@@ -578,6 +578,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
view.postDelayed(() -> {
|
view.postDelayed(() -> {
|
||||||
try {
|
try {
|
||||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
|
ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
|
||||||
|
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", (getScreenWidth() - view.getMeasuredWidth()) / 2f, -view.getMeasuredWidth());
|
||||||
animator2.setDuration(1500);
|
animator2.setDuration(1500);
|
||||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
|
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||||
animator2.addListener(new AnimatorListenerAdapter() {
|
animator2.addListener(new AnimatorListenerAdapter() {
|
||||||
@@ -602,7 +603,15 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
onAnimationEnd.run();
|
onAnimationEnd.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 添加获取屏幕宽度的方法
|
||||||
|
private int getScreenWidth() {
|
||||||
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||||
|
if (getWindowManager() != null) {
|
||||||
|
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||||
|
return displayMetrics.widthPixels;
|
||||||
|
}
|
||||||
|
return getResources().getDisplayMetrics().widthPixels;
|
||||||
|
}
|
||||||
private void resetAndStartXlhAnimation(View view, Runnable onAnimationEnd) {
|
private void resetAndStartXlhAnimation(View view, Runnable onAnimationEnd) {
|
||||||
try {
|
try {
|
||||||
view.setTranslationX(view.getWidth());
|
view.setTranslationX(view.getWidth());
|
||||||
@@ -680,8 +689,9 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
|||||||
private void handleItemClick(XLHBean xlhBean) {
|
private void handleItemClick(XLHBean xlhBean) {
|
||||||
// 这里可以根据实际需求实现跳转逻辑
|
// 这里可以根据实际需求实现跳转逻辑
|
||||||
// 例如:跳转到礼物详情页面、用户主页等
|
// 例如:跳转到礼物详情页面、用户主页等
|
||||||
|
// 使用缓存数据进入房间
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), xlhBean.getRoom_id(), "");
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", xlhBean.getRoom_id()).navigation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.Manifest;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.core.app.ActivityCompat;
|
import androidx.core.app.ActivityCompat;
|
||||||
@@ -11,9 +12,18 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.databinding.ViewDataBinding;
|
import androidx.databinding.ViewDataBinding;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMConversationListener;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMConversationManager;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMSDKListener;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||||
|
import com.tencent.qcloud.tuicore.TUIConfig;
|
||||||
|
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||||
|
import com.tencent.qcloud.tuicore.TUICore;
|
||||||
|
import com.tencent.qcloud.tuicore.interfaces.TUILoginListener;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
import com.xscm.moduleutil.bean.UserBean;
|
import com.xscm.moduleutil.bean.UserBean;
|
||||||
import com.xscm.moduleutil.bean.UserInfo;
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
|
import com.xscm.moduleutil.http.RetrofitClient;
|
||||||
import com.xscm.moduleutil.utils.LanguageUtil;
|
import com.xscm.moduleutil.utils.LanguageUtil;
|
||||||
import com.xscm.moduleutil.utils.location.LocationProvider;
|
import com.xscm.moduleutil.utils.location.LocationProvider;
|
||||||
import com.xscm.moduleutil.utils.location.SystemLocationProvider;
|
import com.xscm.moduleutil.utils.location.SystemLocationProvider;
|
||||||
@@ -28,12 +38,12 @@ import org.greenrobot.eventbus.Subscribe;
|
|||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements
|
public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewDataBinding> extends BaseAppCompatActivity<VDB> implements
|
||||||
IView<Activity> , LocationProvider.LocationCallback
|
IView<Activity>, LocationProvider.LocationCallback {
|
||||||
{
|
|
||||||
|
|
||||||
protected P MvpPre;
|
protected P MvpPre;
|
||||||
|
|
||||||
protected abstract P bindPresenter();
|
protected abstract P bindPresenter();
|
||||||
|
|
||||||
private String city1;
|
private String city1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -77,36 +87,53 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void logOutEvent(UserBean userBean) {
|
public void logOutEvent(UserBean userBean) {
|
||||||
// 在用户 UI 点击登录的时候调用
|
// 在用户 UI 点击登录的时候调用
|
||||||
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u"+userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
|
TUILogin.login(getBaseContext(), CommonAppContext.getInstance().getCurrentEnvironment().getSdkAppId(), "u" + userBean.getUser_id(), userBean.getTencent_im(), new TUICallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onError(final int code, final String desc) {
|
public void onError(final int code, final String desc) {
|
||||||
LogUtils.e("@@@1",code,"描述:",desc);
|
LogUtils.e("@@@1", code, "描述:", desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
LogUtils.e("@@@","成功");
|
LogUtils.e("@@@", "成功");
|
||||||
// V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();
|
|
||||||
// userFullInfo.setNickname(userBean.getNickname());
|
|
||||||
// userFullInfo.setFaceUrl(userBean.getAvatar());
|
|
||||||
// userFullInfo.setAllowType(userBean.getSex());
|
|
||||||
// V2TIMManager.getInstance().setSelfInfo(userFullInfo, new V2TIMCallback() {
|
|
||||||
// @Override
|
|
||||||
// public void onSuccess() {
|
|
||||||
// LogUtils.e("@@@", "成功");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onError(int code, String desc) {
|
|
||||||
// LogUtils.e("@@@", "描述"+desc);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
initLocation();
|
initLocation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final V2TIMSDKListener imSdkListener = new V2TIMSDKListener() {
|
||||||
|
@Override
|
||||||
|
public void onConnecting() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectSuccess() {//重连成功
|
||||||
|
if (CommonAppContext.getInstance().playId!=null){
|
||||||
|
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnectFailed(int code, String error) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onKickedOffline() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUserSigExpired() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSelfInfoUpdated(V2TIMUserFullInfo info) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private SystemLocationProvider locationProvider;
|
private SystemLocationProvider locationProvider;
|
||||||
|
|
||||||
private void initLocation() {
|
private void initLocation() {
|
||||||
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
|
||||||
@@ -126,24 +153,24 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
|||||||
locationProvider.getLastKnownLocation(this, this);
|
locationProvider.getLastKnownLocation(this, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLocationReceived(double latitude, double longitude, String city) {
|
public void onLocationReceived(double latitude, double longitude, String city) {
|
||||||
LogUtils.e("当前位置:" + city);
|
LogUtils.e("当前位置:" + city);
|
||||||
city1=city;
|
city1 = city;
|
||||||
EventBus.getDefault().post(city1);
|
EventBus.getDefault().post(city1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(String errorMessage) {
|
public void onFailed(String errorMessage) {
|
||||||
LogUtils.e("定位失败");
|
LogUtils.e("定位失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||||
|
|
||||||
if (requestCode == 1001) {
|
if (requestCode == 1001) {
|
||||||
if (locationProvider==null) {
|
if (locationProvider == null) {
|
||||||
locationProvider = new SystemLocationProvider();
|
locationProvider = new SystemLocationProvider();
|
||||||
}
|
}
|
||||||
locationProvider.getLastKnownLocation(this, this);
|
locationProvider.getLastKnownLocation(this, this);
|
||||||
@@ -169,10 +196,10 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 显示全局飘屏消息(支持任意位置飘过)
|
* 显示全局飘屏消息(支持任意位置飘过)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
// public void showPiaoPingMessage(MqttBean mqttBean) {
|
// public void showPiaoPingMessage(MqttBean mqttBean) {
|
||||||
// WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
// WindowManager windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.blankj.utilcode.util.LogUtils;
|
|||||||
import com.blankj.utilcode.util.ToastUtils;
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
import com.xscm.moduleutil.R;
|
import com.xscm.moduleutil.R;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.databinding.ActivityWebViewBinding;
|
import com.xscm.moduleutil.databinding.ActivityWebViewBinding;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||||
@@ -389,7 +390,9 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void jumpRoomPage(String room_id) {
|
public void jumpRoomPage(String room_id) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), room_id,"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
@@ -402,14 +405,16 @@ public class WebViewActivity extends BaseAppCompatActivity<ActivityWebViewBindin
|
|||||||
public void enterGroupChat(String group_id, String cover, String guild_name) {
|
public void enterGroupChat(String group_id, String cover, String guild_name) {
|
||||||
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
||||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
|
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, group_id);
|
||||||
|
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, guild_name);
|
||||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
|
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_GROUP);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void chatWithUser(String user_id, String nickname) {
|
public void chatWithUser(String user_id, String nickname) {
|
||||||
Intent intent = new Intent(mContext, TUIC2CChatActivity.class);
|
Intent intent = new Intent(mContext, TUIGroupChatActivity.class);
|
||||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
|
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, user_id);
|
||||||
|
intent.putExtra(TUIConstants.TUIChat.CHAT_NAME, nickname);
|
||||||
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
intent.putExtra(TUIConstants.TUIChat.CHAT_TYPE, V2TIMConversation.V2TIM_C2C);
|
||||||
mContext.startActivity(intent);
|
mContext.startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.chad.library.adapter.base.BaseQuickAdapter;
|
|||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.xscm.moduleutil.R;
|
import com.xscm.moduleutil.R;
|
||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.NewsMessageList;
|
import com.xscm.moduleutil.bean.NewsMessageList;
|
||||||
import com.xscm.moduleutil.databinding.ActivityOfficialNoticeBinding;
|
import com.xscm.moduleutil.databinding.ActivityOfficialNoticeBinding;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
@@ -75,7 +76,8 @@ 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("roomId", item.getRoom_id() + "").navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id()+"","");
|
||||||
|
// 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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/20
|
||||||
|
*@description: 模块之间的通讯接口
|
||||||
|
*/
|
||||||
|
public interface AppStateListener {
|
||||||
|
void onAppForeground();
|
||||||
|
void onAppBackground();
|
||||||
|
void onRoomActivityCreated(Activity roomActivity);
|
||||||
|
void onRoomActivityDestroyed();
|
||||||
|
boolean isRoomActivityActive();
|
||||||
|
void setFloatingWindowVisible(boolean visible);
|
||||||
|
boolean isFloatingWindowVisible();
|
||||||
|
|
||||||
|
// 新增方法
|
||||||
|
boolean shouldShowSplash();
|
||||||
|
void setShouldShowSplash(boolean shouldShow);
|
||||||
|
boolean isAppInBackground();
|
||||||
|
void setAppInBackground(boolean inBackground);
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/20
|
||||||
|
*@description: 应用状态管理的单例类
|
||||||
|
*/
|
||||||
|
// 在 common 模块中
|
||||||
|
public class AppStateManager implements AppStateListener {
|
||||||
|
private static AppStateManager instance;
|
||||||
|
private boolean isAppInBackground = true;
|
||||||
|
private boolean shouldShowSplash = true;
|
||||||
|
private WeakReference<Activity> roomActivityRef;
|
||||||
|
private boolean isFloatingWindowVisible = false;
|
||||||
|
private boolean isRoomActivityMinimized = false;
|
||||||
|
private AppStateManager() {
|
||||||
|
// 私有构造函数
|
||||||
|
}
|
||||||
|
|
||||||
|
public static synchronized AppStateManager getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new AppStateManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldShowSplash() {
|
||||||
|
return shouldShowSplash;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setShouldShowSplash(boolean shouldShow) {
|
||||||
|
this.shouldShowSplash = shouldShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAppInBackground() {
|
||||||
|
return isAppInBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setAppInBackground(boolean inBackground) {
|
||||||
|
this.isAppInBackground = inBackground;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRoomActivityCreated(Activity roomActivity) {
|
||||||
|
roomActivityRef = new WeakReference<>(roomActivity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRoomActivityDestroyed() {
|
||||||
|
roomActivityRef = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isRoomActivityActive() {
|
||||||
|
Activity activity = getRoomActivity();
|
||||||
|
return activity != null && !activity.isFinishing();
|
||||||
|
}
|
||||||
|
|
||||||
|
private Activity getRoomActivity() {
|
||||||
|
return roomActivityRef != null ? roomActivityRef.get() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFloatingWindowVisible(boolean visible) {
|
||||||
|
this.isFloatingWindowVisible = visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFloatingWindowVisible() {
|
||||||
|
return isFloatingWindowVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppForeground() {
|
||||||
|
// 应用进入前台时的处理
|
||||||
|
setAppInBackground(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAppBackground() {
|
||||||
|
// 应用进入后台时的处理
|
||||||
|
setAppInBackground(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增方法:设置RoomActivity为最小化状态
|
||||||
|
public void setRoomActivityMinimized(boolean minimized) {
|
||||||
|
this.isRoomActivityMinimized = minimized;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增方法:检查RoomActivity是否处于最小化状态
|
||||||
|
public boolean isRoomActivityMinimized() {
|
||||||
|
return isRoomActivityMinimized;
|
||||||
|
}
|
||||||
|
private RoomInfoResp roomInfoResp;
|
||||||
|
public void setRoomInfo(RoomInfoResp roomInfoResp) {
|
||||||
|
// 处理RoomInfoResp对象
|
||||||
|
this.roomInfoResp = roomInfoResp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoomInfoResp getRoomInfo() {
|
||||||
|
return roomInfoResp;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package com.xscm.moduleutil.base;
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
import static androidx.core.app.ActivityCompat.startActivityForResult;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
|
import android.content.ComponentCallbacks2;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.Signature;
|
import android.content.pm.Signature;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -19,6 +19,8 @@ import android.provider.Settings;
|
|||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.multidex.MultiDex;
|
import androidx.multidex.MultiDex;
|
||||||
import androidx.multidex.MultiDexApplication;
|
import androidx.multidex.MultiDexApplication;
|
||||||
|
|
||||||
@@ -27,16 +29,23 @@ import com.blankj.utilcode.util.AppUtils;
|
|||||||
import com.blankj.utilcode.util.FileUtils;
|
import com.blankj.utilcode.util.FileUtils;
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.blankj.utilcode.util.ProcessUtils;
|
import com.blankj.utilcode.util.ProcessUtils;
|
||||||
import com.blankj.utilcode.util.ServiceUtils;
|
|
||||||
import com.lahm.library.EasyProtectorLib;
|
import com.lahm.library.EasyProtectorLib;
|
||||||
import com.lahm.library.EmulatorCheckCallback;
|
import com.lahm.library.EmulatorCheckCallback;
|
||||||
import com.xscm.moduleutil.R;
|
import com.tencent.imsdk.v2.V2TIMAdvancedMsgListener;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMManager;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMMessage;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMMessageManager;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMMessageReceipt;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||||
import com.xscm.moduleutil.bean.UserBean;
|
import com.xscm.moduleutil.bean.UserBean;
|
||||||
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
import com.xscm.moduleutil.event.AppLifecycleEvent;
|
import com.xscm.moduleutil.event.AppLifecycleEvent;
|
||||||
|
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||||
import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
|
import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
|
||||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
import com.xscm.moduleutil.service.MqttConnect;
|
import com.xscm.moduleutil.service.MqttConnect;
|
||||||
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
import com.xscm.moduleutil.utils.UtilConfig;
|
import com.xscm.moduleutil.utils.UtilConfig;
|
||||||
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
|
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
|
||||||
@@ -59,8 +68,7 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.List;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -69,7 +77,7 @@ import lombok.Getter;
|
|||||||
* Created by cxf on 2017/8/3.
|
* Created by cxf on 2017/8/3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class CommonAppContext extends MultiDexApplication {
|
public class CommonAppContext extends MultiDexApplication implements Application.ActivityLifecycleCallbacks {
|
||||||
|
|
||||||
private static CommonAppContext sInstance;
|
private static CommonAppContext sInstance;
|
||||||
private static Handler sMainThreadHandler;
|
private static Handler sMainThreadHandler;
|
||||||
@@ -87,8 +95,6 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
public String playCover;
|
public String playCover;
|
||||||
public boolean showSelf;//盲盒是否能送自己
|
public boolean showSelf;//盲盒是否能送自己
|
||||||
public String playName;
|
public String playName;
|
||||||
private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1);
|
|
||||||
private ScheduledExecutorService scheduledExecutorServiceRoom = null;
|
|
||||||
private MqttConnect mqttConnect=null;
|
private MqttConnect mqttConnect=null;
|
||||||
|
|
||||||
// 添加后台状态标记
|
// 添加后台状态标记
|
||||||
@@ -106,22 +112,230 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
return wasInBackground;
|
return wasInBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int activityCount = 0;
|
||||||
|
|
||||||
|
private Long masageCount;
|
||||||
|
private int announcement_read_count;
|
||||||
|
|
||||||
|
public int getAnnouncement_read_count() {
|
||||||
|
return announcement_read_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnnouncement_read_count(int announcement_read_count) {
|
||||||
|
this.announcement_read_count = announcement_read_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMasageCount() {
|
||||||
|
return masageCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMasageCount(Long masageCount) {
|
||||||
|
this.masageCount = masageCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
private AppStateListener appStateListener;
|
||||||
|
private boolean isListeningUnreadCount = false;
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
sInstance = this;
|
sInstance = this;
|
||||||
sMainThreadHandler = new Handler();
|
sMainThreadHandler = new Handler();
|
||||||
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
|
EnvironmentPrefs prefs = new EnvironmentPrefs(this);
|
||||||
|
// 添加内存优化配置
|
||||||
|
optimizeMemorySettings();
|
||||||
currentEnvironment = prefs.getSelectedEnvironment();
|
currentEnvironment = prefs.getSelectedEnvironment();
|
||||||
initialization();
|
initialization();
|
||||||
|
registerActivityLifecycleCallbacks(this);
|
||||||
|
appStateListener = AppStateManager.getInstance();
|
||||||
|
startListeningUnreadMessageCount();
|
||||||
|
}
|
||||||
|
// 在适当的位置(如onCreate或onResume)添加实时监听
|
||||||
|
protected void startListeningUnreadMessageCount() {
|
||||||
|
if (!isListeningUnreadCount) {
|
||||||
|
// 添加未读消息数变化监听器
|
||||||
|
V2TIMMessageManager messageManager = V2TIMManager.getMessageManager();
|
||||||
|
messageManager.addAdvancedMsgListener(new V2TIMAdvancedMsgListener() {
|
||||||
|
@Override
|
||||||
|
public void onRecvNewMessage(V2TIMMessage msg) {
|
||||||
|
// 收到新消息时更新未读数
|
||||||
|
updateUnreadMessageCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRecvC2CReadReceipt(List<V2TIMMessageReceipt> receiptList) {
|
||||||
|
// 收到C2C消息已读回执时更新未读数
|
||||||
|
updateUnreadMessageCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
isListeningUnreadCount = true;
|
||||||
|
// 首次获取未读数
|
||||||
|
updateUnreadMessageCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新未读消息数的方法
|
||||||
|
private void updateUnreadMessageCount() {
|
||||||
|
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Long aLong) {
|
||||||
|
CommonAppContext.getInstance().setMasageCount(aLong != null ? aLong : 0L);
|
||||||
|
// 通知未读数变化
|
||||||
|
notifyUnreadCountChanged(aLong != null ? aLong : 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String desc) {
|
||||||
|
// 错误处理
|
||||||
|
CommonAppContext.getInstance().setMasageCount(0L);
|
||||||
|
notifyUnreadCountChanged(0L);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通知未读数变化的方法(可以发送广播或EventBus事件)
|
||||||
|
private void notifyUnreadCountChanged(long unreadCount) {
|
||||||
|
// 使用EventBus通知
|
||||||
|
EventBus.getDefault().post(new UnreadCountEvent(unreadCount,0));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 优化内存设置
|
||||||
|
*/
|
||||||
|
private void optimizeMemorySettings() {
|
||||||
|
try {
|
||||||
|
// 请求降低内存负载
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
// 启用自动内存管理优化
|
||||||
|
registerComponentCallbacks(new ComponentCallbacks2() {
|
||||||
|
@Override
|
||||||
|
public void onTrimMemory(int level) {
|
||||||
|
handleMemoryTrim(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigurationChanged(@NonNull Configuration newConfig) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLowMemory() {
|
||||||
|
// 内存极低时的处理
|
||||||
|
releaseNonEssentialResources();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("Memory optimization setup failed: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理内存削减事件
|
||||||
|
* @param level 削减级别
|
||||||
|
*/
|
||||||
|
private void handleMemoryTrim(int level) {
|
||||||
|
switch (level) {
|
||||||
|
case TRIM_MEMORY_RUNNING_MODERATE:
|
||||||
|
// 应用正在运行,内存开始紧张
|
||||||
|
LogUtils.d("Memory trim: moderate");
|
||||||
|
break;
|
||||||
|
case TRIM_MEMORY_RUNNING_LOW:
|
||||||
|
// 应用正在运行,内存更加紧张
|
||||||
|
LogUtils.d("Memory trim: low");
|
||||||
|
releaseNonEssentialResources();
|
||||||
|
break;
|
||||||
|
case TRIM_MEMORY_RUNNING_CRITICAL:
|
||||||
|
// 应用仍在运行,但系统已开始杀死后台进程
|
||||||
|
LogUtils.d("Memory trim: critical");
|
||||||
|
releaseAllNonEssentialResources();
|
||||||
|
break;
|
||||||
|
case TRIM_MEMORY_UI_HIDDEN:
|
||||||
|
// 应用UI已隐藏,可以释放UI相关资源
|
||||||
|
LogUtils.d("Memory trim: UI hidden");
|
||||||
|
releaseUIResources();
|
||||||
|
break;
|
||||||
|
case TRIM_MEMORY_BACKGROUND:
|
||||||
|
// 应用处于LRU列表中较远位置
|
||||||
|
LogUtils.d("Memory trim: background");
|
||||||
|
break;
|
||||||
|
case TRIM_MEMORY_MODERATE:
|
||||||
|
// 应用处于LRU列表中间位置
|
||||||
|
LogUtils.d("Memory trim: moderate background");
|
||||||
|
releaseAllNonEssentialResources();
|
||||||
|
break;
|
||||||
|
case TRIM_MEMORY_COMPLETE:
|
||||||
|
// 应用处于LRU列表中最远位置,即将被杀死
|
||||||
|
LogUtils.d("Memory trim: complete");
|
||||||
|
releaseAllResources();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 释放非必要资源
|
||||||
|
*/
|
||||||
|
private void releaseNonEssentialResources() {
|
||||||
|
try {
|
||||||
|
// 清理图片缓存
|
||||||
|
// Glide.get(this).clearMemory();
|
||||||
|
|
||||||
|
// 释放MQTT资源
|
||||||
|
if (mqttConnect != null) {
|
||||||
|
mqttConnect.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 通知各个组件释放资源
|
||||||
|
// EventBus.getDefault().post(new MemoryTrimEvent());
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("Error releasing non-essential resources: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放所有非必要资源
|
||||||
|
*/
|
||||||
|
private void releaseAllNonEssentialResources() {
|
||||||
|
try {
|
||||||
|
releaseNonEssentialResources();
|
||||||
|
|
||||||
|
// 进行垃圾回收
|
||||||
|
System.gc();
|
||||||
|
System.runFinalization();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("Error releasing all non-essential resources: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放UI相关资源
|
||||||
|
*/
|
||||||
|
private void releaseUIResources() {
|
||||||
|
try {
|
||||||
|
// 可以在这里通知UI组件释放资源
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("Error releasing UI resources: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放所有资源
|
||||||
|
*/
|
||||||
|
private void releaseAllResources() {
|
||||||
|
try {
|
||||||
|
releaseAllNonEssentialResources();
|
||||||
|
releaseUIResources();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("Error releasing all resources: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppStateListener(AppStateListener listener) {
|
||||||
|
this.appStateListener = listener;
|
||||||
|
}
|
||||||
public void initialization(){
|
public void initialization(){
|
||||||
UtilConfig.init(this);
|
UtilConfig.init(this);
|
||||||
registerActivityLifecycleCallbacks();
|
// registerActivityLifecycleCallbacks();
|
||||||
initWebView();
|
initWebView();
|
||||||
if (ProcessUtils.isMainProcess()) {
|
if (ProcessUtils.isMainProcess()) {
|
||||||
initARouter();
|
initARouter();
|
||||||
@@ -156,7 +370,7 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBatteryOptimizationExemption();
|
// requestBatteryOptimizationExemption();
|
||||||
}
|
}
|
||||||
private void requestBatteryOptimizationExemption() {
|
private void requestBatteryOptimizationExemption() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
@@ -414,6 +628,11 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
return mUserBean;
|
return mUserBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserInfo getUserInfo() {
|
||||||
|
UserInfo userInfo = SpUtil.getUserInfo();
|
||||||
|
return userInfo;
|
||||||
|
}
|
||||||
|
|
||||||
public void setUserBean(UserBean bean) {
|
public void setUserBean(UserBean bean) {
|
||||||
mUserBean = bean;
|
mUserBean = bean;
|
||||||
}
|
}
|
||||||
@@ -480,4 +699,109 @@ public class CommonAppContext extends MultiDexApplication {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityStarted(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityResumed(@NonNull Activity activity) {
|
||||||
|
if (activityCount == 0) {
|
||||||
|
// 应用从后台回到前台
|
||||||
|
if (appStateListener != null) {
|
||||||
|
appStateListener.onAppForeground();
|
||||||
|
}
|
||||||
|
// handleAppForeground(activity);
|
||||||
|
// AppStateManager.setRoomActivityMinimized(false);
|
||||||
|
}
|
||||||
|
activityCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityPaused(@NonNull Activity activity) {
|
||||||
|
activityCount--;
|
||||||
|
if (activityCount == 0) {
|
||||||
|
// 应用切换到后台
|
||||||
|
if (appStateListener != null) {
|
||||||
|
appStateListener.onAppBackground();
|
||||||
|
}
|
||||||
|
// handleAppBackground(activity);
|
||||||
|
// AppStateManager.setRoomActivityMinimized( true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleAppBackground(Activity activity) {
|
||||||
|
String className = activity.getClass().getName();
|
||||||
|
if (className.contains("RoomActivity") && appStateListener != null) {
|
||||||
|
// RoomActivity进入后台时显示悬浮窗
|
||||||
|
appStateListener.setFloatingWindowVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void handleAppForeground(Activity activity) {
|
||||||
|
// 获取当前Activity的类名,避免直接引用类
|
||||||
|
String className = activity.getClass().getName();
|
||||||
|
|
||||||
|
if (className.contains("LaunchPageActivity")) {
|
||||||
|
// 对于启动页,我们需要检查是否应该跳转到主页面
|
||||||
|
if (appStateListener != null && appStateListener.isFloatingWindowVisible()) {
|
||||||
|
// 有悬浮窗,直接回到首页
|
||||||
|
ARouter.getInstance().build(ARouteConstants.ME).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP).navigation();
|
||||||
|
} else if (appStateListener != null && appStateListener.shouldShowSplash()) {
|
||||||
|
// 需要显示启动页,但已经在启动页了,不需要额外操作
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// 默认情况下,跳转到主页面
|
||||||
|
ARouter.getInstance().build(ARouteConstants.ME).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP).navigation();
|
||||||
|
}
|
||||||
|
return; // 启动页或引导页不需要特殊处理
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appStateListener != null && appStateListener.isFloatingWindowVisible()) {
|
||||||
|
// 有悬浮窗,直接回到首页
|
||||||
|
// if (!className.contains("MainActivity")) {
|
||||||
|
ARouter.getInstance().build(ARouteConstants.ME).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP).navigation();
|
||||||
|
// }
|
||||||
|
} else if (appStateListener != null && appStateListener.shouldShowSplash()) {
|
||||||
|
// 需要显示启动页
|
||||||
|
try {
|
||||||
|
Class<?> splashActivityClass = Class.forName("com.xscm.modulemain.activity.LaunchPageActivity");
|
||||||
|
Intent intent = new Intent(activity, splashActivityClass);
|
||||||
|
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
activity.startActivity(intent);
|
||||||
|
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFloatingWindow(Activity activity) {
|
||||||
|
// 这里实现显示悬浮窗的逻辑
|
||||||
|
AppStateManager.getInstance().setFloatingWindowVisible(true);
|
||||||
|
// 实际显示悬浮窗的代码,已实现
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityStopped(@NonNull Activity activity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onActivityDestroyed(@NonNull Activity activity) {
|
||||||
|
// String className = activity.getClass().getName();
|
||||||
|
// if (className.contains("RoomActivity") && appStateListener != null) {
|
||||||
|
// appStateListener.onRoomActivityDestroyed();
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,497 @@
|
|||||||
|
package com.xscm.moduleutil.base;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||||
|
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||||
|
import com.xscm.moduleutil.http.BaseObserver;
|
||||||
|
import com.xscm.moduleutil.http.RetrofitClient;
|
||||||
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
import com.xscm.moduleutil.utils.logger.Logger;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房间管理器
|
||||||
|
* 统一处理房间数据获取、进入房间和退出房间的逻辑
|
||||||
|
*/
|
||||||
|
public class RoomManager {
|
||||||
|
private static final String TAG = "RoomManager";
|
||||||
|
|
||||||
|
private static RoomManager instance;
|
||||||
|
|
||||||
|
// 房间数据缓存
|
||||||
|
private Map<String, RoomInfoResp> roomDataCache = new ConcurrentHashMap<>();
|
||||||
|
private Map<String, Long> cacheTimestamps = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
// 缓存有效期(5分钟)
|
||||||
|
private static final long CACHE_DURATION = 5 * 60 * 1000;
|
||||||
|
|
||||||
|
private RoomManager() {}
|
||||||
|
|
||||||
|
public static synchronized RoomManager getInstance() {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = new RoomManager();
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入房间 - 自动获取房间数据
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
*/
|
||||||
|
public void enterRoom(Context context, String roomId) {
|
||||||
|
enterRoom(context, roomId, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入房间 - 使用密码
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
*/
|
||||||
|
public void enterRoom(Context context, String roomId, String password) {
|
||||||
|
enterRoom(context, roomId, password, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进入房间 - 使用缓存数据
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
* @param cachedData 缓存的房间数据
|
||||||
|
*/
|
||||||
|
public void enterRoom(Context context, String roomId, String password, RoomInfoResp cachedData) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
ToastUtils.showShort("房间ID不能为空");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否有有效的缓存数据
|
||||||
|
RoomInfoResp roomInfo = cachedData != null ? cachedData : getCachedRoomData(roomId);
|
||||||
|
|
||||||
|
if (roomInfo != null) {
|
||||||
|
// 使用缓存数据直接进入房间
|
||||||
|
navigateToRoom(context, roomId, password, roomInfo, false);
|
||||||
|
} else {
|
||||||
|
// 获取房间数据后进入房间
|
||||||
|
fetchRoomDataAndEnter(context, roomId, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间数据并进入房间
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
*/
|
||||||
|
public void fetchRoomDataAndEnter(Context context, String roomId, String password) {
|
||||||
|
// 显示加载提示
|
||||||
|
// 这里可以根据需要添加加载对话框
|
||||||
|
|
||||||
|
// 检查是否有有效的缓存数据
|
||||||
|
// RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||||
|
// 检查是否是当前房间且用户在线
|
||||||
|
// boolean isCurrentRoom = isCurrentRoom(roomId);
|
||||||
|
if (CommonAppContext.getInstance().playId==null){
|
||||||
|
fetchAndJoinRoom(context, roomId, password);
|
||||||
|
}else {
|
||||||
|
isUserOnline(context, roomId, password, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(1000);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 如果是当前房间且用户在线,直接跳转到房间页面,仅更新数据
|
||||||
|
|
||||||
|
|
||||||
|
// // 获取房间数据
|
||||||
|
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
|
// // 等待一段时间确保退出完成
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(500);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RoomInfoResp resp) {
|
||||||
|
// String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||||
|
// String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||||
|
// String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||||
|
// String rtm_token=resp.getUser_info().getAgora_rtm_token();
|
||||||
|
// SpUtil.setRtmToken(rtm_token);
|
||||||
|
// int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||||
|
// boolean enableMic = false; // 是否开启麦克风
|
||||||
|
// boolean enableJs=false; // 是否开启角色
|
||||||
|
// if (resp.getUser_info().getPit_number()!=0){
|
||||||
|
// enableJs=true;
|
||||||
|
// }
|
||||||
|
// LogUtils.e("token",token);
|
||||||
|
// LogUtils.e("roomId:",roomId);
|
||||||
|
//// 初始化 Agora 并加入房间
|
||||||
|
// AgoraManager.getInstance(context)
|
||||||
|
// .joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||||
|
// cacheRoomData(roomId, resp);
|
||||||
|
// navigateToRoom(context, roomId, password, resp);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// 临时实现 - 直接跳转(因为缺少具体的网络请求代码)
|
||||||
|
// navigateToRoom(context, roomId, password, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void upInfo(Context context, String roomId, String password,boolean isOnline, RoomInfoResp roomInfo,boolean isCurrentRoom){
|
||||||
|
|
||||||
|
|
||||||
|
if (isOnline){
|
||||||
|
navigateToRoom(context, roomId, password, roomInfo,isOnline);
|
||||||
|
}else {
|
||||||
|
// CommonAppContext.getInstance().isShow = false;
|
||||||
|
// CommonAppContext.getInstance().isPlaying = false;
|
||||||
|
// EventBus.getDefault().post(new RoomOutEvent());
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(300);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// }
|
||||||
|
fetchAndJoinRoom(context, roomId, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// if (isCurrentRoom&& isOnline) {
|
||||||
|
// if (roomInfo != null) {
|
||||||
|
// navigateToRoom(context, roomId, password, roomInfo);
|
||||||
|
// } else {
|
||||||
|
// // 即使在线,如果没有缓存数据,也需要获取数据
|
||||||
|
// fetchAndJoinRoom(context, roomId, password);
|
||||||
|
// }
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// 如果有缓存数据且用户在线,使用缓存数据进入房间
|
||||||
|
// if (roomInfo != null && isOnline) {
|
||||||
|
// RetrofitClient.getInstance().postRoomInfo(roomId, new BaseObserver<RoomInfoResp>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RoomInfoResp roomInfoResp) {
|
||||||
|
//// cacheRoomData(roomId, roomInfo);
|
||||||
|
// navigateToRoom(context, roomId, password, roomInfoResp);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
|
// cacheRoomData(roomId, roomInfo);
|
||||||
|
// navigateToRoom(context, roomId, password, roomInfo);
|
||||||
|
return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 其他情况,获取新的房间数据并加入房间
|
||||||
|
// fetchAndJoinRoom(context, roomId, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取新的房间数据并加入房间
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
*/
|
||||||
|
private void fetchAndJoinRoom(Context context, String roomId, String password) {
|
||||||
|
// 获取房间数据
|
||||||
|
MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
|
// 等待一段时间确保退出完成
|
||||||
|
try {
|
||||||
|
Thread.sleep(300);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
navigateToRoom(context, roomId, password, null,false);
|
||||||
|
|
||||||
|
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onSubscribe(Disposable d) {
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onNext(RoomInfoResp resp) {
|
||||||
|
// String appId = CommonAppContext.getInstance().getCurrentEnvironment().getSwSdkAppId();
|
||||||
|
// String token = resp.getUser_info().getAgora_token(); // 如果启用了鉴权才需要
|
||||||
|
// String roomId = resp.getRoom_info().getRoom_id(); // 房间 ID
|
||||||
|
// String rtm_token=resp.getUser_info().getAgora_rtm_token();
|
||||||
|
// SpUtil.setRtmToken(rtm_token);
|
||||||
|
// int uid = SpUtil.getUserId(); // 0 表示由 Agora 自动生成 UID
|
||||||
|
// boolean enableMic = false; // 是否开启麦克风
|
||||||
|
// boolean enableJs=false; // 是否开启角色
|
||||||
|
// if (resp.getUser_info().getPit_number()!=0){
|
||||||
|
// enableJs=true;
|
||||||
|
// }
|
||||||
|
// LogUtils.e("token",token);
|
||||||
|
// LogUtils.e("roomId:",roomId);
|
||||||
|
//// 初始化 Agora 并加入房间
|
||||||
|
// AgoraManager.getInstance(context)
|
||||||
|
// .joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||||
|
// cacheRoomData(roomId, resp);
|
||||||
|
// navigateToRoom(context, roomId, password, resp);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查是否是当前房间
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return true表示是当前房间,false表示不是
|
||||||
|
*/
|
||||||
|
private boolean isCurrentRoom(String roomId) {
|
||||||
|
// 这里应该实现检查是否是当前房间的逻辑
|
||||||
|
// 可以通过检查当前Activity或者通过全局变量等方式实现
|
||||||
|
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||||
|
|
||||||
|
RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||||
|
if (roomInfo != null){
|
||||||
|
if (roomInfo.getRoom_info().getRoom_id().equals(roomId)){
|
||||||
|
return true;
|
||||||
|
}else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 跳转到房间页面
|
||||||
|
* @param context 上下文
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param password 房间密码
|
||||||
|
* @param roomInfo 房间信息
|
||||||
|
*/
|
||||||
|
private void navigateToRoom(Context context, String roomId, String password, RoomInfoResp roomInfo,boolean isOnline) {
|
||||||
|
try {
|
||||||
|
// 构建跳转参数
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putString("roomId", roomId);
|
||||||
|
bundle.putBoolean("isOnline", isOnline);
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(password)) {
|
||||||
|
bundle.putString("password", password);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roomInfo != null) {
|
||||||
|
// bundle.putSerializable("roomInfo", roomInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用ARouter跳转到房间页面
|
||||||
|
ARouter.getInstance()
|
||||||
|
.build(ARouteConstants.ROOM_DETAILS)
|
||||||
|
.with(bundle)
|
||||||
|
.withFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||||
|
.navigation(context);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.e(TAG, "跳转房间页面失败: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓存房间数据
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @param roomInfo 房间信息
|
||||||
|
*/
|
||||||
|
public void cacheRoomData(String roomId, RoomInfoResp roomInfo) {
|
||||||
|
|
||||||
|
if (TextUtils.isEmpty(roomId) || roomInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 清除所有现有的缓存数据
|
||||||
|
roomDataCache.clear();
|
||||||
|
cacheTimestamps.clear();
|
||||||
|
roomDataCache.put(roomId, roomInfo);
|
||||||
|
cacheTimestamps.put(roomId, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取缓存的房间数据
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return 房间信息,如果缓存无效则返回null
|
||||||
|
*/
|
||||||
|
public RoomInfoResp getCachedRoomData(String roomId) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Long timestamp = cacheTimestamps.get(roomId);
|
||||||
|
if (timestamp == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查缓存是否过期
|
||||||
|
if (System.currentTimeMillis() - timestamp > CACHE_DURATION) {
|
||||||
|
// 缓存过期,清除数据
|
||||||
|
roomDataCache.remove(roomId);
|
||||||
|
cacheTimestamps.remove(roomId);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return roomDataCache.get(roomId);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 检查用户是否在线
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return true表示用户在线,false表示不在线
|
||||||
|
*/
|
||||||
|
private boolean isUserOnline(Context context, String roomId,String password,RoomInfoResp roomInfo) {
|
||||||
|
// 这里应该实现检查用户是否在线的逻辑
|
||||||
|
// 可以通过检查Agora是否还在房间中,或者通过服务端接口查询用户状态等方式实现
|
||||||
|
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||||
|
// boolean isCurrentRoom=isCurrentRoom(roomId);
|
||||||
|
try {
|
||||||
|
Thread.sleep(300);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
final boolean[] isOnline = {false};
|
||||||
|
RetrofitClient.getInstance().getRoomOnline(roomId, "1", "50", new BaseObserver<RoomOnline>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(RoomOnline roomOnline) {
|
||||||
|
try {
|
||||||
|
if (roomOnline != null) {
|
||||||
|
if (roomOnline.getOn_pit() != null) {
|
||||||
|
for (RoomOnlineBean roomOnlineBean : roomOnline.getOn_pit()) {
|
||||||
|
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||||
|
isOnline[0] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (roomOnline.getOff_pit() != null) {
|
||||||
|
for (RoomOnlineBean roomOnlineBean : roomOnline.getOff_pit()) {
|
||||||
|
if (roomOnlineBean.getUser_id() == SpUtil.getUserId()) {
|
||||||
|
isOnline[0] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
|
||||||
|
} else {
|
||||||
|
isOnline[0] = false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 捕获所有可能的异常,避免崩溃
|
||||||
|
e.printStackTrace();
|
||||||
|
isOnline[0] = false;
|
||||||
|
// 即使出现异常也继续执行
|
||||||
|
upInfo(context, roomId, password, isOnline[0], roomInfo, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return isOnline[0];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 清除指定房间的缓存数据
|
||||||
|
* @param roomId 房间ID
|
||||||
|
*/
|
||||||
|
public void clearRoomCache(String roomId) {
|
||||||
|
if (!TextUtils.isEmpty(roomId)) {
|
||||||
|
roomDataCache.remove(roomId);
|
||||||
|
cacheTimestamps.remove(roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除所有房间缓存数据
|
||||||
|
*/
|
||||||
|
public void clearAllRoomCache() {
|
||||||
|
roomDataCache.clear();
|
||||||
|
cacheTimestamps.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退出房间
|
||||||
|
* @param roomId 房间ID
|
||||||
|
*/
|
||||||
|
public void exitRoom(String roomId) {
|
||||||
|
// 清除该房间的缓存数据
|
||||||
|
clearRoomCache(roomId);
|
||||||
|
|
||||||
|
// 可以在这里添加其他退出房间的逻辑
|
||||||
|
// 例如:通知服务器用户已退出、清理房间相关资源等
|
||||||
|
|
||||||
|
Logger.d(TAG, "退出房间: " + roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量退出房间
|
||||||
|
* @param roomIds 房间ID列表
|
||||||
|
*/
|
||||||
|
public void exitRooms(String... roomIds) {
|
||||||
|
if (roomIds != null) {
|
||||||
|
for (String roomId : roomIds) {
|
||||||
|
exitRoom(roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取房间缓存状态
|
||||||
|
* @param roomId 房间ID
|
||||||
|
* @return 缓存状态信息
|
||||||
|
*/
|
||||||
|
public String getRoomCacheStatus(String roomId) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
return "无效的房间ID";
|
||||||
|
}
|
||||||
|
|
||||||
|
Long timestamp = cacheTimestamps.get(roomId);
|
||||||
|
if (timestamp == null) {
|
||||||
|
return "未缓存";
|
||||||
|
}
|
||||||
|
|
||||||
|
long elapsed = System.currentTimeMillis() - timestamp;
|
||||||
|
if (elapsed > CACHE_DURATION) {
|
||||||
|
return "缓存已过期";
|
||||||
|
}
|
||||||
|
|
||||||
|
RoomInfoResp data = roomDataCache.get(roomId);
|
||||||
|
if (data == null) {
|
||||||
|
return "缓存数据为空";
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("已缓存 (%d秒前)", elapsed / 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -37,6 +37,7 @@ public class RoomMessageEvent {
|
|||||||
private UserInfo ToUserInfo;
|
private UserInfo ToUserInfo;
|
||||||
private List<UserInfo> ToUserInfos;
|
private List<UserInfo> ToUserInfos;
|
||||||
private GiftBean GiftInfo;
|
private GiftBean GiftInfo;
|
||||||
|
private List<GiftBean> GiftInfos;
|
||||||
private int room_up_pit_type;
|
private int room_up_pit_type;
|
||||||
private MusicSongBean songInfo;
|
private MusicSongBean songInfo;
|
||||||
private MusicSongBean nextInfo;
|
private MusicSongBean nextInfo;
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ public class UserBean implements Serializable {
|
|||||||
private String mobile;
|
private String mobile;
|
||||||
private int sex;
|
private int sex;
|
||||||
private int auth;
|
private int auth;
|
||||||
|
private int is_can_chat;//是否可以私聊,1:可以,0:不可以
|
||||||
|
private int can_chat_money;//需要充值的金额
|
||||||
|
|
||||||
private List<MultiUserBean> multi_user;
|
private List<MultiUserBean> multi_user;
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ public class UserInfo implements Serializable {
|
|||||||
private String red_status;
|
private String red_status;
|
||||||
private String gift_num;
|
private String gift_num;
|
||||||
|
|
||||||
|
private int is_can_chat;//是否可以私聊,1:可以,0:不可以
|
||||||
|
private int can_chat_money;//需要充值的金额
|
||||||
|
|
||||||
private RelationshipBean qinmi;
|
private RelationshipBean qinmi;
|
||||||
private RelationshipBean zhenai;
|
private RelationshipBean zhenai;
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ public class RoomSettingBean implements MultiItemEntity {
|
|||||||
public static final int QXRoomSettingTypeRoomCloseEffects = 25;
|
public static final int QXRoomSettingTypeRoomCloseEffects = 25;
|
||||||
/// 意见反馈
|
/// 意见反馈
|
||||||
public static final int QXRoomSettingTypeRoomReport = 26;
|
public static final int QXRoomSettingTypeRoomReport = 26;
|
||||||
|
public static final int QXRoomSettingTypeRoomFloatingScreen = 29;
|
||||||
|
|
||||||
public static final int ITEM_TYPE_DEFAULT = 0;
|
public static final int ITEM_TYPE_DEFAULT = 0;
|
||||||
public static final int ITEM_TYPE_WITH_ICON = 1;
|
public static final int ITEM_TYPE_WITH_ICON = 1;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.blankj.utilcode.util.LogUtils;
|
|||||||
import com.blankj.utilcode.util.ScreenUtils;
|
import com.blankj.utilcode.util.ScreenUtils;
|
||||||
import com.xscm.moduleutil.R;
|
import com.xscm.moduleutil.R;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.databinding.WebViewDialogBinding;
|
import com.xscm.moduleutil.databinding.WebViewDialogBinding;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||||
@@ -162,7 +163,9 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
|||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void jumpRoomPage(String room_id) {
|
public void jumpRoomPage(String room_id) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getContext(), room_id,"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", room_id).navigation();
|
||||||
}
|
}
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void jumpWebPage(String objects) {
|
public void jumpWebPage(String objects) {
|
||||||
|
|||||||
@@ -22,16 +22,20 @@ import androidx.core.content.ContextCompat;
|
|||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
import com.xscm.moduleutil.R;
|
import com.xscm.moduleutil.R;
|
||||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||||
import com.xscm.moduleutil.bean.GiftBean;
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
import com.xscm.moduleutil.bean.MqttXlhEnd;
|
import com.xscm.moduleutil.bean.MqttXlhEnd;
|
||||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||||
import com.xscm.moduleutil.bean.WalletBean;
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
|
import com.xscm.moduleutil.bean.XLHBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
import com.xscm.moduleutil.databinding.DialogGiftLotteryBinding;
|
import com.xscm.moduleutil.databinding.DialogGiftLotteryBinding;
|
||||||
|
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||||
import com.xscm.moduleutil.dialog.WebViewDialog;
|
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||||
import com.xscm.moduleutil.event.LotteryEvent;
|
import com.xscm.moduleutil.event.LotteryEvent;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
@@ -81,8 +85,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
private GiftCardView currentGiftCardView;
|
private GiftCardView currentGiftCardView;
|
||||||
private boolean isDrawing;//是否正在抽奖
|
private boolean isDrawing;//是否正在抽奖
|
||||||
private boolean isOpenSound;//是否开启音效
|
private boolean isOpenSound;//是否开启音效
|
||||||
private boolean isOpenSpecial;//是否开启特效
|
|
||||||
|
|
||||||
|
private boolean isOpenSpecial;//是否开启特效
|
||||||
private Handler handler;
|
private Handler handler;
|
||||||
private Runnable timerRunnable;//定时器
|
private Runnable timerRunnable;//定时器
|
||||||
private int startType;//类型,点击的事抽奖1次还是10次还是100次
|
private int startType;//类型,点击的事抽奖1次还是10次还是100次
|
||||||
@@ -145,7 +149,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
mBinding.mirroeSky.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
mBinding.mirroeSky.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||||
isOpenSound= check;
|
isOpenSound= check;//音效
|
||||||
if(!check){
|
if(!check){
|
||||||
stopPlay();
|
stopPlay();
|
||||||
}
|
}
|
||||||
@@ -154,7 +158,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
mBinding.cityTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
mBinding.cityTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||||
isOpenSound= check;
|
isOpenSound= check;//音效
|
||||||
if(!check){
|
if(!check){
|
||||||
stopPlay();
|
stopPlay();
|
||||||
}
|
}
|
||||||
@@ -163,7 +167,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
mBinding.pinnacleTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
mBinding.pinnacleTime.swLockYx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean check) {
|
||||||
isOpenSound= check;
|
isOpenSound= check;//音效
|
||||||
if(!check){
|
if(!check){
|
||||||
stopPlay();
|
stopPlay();
|
||||||
}
|
}
|
||||||
@@ -437,7 +441,8 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (id == R.id.exchange_layout) {
|
} else if (id == R.id.exchange_layout) {
|
||||||
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
// ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||||
|
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,13 +576,19 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
mBinding.pinnacleTime.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
|
mBinding.pinnacleTime.llHundred.setBackground(getResources().getDrawable(R.mipmap.chou_w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onMessageReceived(MqttXlhEnd event) {
|
public void onMessageReceived(MqttXlhEnd event) {
|
||||||
BlindBoxBean.XlhData xlhData =new BlindBoxBean.XlhData();
|
XLHBean xlhBean= GsonUtils.fromJson(event.getMessage(), XLHBean.class);
|
||||||
xlhData.setCurrent_num(0);
|
// if (xlhBean.getFrom_type()==3) {
|
||||||
xlhData.setCurrent_num(0);
|
// dismiss();
|
||||||
xlhData.setStatus(0);
|
// }
|
||||||
UpView(xlhData);
|
// BlindBoxBean.XlhData xlhData =new BlindBoxBean.XlhData();
|
||||||
|
if (xlhBean.getFrom_type()==3) {
|
||||||
|
xlhData.setCurrent_num(0);
|
||||||
|
xlhData.setStatus(0);
|
||||||
|
UpView(xlhData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/// 定时器
|
/// 定时器
|
||||||
public void startFastAnimate() {
|
public void startFastAnimate() {
|
||||||
@@ -661,6 +672,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
MvpPre.giftSend(blind_box_turntable_id);
|
MvpPre.giftSend(blind_box_turntable_id);
|
||||||
MvpPre.wallet();
|
MvpPre.wallet();
|
||||||
isDrawing = false;
|
isDrawing = false;
|
||||||
|
playSound("xuanz.mp3");
|
||||||
stopFastAnimate();
|
stopFastAnimate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -803,6 +815,11 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMessageReceived(BlindBoxBean.XlhData xlhData) {
|
||||||
|
UpView(xlhData);
|
||||||
|
}
|
||||||
|
|
||||||
public void UpView(BlindBoxBean.XlhData xlhData) {
|
public void UpView(BlindBoxBean.XlhData xlhData) {
|
||||||
if (xlhData != null) {
|
if (xlhData != null) {
|
||||||
this.xlhData = xlhData;
|
this.xlhData = xlhData;
|
||||||
@@ -897,17 +914,22 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
|||||||
MvpPre = new GiftLotteryPresenter(this, getActivity());
|
MvpPre = new GiftLotteryPresenter(this, getActivity());
|
||||||
}
|
}
|
||||||
MvpPre.wallet();
|
MvpPre.wallet();
|
||||||
isDrawing = false;
|
|
||||||
MvpPre.giftSend(blind_box_turntable_id);
|
MvpPre.giftSend(blind_box_turntable_id);
|
||||||
Log.e("isOpenSound===","isOpenSound1222"+isOpenSound);
|
Log.e("isOpenSound===","isOpenSound1222"+isOpenSound);
|
||||||
if (isOpenSpecial) {
|
if (isOpenSpecial) {//特效
|
||||||
Log.e("isOpenSound===","isOpenSound333"+isOpenSound);
|
Log.e("isOpenSound===","isOpenSound333"+isOpenSound);
|
||||||
startFastAnimate();
|
startFastAnimate();
|
||||||
}else{
|
}else{
|
||||||
if(isOpenSound){
|
if(isOpenSound){//音效
|
||||||
|
isDrawing = false;
|
||||||
playSound("xuanz.mp3");
|
playSound("xuanz.mp3");
|
||||||
|
}else {
|
||||||
|
isDrawing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
isDrawing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.xscm.moduleutil.bean.blindboxwheel.BlindBoxBean;
|
|||||||
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.BlindReslutBean;
|
||||||
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
import com.xscm.moduleutil.bean.blindboxwheel.XlhDrawBean;
|
||||||
import com.xscm.moduleutil.databinding.FragmentTourClubDialogBinding;
|
import com.xscm.moduleutil.databinding.FragmentTourClubDialogBinding;
|
||||||
|
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||||
import com.xscm.moduleutil.dialog.WebViewDialog;
|
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||||
import com.xscm.moduleutil.event.MqttBean;
|
import com.xscm.moduleutil.event.MqttBean;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
@@ -75,6 +76,14 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
|
|
||||||
private boolean isDrawing;//是否正在抽奖
|
private boolean isDrawing;//是否正在抽奖
|
||||||
|
|
||||||
|
|
||||||
|
// 添加自动滚动相关的成员变量
|
||||||
|
private Handler autoScrollHandler = new Handler();
|
||||||
|
private Runnable autoScrollRunnable;
|
||||||
|
private boolean isAutoScrolling = false;
|
||||||
|
private static final int AUTO_SCROLL_DELAY = 1000; // 1秒滚动一个item
|
||||||
|
private boolean vCheckbox=false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected GiftLotteryPresenter bindPresenter() {
|
protected GiftLotteryPresenter bindPresenter() {
|
||||||
return new GiftLotteryPresenter(this, getActivity());
|
return new GiftLotteryPresenter(this, getActivity());
|
||||||
@@ -146,8 +155,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
mBinding.tvBd.setOnClickListener(this::onClick);
|
mBinding.tvBd.setOnClickListener(this::onClick);
|
||||||
mBinding.tvJl.setOnClickListener(this::onClick);
|
mBinding.tvJl.setOnClickListener(this::onClick);
|
||||||
mBinding.exchangeLayout.setOnClickListener(this::onClick);
|
mBinding.exchangeLayout.setOnClickListener(this::onClick);
|
||||||
|
mBinding.vCheckbox.setOnClickListener(this::onClick);
|
||||||
|
|
||||||
giftXlhChouAdapter = new GiftXlhChouAdapter();
|
giftXlhChouAdapter = new GiftXlhChouAdapter();
|
||||||
// 使用 LinearLayoutManager 横向滚动
|
// 使用 LinearLayoutManager 横向滚动
|
||||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
|
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false);
|
||||||
@@ -173,10 +181,75 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
mBinding.recycleView.scrollToPosition(middlePosition);
|
mBinding.recycleView.scrollToPosition(middlePosition);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加自动滚动相关的方法
|
||||||
|
private void startAutoScroll() {
|
||||||
|
// 如果已经在自动滚动或数据为空,则不启动
|
||||||
|
if (isAutoScrolling || giftLists == null || giftLists.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isAutoScrolling = true;
|
||||||
|
autoScrollRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (isAutoScrolling && mBinding != null && mBinding.recycleView != null) {
|
||||||
|
// 获取当前显示的第一个可见item位置
|
||||||
|
LinearLayoutManager layoutManager = (LinearLayoutManager) mBinding.recycleView.getLayoutManager();
|
||||||
|
if (layoutManager != null) {
|
||||||
|
int currentPosition = layoutManager.findFirstVisibleItemPosition();
|
||||||
|
|
||||||
|
// 如果没有完全可见的item,使用第一个可见item
|
||||||
|
if (currentPosition == RecyclerView.NO_POSITION) {
|
||||||
|
currentPosition = layoutManager.findFirstVisibleItemPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果还是没有有效的position,从0开始
|
||||||
|
if (currentPosition == RecyclerView.NO_POSITION) {
|
||||||
|
currentPosition = 0;
|
||||||
|
}
|
||||||
|
// 计算下一个位置
|
||||||
|
int nextPosition = currentPosition + 1;
|
||||||
|
|
||||||
|
// 如果到达末尾,回到开始位置
|
||||||
|
if (nextPosition >= giftXlhChouAdapter.getItemCount()) {
|
||||||
|
nextPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 平滑滚动到下一个位置
|
||||||
|
mBinding.recycleView.smoothScrollToPosition(nextPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1秒后继续滚动
|
||||||
|
autoScrollHandler.postDelayed(this, AUTO_SCROLL_DELAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 开始自动滚动
|
||||||
|
autoScrollHandler.postDelayed(autoScrollRunnable, AUTO_SCROLL_DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void stopAutoScroll() {
|
||||||
|
isAutoScrolling = false;
|
||||||
|
if (autoScrollRunnable != null) {
|
||||||
|
autoScrollHandler.removeCallbacks(autoScrollRunnable);
|
||||||
|
autoScrollRunnable = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在抽奖结束后重新启动自动滚动
|
||||||
|
private void resumeAutoScrollAfterLottery() {
|
||||||
|
// 延迟一段时间后再启动自动滚动,让用户看到抽奖结果
|
||||||
|
mBinding.recycleView.postDelayed(() -> {
|
||||||
|
if (isVisible() && !isDrawing) {
|
||||||
|
startAutoScroll();
|
||||||
|
}
|
||||||
|
}, 3000); // 3秒后重新开始自动滚动
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void onClick(View view) {
|
private void onClick(View view) {
|
||||||
int id = view.getId();
|
int id = view.getId();
|
||||||
if (id == R.id.tv_jc) {
|
if (id == R.id.tv_jc) {
|
||||||
@@ -240,7 +313,11 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
xlhRecordDialog = XlhRecordDialog.newInstance(roomId);
|
xlhRecordDialog = XlhRecordDialog.newInstance(roomId);
|
||||||
xlhRecordDialog.show(getChildFragmentManager(), "XlhRecordDialog");
|
xlhRecordDialog.show(getChildFragmentManager(), "XlhRecordDialog");
|
||||||
} else if (id == R.id.exchange_layout) {//钻石兑换
|
} else if (id == R.id.exchange_layout) {//钻石兑换
|
||||||
ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
// ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||||
|
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
|
||||||
|
}else if (id==R.id.v_checkbox){
|
||||||
|
mBinding.vCheckbox.setSelected(!mBinding.vCheckbox.isSelected());
|
||||||
|
vCheckbox=mBinding.vCheckbox.isSelected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,12 +365,24 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
}
|
}
|
||||||
|
|
||||||
giftXlhChouAdapter.setNewData(giftLists);
|
giftXlhChouAdapter.setNewData(giftLists);
|
||||||
|
// // 数据加载完成后启动自动滚动
|
||||||
|
// if (giftLists != null && !giftLists.isEmpty()) {
|
||||||
|
// mBinding.recycleView.post(() -> {
|
||||||
|
// // 确保在UI线程中启动自动滚动
|
||||||
|
// startAutoScroll();
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
|
||||||
|
}else {
|
||||||
|
isDrawing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mboxPrice;
|
||||||
|
|
||||||
// TODO: 2025/9/4 设置底部按钮文字
|
// TODO: 2025/9/4 设置底部按钮文字
|
||||||
private void upTitle(int boxPrice) {
|
private void upTitle(int boxPrice) {
|
||||||
|
this.mboxPrice = boxPrice;
|
||||||
mBinding.tvOne.setText(boxPrice + "币一次");
|
mBinding.tvOne.setText(boxPrice + "币一次");
|
||||||
mBinding.tvTen.setText((boxPrice * 10) + "币十次");
|
mBinding.tvTen.setText((boxPrice * 10) + "币十次");
|
||||||
mBinding.tvHundred.setText((boxPrice * 100) + "币百次");
|
mBinding.tvHundred.setText((boxPrice * 100) + "币百次");
|
||||||
@@ -309,9 +398,15 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
mBinding.tvGiftCount.setText(message.getText().getGift_num() != null ? message.getText().getGift_num() : "0");
|
mBinding.tvGiftCount.setText(message.getText().getGift_num() != null ? message.getText().getGift_num() : "0");
|
||||||
mBinding.userName.setText(message.getText().getFromUserInfo().getNickname() != null ? message.getText().getFromUserInfo().getNickname() : "");
|
mBinding.userName.setText(message.getText().getFromUserInfo().getNickname() != null ? message.getText().getFromUserInfo().getNickname() : "");
|
||||||
ImageUtils.loadHeadCC(message.getText().getFromUserInfo().getAvatar(), mBinding.userPic);
|
ImageUtils.loadHeadCC(message.getText().getFromUserInfo().getAvatar(), mBinding.userPic);
|
||||||
|
isDrawing=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onMessageReceived(RoomMessageEvent event) {
|
||||||
|
onMusicPlay( event);
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onMessageReceived(MqttXlhEnd event) {
|
public void onMessageReceived(MqttXlhEnd event) {
|
||||||
dismiss();
|
dismiss();
|
||||||
@@ -429,6 +524,9 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
||||||
xlhObtainDialog.dismiss();
|
xlhObtainDialog.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopAutoScroll();
|
||||||
|
autoScrollHandler.removeCallbacksAndMessages(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -452,10 +550,37 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int icon;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void wallet(WalletBean walletBean) {
|
public void wallet(WalletBean walletBean) {
|
||||||
if (walletBean != null) {
|
if (walletBean != null) {
|
||||||
mBinding.tvIcon.setText(walletBean.getCoin());
|
icon = (int) Double.parseDouble(
|
||||||
|
(walletBean.getCoin() != null && !walletBean.getCoin().isEmpty())
|
||||||
|
? walletBean.getCoin()
|
||||||
|
: "0"
|
||||||
|
);
|
||||||
|
mBinding.tvIcon.setText(walletBean.getCoin()!=null && !walletBean.getCoin().isEmpty() ?walletBean.getCoin():"0");
|
||||||
|
showView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showView() {
|
||||||
|
if (icon>=mboxPrice){
|
||||||
|
mBinding.llOne.setClickable( true);
|
||||||
|
}else {
|
||||||
|
mBinding.llOne.setClickable( false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (icon>=mboxPrice*10){
|
||||||
|
mBinding.llTen.setClickable( true);
|
||||||
|
}else {
|
||||||
|
mBinding.llTen.setClickable( false);
|
||||||
|
}
|
||||||
|
if (icon>=mboxPrice*100){
|
||||||
|
mBinding.llHundred.setClickable( true);
|
||||||
|
}else {
|
||||||
|
mBinding.llHundred.setClickable( false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,74 +590,85 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
@Override
|
@Override
|
||||||
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
public void xlhChouSuccess(List<XlhDrawBean> data) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
if (vCheckbox){
|
||||||
|
showResultDialog(data);
|
||||||
|
}else {
|
||||||
|
// showResultDialog(data);
|
||||||
|
|
||||||
showResultDialog(data);
|
// 取消之前可能存在的任务
|
||||||
|
clearPendingTasks();
|
||||||
|
// 抽奖完成后执行动画滚动
|
||||||
|
pendingLotteryRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// 清理之前的状态
|
||||||
|
if (giftXlhChouAdapter != null) {
|
||||||
|
giftXlhChouAdapter.clearSelection();
|
||||||
|
}
|
||||||
|
int winningPosition = findHighestValueWinningPosition(data);//这是获取到的中奖位置下标
|
||||||
|
if (winningPosition != -1) {
|
||||||
|
if (scrollHelper == null) {
|
||||||
|
scrollHelper = new CenterScrollHelper(mBinding.recycleView);
|
||||||
|
}
|
||||||
|
|
||||||
// 取消之前可能存在的任务
|
// 计算在循环列表中的目标位置(滚动几圈后停在目标位置)
|
||||||
// clearPendingTasks();
|
int loopCount = 4; // 滚动4圈
|
||||||
// // 抽奖完成后执行动画滚动
|
int originalSize = giftLists.size();///这是列表的总大小
|
||||||
// pendingLotteryRunnable = new Runnable() {
|
// 计算目标在循环列表中的位置(确保在中间区域)
|
||||||
// @Override
|
///这是计算总圈数的大小
|
||||||
// public void run() {
|
int middleBaseIndex = (loopCount * originalSize);
|
||||||
// // 清理之前的状态
|
///这里是展示在中奖的位置,加上总圈数的大小,
|
||||||
// if (giftXlhChouAdapter != null) {
|
int targetLoopIndex = middleBaseIndex + (winningPosition % originalSize);
|
||||||
// giftXlhChouAdapter.clearSelection();
|
|
||||||
// }
|
|
||||||
// int winningPosition = findHighestValueWinningPosition(data);//这是获取到的中奖位置下标
|
|
||||||
// if (winningPosition != -1) {
|
|
||||||
// if (scrollHelper == null) {
|
|
||||||
// scrollHelper = new CenterScrollHelper(mBinding.recycleView);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 计算在循环列表中的目标位置(滚动几圈后停在目标位置)
|
|
||||||
// int loopCount = 4; // 滚动4圈
|
|
||||||
// int originalSize = giftLists.size();///这是列表的总大小
|
|
||||||
// // 计算目标在循环列表中的位置(确保在中间区域)
|
|
||||||
// ///这是计算总圈数的大小
|
|
||||||
// int middleBaseIndex = (loopCount * originalSize);
|
|
||||||
// ///这里是展示在中奖的位置,加上总圈数的大小,
|
|
||||||
// int targetLoopIndex = middleBaseIndex + (winningPosition % originalSize);
|
|
||||||
//
|
|
||||||
// // 使用scrollWithCircles方法执行带动画的滚动(带完成回调)
|
|
||||||
// scrollHelper.scrollWithCircles(
|
|
||||||
// targetLoopIndex, // 在循环列表中的位置
|
|
||||||
// loopCount, // 滚动圈数
|
|
||||||
// 200, // 每个item滚动时间200ms(控制速度)
|
|
||||||
// originalSize, // 原始数据大小
|
|
||||||
// () -> { // 滚动完成回调
|
|
||||||
// // 滚动完成后更新选中状态(使用原始位置)
|
|
||||||
// if (giftXlhChouAdapter != null) {
|
|
||||||
// giftXlhChouAdapter.setSelectedPosition(winningPosition);
|
|
||||||
// }
|
|
||||||
// // 滚动完成后延迟一小段时间再居中,确保UI更新完成
|
|
||||||
// pendingCenteringRunnable = new Runnable() {
|
|
||||||
// @Override
|
|
||||||
// public void run() {
|
|
||||||
// // 手动将选中项居中
|
|
||||||
// centerSelectedItem(winningPosition, originalSize);
|
|
||||||
//
|
|
||||||
// // 显示结果对话框
|
|
||||||
// getActivity().runOnUiThread(() -> {
|
|
||||||
// scrollHelper = null;
|
|
||||||
// showResultDialog(data);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// mBinding.recycleView.postDelayed(pendingCenteringRunnable, 100);
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// } else {
|
|
||||||
// // 如果没有找到中奖位置,直接显示对话框
|
|
||||||
// showResultDialog(data);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// mBinding.recycleView.postDelayed(pendingLotteryRunnable, 300);
|
|
||||||
|
|
||||||
|
// 使用scrollWithCircles方法执行带动画的滚动(带完成回调)
|
||||||
|
scrollHelper.scrollWithCircles(
|
||||||
|
targetLoopIndex, // 在循环列表中的位置
|
||||||
|
loopCount, // 滚动圈数
|
||||||
|
1000, // 每个item滚动时间200ms(控制速度)
|
||||||
|
originalSize, // 原始数据大小
|
||||||
|
() -> { // 滚动完成回调
|
||||||
|
// 滚动完成后更新选中状态(使用原始位置)
|
||||||
|
if (giftXlhChouAdapter != null) {
|
||||||
|
giftXlhChouAdapter.setSelectedPosition(winningPosition);
|
||||||
|
}
|
||||||
|
// 滚动完成后延迟一小段时间再居中,确保UI更新完成
|
||||||
|
pendingCenteringRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// 手动将选中项居中
|
||||||
|
centerSelectedItem(winningPosition, originalSize);
|
||||||
|
|
||||||
|
// 显示结果对话框
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
scrollHelper = null;
|
||||||
|
showResultDialog(data);
|
||||||
|
// 抽奖结束后重新启动自动滚动
|
||||||
|
// resumeAutoScrollAfterLottery();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mBinding.recycleView.postDelayed(pendingCenteringRunnable, 1000);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 如果没有找到中奖位置,直接显示对话框
|
||||||
|
showResultDialog(data);
|
||||||
|
// 抽奖结束后重新启动自动滚动
|
||||||
|
// resumeAutoScrollAfterLottery();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
mBinding.recycleView.postDelayed(pendingLotteryRunnable, 1000);
|
||||||
|
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
isDrawing=false;
|
||||||
|
// 抽奖失败也重新启动自动滚动
|
||||||
|
// resumeAutoScrollAfterLottery();
|
||||||
}
|
}
|
||||||
MvpPre.wallet();
|
MvpPre.wallet();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -540,6 +676,10 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
* 为新的抽奖做准备,清理之前的状态
|
* 为新的抽奖做准备,清理之前的状态
|
||||||
*/
|
*/
|
||||||
private void prepareForNewLottery() {
|
private void prepareForNewLottery() {
|
||||||
|
|
||||||
|
// 停止自动滚动
|
||||||
|
stopAutoScroll();
|
||||||
|
|
||||||
// 取消之前可能存在的任务
|
// 取消之前可能存在的任务
|
||||||
clearPendingTasks();
|
clearPendingTasks();
|
||||||
|
|
||||||
@@ -843,6 +983,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
|||||||
public void onCloseClick() {
|
public void onCloseClick() {
|
||||||
// 处理关闭点击事件
|
// 处理关闭点击事件
|
||||||
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
if (xlhObtainDialog != null && xlhObtainDialog.isShowing()) {
|
||||||
|
isDrawing = false;
|
||||||
xlhObtainDialog.dismiss();
|
xlhObtainDialog.dismiss();
|
||||||
}
|
}
|
||||||
xlhObtainDialog = null;
|
xlhObtainDialog = null;
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.xscm.moduleutil.event;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*@author qx
|
||||||
|
*@data 2025/9/22
|
||||||
|
*@description: 关闭飘屏
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class FloatingScreenEvent {
|
||||||
|
private boolean floatingScreen;
|
||||||
|
}
|
||||||
@@ -9,8 +9,10 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class UnreadCountEvent {
|
public class UnreadCountEvent {
|
||||||
private long aLong;
|
private long aLong;
|
||||||
|
private long bLong;
|
||||||
|
|
||||||
public UnreadCountEvent(long aLong) {
|
public UnreadCountEvent(long aLong, long bLong) {
|
||||||
this.aLong = aLong;
|
this.aLong = aLong;
|
||||||
|
this.bLong = bLong;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,7 +477,7 @@ public interface ApiServer {
|
|||||||
|
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Constants.JOIN_ROOM)
|
@POST(Constants.JOIN_ROOM)
|
||||||
Observable<BaseModel<RoomInfoResp>> roomGetIn(@Field("room_id") String roomId, @Field("password") String password);
|
Call<BaseModel<RoomInfoResp>> roomGetIn(@Field("room_id") String roomId, @Field("password") String password);
|
||||||
|
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@POST(Constants.DELETE_ALBUM_IMAGE)
|
@POST(Constants.DELETE_ALBUM_IMAGE)
|
||||||
@@ -777,4 +777,8 @@ public interface ApiServer {
|
|||||||
@GET(Constants.GET_GIFT_PACK_LIST_COUNT)
|
@GET(Constants.GET_GIFT_PACK_LIST_COUNT)
|
||||||
Call<BaseModel<GiftPackListCount>> getGiftPackListCount();
|
Call<BaseModel<GiftPackListCount>> getGiftPackListCount();
|
||||||
|
|
||||||
|
@FormUrlEncoded
|
||||||
|
@POST(Constants.ROOM_USER_RECONNECT)
|
||||||
|
Observable<BaseModel<String>> roomUserReconnect(@Field("room_id") String room_id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
|
|||||||
return adapter.fromJson(json);
|
return adapter.fromJson(json);
|
||||||
} else {
|
} else {
|
||||||
if(!info.contains("更新失败")) {
|
if(!info.contains("更新失败")) {
|
||||||
ToastUtils.showShort(info);
|
// ToastUtils.showShort(info);
|
||||||
}
|
}
|
||||||
// throw new APIException(obj.getCode(), info);
|
// throw new APIException(obj.getCode(), info);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ import com.xscm.moduleutil.bean.room.RoomBean;
|
|||||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
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.bean.zhuangb.ZhuangBanShangChengBean;
|
import com.xscm.moduleutil.bean.zhuangb.ZhuangBanShangChengBean;
|
||||||
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
import com.xscm.moduleutil.utils.SystemUtils;
|
import com.xscm.moduleutil.utils.SystemUtils;
|
||||||
import com.xscm.moduleutil.utils.logger.DataLogger;
|
import com.xscm.moduleutil.utils.logger.DataLogger;
|
||||||
@@ -101,6 +102,7 @@ import java.security.SecureRandom;
|
|||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.EventListener;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -518,6 +520,10 @@ public class RetrofitClient {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void roomUserReconnect(String roomId){
|
||||||
|
sApiServer.roomUserReconnect(roomId).compose(new DefaultTransformer<>()).subscribe();
|
||||||
|
}
|
||||||
|
|
||||||
public void tasksLihen(BaseObserver<GiftBoxBean> observer) {
|
public void tasksLihen(BaseObserver<GiftBoxBean> observer) {
|
||||||
sApiServer.tasksLihen().enqueue(new Callback<ResponseBody>() {
|
sApiServer.tasksLihen().enqueue(new Callback<ResponseBody>() {
|
||||||
@Override
|
@Override
|
||||||
@@ -1096,7 +1102,25 @@ public class RetrofitClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void roomGetIn(String roomId, String password, BaseObserver<RoomInfoResp> observer) {
|
public void roomGetIn(String roomId, String password, BaseObserver<RoomInfoResp> observer) {
|
||||||
sApiServer.roomGetIn(roomId, password).compose(new DefaultTransformer<>()).subscribe(observer);
|
sApiServer.roomGetIn(roomId, password).enqueue(new Callback<BaseModel<RoomInfoResp>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<BaseModel<RoomInfoResp>> call, Response<BaseModel<RoomInfoResp>> response) {
|
||||||
|
if (response.code() == 200){
|
||||||
|
BaseModel<RoomInfoResp> roomInfoRespBaseModel = response.body();
|
||||||
|
if (roomInfoRespBaseModel.getCode()==1){
|
||||||
|
observer.onNext(roomInfoRespBaseModel.getData());
|
||||||
|
}else {
|
||||||
|
MessageListenerSingleton.getInstance().quitGroup(roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<BaseModel<RoomInfoResp>> call, Throwable t) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePassword(String roomId, String password, BaseObserver<String> observer) {
|
public void updatePassword(String roomId, String password, BaseObserver<String> observer) {
|
||||||
@@ -1231,7 +1255,12 @@ public class RetrofitClient {
|
|||||||
public void onResponse(Call<BaseModel<RoomAuction.AuctionListBean>> call, Response<BaseModel<RoomAuction.AuctionListBean>> response) {
|
public void onResponse(Call<BaseModel<RoomAuction.AuctionListBean>> call, Response<BaseModel<RoomAuction.AuctionListBean>> response) {
|
||||||
if (response.code() == 200){
|
if (response.code() == 200){
|
||||||
BaseModel<RoomAuction.AuctionListBean> baseModel = response.body();
|
BaseModel<RoomAuction.AuctionListBean> baseModel = response.body();
|
||||||
observer.onNext(baseModel.getData());
|
|
||||||
|
if (baseModel.getCode()==1) {
|
||||||
|
observer.onNext(baseModel.getData());
|
||||||
|
}else {
|
||||||
|
ToastUtils.showShort(baseModel.getMsg());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1550,7 +1579,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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2333,12 +2362,15 @@ public class RetrofitClient {
|
|||||||
|
|
||||||
} else if (code == 301) {
|
} else if (code == 301) {
|
||||||
try {
|
try {
|
||||||
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
// com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||||
|
ToastUtils.showShort(string.getMsg());
|
||||||
CommonAppContext.getInstance().clearLoginInfo();
|
CommonAppContext.getInstance().clearLoginInfo();
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
ToastUtils.showShort(string.getMsg());
|
ToastUtils.showShort(string.getMsg());
|
||||||
|
}else {
|
||||||
|
ToastUtils.showShort(string.getMsg());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2351,7 +2383,11 @@ public class RetrofitClient {
|
|||||||
public void onResponse(Call<BaseModel<BlindBoxBean>> call, Response<BaseModel<BlindBoxBean>> response) {
|
public void onResponse(Call<BaseModel<BlindBoxBean>> call, Response<BaseModel<BlindBoxBean>> response) {
|
||||||
if (response.code() == 200) {
|
if (response.code() == 200) {
|
||||||
BaseModel<BlindBoxBean> baseModel = response.body();
|
BaseModel<BlindBoxBean> baseModel = response.body();
|
||||||
observer.onNext(baseModel.getData());
|
if (baseModel.getCode()==1) {
|
||||||
|
observer.onNext(baseModel.getData());
|
||||||
|
}else {
|
||||||
|
observer.onNext(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2392,6 +2428,7 @@ public class RetrofitClient {
|
|||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
observer.onNext(null);
|
observer.onNext(null);
|
||||||
|
ToastUtils.showShort(baseModel.getMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2412,7 +2449,12 @@ public class RetrofitClient {
|
|||||||
public void onResponse(Call<BaseModel<BlindReslutBean>> call, Response<BaseModel<BlindReslutBean>> response) {
|
public void onResponse(Call<BaseModel<BlindReslutBean>> call, Response<BaseModel<BlindReslutBean>> response) {
|
||||||
if (response.code() == 200) {
|
if (response.code() == 200) {
|
||||||
BaseModel<BlindReslutBean> baseModel = response.body();
|
BaseModel<BlindReslutBean> baseModel = response.body();
|
||||||
observer.onNext(baseModel.getData());
|
if (baseModel.getCode()==1) {
|
||||||
|
observer.onNext(baseModel.getData());
|
||||||
|
}else {
|
||||||
|
observer.onNext(null);
|
||||||
|
ToastUtils.showShort(baseModel.getMsg());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
package com.xscm.moduleutil.listener;
|
package com.xscm.moduleutil.listener;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.GsonUtils;
|
import com.blankj.utilcode.util.GsonUtils;
|
||||||
@@ -29,6 +32,10 @@ import org.greenrobot.eventbus.EventBus;
|
|||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author qx
|
* @author qx
|
||||||
@@ -46,6 +53,16 @@ public class MessageListenerSingleton {
|
|||||||
private V2TIMGroupListener groupListener;
|
private V2TIMGroupListener groupListener;
|
||||||
private V2TIMConversationListener conversationListener; // 需要保存引用
|
private V2TIMConversationListener conversationListener; // 需要保存引用
|
||||||
|
|
||||||
|
// 添加操作状态标记
|
||||||
|
private volatile boolean isGroupOperationInProgress = false;
|
||||||
|
private final Object groupOperationLock = new Object();
|
||||||
|
private Handler mainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
// 添加消息缓存机制
|
||||||
|
private static final int MAX_CACHED_MESSAGES = 20;
|
||||||
|
private final Map<String, List<RoomMessageEvent>> cachedMessages = new ConcurrentHashMap<>();
|
||||||
|
private final Set<String> joinedRooms = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// private boolean listenersAdded = false; // 标记监听器是否已添加
|
// private boolean listenersAdded = false; // 标记监听器是否已添加
|
||||||
// 1. 添加新的监听器接口
|
// 1. 添加新的监听器接口
|
||||||
public interface PublicScreenMessageListener {
|
public interface PublicScreenMessageListener {
|
||||||
@@ -79,44 +96,293 @@ public class MessageListenerSingleton {
|
|||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改 joinGroup 方法
|
/**
|
||||||
public void joinGroup(String roomId) {
|
* 缓存消息(用于在Fragment未准备好时存储消息)
|
||||||
|
*/
|
||||||
LogUtils.e("@@@", "加入房间的"+roomId);
|
private void cacheMessage(String roomId, RoomMessageEvent message) {
|
||||||
|
if (TextUtils.isEmpty(roomId) || message == null) {
|
||||||
if (groupId!=null){
|
return;
|
||||||
quitGroup(groupId);
|
|
||||||
}
|
}
|
||||||
// 确保监听器已初始化并添加
|
// 标记该房间有待处理的消息
|
||||||
ensureListenersAdded();
|
List<RoomMessageEvent> roomMessages = cachedMessages.computeIfAbsent(roomId, k -> new ArrayList<>());
|
||||||
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
|
||||||
// t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
|
||||||
// notifyMessageReceived(new RoomMessageEvent(1000, mRoomId, t));
|
|
||||||
V2TIMManager.getInstance().joinGroup("room" + roomId, "申请加入", new V2TIMCallback() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess() {
|
|
||||||
Log.d("@@@", "加入im群组成功:");
|
|
||||||
groupId = roomId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// 限制每个房间的缓存消息数量
|
||||||
public void onError(int code, String desc) {
|
if (roomMessages.size() >= MAX_CACHED_MESSAGES) {
|
||||||
Log.d("@@@", "加入群组失败:" + code + "=" + desc);
|
roomMessages.remove(0); // 移除最旧的消息
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (tempGroupJoinListener == null) {
|
roomMessages.add(message);
|
||||||
tempGroupJoinListener = new OnMessageReceivedListener() {
|
LogUtils.d("MessageListener", "缓存消息: roomId=" + roomId + ", msgType=" + message.getMsgType());
|
||||||
@Override
|
}
|
||||||
public void onMessageReceived(RoomMessageEvent message) {
|
|
||||||
// 处理消息
|
|
||||||
|
|
||||||
}
|
/**
|
||||||
};
|
* 获取并清除指定房间的缓存消息
|
||||||
addOnMessageReceivedListener(tempGroupJoinListener);
|
*/
|
||||||
|
public List<RoomMessageEvent> getAndClearCachedMessages(String roomId) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RoomMessageEvent> messages = cachedMessages.remove(roomId);
|
||||||
|
if (messages == null) {
|
||||||
|
messages = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtils.d("MessageListener", "获取并清除缓存消息: roomId=" + roomId + ", count=" + messages.size());
|
||||||
|
return messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标记房间已加入
|
||||||
|
*/
|
||||||
|
public void markRoomJoined(String roomId) {
|
||||||
|
if (!TextUtils.isEmpty(roomId)) {
|
||||||
|
joinedRooms.add(roomId);
|
||||||
|
LogUtils.d("MessageListener", "标记房间已加入: " + roomId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查房间是否已加入
|
||||||
|
*/
|
||||||
|
public boolean isRoomJoined(String roomId) {
|
||||||
|
return !TextUtils.isEmpty(roomId) && joinedRooms.contains(roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除房间加入标记
|
||||||
|
*/
|
||||||
|
public void clearRoomJoined(String roomId) {
|
||||||
|
if (!TextUtils.isEmpty(roomId)) {
|
||||||
|
joinedRooms.remove(roomId);
|
||||||
|
LogUtils.d("MessageListener", "清除房间加入标记: " + roomId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 修改 joinGroup 方法
|
||||||
|
// public void joinGroup(String roomId) {
|
||||||
|
// if (TextUtils.isEmpty(roomId)) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 使用同步块确保操作的原子性
|
||||||
|
// synchronized (groupOperationLock) {
|
||||||
|
// if (isGroupOperationInProgress) {
|
||||||
|
// // 如果有操作正在进行,延迟执行
|
||||||
|
// mainHandler.removeCallbacksAndMessages(null);
|
||||||
|
// mainHandler.postDelayed(() -> joinGroup(roomId), 100);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// isGroupOperationInProgress = true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // 在新线程中执行操作
|
||||||
|
// new Thread(() -> {
|
||||||
|
// try {
|
||||||
|
// // 先退出当前群组
|
||||||
|
// if (groupId != null && !groupId.equals(roomId)) {
|
||||||
|
// try {
|
||||||
|
// quitGroup(groupId);
|
||||||
|
// // 执行退出操作
|
||||||
|
// // TIMGroupManager.getInstance().quitGroup(groupId);
|
||||||
|
// LogUtils.d("MessageListener", "退出群组: " + groupId);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LogUtils.e("MessageListener", "退出群组失败: " + e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 等待一小段时间确保退出完成
|
||||||
|
// Thread.sleep(500);
|
||||||
|
//
|
||||||
|
// // 加入新群组
|
||||||
|
// try {
|
||||||
|
// // 执行加入操作
|
||||||
|
//
|
||||||
|
// ensureListenersAdded();
|
||||||
|
// V2TIMManager.getInstance().joinGroup("room" + roomId, "申请加入", new V2TIMCallback() {
|
||||||
|
// @Override
|
||||||
|
// public void onSuccess() {
|
||||||
|
// Log.d("@@@", "加入im群组成功:");
|
||||||
|
//
|
||||||
|
// groupId = roomId;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void onError(int code, String desc) {
|
||||||
|
// Log.d("@@@", "加入群组失败:" + code + "=" + desc);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// groupId = roomId;
|
||||||
|
// LogUtils.d("MessageListener", "加入群组: " + roomId);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// LogUtils.e("MessageListener", "加入群组失败: " + e.getMessage());
|
||||||
|
// }
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// Thread.currentThread().interrupt();
|
||||||
|
// } finally {
|
||||||
|
// synchronized (groupOperationLock) {
|
||||||
|
// isGroupOperationInProgress = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }).start();
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// LogUtils.e("@@@", "加入房间的"+roomId);
|
||||||
|
//// if (groupId!=null){
|
||||||
|
//// quitGroup(groupId);
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// // 确保监听器已初始化并添加
|
||||||
|
//// ensureListenersAdded();
|
||||||
|
//// V2TIMManager.getInstance().joinGroup("room" + roomId, "申请加入", new V2TIMCallback() {
|
||||||
|
//// @Override
|
||||||
|
//// public void onSuccess() {
|
||||||
|
//// Log.d("@@@", "加入im群组成功:");
|
||||||
|
////
|
||||||
|
//// groupId = roomId;
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// @Override
|
||||||
|
//// public void onError(int code, String desc) {
|
||||||
|
//// Log.d("@@@", "加入群组失败:" + code + "=" + desc);
|
||||||
|
//// }
|
||||||
|
//// });
|
||||||
|
//
|
||||||
|
// if (tempGroupJoinListener == null) {
|
||||||
|
// tempGroupJoinListener = new OnMessageReceivedListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onMessageReceived(RoomMessageEvent message) {
|
||||||
|
// // 处理消息
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// addOnMessageReceivedListener(tempGroupJoinListener);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 修改 joinGroup 方法,确保先退出再加入
|
||||||
|
public void joinGroup(String roomId) {
|
||||||
|
if (TextUtils.isEmpty(roomId)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronized (groupOperationLock) {
|
||||||
|
if (isGroupOperationInProgress) {
|
||||||
|
// 如果有操作正在进行,延迟执行
|
||||||
|
mainHandler.removeCallbacksAndMessages(null);
|
||||||
|
mainHandler.postDelayed(() -> joinGroup(roomId), 100);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
isGroupOperationInProgress = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
// 先退出当前群组(如果需要)
|
||||||
|
if (groupId != null && !groupId.equals(roomId)) {
|
||||||
|
LogUtils.d("MessageListener", "开始退出群组: " + groupId);
|
||||||
|
CountDownLatch quitLatch = new CountDownLatch(1);
|
||||||
|
boolean[] quitSuccess = {false};
|
||||||
|
|
||||||
|
try {
|
||||||
|
V2TIMManager.getInstance().quitGroup("room" + groupId, new V2TIMCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
LogUtils.d("MessageListener", "退出群组成功: " + groupId);
|
||||||
|
quitSuccess[0] = true;
|
||||||
|
quitLatch.countDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String desc) {
|
||||||
|
LogUtils.e("MessageListener", "退出群组失败: " + groupId + ", code=" + code + ", desc=" + desc);
|
||||||
|
quitSuccess[0] = false;
|
||||||
|
quitLatch.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 等待退出操作完成,最多等待3秒
|
||||||
|
try {
|
||||||
|
quitLatch.await(3, java.util.concurrent.TimeUnit.SECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("MessageListener", "退出群组异常: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待一段时间确保退出完成
|
||||||
|
try {
|
||||||
|
Thread.sleep(200);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加入新群组
|
||||||
|
LogUtils.d("MessageListener", "开始加入群组: " + roomId);
|
||||||
|
CountDownLatch joinLatch = new CountDownLatch(1);
|
||||||
|
boolean[] joinSuccess = {false};
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 确保监听器已添加
|
||||||
|
ensureListenersAdded();
|
||||||
|
|
||||||
|
V2TIMManager.getInstance().joinGroup("room" + roomId, "申请加入", new V2TIMCallback() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess() {
|
||||||
|
LogUtils.d("MessageListener", "加入im群组成功: " + roomId);
|
||||||
|
joinSuccess[0] = true;
|
||||||
|
groupId = roomId;
|
||||||
|
joinLatch.countDown();
|
||||||
|
// 标记房间已加入
|
||||||
|
markRoomJoined(roomId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// // 发送加入成功的事件
|
||||||
|
// mainHandler.post(() -> {
|
||||||
|
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||||
|
// t.setText("成功加入房间");
|
||||||
|
// notifyMessageReceived(new RoomMessageEvent(1000, roomId, t));
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String desc) {
|
||||||
|
LogUtils.e("MessageListener", "加入群组失败: " + roomId + ", code=" + code + ", desc=" + desc);
|
||||||
|
joinSuccess[0] = false;
|
||||||
|
joinLatch.countDown();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 等待加入操作完成,最多等待3秒
|
||||||
|
try {
|
||||||
|
joinLatch.await(3, java.util.concurrent.TimeUnit.SECONDS);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
LogUtils.e("MessageListener", "加入群组异常: " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtils.d("MessageListener", "群组操作完成 - 退出成功: " + (groupId == null || !groupId.equals(roomId)) + ", 加入成功: " + joinSuccess[0]);
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
synchronized (groupOperationLock) {
|
||||||
|
isGroupOperationInProgress = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void initListeners() {
|
private void initListeners() {
|
||||||
// 简单消息监听器
|
// 简单消息监听器
|
||||||
if (simpleMsgListener == null) {
|
if (simpleMsgListener == null) {
|
||||||
@@ -246,7 +512,7 @@ public class MessageListenerSingleton {
|
|||||||
@Override
|
@Override
|
||||||
public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
|
public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
|
||||||
super.onTotalUnreadMessageCountChanged(totalUnreadCount);
|
super.onTotalUnreadMessageCountChanged(totalUnreadCount);
|
||||||
EventBus.getDefault().post(new UnreadCountEvent(totalUnreadCount));
|
EventBus.getDefault().post(new UnreadCountEvent(totalUnreadCount,0));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -297,28 +563,27 @@ public class MessageListenerSingleton {
|
|||||||
// 修改 quitGroup 方法
|
// 修改 quitGroup 方法
|
||||||
public static void quitGroup(String mRoomId) {
|
public static void quitGroup(String mRoomId) {
|
||||||
|
|
||||||
if (instance != null) {
|
|
||||||
instance.listeners.clear();
|
|
||||||
removeAllListeners();
|
|
||||||
isInitialized = false;
|
|
||||||
groupId=null;
|
|
||||||
// instance = null;
|
|
||||||
LogUtils.e("@@@","重置成功");
|
|
||||||
}
|
|
||||||
|
|
||||||
V2TIMManager.getInstance().quitGroup("room" + mRoomId, new V2TIMCallback() {
|
V2TIMManager.getInstance().quitGroup("room" + mRoomId, new V2TIMCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess() {
|
public void onSuccess() {
|
||||||
LogUtils.d("@@@","退出群组成功"+mRoomId);
|
LogUtils.d("@@@", "退出群组成功" + mRoomId);
|
||||||
// removeAllListeners(); // 移除所有监听器
|
// removeAllListeners(); // 移除所有监听器
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(int code, String desc) {
|
public void onError(int code, String desc) {
|
||||||
LogUtils.d("@@@","退出群组失败"+mRoomId, code, desc);
|
LogUtils.d("@@@", "退出群组失败" + mRoomId, code, desc);
|
||||||
// removeAllListeners(); // 即使失败也移除监听器
|
// removeAllListeners(); // 即使失败也移除监听器
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (instance != null) {
|
||||||
|
instance.listeners.clear();
|
||||||
|
removeAllListeners();
|
||||||
|
isInitialized = false;
|
||||||
|
groupId = null;
|
||||||
|
LogUtils.e("@@@", "重置成功");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改 reset 方法
|
// 修改 reset 方法
|
||||||
@@ -327,10 +592,10 @@ public class MessageListenerSingleton {
|
|||||||
instance.listeners.clear();
|
instance.listeners.clear();
|
||||||
removeAllListeners();
|
removeAllListeners();
|
||||||
isInitialized = false;
|
isInitialized = false;
|
||||||
groupId=null;
|
groupId = null;
|
||||||
// instance = null;
|
// instance = null;
|
||||||
quitGroup(roomId);
|
quitGroup(roomId);
|
||||||
LogUtils.e("@@@","重置成功");
|
LogUtils.e("@@@", "重置成功");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,6 +916,11 @@ public class MessageListenerSingleton {
|
|||||||
// for (OnMessageReceivedListener listener : listeners) {
|
// for (OnMessageReceivedListener listener : listeners) {
|
||||||
// listener.onMessageReceived(message);
|
// listener.onMessageReceived(message);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (message.getMsgType() == 1001 && publicScreenListeners.isEmpty()) {
|
||||||
|
cacheMessage(message.getRoomId(), message);
|
||||||
|
}
|
||||||
|
|
||||||
// 通知原有的监听器
|
// 通知原有的监听器
|
||||||
for (OnMessageReceivedListener listener : listeners) {
|
for (OnMessageReceivedListener listener : listeners) {
|
||||||
listener.onMessageReceived(message);
|
listener.onMessageReceived(message);
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ public class AgoraManager {
|
|||||||
*/
|
*/
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (rtcEngine != null) {
|
if (rtcEngine != null) {
|
||||||
// // 离开频道
|
// // 离开频道
|
||||||
|
|
||||||
|
|||||||
@@ -85,9 +85,11 @@ public class MqttInitCallback implements MqttCallback {
|
|||||||
XLHBean xlhBean= GsonUtils.fromJson(message, XLHBean.class);
|
XLHBean xlhBean= GsonUtils.fromJson(message, XLHBean.class);
|
||||||
if (xlhBean!=null && xlhBean.getRoom_id()!=null && SpUtil.getMyRoomId()!=null) {
|
if (xlhBean!=null && xlhBean.getRoom_id()!=null && SpUtil.getMyRoomId()!=null) {
|
||||||
if (xlhBean.getRoom_id().equals(SpUtil.getMyRoomId())) {
|
if (xlhBean.getRoom_id().equals(SpUtil.getMyRoomId())) {
|
||||||
MqttXlhEnd mqttXlhEnd = new MqttXlhEnd();
|
if (xlhBean.getFrom_type()==3) {
|
||||||
mqttXlhEnd.setMessage(message);
|
MqttXlhEnd mqttXlhEnd = new MqttXlhEnd();
|
||||||
EventBus.getDefault().post(mqttXlhEnd);
|
mqttXlhEnd.setMessage(message);
|
||||||
|
EventBus.getDefault().post(mqttXlhEnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ package com.xscm.moduleutil.utils;
|
|||||||
*@description: 防止重复点击的工具类
|
*@description: 防止重复点击的工具类
|
||||||
*/
|
*/
|
||||||
public class ClickUtils {
|
public class ClickUtils {
|
||||||
private static final long CLICK_INTERVAL = 500; // 500ms内不允许重复点击
|
private static final long CLICK_INTERVAL = 1000; // 1000ms内不允许重复点击
|
||||||
private static long lastClickTime = 0;
|
private static long lastClickTime = 0;
|
||||||
|
|
||||||
public static boolean isFastDoubleClick() {
|
public static boolean isFastDoubleClick() {
|
||||||
|
|||||||
@@ -30,4 +30,6 @@ public class SPConstants {
|
|||||||
public static final String REAL_NAME = "realName";//是否实名认证
|
public static final String REAL_NAME = "realName";//是否实名认证
|
||||||
|
|
||||||
public static final String USER_INFO = "userInfo";
|
public static final String USER_INFO = "userInfo";
|
||||||
|
|
||||||
|
public static final String FLOATING_SCREEN = "floatingScreen";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -369,6 +369,14 @@ public class SpUtil {
|
|||||||
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.OPEN_EFFECT, 1);
|
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.OPEN_EFFECT, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setFloatingScreen(int i){
|
||||||
|
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(SPConstants.FLOATING_SCREEN, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getFloatingScreen(){
|
||||||
|
return SPUtils.getInstance(SPConstants.PREFERENCE_NAME).getInt(SPConstants.FLOATING_SCREEN, 1);
|
||||||
|
}
|
||||||
|
|
||||||
//设置耳返
|
//设置耳返
|
||||||
public static void setAuricularBack(int i) {
|
public static void setAuricularBack(int i) {
|
||||||
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(SPConstants.OPEN_AU_BACK, i);
|
SPUtils.getInstance(SPConstants.PREFERENCE_NAME).put(SPConstants.OPEN_AU_BACK, i);
|
||||||
|
|||||||
@@ -235,10 +235,10 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// 检查特效是否开启
|
// 检查特效是否开启
|
||||||
if (SpUtil.getOpenEffect() != 1) {
|
// if (SpUtil.getOpenEffect() != 1) {
|
||||||
clearQueue();
|
// clearQueue();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
// 检查是否可以开始新的播放
|
// 检查是否可以开始新的播放
|
||||||
// if (!playbackManager.canStartNewPlayback()) {
|
// if (!playbackManager.canStartNewPlayback()) {
|
||||||
// Logger.d("AvatarFrameView", "Max concurrent playbacks reached, waiting...");
|
// Logger.d("AvatarFrameView", "Max concurrent playbacks reached, waiting...");
|
||||||
@@ -299,14 +299,21 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
mBinding.playView.setVisibility(View.GONE);
|
mBinding.playView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
loadSVGA(item.url);
|
loadSVGA(item.url);
|
||||||
} );
|
});
|
||||||
} else if ("mp4".equalsIgnoreCase(ext)) {
|
} else if ("mp4".equalsIgnoreCase(ext)) {
|
||||||
mainHandler.post(() -> {
|
mainHandler.post(() -> {
|
||||||
renderType = RenderType.MP4;
|
renderType = RenderType.MP4;
|
||||||
mType = item.type;
|
mType = item.type;
|
||||||
mBinding.playView.setVisibility(View.VISIBLE);
|
if (mBinding != null && mBinding.playView != null) {
|
||||||
downloadAndPlayMp4(item.url);
|
mBinding.playView.setVisibility(View.VISIBLE);
|
||||||
} );
|
|
||||||
|
downloadAndPlayMp4(item.url);
|
||||||
|
}else {
|
||||||
|
mBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.room_view_svga_anim, this, true);
|
||||||
|
mBinding.playView.setVisibility(View.VISIBLE);
|
||||||
|
downloadAndPlayMp4(item.url);
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// 不支持的格式,直接完成
|
// 不支持的格式,直接完成
|
||||||
handlePlaybackComplete();
|
handlePlaybackComplete();
|
||||||
@@ -329,7 +336,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPlaying() {
|
public boolean isPlaying() {
|
||||||
if (mBinding!=null && mBinding.playView!=null) {
|
if (mBinding != null && mBinding.playView != null) {
|
||||||
return mBinding.playView.isRunning();
|
return mBinding.playView.isRunning();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -557,7 +564,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
LogUtils.e("有缓存");
|
LogUtils.e("有缓存");
|
||||||
mainHandler.post(() -> {
|
mainHandler.post(() -> {
|
||||||
// 检查是否已销毁
|
// 检查是否已销毁
|
||||||
if ( file.exists()) {
|
if (file.exists()) {
|
||||||
playMp4File(file);
|
playMp4File(file);
|
||||||
} else {
|
} else {
|
||||||
LogUtils.w(TAG, "有缓存2222222222222");
|
LogUtils.w(TAG, "有缓存2222222222222");
|
||||||
@@ -813,18 +820,18 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopAll(){
|
public void stopAll() {
|
||||||
if (svgaSurface != null){
|
if (svgaSurface != null) {
|
||||||
svgaSurface.stopAnimation();
|
svgaSurface.stopAnimation();
|
||||||
svgaSurface.clearAnimation();
|
svgaSurface.clearAnimation();
|
||||||
svgaSurface.setImageDrawable( null);
|
svgaSurface.setImageDrawable(null);
|
||||||
}
|
}
|
||||||
if (svgaSurface2 != null){
|
if (svgaSurface2 != null) {
|
||||||
svgaSurface2.stopAnimation();
|
svgaSurface2.stopAnimation();
|
||||||
svgaSurface2.clearAnimation();
|
svgaSurface2.clearAnimation();
|
||||||
svgaSurface.setImageDrawable( null);
|
svgaSurface.setImageDrawable(null);
|
||||||
}
|
}
|
||||||
if (mBinding.playView!=null){
|
if (mBinding.playView != null) {
|
||||||
mBinding.playView.stopPlay();
|
mBinding.playView.stopPlay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1215,7 +1222,7 @@ public class AvatarFrameView extends FrameLayout {
|
|||||||
svgaSurface.stopAnimation(true);
|
svgaSurface.stopAnimation(true);
|
||||||
svgaSurface.clear();
|
svgaSurface.clear();
|
||||||
svgaSurface.clearAnimation();
|
svgaSurface.clearAnimation();
|
||||||
svgaSurface.setImageDrawable( null);
|
svgaSurface.setImageDrawable(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
|
Logger.e(TAG, "Error releasing SVGA resources: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,19 +48,25 @@ public class CenterScrollHelper {
|
|||||||
|
|
||||||
// 使用LinearSmoothScroller进行平滑滚动
|
// 使用LinearSmoothScroller进行平滑滚动
|
||||||
LinearSmoothScroller smoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
|
LinearSmoothScroller smoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
|
||||||
|
private static final float ACCELERATION = 0.5f; // 加速度
|
||||||
|
private static final float DECELERATION = 0.8f; // 减速度
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int calculateTimeForScrolling(int dx) {
|
protected int calculateTimeForScrolling(int dx) {
|
||||||
// 使用缓动函数计算时间,实现从慢到快再到慢的效果
|
// 使用缓动函数计算时间,实现从慢到快再到慢的效果
|
||||||
// return calculateEasingTime(dx, durationPerItem);
|
// return calculateEasingTime(dx, durationPerItem);
|
||||||
|
|
||||||
// 简单线性时间计算,确保滚动速度一致
|
// // 简单线性时间计算,确保滚动速度一致
|
||||||
int screenWidth = recyclerView.getWidth();
|
// int screenWidth = recyclerView.getWidth();
|
||||||
if (screenWidth <= 0) {
|
// if (screenWidth <= 0) {
|
||||||
return durationPerItem * 3;
|
// return durationPerItem * 3;
|
||||||
}
|
// }
|
||||||
int itemWidth = screenWidth / 3;
|
// int itemWidth = screenWidth / 3;
|
||||||
int items = Math.max(1, dx / itemWidth);
|
// int items = Math.max(1, dx / itemWidth);
|
||||||
return durationPerItem * items;
|
// return durationPerItem * items;
|
||||||
|
|
||||||
|
// 使用缓动函数计算时间,实现从慢到快再到慢的效果
|
||||||
|
return calculateEasingTime(dx, durationPerItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -120,8 +126,8 @@ public class CenterScrollHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 计算时间:开始慢(500ms),后来快(50ms)
|
// 计算时间:开始慢(500ms),后来快(50ms)
|
||||||
int minDuration = 50; // 最快速度
|
int minDuration = 1000; // 最快速度
|
||||||
int maxDuration = 500; // 最慢速度
|
int maxDuration = 2000; // 最慢速度
|
||||||
int calculatedTime = (int) (maxDuration - (maxDuration - minDuration) * easeProgress);
|
int calculatedTime = (int) (maxDuration - (maxDuration - minDuration) * easeProgress);
|
||||||
|
|
||||||
return Math.max(minDuration, calculatedTime);
|
return Math.max(minDuration, calculatedTime);
|
||||||
|
|||||||
@@ -380,13 +380,14 @@ public class Constants {
|
|||||||
public static final String GET_ALL_RECORD = "/api/BlindBoxTurntable/get_all_record";//获取全服抽奖记录
|
public static final String GET_ALL_RECORD = "/api/BlindBoxTurntable/get_all_record";//获取全服抽奖记录
|
||||||
public static final String GIFT_SEND = "/api/BlindBoxTurntable/gift_send";//礼物发放
|
public static final String GIFT_SEND = "/api/BlindBoxTurntable/gift_send";//礼物发放
|
||||||
|
|
||||||
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";///巡乐会
|
public static final String GET_BOX_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh";//巡乐会
|
||||||
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";///巡乐会抽奖
|
public static final String POST_DRAW_GIFT_LIST_XLH = "/api/BlindBoxTurntable/xlh_draw_gift";//巡乐会抽奖
|
||||||
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";///巡乐会榜单
|
public static final String POST_XLH_ALL_RECORD = "/api/BlindBoxTurntable/get_xlh_all_record";//巡乐会榜单
|
||||||
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";///巡乐会记录
|
public static final String GET_XLH_MY_RECORD = "/api/BlindBoxTurntable/get_xlh_my_record";//巡乐会记录
|
||||||
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";///背包礼物全清
|
public static final String POST_GIFT_ALL_CLEAR = "/api/Room/room_gift_all_clear";//背包礼物全清
|
||||||
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";///房间用户当前魅力值列表
|
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";//房间用户当前魅力值列表
|
||||||
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";///背包礼物总价值
|
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";//背包礼物总价值
|
||||||
|
public static final String ROOM_USER_RECONNECT = "/api/Room/user_reconnect";//用户重连
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,10 @@ public class PKProgressBar extends View {
|
|||||||
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreDraw() {
|
public boolean onPreDraw() {
|
||||||
|
// 添加视图是否已附加到窗口的检查
|
||||||
|
if (getWindowToken() == null) {
|
||||||
|
return true; // 视图尚未附加到窗口,稍后再试
|
||||||
|
}
|
||||||
getViewTreeObserver().removeOnPreDrawListener(this);
|
getViewTreeObserver().removeOnPreDrawListener(this);
|
||||||
// 是否需要渐变器
|
// 是否需要渐变器
|
||||||
if (isGradient) {
|
if (isGradient) {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
|||||||
mIvRipple.stopAnimation(true);
|
mIvRipple.stopAnimation(true);
|
||||||
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())) {
|
if (TextUtils.isEmpty(pitBean.getDress())) {
|
||||||
mIvFrame.stopAll();
|
mIvFrame.stopAll();
|
||||||
mIvFrame.setVisibility(INVISIBLE);
|
mIvFrame.setVisibility(INVISIBLE);
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.xscm.moduleutil.widget;
|
||||||
|
|
||||||
|
import androidx.lifecycle.LiveData;
|
||||||
|
import androidx.lifecycle.MutableLiveData;
|
||||||
|
import androidx.lifecycle.ViewModel;
|
||||||
|
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||||
|
import com.xscm.moduleutil.event.QXRoomSeatViewType;
|
||||||
|
|
||||||
|
// 在 common 模块中或相应模块中
|
||||||
|
public class SharedViewModel extends ViewModel {
|
||||||
|
// 给roomFragment传递数据
|
||||||
|
private final MutableLiveData<RoomInfoResp> dataForFragment = new MutableLiveData<>();
|
||||||
|
private final MutableLiveData<Boolean> fragmentReady = new MutableLiveData<>(false);
|
||||||
|
private MutableLiveData<QXRoomSeatViewType> seatViewTypeData = new MutableLiveData<>();
|
||||||
|
//给子fragment传递数据
|
||||||
|
private MutableLiveData<RoomInfoResp> childFragmentData = new MutableLiveData<>();
|
||||||
|
|
||||||
|
// 为子Fragment设置数据的方法
|
||||||
|
public void setChildFragmentData(RoomInfoResp data) {
|
||||||
|
childFragmentData.setValue(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取子Fragment数据的LiveData
|
||||||
|
public LiveData<RoomInfoResp> getChildFragmentData() {
|
||||||
|
return childFragmentData;
|
||||||
|
}
|
||||||
|
public void setSeatViewType(QXRoomSeatViewType type) {
|
||||||
|
seatViewTypeData.setValue(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<QXRoomSeatViewType> getSeatViewType() {
|
||||||
|
return seatViewTypeData;
|
||||||
|
}
|
||||||
|
public LiveData<RoomInfoResp> getDataForFragment() {
|
||||||
|
return dataForFragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataForFragment(RoomInfoResp data) {
|
||||||
|
dataForFragment.setValue(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LiveData<Boolean> getFragmentReady() {
|
||||||
|
return fragmentReady;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFragmentReady(boolean ready) {
|
||||||
|
fragmentReady.setValue(ready);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清除数据,避免重复接收
|
||||||
|
|
||||||
|
// 清理所有数据的方法
|
||||||
|
public void clearAllData() {
|
||||||
|
dataForFragment.setValue(null);
|
||||||
|
childFragmentData.setValue(null);
|
||||||
|
seatViewTypeData.setValue(null);
|
||||||
|
fragmentReady.setValue(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理子Fragment数据
|
||||||
|
public void clearChildFragmentData() {
|
||||||
|
childFragmentData.setValue(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理主Fragment数据
|
||||||
|
public void clearFragmentData() {
|
||||||
|
dataForFragment.setValue(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="#fff8b6a8" />
|
<solid android:color="#FF512C" />
|
||||||
<corners
|
<corners
|
||||||
android:bottomLeftRadius="9999dp"
|
android:bottomLeftRadius="9999dp"
|
||||||
android:bottomRightRadius="9999dp"
|
android:bottomRightRadius="9999dp"
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<gradient
|
<gradient
|
||||||
android:angle="180"
|
android:angle="180"
|
||||||
android:endColor="#80FFFFFF"
|
android:endColor="#30FFFFFF"
|
||||||
android:startColor="#80FFFFFF"
|
android:startColor="#30FFFFFF"
|
||||||
android:type="linear"
|
android:type="linear"
|
||||||
android:useLevel="true" />
|
android:useLevel="true" />
|
||||||
<corners android:radius="8dp" />
|
<corners android:radius="@dimen/dp_6" />
|
||||||
</shape>
|
</shape>
|
||||||
@@ -9,14 +9,17 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:alpha="0.8"
|
android:alpha="1"
|
||||||
>
|
>
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_content"
|
android:id="@+id/tv_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/color_0DFFB9"
|
android:textColor="@color/white"
|
||||||
android:padding="@dimen/dp_5"
|
android:paddingTop="@dimen/dp_5"
|
||||||
|
android:paddingBottom="@dimen/dp_5"
|
||||||
|
android:paddingStart="@dimen/dp_8"
|
||||||
|
android:paddingEnd="@dimen/dp_8"
|
||||||
android:background="@drawable/ease_row_pubilc_user_bg"
|
android:background="@drawable/ease_row_pubilc_user_bg"
|
||||||
android:text="我是房间公告"
|
android:text="我是房间公告"
|
||||||
android:textSize="@dimen/sp_14" />
|
android:textSize="@dimen/sp_14" />
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
android:id="@+id/tv_name"
|
android:id="@+id/tv_name"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/white"
|
android:textColor="#CCA882"
|
||||||
android:textSize="@dimen/sp_12"
|
android:textSize="@dimen/sp_12"
|
||||||
android:layout_marginStart="@dimen/dp_2"
|
android:layout_marginStart="@dimen/dp_2"
|
||||||
tools:text="饶利" />
|
tools:text="饶利" />
|
||||||
@@ -121,7 +121,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:lineHeight="@dimen/dp_20"
|
android:lineHeight="@dimen/dp_20"
|
||||||
android:lineSpacingExtra="@dimen/dp_2"
|
android:lineSpacingExtra="@dimen/dp_2"
|
||||||
android:textColor="@color/black"
|
android:paddingStart="@dimen/dp_8"
|
||||||
|
android:paddingEnd="@dimen/dp_8"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/sp_14"
|
android:textSize="@dimen/sp_14"
|
||||||
tools:text="饶利: 潇洒亼◇生2.0:" />
|
tools:text="饶利: 潇洒亼◇生2.0:" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -313,7 +313,6 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
||||||
android:visibility="gone"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
@@ -326,7 +325,6 @@
|
|||||||
app:layout_constraintEnd_toStartOf="@+id/tv_option"
|
app:layout_constraintEnd_toStartOf="@+id/tv_option"
|
||||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
||||||
android:visibility="gone"
|
|
||||||
/>
|
/>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/exchange_layout"
|
android:id="@+id/exchange_layout"
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@mipmap/room_ic_wheat_default"
|
android:src="@mipmap/room_ic_wheat_default"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintDimensionRatio="0.95:0.95"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
@@ -38,12 +37,13 @@
|
|||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible"
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
android:layout_marginTop="@dimen/dp_12"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/riv"
|
app:layout_constraintHeight_percent="1.1"
|
||||||
app:layout_constraintEnd_toEndOf="@id/riv"
|
app:layout_constraintWidth_percent="1"
|
||||||
app:layout_constraintStart_toStartOf="@id/riv"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@id/riv"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_margin="-10dp"/>
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"/>
|
||||||
|
|
||||||
<com.opensource.svgaplayer.SVGAImageView
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
android:id="@+id/iv_ripple"
|
android:id="@+id/iv_ripple"
|
||||||
@@ -162,8 +162,9 @@
|
|||||||
android:paddingLeft="@dimen/dp_5"
|
android:paddingLeft="@dimen/dp_5"
|
||||||
android:paddingRight="@dimen/dp_5"
|
android:paddingRight="@dimen/dp_5"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:layout_marginTop="@dimen/dp_3"
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
|
android:translationZ="@dimen/dp_10"
|
||||||
android:textSize="@dimen/sp_10"
|
android:textSize="@dimen/sp_10"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</layout>
|
</layout>
|
||||||
|
After Width: | Height: | Size: 1.7 KiB |
BIN
moduleUtil/src/main/res/mipmap-mdpi/ic_open_floating_screen.webp
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
moduleUtil/src/main/res/mipmap-mdpi/task_lq.webp
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
BIN
moduleUtil/src/main/res/mipmap-mdpi/task_ylq.webp
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/index_img_room_mask.png
Normal file
|
After Width: | Height: | Size: 32 KiB |
BIN
moduleUtil/src/main/res/mipmap-xxxhdpi/room_ic_wheat_default.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
@@ -28,6 +28,7 @@ import com.google.android.material.bottomsheet.BottomSheetDialog;
|
|||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.adapter.CirleListAdapter;
|
import com.xscm.moduleutil.adapter.CirleListAdapter;
|
||||||
import com.xscm.moduleutil.adapter.CommentAdapter;
|
import com.xscm.moduleutil.adapter.CommentAdapter;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.CircleListBean;
|
import com.xscm.moduleutil.bean.CircleListBean;
|
||||||
import com.xscm.moduleutil.bean.CommentBean;
|
import com.xscm.moduleutil.bean.CommentBean;
|
||||||
import com.xscm.moduleutil.bean.ExpandColumnBean;
|
import com.xscm.moduleutil.bean.ExpandColumnBean;
|
||||||
@@ -128,7 +129,9 @@ public class DynamicDetailActivity extends BaseMvpActivity<CirclePresenter, Acti
|
|||||||
@Override
|
@Override
|
||||||
public void onGensui(CircleListBean item) {
|
public void onGensui(CircleListBean item) {
|
||||||
if (item.getRoom_id()!=null && !item.getRoom_id().equals("0")) {
|
if (item.getRoom_id()!=null && !item.getRoom_id().equals("0")) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id(),"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
||||||
}else {
|
}else {
|
||||||
ChatLauncher.getInstance().launchC2CChat(DynamicDetailActivity.this, item.getUser_id()+"");
|
ChatLauncher.getInstance().launchC2CChat(DynamicDetailActivity.this, item.getUser_id()+"");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.example.modulecircle.presenter.CirclePresenter;
|
|||||||
import com.example.modulevocal.activity.UserHomepageActivity;
|
import com.example.modulevocal.activity.UserHomepageActivity;
|
||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.adapter.CirleListAdapter;
|
import com.xscm.moduleutil.adapter.CirleListAdapter;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.CircleListBean;
|
import com.xscm.moduleutil.bean.CircleListBean;
|
||||||
import com.xscm.moduleutil.bean.CommentBean;
|
import com.xscm.moduleutil.bean.CommentBean;
|
||||||
import com.xscm.moduleutil.bean.ExpandColumnBean;
|
import com.xscm.moduleutil.bean.ExpandColumnBean;
|
||||||
@@ -113,7 +114,9 @@ public class DynamicListActivity extends BaseMvpActivity<CirclePresenter, Activi
|
|||||||
@Override
|
@Override
|
||||||
public void onGensui(CircleListBean item) {
|
public void onGensui(CircleListBean item) {
|
||||||
if (item.getRoom_id()!=null && !item.getRoom_id().equals("0")) {
|
if (item.getRoom_id()!=null && !item.getRoom_id().equals("0")) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), item.getRoom_id(),"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
||||||
}else {
|
}else {
|
||||||
ChatLauncher.getInstance().launchC2CChat(DynamicListActivity.this, item.getUser_id()+"");
|
ChatLauncher.getInstance().launchC2CChat(DynamicListActivity.this, item.getUser_id()+"");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class ReleaseActivity extends BaseMvpActivity<ReleasePresenter, ActivityR
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(type)
|
.setMaxSelectNum(type)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.example.modulecircle.contacts.CircleContacts;
|
|||||||
import com.example.modulecircle.databinding.FragmentCircleCategoryBinding;
|
import com.example.modulecircle.databinding.FragmentCircleCategoryBinding;
|
||||||
import com.example.modulecircle.presenter.CirclePresenter;
|
import com.example.modulecircle.presenter.CirclePresenter;
|
||||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.BaseListData;
|
import com.xscm.moduleutil.bean.BaseListData;
|
||||||
import com.xscm.moduleutil.bean.CircleListBean;
|
import com.xscm.moduleutil.bean.CircleListBean;
|
||||||
import com.xscm.moduleutil.bean.CommentBean;
|
import com.xscm.moduleutil.bean.CommentBean;
|
||||||
@@ -162,7 +163,9 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
|
|||||||
@Override
|
@Override
|
||||||
public void onGensui(CircleListBean item) {
|
public void onGensui(CircleListBean item) {
|
||||||
if (item.getRoom_id()!=null && !item.getRoom_id().equals("0")) {
|
if (item.getRoom_id()!=null && !item.getRoom_id().equals("0")) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), item.getRoom_id(),"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()).navigation();
|
||||||
}else {
|
}else {
|
||||||
ChatLauncher.getInstance().launchC2CChat(getActivity(), item.getUser_id()+"");
|
ChatLauncher.getInstance().launchC2CChat(getActivity(), item.getUser_id()+"");
|
||||||
}
|
}
|
||||||
@@ -241,7 +244,7 @@ public class CircleCategoryFragment extends BaseMvpFragment<CirclePresenter, Fra
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setLikeZone(int type) {
|
public void setLikeZone(int type) {
|
||||||
// MvpPre.getCircleList(page + "", "10");
|
MvpPre.getCircleList(page + "", "10");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.example.modulecircle.contacts.CircleContacts;
|
|||||||
import com.example.modulecircle.databinding.FragmentExpandColumnBinding;
|
import com.example.modulecircle.databinding.FragmentExpandColumnBinding;
|
||||||
import com.example.modulecircle.presenter.CirclePresenter;
|
import com.example.modulecircle.presenter.CirclePresenter;
|
||||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.CircleListBean;
|
import com.xscm.moduleutil.bean.CircleListBean;
|
||||||
import com.xscm.moduleutil.bean.CommentBean;
|
import com.xscm.moduleutil.bean.CommentBean;
|
||||||
import com.xscm.moduleutil.bean.ExpandColumnBean;
|
import com.xscm.moduleutil.bean.ExpandColumnBean;
|
||||||
@@ -130,7 +131,9 @@ public class ExpandColumnFragment extends BaseMvpFragment<CirclePresenter, Fragm
|
|||||||
@Override
|
@Override
|
||||||
public void onGnsClick(ExpandColumnBean item) {
|
public void onGnsClick(ExpandColumnBean item) {
|
||||||
if ( item.getRoom_id()!=0){
|
if ( item.getRoom_id()!=0){
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()+"").navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getActivity(), item.getRoom_id()+"","");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页热门列表").withString("roomId", item.getRoom_id()+"").navigation();
|
||||||
}else {
|
}else {
|
||||||
ChatLauncher.getInstance().launchC2CChat(getActivity(), item.getUser_id()+"");
|
ChatLauncher.getInstance().launchC2CChat(getActivity(), item.getUser_id()+"");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,8 +50,7 @@ dependencies {
|
|||||||
implementation project(':modulecircle')
|
implementation project(':modulecircle')
|
||||||
implementation project(':modulevocal')
|
implementation project(':modulevocal')
|
||||||
implementation project(':modulenews')
|
implementation project(':modulenews')
|
||||||
// implementation project(':moduleroom')
|
implementation project(':moduleroom')
|
||||||
implementation project(':moduleactivity')
|
|
||||||
|
|
||||||
testImplementation libs.junit
|
testImplementation libs.junit
|
||||||
androidTestImplementation libs.ext.junit
|
androidTestImplementation libs.ext.junit
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@mipmap/ic_launcher_app"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:roundIcon="@mipmap/ic_launcher_round_app"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
>
|
>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".activity.MainActivity"
|
android:name=".activity.MainActivity"
|
||||||
android:configChanges="fontScale"
|
android:configChanges="fontScale"
|
||||||
/>
|
android:exported="true"
|
||||||
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait">
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -27,9 +27,9 @@ import com.blankj.utilcode.util.FragmentUtils;
|
|||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.blankj.utilcode.util.ToastUtils;
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
import com.bumptech.glide.Glide;
|
import com.bumptech.glide.Glide;
|
||||||
import com.example.moduleactivity.RoomManager;
|
|
||||||
import com.example.modulecircle.fragment.CircleFragment;
|
import com.example.modulecircle.fragment.CircleFragment;
|
||||||
import com.example.modulenews.fragment.NewsFragment;
|
import com.example.modulenews.fragment.NewsFragment;
|
||||||
|
import com.example.moduleroom.activity.RoomActivity;
|
||||||
import com.example.modulevocal.fragment.VocalRangeFragment;
|
import com.example.modulevocal.fragment.VocalRangeFragment;
|
||||||
import com.example.modulevoice.fragment.VoiceFragment;
|
import com.example.modulevoice.fragment.VoiceFragment;
|
||||||
import com.xscm.modulemain.R;
|
import com.xscm.modulemain.R;
|
||||||
@@ -38,11 +38,15 @@ import com.xscm.modulemain.databinding.ActivityMainBinding;
|
|||||||
import com.xscm.modulemain.presenter.HomePresenter;
|
import com.xscm.modulemain.presenter.HomePresenter;
|
||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.adapter.AppUpdateDialog;
|
import com.xscm.moduleutil.adapter.AppUpdateDialog;
|
||||||
|
import com.xscm.moduleutil.base.AppStateManager;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.AppUpdateModel;
|
import com.xscm.moduleutil.bean.AppUpdateModel;
|
||||||
import com.xscm.moduleutil.bean.FirstChargeBean;
|
import com.xscm.moduleutil.bean.FirstChargeBean;
|
||||||
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
|
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
|
||||||
import com.xscm.moduleutil.bean.ThemeBean;
|
import com.xscm.moduleutil.bean.ThemeBean;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnlineBean;
|
||||||
import com.xscm.moduleutil.dialog.FirstChargeDialog;
|
import com.xscm.moduleutil.dialog.FirstChargeDialog;
|
||||||
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
import com.xscm.moduleutil.dialog.RechargeDialogFragment;
|
||||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||||
@@ -61,6 +65,7 @@ import org.greenrobot.eventbus.Subscribe;
|
|||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Route(path = ARouteConstants.ME)
|
@Route(path = ARouteConstants.ME)
|
||||||
@@ -98,7 +103,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@@ -115,9 +119,12 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
// 检查是否有正在播放的房间
|
// 检查是否有正在播放的房间
|
||||||
if (CommonAppContext.getInstance().isPlaying) {
|
if (CommonAppContext.getInstance().isPlaying) {
|
||||||
// 如果有正在播放的房间,直接退出应用
|
// 如果有正在播放的房间,直接退出应用
|
||||||
finish();
|
// finish();
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
System.exit(0);
|
// System.exit(0);
|
||||||
|
// exitApp();
|
||||||
|
|
||||||
|
clearAllOtherTasksAndRestart();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,6 +145,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
MvpPre.getThemeData();
|
MvpPre.getThemeData();
|
||||||
@@ -152,8 +160,27 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
MvpPre.initData();
|
MvpPre.initData();
|
||||||
MvpPre.userFiles();
|
MvpPre.userFiles();
|
||||||
|
|
||||||
|
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Long aLong) {
|
||||||
|
if (aLong == 0) {
|
||||||
|
mBinding.tvMessage.setVisibility(View.GONE);
|
||||||
|
mBinding.tvMessage.setText("0");
|
||||||
|
} else {
|
||||||
|
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
mBinding.tvMessage.setText(String.valueOf(aLong));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String desc) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
@@ -181,16 +208,16 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
setIntent(intent);
|
setIntent(intent);
|
||||||
|
|
||||||
// 检查是否需要跳转到房间
|
// 检查是否需要跳转到房间
|
||||||
if (shouldRestoreRoom()) {
|
// if (shouldRestoreRoom()) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
|
||||||
.withString("form", "首页")
|
// .withString("form", "首页")
|
||||||
.withString("roomId", CommonAppContext.getInstance().playId)
|
// .withString("roomId", CommonAppContext.getInstance().playId)
|
||||||
.withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
// .withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||||
.navigation();
|
// .navigation();
|
||||||
|
//
|
||||||
// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(CommonAppContext.getInstance().playId, true);
|
//// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(CommonAppContext.getInstance().playId, true);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 处理tab切换
|
// 处理tab切换
|
||||||
checkTab(intent.getIntExtra("tab", -1));
|
checkTab(intent.getIntExtra("tab", -1));
|
||||||
@@ -201,6 +228,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
selectShow(tab);
|
selectShow(tab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isExit = false; // 标记是否准备退出
|
private boolean isExit = false; // 标记是否准备退出
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
@@ -211,9 +239,11 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
// 检查是否有正在播放的房间
|
// 检查是否有正在播放的房间
|
||||||
if (CommonAppContext.getInstance().isPlaying) {
|
if (CommonAppContext.getInstance().isPlaying) {
|
||||||
// 如果有正在播放的房间,直接退出应用
|
// 如果有正在播放的房间,直接退出应用
|
||||||
finish();
|
// finish();
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
// android.os.Process.killProcess(android.os.Process.myPid());
|
||||||
System.exit(0);
|
// System.exit(0);
|
||||||
|
// exitApp();
|
||||||
|
clearAllOtherTasksAndRestart();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +262,22 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
}
|
}
|
||||||
return super.onKeyDown(keyCode, event);
|
return super.onKeyDown(keyCode, event);
|
||||||
}
|
}
|
||||||
|
// 最推荐的方法
|
||||||
|
private void clearAllOtherTasksAndRestart() {
|
||||||
|
// Intent intent = new Intent(this, MainActivity.class);
|
||||||
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
// intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||||
|
// intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
|
||||||
|
// startActivity(intent);
|
||||||
|
|
||||||
|
// 可选:finish当前Activity
|
||||||
|
// if (!isFinishing()) {
|
||||||
|
// finish();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 可选:如果上面的方法不够彻底,可以配合使用
|
||||||
|
Runtime.getRuntime().gc(); // 建议垃圾回收
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 优雅地退出应用,避免闪屏
|
* 优雅地退出应用,避免闪屏
|
||||||
*/
|
*/
|
||||||
@@ -281,7 +326,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
index = 0;
|
index = 0;
|
||||||
isMediaSelected = true; // 确保设置为选中状态
|
isMediaSelected = true; // 确保设置为选中状态
|
||||||
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
||||||
unselectedTextColor =Color.parseColor("#000000");
|
unselectedTextColor = Color.parseColor("#000000");
|
||||||
updateAllTabUI(); // 这会同时更新图标和文字颜色
|
updateAllTabUI(); // 这会同时更新图标和文字颜色
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -321,9 +366,26 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
} else if (id == R.id.riv) {
|
} else if (id == R.id.riv) {
|
||||||
String roomId = CommonAppContext.getInstance().playId;
|
String roomId = CommonAppContext.getInstance().playId;
|
||||||
if (!TextUtils.isEmpty(roomId)) {
|
if (!TextUtils.isEmpty(roomId)) {
|
||||||
// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(roomId, true);
|
RoomManager.getInstance().fetchRoomDataAndEnter(this, CommonAppContext.getInstance().playId,"");
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", roomId).navigation();
|
|
||||||
|
// MvpPre.getRoomOnline(roomId, "1", "100");
|
||||||
|
// AppStateManager stateManager = AppStateManager.getInstance();
|
||||||
|
// if (stateManager.isRoomActivityActive()) {
|
||||||
|
// // RoomActivity可用,直接回到该Activity
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// RoomActivity不可用,重新创建
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||||
|
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String roomId = CommonAppContext.getInstance().playId;
|
||||||
|
// if (!TextUtils.isEmpty(roomId)) {
|
||||||
|
//// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(roomId, true);
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", roomId).navigation();
|
||||||
|
// }
|
||||||
} else if (id == R.id.iv_shouchl) {//首充
|
} else if (id == R.id.iv_shouchl) {//首充
|
||||||
FirstChargeDialog firstChargeDialog = new FirstChargeDialog(this);
|
FirstChargeDialog firstChargeDialog = new FirstChargeDialog(this);
|
||||||
firstChargeDialog.show();
|
firstChargeDialog.show();
|
||||||
@@ -428,7 +490,7 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
.load(imageUrl)
|
.load(imageUrl)
|
||||||
.placeholder(com.xscm.moduleutil.R.mipmap.tab_main_media_unselected) // 默认图标
|
.placeholder(com.xscm.moduleutil.R.mipmap.tab_main_media_unselected) // 默认图标
|
||||||
.into(mBinding.imSy);
|
.into(mBinding.imSy);
|
||||||
}else {
|
} else {
|
||||||
// 如果没有网络图标,使用默认的选中/未选中状态
|
// 如果没有网络图标,使用默认的选中/未选中状态
|
||||||
int resId = (index == 0) ?
|
int resId = (index == 0) ?
|
||||||
com.xscm.moduleutil.R.mipmap.tab_main_media_selected :
|
com.xscm.moduleutil.R.mipmap.tab_main_media_selected :
|
||||||
@@ -452,15 +514,15 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
// 修改判断条件:不仅检查 isTaskRoot,还要检查是否是从后台恢复
|
// 修改判断条件:不仅检查 isTaskRoot,还要检查是否是从后台恢复
|
||||||
if (shouldRestoreRoom()) {
|
// if (shouldRestoreRoom()) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS)
|
||||||
.withString("form", "首页")
|
// .withString("form", "首页")
|
||||||
.withString("roomId", CommonAppContext.getInstance().playId)
|
// .withString("roomId", CommonAppContext.getInstance().playId)
|
||||||
.withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
// .withFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
.navigation();
|
// .navigation();
|
||||||
// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(CommonAppContext.getInstance().playId, true);
|
//// RoomManager.instance( CommonAppContext.getInstance()).joinRoomWithRoomId(CommonAppContext.getInstance().playId, true);
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
MvpPre.loginIm();
|
MvpPre.loginIm();
|
||||||
Logger.i("MainActivity", "onResume");
|
Logger.i("MainActivity", "onResume");
|
||||||
@@ -478,23 +540,9 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Long aLong) {
|
|
||||||
if (aLong == 0) {
|
|
||||||
mBinding.tvMessage.setVisibility(View.GONE);
|
|
||||||
mBinding.tvMessage.setText("0");
|
|
||||||
} else {
|
|
||||||
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
mBinding.tvMessage.setText(String.valueOf(aLong));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onError(int code, String desc) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
||||||
|
|
||||||
@@ -504,10 +552,22 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onEvent(UnreadCountEvent event) {
|
public void onEvent(UnreadCountEvent event) {
|
||||||
if (event.getALong() == 0) {
|
if (event.getALong() == 0) {
|
||||||
mBinding.tvMessage.setVisibility(View.GONE);
|
if (event.getBLong()==0){
|
||||||
mBinding.tvMessage.setText("0");
|
mBinding.tvMessage.setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||||
|
mBinding.tvMessage.setText(String.valueOf(event.getBLong()));
|
||||||
|
}
|
||||||
|
// mBinding.tvMessage.setVisibility(View.GONE);
|
||||||
|
// mBinding.tvMessage.setText("0");
|
||||||
} else if (event.getALong() > 0) {
|
} else if (event.getALong() > 0) {
|
||||||
mBinding.tvMessage.setText(String.valueOf(event.getALong()));
|
mBinding.tvMessage.setVisibility(View.VISIBLE);
|
||||||
|
if (event.getBLong()==0){
|
||||||
|
mBinding.tvMessage.setText(String.valueOf(event.getALong()));
|
||||||
|
}else {
|
||||||
|
mBinding.tvMessage.setText(String.valueOf(event.getALong()+event.getBLong()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,9 +664,9 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getThemeData(ThemeBean themeBean) {
|
public void getThemeData(ThemeBean themeBean) {
|
||||||
if (themeBean != null){
|
if (themeBean != null) {
|
||||||
selectedMediaUrl=themeBean.getHome_sel();
|
selectedMediaUrl = themeBean.getHome_sel();
|
||||||
unselectedMediaUrl=themeBean.getHome_nor();
|
unselectedMediaUrl = themeBean.getHome_nor();
|
||||||
|
|
||||||
// 语圈 tab 图标
|
// 语圈 tab 图标
|
||||||
selectedTrendUrl = themeBean.getFind_sel();
|
selectedTrendUrl = themeBean.getFind_sel();
|
||||||
@@ -624,18 +684,18 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
if (themeBean.getBtn_text_color() != null && !themeBean.getBtn_text_color().isEmpty()) {
|
if (themeBean.getBtn_text_color() != null && !themeBean.getBtn_text_color().isEmpty()) {
|
||||||
selectedTextColor = Color.parseColor(themeBean.getBtn_text_color());
|
selectedTextColor = Color.parseColor(themeBean.getBtn_text_color());
|
||||||
}
|
}
|
||||||
unselectedTextColor = Color.parseColor("#000000");
|
unselectedTextColor = Color.parseColor("#000000");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 使用默认颜色
|
// 使用默认颜色
|
||||||
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
selectedTextColor = ColorManager.getInstance().getPrimaryColorInt();
|
||||||
unselectedTextColor =Color.parseColor("#000000");
|
unselectedTextColor = Color.parseColor("#000000");
|
||||||
}
|
}
|
||||||
Map<String, String> colorMap = new HashMap<>();
|
Map<String, String> colorMap = new HashMap<>();
|
||||||
colorMap.put("theme_color", themeBean.getTheme_color());
|
colorMap.put("theme_color", themeBean.getTheme_color());
|
||||||
colorMap.put("btn_text_color", themeBean.getBtn_text_color());
|
colorMap.put("btn_text_color", themeBean.getBtn_text_color());
|
||||||
// 更新 UI
|
// 更新 UI
|
||||||
updateAllTabUI();
|
updateAllTabUI();
|
||||||
if (themeBean.getApp_bg()!=null) {
|
if (themeBean.getApp_bg() != null) {
|
||||||
BackgroundManager.getInstance().setBackgroundUrl(themeBean.getApp_bg());
|
BackgroundManager.getInstance().setBackgroundUrl(themeBean.getApp_bg());
|
||||||
loadNetworkBackground();
|
loadNetworkBackground();
|
||||||
}
|
}
|
||||||
@@ -643,6 +703,43 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getRoomOnline(RoomOnline onlineBean) {
|
||||||
|
if (onlineBean != null) {
|
||||||
|
List<RoomOnlineBean> onlineBeans = onlineBean.getOff_pit();
|
||||||
|
List<RoomOnlineBean> onlineList = onlineBean.getOn_pit();
|
||||||
|
boolean isPlaying = false;
|
||||||
|
if (onlineBeans != null) {
|
||||||
|
for (RoomOnlineBean onlineBean1 : onlineBeans) {
|
||||||
|
if (onlineBean1.getUser_id() == SpUtil.getUserId()) {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
isPlaying = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (onlineList != null) {
|
||||||
|
for (RoomOnlineBean onlineBean1 : onlineList) {
|
||||||
|
if (onlineBean1.getUser_id() == SpUtil.getUserId()) {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
isPlaying = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isPlaying){
|
||||||
|
RoomManager.getInstance().fetchRoomDataAndEnter(this, CommonAppContext.getInstance().playId,"");
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
|
||||||
|
}else {
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
|
RoomManager.getInstance().fetchRoomDataAndEnter(this, CommonAppContext.getInstance().playId,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateAllTabUI() {
|
private void updateAllTabUI() {
|
||||||
index = 0;
|
index = 0;
|
||||||
// 更新图标
|
// 更新图标
|
||||||
@@ -734,7 +831,6 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// protected void onPause() {
|
// protected void onPause() {
|
||||||
// super.onPause();
|
// super.onPause();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.xscm.moduleutil.activity.IView;
|
|||||||
import com.xscm.moduleutil.bean.AppUpdateModel;
|
import com.xscm.moduleutil.bean.AppUpdateModel;
|
||||||
import com.xscm.moduleutil.bean.FirstChargeBean;
|
import com.xscm.moduleutil.bean.FirstChargeBean;
|
||||||
import com.xscm.moduleutil.bean.ThemeBean;
|
import com.xscm.moduleutil.bean.ThemeBean;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||||
|
|
||||||
|
|
||||||
public final class HomeContacts {
|
public final class HomeContacts {
|
||||||
@@ -27,6 +28,9 @@ public final class HomeContacts {
|
|||||||
void myInfoSuccess(FirstChargeBean data);
|
void myInfoSuccess(FirstChargeBean data);
|
||||||
|
|
||||||
void getThemeData(ThemeBean themeBean);
|
void getThemeData(ThemeBean themeBean);
|
||||||
|
|
||||||
|
void getRoomOnline(RoomOnline onlineBean);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IHomePre extends IPresenter {
|
public interface IHomePre extends IPresenter {
|
||||||
@@ -52,5 +56,7 @@ public final class HomeContacts {
|
|||||||
|
|
||||||
void getThemeData();//主题接口
|
void getThemeData();//主题接口
|
||||||
|
|
||||||
|
void getRoomOnline(String roomId, String page, String page_limit);//在线列表
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.xscm.moduleutil.bean.AppUpdateModel;
|
|||||||
import com.xscm.moduleutil.bean.FirstChargeBean;
|
import com.xscm.moduleutil.bean.FirstChargeBean;
|
||||||
import com.xscm.moduleutil.bean.ThemeBean;
|
import com.xscm.moduleutil.bean.ThemeBean;
|
||||||
import com.xscm.moduleutil.bean.UserBean;
|
import com.xscm.moduleutil.bean.UserBean;
|
||||||
|
import com.xscm.moduleutil.bean.room.RoomOnline;
|
||||||
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 com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
@@ -377,4 +378,23 @@ public class HomePresenter extends BasePresenter<HomeContacts.View> implements H
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getRoomOnline(String roomId, String page, String page_limit) {
|
||||||
|
api.getRoomOnline(roomId, page, page_limit, new BaseObserver<RoomOnline>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
addDisposable(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(RoomOnline roomOnlineBeans) {
|
||||||
|
if (MvpRef==null){
|
||||||
|
MvpRef=new WeakReference<>(mView);
|
||||||
|
}
|
||||||
|
MvpRef.get().getRoomOnline(roomOnlineBeans);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,16 +5,19 @@ import android.app.Activity;
|
|||||||
import com.xscm.moduleutil.activity.IPresenter;
|
import com.xscm.moduleutil.activity.IPresenter;
|
||||||
import com.xscm.moduleutil.activity.IView;
|
import com.xscm.moduleutil.activity.IView;
|
||||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||||
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
|
|
||||||
public class NewsContacts {
|
public class NewsContacts {
|
||||||
public interface View extends IView<Activity> {
|
public interface View extends IView<Activity> {
|
||||||
|
|
||||||
void getOfficialNoticeList(NewsDataBean newsDataBeans);
|
void getOfficialNoticeList(NewsDataBean newsDataBeans);
|
||||||
|
void myInfoSuccess(UserInfo data);
|
||||||
}
|
}
|
||||||
public interface IHomePre extends IPresenter {
|
public interface IHomePre extends IPresenter {
|
||||||
|
|
||||||
void getOfficialNotice();
|
void getOfficialNotice();
|
||||||
|
void getMyInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,14 +10,22 @@ import com.example.modulenews.R;
|
|||||||
import com.example.modulenews.contacts.NewsContacts;
|
import com.example.modulenews.contacts.NewsContacts;
|
||||||
import com.example.modulenews.databinding.FragmentNewsBinding;
|
import com.example.modulenews.databinding.FragmentNewsBinding;
|
||||||
import com.example.modulenews.presenter.NewsPresenter;
|
import com.example.modulenews.presenter.NewsPresenter;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMManager;
|
||||||
|
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
||||||
import com.xscm.moduleutil.activity.news.OfficialNoticeActivity;
|
import com.xscm.moduleutil.activity.news.OfficialNoticeActivity;
|
||||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||||
import com.tencent.imsdk.v2.V2TIMConversation;
|
import com.tencent.imsdk.v2.V2TIMConversation;
|
||||||
import com.tencent.qcloud.tuicore.TUIConstants;
|
import com.tencent.qcloud.tuicore.TUIConstants;
|
||||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIC2CChatActivity;
|
||||||
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment;
|
import com.tencent.qcloud.tuikit.tuiconversation.classicui.page.TUIConversationFragment;
|
||||||
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
|
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||||
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
|
||||||
|
import org.greenrobot.eventbus.EventBus;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -29,20 +37,20 @@ import java.util.List;
|
|||||||
*@description: 音域
|
*@description: 音域
|
||||||
*/
|
*/
|
||||||
public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBinding> implements NewsContacts.View {
|
public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBinding> implements NewsContacts.View {
|
||||||
|
private Long messageCount;
|
||||||
public static NewsFragment newInstance () {
|
public static NewsFragment newInstance () {
|
||||||
return new NewsFragment();
|
return new NewsFragment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData () {
|
protected void initData () {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
MvpPre.getOfficialNotice();
|
MvpPre.getOfficialNotice();
|
||||||
|
MvpPre.getMyInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,9 +135,18 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
|||||||
mBinding.tvXtCount.setVisibility(View.GONE);
|
mBinding.tvXtCount.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
if (newsDataBeans.getAnnouncement_read_count()>0) {
|
if (newsDataBeans.getAnnouncement_read_count()>0) {
|
||||||
|
CommonAppContext.getInstance().setAnnouncement_read_count(newsDataBeans.getAnnouncement_read_count());
|
||||||
mBinding.tvOfficialCount.setText(newsDataBeans.getAnnouncement_read_count()+"");
|
mBinding.tvOfficialCount.setText(newsDataBeans.getAnnouncement_read_count()+"");
|
||||||
}else {
|
}else {
|
||||||
mBinding.tvOfficialCount.setVisibility(View.GONE);
|
mBinding.tvOfficialCount.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
int count = newsDataBeans.getSystem_no_read_count()+newsDataBeans.getAnnouncement_read_count();
|
||||||
|
EventBus.getDefault().post(new UnreadCountEvent(0,(long)count));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void myInfoSuccess(UserInfo data) {
|
||||||
|
SpUtil.saveUserInfo(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
|||||||
|
|
||||||
import com.example.modulenews.contacts.NewsContacts;
|
import com.example.modulenews.contacts.NewsContacts;
|
||||||
import com.xscm.moduleutil.bean.NewsDataBean;
|
import com.xscm.moduleutil.bean.NewsDataBean;
|
||||||
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
import com.xscm.moduleutil.http.BaseObserver;
|
import com.xscm.moduleutil.http.BaseObserver;
|
||||||
import com.xscm.moduleutil.presenter.BasePresenter;
|
import com.xscm.moduleutil.presenter.BasePresenter;
|
||||||
|
|
||||||
@@ -28,4 +29,19 @@ public class NewsPresenter extends BasePresenter<NewsContacts.View> implements N
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getMyInfo() {
|
||||||
|
api.getMyInfo(new BaseObserver<UserInfo>() {
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
addDisposable(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(UserInfo userInfo) {
|
||||||
|
MvpRef.get().myInfoSuccess(userInfo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,13 @@
|
|||||||
android:name=".activity.RoomActivity"
|
android:name=".activity.RoomActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
android:taskAffinity=".RoomTaskAffinity"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
android:windowSoftInputMode="adjustPan"
|
||||||
|
android:enableOnBackInvokedCallback="false"
|
||||||
|
android:theme="@style/TransparentActivityTheme"
|
||||||
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
||||||
/>
|
/>
|
||||||
<!-- <activity-->
|
<!-- <activity-->
|
||||||
<!-- android:name=".activity.RoomActivity"-->
|
<!-- android:name=".activity.RoomActivity"-->
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
package com.example.moduleroom.adapter;
|
package com.example.moduleroom.adapter;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.text.Spannable;
|
||||||
|
import android.text.SpannableStringBuilder;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@@ -12,7 +17,9 @@ import com.bumptech.glide.Glide;
|
|||||||
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
|
||||||
import com.chad.library.adapter.base.BaseViewHolder;
|
import com.chad.library.adapter.base.BaseViewHolder;
|
||||||
import com.example.moduleroom.R;
|
import com.example.moduleroom.R;
|
||||||
|
import com.xscm.moduleutil.bean.GiftBean;
|
||||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||||
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
import com.xscm.moduleutil.bean.room.EMMessageInfo;
|
import com.xscm.moduleutil.bean.room.EMMessageInfo;
|
||||||
import com.xscm.moduleutil.utils.ColorManager;
|
import com.xscm.moduleutil.utils.ColorManager;
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
@@ -38,6 +45,8 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
|||||||
private List<EMMessageInfo> allMsgList;
|
private List<EMMessageInfo> allMsgList;
|
||||||
private List<EMMessageInfo> userMsgList;
|
private List<EMMessageInfo> userMsgList;
|
||||||
private List<EMMessageInfo> systemMsgList;
|
private List<EMMessageInfo> systemMsgList;
|
||||||
|
private String messageNameColor = "#00C8FF";//名称的颜色
|
||||||
|
private String messageGiftColor="#FFE309";//礼物的颜色
|
||||||
|
|
||||||
public EaseChatAdapter() {
|
public EaseChatAdapter() {
|
||||||
super(null);
|
super(null);
|
||||||
@@ -76,37 +85,106 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
|||||||
//notifyDataSetChanged();
|
//notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SpannableStringBuilder getSpannable(RoomMessageEvent message) {
|
||||||
|
// 在 Android 中实现类似的富文本功能
|
||||||
|
SpannableStringBuilder spannable = new SpannableStringBuilder(message.getText().getText());
|
||||||
|
|
||||||
|
// 设置发送者昵称的颜色
|
||||||
|
if (message.getText().getFromUserInfo() != null && !TextUtils.isEmpty(message.getText().getFromUserInfo().getNickname())) {
|
||||||
|
String nickname = message.getText ().getFromUserInfo().getNickname();
|
||||||
|
int startIndex = message.getText().getText().indexOf(nickname);
|
||||||
|
if (startIndex != -1) {
|
||||||
|
int endIndex = startIndex + nickname.length();
|
||||||
|
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置接收者昵称的颜色
|
||||||
|
if (message.getText().getToUserInfo() != null && !TextUtils.isEmpty(message.getText().getToUserInfo().getNickname())) {
|
||||||
|
String nickname = message.getText().getToUserInfo().getNickname();
|
||||||
|
int startIndex = message.getText().getText().indexOf(nickname);
|
||||||
|
if (startIndex != -1) {
|
||||||
|
int endIndex = startIndex + nickname.length();
|
||||||
|
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理礼物名称的颜色设置
|
||||||
|
if (message.getText().getGiftInfo() != null && !TextUtils.isEmpty(message.getText().getGiftInfo().getGift_name())) {
|
||||||
|
String[] giftNames = message.getText().getGiftInfo().getGift_name().split(",");
|
||||||
|
for (String giftName : giftNames) {
|
||||||
|
List<int[]> occurrences = findAllOccurrencesOfString(message.getText().getText(), giftName);
|
||||||
|
for (int[] range : occurrences) {
|
||||||
|
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageGiftColor)), range[0], range[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理多个礼物信息的颜色设置
|
||||||
|
if (message.getText().getGiftInfos() != null && !message.getText().getGiftInfos().isEmpty()) {
|
||||||
|
for (GiftBean gift : message.getText().getGiftInfos()) {
|
||||||
|
if (!TextUtils.isEmpty(gift.getGift_name())) {
|
||||||
|
int startIndex = message.getText().getText().indexOf(gift.getGift_name());
|
||||||
|
if (startIndex != -1) {
|
||||||
|
int endIndex = startIndex + gift.getGift_name().length();
|
||||||
|
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageGiftColor)), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理多个接收者信息的颜色设置
|
||||||
|
if (message.getText().getToUserInfos() != null && !message.getText().getToUserInfos().isEmpty()) {
|
||||||
|
for (int i = 0; i < message.getText().getToUserInfos().size(); i++) {
|
||||||
|
UserInfo userModel = message.getText().getToUserInfos().get(i);
|
||||||
|
if (!TextUtils.isEmpty(userModel.getNickname())) {
|
||||||
|
List<int[]> occurrences = findAllOccurrencesOfString(message.getText().getText(), userModel.getNickname());
|
||||||
|
for (int[] range : occurrences) {
|
||||||
|
spannable.setSpan(new ForegroundColorSpan(Color.parseColor(messageNameColor)), range[0], range[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return spannable;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查找字符串中所有子字符串出现的位置
|
||||||
|
* @param text 原始文本
|
||||||
|
* @param searchString 要查找的子字符串
|
||||||
|
* @return 包含所有出现位置的列表,每个位置用 [start, end] 表示
|
||||||
|
*/
|
||||||
|
private List<int[]> findAllOccurrencesOfString(String text, String searchString) {
|
||||||
|
List<int[]> occurrences = new ArrayList<>();
|
||||||
|
if (TextUtils.isEmpty(text) || TextUtils.isEmpty(searchString)) {
|
||||||
|
return occurrences;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = text.indexOf(searchString);
|
||||||
|
while (index >= 0) {
|
||||||
|
occurrences.add(new int[]{index, index + searchString.length()});
|
||||||
|
index = text.indexOf(searchString, index + searchString.length());
|
||||||
|
}
|
||||||
|
|
||||||
|
return occurrences;
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void convert(BaseViewHolder helper, EMMessageInfo item) {
|
protected void convert(BaseViewHolder helper, EMMessageInfo item) {
|
||||||
RoomMessageEvent emMessage = item.getEmMessage();
|
RoomMessageEvent emMessage = item.getEmMessage();
|
||||||
// EMTextMessageBody txtBody = (EMTextMessageBody) emMessage.getBody();
|
|
||||||
// Spanned spanned = Html.fromHtml(txtBody.getMessage());
|
|
||||||
// String message = txtBody.getMessage();
|
|
||||||
// Log.e("环信消息", message);
|
|
||||||
// SpanUtils spanUtils = new SpanUtils();
|
|
||||||
// String role = emMessage.getStringAttribute("role", "0");
|
|
||||||
// String userIsNew = emMessage.getStringAttribute("user_is_new", "0");
|
|
||||||
// String rankIcon = emMessage.getStringAttribute("rank_icon", "");
|
|
||||||
// String nobilityIcon = emMessage.getStringAttribute("nobility_icon", "");
|
|
||||||
// String nickname = emMessage.getStringAttribute("nickname", "");
|
|
||||||
// String type = emMessage.getStringAttribute("type", "");
|
|
||||||
// String charmIcon = emMessage.getStringAttribute("charm_icon", null);
|
|
||||||
// String user_title = emMessage.getStringAttribute("user_title", null);
|
|
||||||
// String emoji_special = emMessage.getStringAttribute("face_special", message);
|
|
||||||
// String userId = emMessage.getStringAttribute("user_id", null);
|
|
||||||
// Spanned spanned1 = null;
|
|
||||||
//
|
//
|
||||||
TextView tv_content= helper.getView(R.id.tv_content);
|
TextView tv_content= helper.getView(R.id.tv_content);
|
||||||
|
|
||||||
switch (helper.getItemViewType()) {
|
switch (helper.getItemViewType()) {
|
||||||
case 1:
|
case 1:
|
||||||
helper.getView(R.id.tv_content).setVisibility(View.VISIBLE);
|
helper.getView(R.id.tv_content).setVisibility(View.VISIBLE);
|
||||||
helper.setText(R.id.tv_content, emMessage.getText().getText());
|
helper.setText(R.id.tv_content, getSpannable(emMessage));
|
||||||
tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
// helper.setText(R.id.tv_content, emMessage.getText().getText());
|
||||||
|
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
||||||
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
||||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
helper.setText(com.xscm.moduleutil.R.id.tv_content, getSpannable(emMessage));
|
||||||
|
// helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||||
List<String> images = emMessage.getText().getFromUserInfo().getIcon();
|
List<String> images = emMessage.getText().getFromUserInfo().getIcon();
|
||||||
LinearLayout ll_images = helper.getView(com.xscm.moduleutil.R.id.line);
|
LinearLayout ll_images = helper.getView(com.xscm.moduleutil.R.id.line);
|
||||||
ll_images.removeAllViews();
|
ll_images.removeAllViews();
|
||||||
@@ -125,80 +203,20 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
|||||||
ll_images.addView(imageView);
|
ll_images.addView(imageView);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
// int paddingLeftValues3 = 0;//距离左边距(默认加上8dp间距)
|
|
||||||
// ivRole = helper.getView(R.id.iv_role);
|
|
||||||
// ivNew = helper.getView(R.id.iv_new);
|
|
||||||
// ivGrade = helper.getView(R.id.iv_grade);
|
|
||||||
// ivTitle = helper.getView(R.id.iv_title_label);
|
|
||||||
// ivNHobility = helper.getView(R.id.iv_nobility);
|
|
||||||
// TextView tvContent3 = helper.getView(R.id.tv_content);
|
|
||||||
// ivRole.setRole(Integer.parseInt(role));
|
|
||||||
// ivNew.setNew(Integer.parseInt(userIsNew));
|
|
||||||
// ivGrade.setGrade(rankIcon);
|
|
||||||
// ivTitle.setLabelView(user_title);
|
|
||||||
// ivTitle.setLabelView(user_title);
|
|
||||||
// ivNHobility.setNobility(nobilityIcon);
|
|
||||||
// ImageUtils.loadIcon(charmIcon, helper.getView(R.id.iv_charm));
|
|
||||||
// // !---------------------------- 获取 最终的padding值
|
|
||||||
// //爵位图标判断
|
|
||||||
// if (ivNHobility.getVisibility() == View.VISIBLE) {
|
|
||||||
// paddingLeftValues3 += 23;
|
|
||||||
// }
|
|
||||||
// //角色图标
|
|
||||||
// if (ivRole.getVisibility() == View.VISIBLE) {
|
|
||||||
// paddingLeftValues3 += 27;
|
|
||||||
// }
|
|
||||||
// //新人图标
|
|
||||||
// if (ivNew.getVisibility() == View.VISIBLE) {
|
|
||||||
// paddingLeftValues3 += 33;
|
|
||||||
// }
|
|
||||||
// //等级图标
|
|
||||||
// if (ivGrade.getVisibility() == View.VISIBLE) {
|
|
||||||
// paddingLeftValues3 += 33;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// //称号图标
|
|
||||||
// try {
|
|
||||||
// if (user_title == null || user_title.isEmpty()){
|
|
||||||
// user_title = "";
|
|
||||||
// }
|
|
||||||
// String s = user_title.substring(user_title.lastIndexOf("=") + 1);
|
|
||||||
// if (TextUtils.isEmpty(s)){
|
|
||||||
// s = "1";
|
|
||||||
// }
|
|
||||||
// int mWidth = (int) (Float.parseFloat(s) * 20);
|
|
||||||
// int mHeight = 20;
|
|
||||||
// ViewGroup.LayoutParams layoutParams = ivTitle.getLayoutParams();
|
|
||||||
// layoutParams.width = ConvertUtils.dp2px(mWidth);
|
|
||||||
// layoutParams.height = ConvertUtils.dp2px(mHeight);
|
|
||||||
// ivTitle.setLayoutParams(layoutParams);
|
|
||||||
// if (ivTitle.getVisibility() == View.VISIBLE) {
|
|
||||||
// paddingLeftValues3 += (mWidth + 3);
|
|
||||||
// }
|
|
||||||
// } catch (Exception e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// //魅力图标
|
|
||||||
// if (helper.getView(R.id.iv_charm).getVisibility() == View.VISIBLE) {
|
|
||||||
// paddingLeftValues3 += 23;
|
|
||||||
// }
|
|
||||||
// spanUtils.append(nickname + " ").setForegroundColor(mContext.getResources().getColor(R.color.color_FFFFBC00)).setFontSize(ResourceUtil.getDimen(R.dimen.sp_13))
|
|
||||||
// .append(spanned);
|
|
||||||
// tvContent3.setPadding(ResourceUtil.getDimen(String.valueOf(paddingLeftValues3)), 0, 0, 0);
|
|
||||||
// tvContent3.setText(spanUtils.create());
|
|
||||||
|
|
||||||
if (emMessage.getText().getFromUserInfo()!=null && emMessage.getText().getFromUserInfo().getAvatar()!=null) {
|
if (emMessage.getText().getFromUserInfo()!=null && emMessage.getText().getFromUserInfo().getAvatar()!=null) {
|
||||||
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
ImageUtils.loadHeadCC(emMessage.getText().getFromUserInfo().getAvatar(), helper.getView(com.xscm.moduleutil.R.id.avatar));
|
||||||
}
|
}
|
||||||
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
helper.setText(com.xscm.moduleutil.R.id.tv_name, emMessage.getText().getFromUserInfo().getNickname());
|
||||||
helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
// helper.setText(com.xscm.moduleutil.R.id.tv_content, emMessage.getText().getText());
|
||||||
|
helper.setText(com.xscm.moduleutil.R.id.tv_content, getSpannable(emMessage));
|
||||||
List<String> images1 = emMessage.getText().getFromUserInfo().getIcon();
|
List<String> images1 = emMessage.getText().getFromUserInfo().getIcon();
|
||||||
LinearLayout ll_images1 = helper.getView(com.xscm.moduleutil.R.id.line);
|
LinearLayout ll_images1 = helper.getView(com.xscm.moduleutil.R.id.line);
|
||||||
ll_images1.removeAllViews();
|
ll_images1.removeAllViews();
|
||||||
tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
// tv_content.setTextColor(ColorManager.getInstance().getPrimaryColorInt());
|
||||||
if (images1 == null){
|
if (images1 == null){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBea
|
|||||||
return b ? "排麦模式" : "自由模式";
|
return b ? "排麦模式" : "自由模式";
|
||||||
case RoomSettingBean.QXRoomSettingTypeRoomCloseEffects:
|
case RoomSettingBean.QXRoomSettingTypeRoomCloseEffects:
|
||||||
return b ? "关闭特效" : "开启特效";
|
return b ? "关闭特效" : "开启特效";
|
||||||
|
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||||
|
return b ? "关闭飘屏" : "开启飘屏";
|
||||||
default:
|
default:
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@@ -83,6 +85,8 @@ public class RoomSettingAdapter extends BaseMultiItemQuickAdapter<RoomSettingBea
|
|||||||
return b ? com.xscm.moduleutil.R.mipmap.ic_close_effects : com.xscm.moduleutil.R.mipmap.ic_open_effects;
|
return b ? com.xscm.moduleutil.R.mipmap.ic_close_effects : com.xscm.moduleutil.R.mipmap.ic_open_effects;
|
||||||
case RoomSettingBean.QXRoomSettingTypeRoomReport:
|
case RoomSettingBean.QXRoomSettingTypeRoomReport:
|
||||||
return com.xscm.moduleutil.R.mipmap.ic_report;
|
return com.xscm.moduleutil.R.mipmap.ic_report;
|
||||||
|
case RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen:
|
||||||
|
return b ? com.xscm.moduleutil.R.mipmap.ic_close_floating_screen : com.xscm.moduleutil.R.mipmap.ic_open_floating_screen;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
mSelectGiftNumPopupWindow.setData(mGiftNumList);
|
mSelectGiftNumPopupWindow.setData(mGiftNumList);
|
||||||
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 230);
|
mSelectGiftNumPopupWindow.showAtLocation(mBinding.tvGiveCoinNum, Gravity.BOTTOM | Gravity.RIGHT, 100, 190);
|
||||||
|
|
||||||
|
|
||||||
} else if (view1.getId() == R.id.tv_give) {
|
} else if (view1.getId() == R.id.tv_give) {
|
||||||
|
|||||||
@@ -100,15 +100,32 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
|||||||
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
mBinding.srl.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
|
||||||
page++;
|
// 添加延迟以避免过于频繁的请求
|
||||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), page + "", "10");
|
mBinding.getRoot().postDelayed(() -> {
|
||||||
|
page++;
|
||||||
|
if (MvpPre != null && getArguments() != null) {
|
||||||
|
MvpPre.getRoomOnline(getArguments().getString("roomId"), page + "", "10");
|
||||||
|
} else {
|
||||||
|
refreshLayout.finishLoadMore(false);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
|
||||||
// EventBus.getDefault().post(new BannerRefreshEvent());
|
// EventBus.getDefault().post(new BannerRefreshEvent());
|
||||||
page = 1;
|
// page = 1;
|
||||||
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
// MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||||
|
|
||||||
|
// 添加延迟以避免过于频繁的请求
|
||||||
|
mBinding.getRoot().postDelayed(() -> {
|
||||||
|
page = 1;
|
||||||
|
if (MvpPre != null && getArguments() != null) {
|
||||||
|
MvpPre.getRoomOnline(getArguments().getString("roomId"), "1", "10");
|
||||||
|
} else {
|
||||||
|
refreshLayout.finishRefresh(false);
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -153,6 +170,14 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 在类中添加以下方法
|
||||||
|
private void resetRefreshState() {
|
||||||
|
if (mBinding != null && mBinding.srl != null) {
|
||||||
|
mBinding.srl.resetNoMoreData();
|
||||||
|
}
|
||||||
|
page = 1;
|
||||||
|
}
|
||||||
|
|
||||||
private int isNumberWhether() {
|
private int isNumberWhether() {
|
||||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||||
if (roomInfoResp.getRoom_info().getPit_list().get(i).getPit_number().equals("9") && roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id() != null &&
|
if (roomInfoResp.getRoom_info().getPit_list().get(i).getPit_number().equals("9") && roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id() != null &&
|
||||||
@@ -215,55 +240,152 @@ public class RoomOnlineDialogFragment extends BaseMvpDialogFragment<RoomPresente
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getRoomOnline(RoomOnline onlineBean) {
|
public void getRoomOnline(RoomOnline onlineBean) {
|
||||||
List<RoomOnlineBean> roomOnlineBeanList=new ArrayList<>();
|
|
||||||
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
try {
|
||||||
int type_pit;
|
// 确保在主线程中执行UI操作
|
||||||
if (pit_number.isEmpty()) {
|
if (getActivity() == null || mBinding == null) {
|
||||||
type_pit = 1;
|
return;
|
||||||
} else {
|
|
||||||
type_pit = 2;
|
|
||||||
}
|
|
||||||
if (onlineBean.getOn_pit() != null && onlineBean.getOn_pit().size() > 0) {
|
|
||||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
|
||||||
roomOnlineBean.setItemViewType(1);
|
|
||||||
roomOnlineBean.setTypeNames("麦上用户");
|
|
||||||
roomOnlineBeanList.add(roomOnlineBean);
|
|
||||||
for (RoomOnlineBean roomOnlineBean1 : onlineBean.getOn_pit()) {
|
|
||||||
roomOnlineBean1.setType(1);
|
|
||||||
roomOnlineBean1.setType_pit(0);
|
|
||||||
roomOnlineBean1.setItemViewType(2);
|
|
||||||
roomOnlineBeanList.add(roomOnlineBean1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
// 完成刷新或加载更多操作
|
||||||
|
if (mBinding.srl != null) {
|
||||||
|
if (page <= 1) {
|
||||||
|
mBinding.srl.finishRefresh();
|
||||||
|
} else {
|
||||||
|
mBinding.srl.finishLoadMore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RoomOnlineBean> roomOnlineBeanList = new ArrayList<>();
|
||||||
|
// 处理第一页数据(刷新操作)
|
||||||
|
if (page <= 1) {
|
||||||
|
// 清空之前的数据
|
||||||
|
roomOnlineAdapter.setNewData(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
// roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||||
|
int type_pit;
|
||||||
|
if (pit_number.isEmpty()) {
|
||||||
|
type_pit = 1;
|
||||||
|
} else {
|
||||||
|
type_pit = 2;
|
||||||
|
}
|
||||||
|
if (onlineBean.getOn_pit() != null && onlineBean.getOn_pit().size() > 0) {
|
||||||
|
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||||
|
roomOnlineBean.setItemViewType(1);
|
||||||
|
roomOnlineBean.setTypeNames("麦上用户");
|
||||||
|
roomOnlineBeanList.add(roomOnlineBean);
|
||||||
|
for (RoomOnlineBean roomOnlineBean1 : onlineBean.getOn_pit()) {
|
||||||
|
roomOnlineBean1.setType(1);
|
||||||
|
roomOnlineBean1.setType_pit(0);
|
||||||
|
roomOnlineBean1.setItemViewType(2);
|
||||||
|
roomOnlineBeanList.add(roomOnlineBean1);
|
||||||
|
}
|
||||||
|
|
||||||
// roomOnlineAdapter.setNewData(onlineBean.getOn_pit());
|
// roomOnlineAdapter.setNewData(onlineBean.getOn_pit());
|
||||||
}
|
}
|
||||||
if (onlineBean.getOff_pit() != null && onlineBean.getOff_pit().size() > 0) {
|
if (onlineBean.getOff_pit() != null && onlineBean.getOff_pit().size() > 0) {
|
||||||
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
RoomOnlineBean roomOnlineBean = new RoomOnlineBean();
|
||||||
roomOnlineBean.setItemViewType(1);
|
roomOnlineBean.setItemViewType(1);
|
||||||
roomOnlineBean.setTypeNames("麦下用户");
|
roomOnlineBean.setTypeNames("麦下用户");
|
||||||
roomOnlineBeanList.add(roomOnlineBean);
|
roomOnlineBeanList.add(roomOnlineBean);
|
||||||
for (RoomOnlineBean roomOnlineBean2 : onlineBean.getOff_pit()) {
|
for (RoomOnlineBean roomOnlineBean2 : onlineBean.getOff_pit()) {
|
||||||
roomOnlineBean2.setType(2);
|
roomOnlineBean2.setType(2);
|
||||||
roomOnlineBean2.setType_pit(type_pit);
|
roomOnlineBean2.setType_pit(type_pit);
|
||||||
roomOnlineBean2.setItemViewType(2);
|
roomOnlineBean2.setItemViewType(2);
|
||||||
roomOnlineBeanList.add(roomOnlineBean2);
|
roomOnlineBeanList.add(roomOnlineBean2);
|
||||||
}
|
}
|
||||||
// roomOnlineAdapter2.setNewData(onlineBean.getOff_pit());
|
// roomOnlineAdapter2.setNewData(onlineBean.getOff_pit());
|
||||||
}
|
}
|
||||||
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
|
||||||
int total = onlineBean.getOn_pit().size() + onlineBean.getOff_pit().size();
|
|
||||||
|
|
||||||
mBinding.tvNum.setText("在线用户(" + total + ")人");
|
// 根据是刷新还是加载更多来处理数据
|
||||||
if (getActivity() instanceof RoomActivity) {
|
if (page <= 1) {
|
||||||
((RoomActivity) getActivity()).setOnlineNumber(total);
|
// 刷新操作,设置新数据
|
||||||
|
roomOnlineAdapter.setNewData(roomOnlineBeanList);
|
||||||
|
} else {
|
||||||
|
// 加载更多操作,添加数据
|
||||||
|
if (roomOnlineBeanList.size() > 0) {
|
||||||
|
roomOnlineAdapter.addData(roomOnlineBeanList);
|
||||||
|
} else {
|
||||||
|
// 没有更多数据了
|
||||||
|
if (mBinding.srl != null) {
|
||||||
|
mBinding.srl.finishLoadMoreWithNoMoreData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新用户总数
|
||||||
|
// 更新用户总数 - 仅在第一页刷新时更新总数
|
||||||
|
if (page <= 1) {
|
||||||
|
int total = 0;
|
||||||
|
if (onlineBean.getOn_pit() != null) {
|
||||||
|
total += onlineBean.getOn_pit().size();
|
||||||
|
}
|
||||||
|
if (onlineBean.getOff_pit() != null) {
|
||||||
|
total += onlineBean.getOff_pit().size();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只有当获取到有效数据时才更新总数显示
|
||||||
|
if (onlineBean.getOn_pit() != null || onlineBean.getOff_pit() != null) {
|
||||||
|
mBinding.tvNum.setText("在线用户(" + total + ")人");
|
||||||
|
if (getActivity() instanceof RoomActivity) {
|
||||||
|
((RoomActivity) getActivity()).setOnlineNumber(total);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 如果两个列表都为null,保持之前的总数显示不变
|
||||||
|
} else {
|
||||||
|
// 加载更多时,更新总数显示
|
||||||
|
int currentTotal = 0;
|
||||||
|
List<RoomOnlineBean> currentData = roomOnlineAdapter.getData();
|
||||||
|
for (RoomOnlineBean bean : currentData) {
|
||||||
|
if (bean.getItemViewType() == 2) { // 只统计用户项,不统计标题项
|
||||||
|
currentTotal++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mBinding.tvNum.setText("在线用户(" + currentTotal + ")人");
|
||||||
|
if (getActivity() instanceof RoomActivity) {
|
||||||
|
((RoomActivity) getActivity()).setOnlineNumber(currentTotal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查是否需要禁用加载更多(如果当前页数据少于预期)
|
||||||
|
if (onlineBean.getOn_pit() != null && onlineBean.getOff_pit() != null) {
|
||||||
|
int currentCount = onlineBean.getOn_pit().size() + onlineBean.getOff_pit().size();
|
||||||
|
if (currentCount < 10 && page > 1) { // 每页预期10条数据
|
||||||
|
if (mBinding.srl != null) {
|
||||||
|
mBinding.srl.finishLoadMoreWithNoMoreData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 确保在异常情况下也能完成刷新操作
|
||||||
|
if (getActivity() != null && mBinding != null && mBinding.srl != null) {
|
||||||
|
getActivity().runOnUiThread(() -> {
|
||||||
|
if (page <= 1) {
|
||||||
|
mBinding.srl.finishRefresh(false);
|
||||||
|
} else {
|
||||||
|
mBinding.srl.finishLoadMore(false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
// @Override
|
||||||
// public void getRoomOnline(List<RoomOnlineBean> onlineBean) {
|
// public void getRoomOnline(List<RoomOnlineBean> onlineBean) {
|
||||||
// roomOnlineAdapter.setNewData(onlineBean);
|
// roomOnlineAdapter.setNewData(onlineBean);
|
||||||
// mBinding.tvNum.setText("在线用户("+onlineBean.size()+")人");
|
// mBinding.tvNum.setText("在线用户("+onlineBean.size()+")人");
|
||||||
// }
|
// }
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
// 每次恢复时重置刷新状态
|
||||||
|
resetRefreshState();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void applyPit() {
|
public void applyPit() {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.hjq.toast.ToastUtils;
|
|||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||||
import com.xscm.moduleutil.event.EffectEvent;
|
import com.xscm.moduleutil.event.EffectEvent;
|
||||||
|
import com.xscm.moduleutil.event.FloatingScreenEvent;
|
||||||
import com.xscm.moduleutil.event.MusicEvent;
|
import com.xscm.moduleutil.event.MusicEvent;
|
||||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
@@ -61,6 +62,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
|||||||
private int read;
|
private int read;
|
||||||
private boolean isSelected;
|
private boolean isSelected;
|
||||||
private boolean effectOn = false;//开启/关闭特效
|
private boolean effectOn = false;//开启/关闭特效
|
||||||
|
private boolean floatingScreen = false;//开启/关闭飘屏
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RoomSettingPresenter bindPresenter() {
|
protected RoomSettingPresenter bindPresenter() {
|
||||||
@@ -133,6 +135,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
|||||||
protected void initData() {
|
protected void initData() {
|
||||||
dataList = new ArrayList<>();
|
dataList = new ArrayList<>();
|
||||||
effectOn = SpUtil.getOpenEffect() == 1;
|
effectOn = SpUtil.getOpenEffect() == 1;
|
||||||
|
floatingScreen = SpUtil.getFloatingScreen() == 1;
|
||||||
boolean b = roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1");
|
boolean b = roomInfoResp.getRoom_info().getRoom_up_pit_type().equals("1");
|
||||||
LogUtils.e("effectOn=" + effectOn);
|
LogUtils.e("effectOn=" + effectOn);
|
||||||
// 添加标题和对应的内容项
|
// 添加标题和对应的内容项
|
||||||
@@ -160,6 +163,7 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
|||||||
dataList.add(new RoomSettingBean("房间设置", "ic_room_setting", null, null, RoomSettingBean.QXRoomSettingTypeRoomSetting, read, isSelected, false, false));
|
dataList.add(new RoomSettingBean("房间设置", "ic_room_setting", null, null, RoomSettingBean.QXRoomSettingTypeRoomSetting, read, isSelected, false, false));
|
||||||
// dataList.add(new RoomSettingBean("房间欢迎语", "ic_welcome", null, null, RoomSettingBean.QXRoomSettingTypeRoomWelcome,read,isSelected, false));
|
// dataList.add(new RoomSettingBean("房间欢迎语", "ic_welcome", null, null, RoomSettingBean.QXRoomSettingTypeRoomWelcome,read,isSelected, false));
|
||||||
dataList.add(new RoomSettingBean("关闭特效", "ic_close_effects", null, null, RoomSettingBean.QXRoomSettingTypeRoomCloseEffects, read, isSelected, false, effectOn));
|
dataList.add(new RoomSettingBean("关闭特效", "ic_close_effects", null, null, RoomSettingBean.QXRoomSettingTypeRoomCloseEffects, read, isSelected, false, effectOn));
|
||||||
|
dataList.add(new RoomSettingBean("关闭飘屏", "ic_close_floating_screen", null, null, RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen, read, isSelected, false, floatingScreen));
|
||||||
dataList.add(new RoomSettingBean("举报", "ic_report", null, null, RoomSettingBean.QXRoomSettingTypeRoomReport, read, isSelected, false, false));
|
dataList.add(new RoomSettingBean("举报", "ic_report", null, null, RoomSettingBean.QXRoomSettingTypeRoomReport, read, isSelected, false, false));
|
||||||
List<RoomSettingBean> filteredList = new ArrayList<>();
|
List<RoomSettingBean> filteredList = new ArrayList<>();
|
||||||
// 更新 itemType
|
// 更新 itemType
|
||||||
@@ -281,7 +285,22 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
|||||||
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) {
|
} else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomSubsidy) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_ALLOWANCE).withString("from", "我的界面").withString("roomId", roomInfoResp.getRoom_info().getRoom_id() + "").navigation();
|
ARouter.getInstance().build(ARouteConstants.ROOM_ALLOWANCE).withString("from", "我的界面").withString("roomId", roomInfoResp.getRoom_info().getRoom_id() + "").navigation();
|
||||||
|
}else if (bean.getType() == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen){//2025年9月22日14:10:25,添加飘屏关闭打开按钮
|
||||||
|
if (floatingScreen) {
|
||||||
|
//关闭
|
||||||
|
floatingScreen = false;
|
||||||
|
//保存到本地
|
||||||
|
SpUtil.setFloatingScreen(0);
|
||||||
|
EventBus.getDefault().post(new FloatingScreenEvent(false));
|
||||||
|
bean.setSelect(false);
|
||||||
|
} else {
|
||||||
|
//打开
|
||||||
|
floatingScreen = true;
|
||||||
|
SpUtil.setFloatingScreen(1);
|
||||||
|
EventBus.getDefault().post(new FloatingScreenEvent(true));
|
||||||
|
bean.setSelect(true);
|
||||||
|
}
|
||||||
|
upAdapter();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -318,31 +337,44 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
|||||||
|| roomInfoResp.getRoom_info().getType_id().equals("4") || roomInfoResp.getRoom_info().getType_id().equals("8")) && roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
|
|| roomInfoResp.getRoom_info().getType_id().equals("4") || roomInfoResp.getRoom_info().getType_id().equals("8")) && roomInfoResp.getRoom_info().getLabel_id().equals("2")) {
|
||||||
onMic = true;
|
onMic = true;
|
||||||
}
|
}
|
||||||
|
// 2025年9月22日14:18:50,因为声网sdk不对,和点唱有关系的所有,需要关闭
|
||||||
// 房主显示全部
|
// 房主显示全部
|
||||||
if (roleLevel == 1) {
|
if (roleLevel == 1) {
|
||||||
if (onMic) {
|
if (onMic) {
|
||||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
if (type==RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (roleLevel == 2 || roleLevel == 3) { // type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl || 2025年9月19日11:21:04,将男神女神合并成互娱,最总是新添加一个标签
|
} else if (roleLevel == 2 || roleLevel == 3) { // type == RoomSettingBean.QXRoomSettingTypeRoomTypeBoy || type == RoomSettingBean.QXRoomSettingTypeRoomTypeGirl || 2025年9月19日11:21:04,将男神女神合并成互娱,最总是新添加一个标签
|
||||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
|
if (type == RoomSettingBean.QXRoomSettingTypeRoomTypeSing || type == RoomSettingBean.QXRoomSettingTypeRoomTypeAuction ||
|
||||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU ||
|
type == RoomSettingBean.QXRoomSettingTypeRoomTypeHUYU ||
|
||||||
type == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy ||
|
type == RoomSettingBean.QXRoomSettingTypeRoomTypeJiaoy ||
|
||||||
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic
|
type == RoomSettingBean.QXRoomSettingTypeRoomClearMessage || type == QXRoomSettingTypeRoomOrderMic || type == RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen
|
||||||
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
|
|| type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic || type == RoomSettingBean.QXRoomSettingTypeRoomBgImage || type == -1) {
|
||||||
if (onMic) {
|
if (onMic) {
|
||||||
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
if (type==RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
if (type >= RoomSettingBean.QXRoomSettingTypeRoomLeave &&
|
||||||
type <= RoomSettingBean.QXRoomSettingTypeRoomReport) {
|
type <= RoomSettingBean.QXRoomSettingTypeRoomReport
|
||||||
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
}else {
|
||||||
|
if (type == RoomSettingBean.QXRoomSettingTypeRoomBgMusic){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -368,7 +400,8 @@ public class RoomSettingFragment extends BaseMvpDialogFragment<RoomSettingPresen
|
|||||||
type == RoomSettingBean.QXRoomSettingTypeRoomShare ||
|
type == RoomSettingBean.QXRoomSettingTypeRoomShare ||
|
||||||
type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ||
|
type == RoomSettingBean.QXRoomSettingTypeRoomMyDress ||
|
||||||
type == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects ||
|
type == RoomSettingBean.QXRoomSettingTypeRoomCloseEffects ||
|
||||||
type == RoomSettingBean.QXRoomSettingTypeRoomReport;
|
type == RoomSettingBean.QXRoomSettingTypeRoomReport ||
|
||||||
|
type== RoomSettingBean.QXRoomSettingTypeRoomFloatingScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ public class RoomUserInfoFragment extends BaseMvpDialogFragment<RoomUserPresente
|
|||||||
// showContent = "点击 Item菜单6";
|
// showContent = "点击 Item菜单6";
|
||||||
//TODO 举报功能
|
//TODO 举报功能
|
||||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
ARouter.getInstance().build(ARouteConstants.H5).withString("url",CommonAppContext.getInstance().getCurrentEnvironment().getH5Url()+ "/web/index.html#/pages/feedback/report?id="+SpUtil.getToken()+"&fromType=1&fromId="+user_id).withString("title", "举报").navigation();
|
||||||
|
dismiss();
|
||||||
} else if (id == R.id.action_blacklist) {
|
} else if (id == R.id.action_blacklist) {
|
||||||
MvpPre.addBlackList(user_id);
|
MvpPre.addBlackList(user_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ import android.annotation.SuppressLint;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
@@ -45,10 +48,13 @@ 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.dialog.ConfirmDialog;
|
||||||
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
import com.xscm.moduleutil.utils.ClickUtils;
|
import com.xscm.moduleutil.utils.ClickUtils;
|
||||||
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.utils.StringUtil;
|
||||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||||
|
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||||
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
import com.xscm.moduleutil.widget.floatingView.IFloatingView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -111,6 +117,22 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
//
|
||||||
|
// // 观察专门给子Fragment的数据
|
||||||
|
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||||
|
// if (data != null) {
|
||||||
|
// // 处理数据
|
||||||
|
// roomInfoUpdate(data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConcernSelected(RoomRelationBean selectedDean, FriendUserBean relationshipList) {
|
public void onConcernSelected(RoomRelationBean selectedDean, FriendUserBean relationshipList) {
|
||||||
@@ -937,8 +959,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
* @param pitArr 麦位数组
|
* @param pitArr 麦位数组
|
||||||
*/
|
*/
|
||||||
public void friendSeatDidChanged(List<RoomPitBean> pitArr) { // 使用实际的麦位模型类
|
public void friendSeatDidChanged(List<RoomPitBean> pitArr) { // 使用实际的麦位模型类
|
||||||
|
boolean isHaveMe=false;
|
||||||
if (myPitNumber == 9 || myPitNumber == 10) {
|
if (myPitNumber == 9 || myPitNumber == 10) {
|
||||||
|
isHaveMe=true;
|
||||||
} else {
|
} else {
|
||||||
myPitNumber = -1;
|
myPitNumber = -1;
|
||||||
}
|
}
|
||||||
@@ -957,6 +980,20 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
friendshipWheatView.setData(roomPitBean);
|
friendshipWheatView.setData(roomPitBean);
|
||||||
if (pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
if (pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||||
myPitNumber = Integer.parseInt(pitBean.getPit_number());
|
myPitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||||
|
isHaveMe=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isHaveMe){
|
||||||
|
if (getActivity() instanceof RoomActivity) {
|
||||||
|
((RoomActivity) getActivity()).setrlMic(false);
|
||||||
|
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
|
||||||
|
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
if (getActivity() instanceof RoomActivity) {
|
||||||
|
((RoomActivity) getActivity()).setrlMic(true);
|
||||||
|
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
|
||||||
|
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configPowerBtn();
|
configPowerBtn();
|
||||||
@@ -1072,7 +1109,8 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
mBinding.imX1.setVisibility(View.VISIBLE);
|
mBinding.imX1.setVisibility(View.VISIBLE);
|
||||||
// mBinding.iv11.setVisibility(View.VISIBLE);
|
// mBinding.iv11.setVisibility(View.VISIBLE);
|
||||||
mBinding.tv1.setVisibility(View.VISIBLE);
|
mBinding.tv1.setVisibility(View.VISIBLE);
|
||||||
mBinding.tv1.setText(heartList2.getHeartNum() + "");
|
mBinding.tv1.setText(StringUtil.toWan2(heartList2.getHeartNum()+"", 1));
|
||||||
|
// mBinding.tv1.setText(heartList2.getHeartNum() + "");
|
||||||
// if (!topIsAnimate) {
|
// if (!topIsAnimate) {
|
||||||
// // 强制刷新视图
|
// // 强制刷新视图
|
||||||
// mBinding.iv11.requestLayout();
|
// mBinding.iv11.requestLayout();
|
||||||
@@ -1093,7 +1131,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
mBinding.imX3.setVisibility(View.VISIBLE);
|
mBinding.imX3.setVisibility(View.VISIBLE);
|
||||||
// mBinding.iv33.setVisibility(View.VISIBLE);
|
// mBinding.iv33.setVisibility(View.VISIBLE);
|
||||||
mBinding.tv3.setVisibility(View.VISIBLE);
|
mBinding.tv3.setVisibility(View.VISIBLE);
|
||||||
mBinding.tv3.setText(heartList3.getHeartNum() + "");
|
mBinding.tv3.setText(StringUtil.toWan2(heartList3.getHeartNum() + "",2));
|
||||||
// if (!bottomIsAnimate) {
|
// if (!bottomIsAnimate) {
|
||||||
// // 强制刷新视图
|
// // 强制刷新视图
|
||||||
// mBinding.iv33.requestLayout();
|
// mBinding.iv33.requestLayout();
|
||||||
@@ -1324,8 +1362,12 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
setTime(time1);
|
setTime(time1);
|
||||||
remainingTime = time1;
|
remainingTime = time1;
|
||||||
if (time1 <= 10) {
|
if (time1 <= 10) {
|
||||||
|
|
||||||
mBinding.tvJsq.setVisibility(VISIBLE);
|
mBinding.tvJsq.setVisibility(VISIBLE);
|
||||||
mBinding.tvJsq.setText(time1 + "");
|
mBinding.tvJsq.setText(time1 + "");
|
||||||
|
if (time1==0){
|
||||||
|
mBinding.tvJsq.setVisibility(GONE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mBinding.tvJsq.setVisibility(GONE);
|
mBinding.tvJsq.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
@@ -1408,6 +1450,13 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
|||||||
/// self.cpView.model=relationModel;[self.cpView showInView:KEYWINDOW];
|
/// self.cpView.model=relationModel;[self.cpView showInView:KEYWINDOW];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearDialog(){
|
||||||
|
dialogFragment = (RoomConcernDialogFragment) getChildFragmentManager().findFragmentByTag("RoomConcernDialogFragment");
|
||||||
|
if (dialogFragment != null && dialogFragment.isAdded()) {
|
||||||
|
dialogFragment.dismiss();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public void registerWheatViews() {
|
public void registerWheatViews() {
|
||||||
|
|
||||||
|
|||||||
@@ -163,17 +163,53 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
* 登录聊天室
|
* 登录聊天室
|
||||||
*/
|
*/
|
||||||
public void onChatRoomViewCreation() {
|
public void onChatRoomViewCreation() {
|
||||||
|
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
// RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||||
// t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
// t.setText("羽声严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||||
// // 加入群组成功
|
// // 加入群组成功
|
||||||
// handleRoomMessage(new RoomMessageEvent(1000,roomId, t));
|
// handleRoomMessage(new RoomMessageEvent(1000,roomId, t));
|
||||||
if (messageListener == null) {
|
|
||||||
|
|
||||||
// 创建并添加监听器
|
// 先移除旧的监听器
|
||||||
messageListener = new MessageListenerSingleton.PublicScreenMessageListener() {
|
if (messageListener != null) {
|
||||||
@Override
|
MessageListenerSingleton.getInstance().removePublicScreenMessageListener(messageListener);
|
||||||
public void onPublicScreenMessageReceived(RoomMessageEvent message) {
|
messageListener = null;
|
||||||
// 确保在主线程更新 UI
|
}
|
||||||
|
// 执行加入操作
|
||||||
|
// MessageListenerSingleton.getInstance().joinGroup(roomId);
|
||||||
|
// 设置消息监听器
|
||||||
|
setupMessageListener();
|
||||||
|
|
||||||
|
// 检查是否有缓存的消息需要处理
|
||||||
|
checkAndProcessCachedMessages();
|
||||||
|
// if (messageListener == null) {
|
||||||
|
//
|
||||||
|
// // 创建并添加监听器
|
||||||
|
// messageListener = new MessageListenerSingleton.PublicScreenMessageListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onPublicScreenMessageReceived(RoomMessageEvent message) {
|
||||||
|
// // 确保在主线程更新 UI
|
||||||
|
// getActivity().runOnUiThread(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// handleRoomMessage(message);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// }
|
||||||
|
// MessageListenerSingleton.getInstance().addPublicScreenMessageListener(messageListener);
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置消息监听器
|
||||||
|
*/
|
||||||
|
private void setupMessageListener() {
|
||||||
|
// 创建并添加监听器
|
||||||
|
messageListener = new MessageListenerSingleton.PublicScreenMessageListener() {
|
||||||
|
@Override
|
||||||
|
public void onPublicScreenMessageReceived(RoomMessageEvent message) {
|
||||||
|
// 确保在主线程更新 UI
|
||||||
|
if (getActivity() != null) {
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@@ -181,17 +217,51 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
};
|
||||||
MessageListenerSingleton.getInstance().addPublicScreenMessageListener(messageListener);
|
MessageListenerSingleton.getInstance().addPublicScreenMessageListener(messageListener);
|
||||||
|
|
||||||
// 注册消息监听器
|
|
||||||
// MessageListenerSingleton.getInstance().addOnMessageReceivedListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查并处理缓存的消息
|
||||||
|
*/
|
||||||
|
private void checkAndProcessCachedMessages() {
|
||||||
|
if (roomId == null || roomId.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 延迟一小段时间,确保监听器已注册
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// 获取并处理缓存的消息
|
||||||
|
List<RoomMessageEvent> cachedMessages = MessageListenerSingleton.getInstance().getAndClearCachedMessages(roomId);
|
||||||
|
if (!cachedMessages.isEmpty()) {
|
||||||
|
LogUtils.d("PublicScreenEaseChatFragment", "处理缓存消息数量: " + cachedMessages.size());
|
||||||
|
for (RoomMessageEvent message : cachedMessages) {
|
||||||
|
handleRoomMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// // 如果没有缓存消息,发送默认的欢迎消息
|
||||||
|
// sendWelcomeMessage();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}, 300); // 延迟300ms确保监听器已注册
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送欢迎消息
|
||||||
|
*/
|
||||||
|
private void sendWelcomeMessage() {
|
||||||
|
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||||
|
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||||
|
// 加入群组成功
|
||||||
|
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void initListener() {
|
protected void initListener() {
|
||||||
mBinding.recycleView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
mBinding.recycleViewPublic.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
|
||||||
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||||
@@ -219,25 +289,49 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
|
|
||||||
public void getUpRoomInfo(RoomInfoResp resp) {
|
public void getUpRoomInfo(RoomInfoResp resp) {
|
||||||
this.roomInfoResp = resp;
|
this.roomInfoResp = resp;
|
||||||
// 确保适配器已初始化
|
// 确保Fragment视图已创建
|
||||||
if (easeChatAdapter == null) {
|
if (isAdded() && getActivity() != null && mBinding != null) {
|
||||||
initChatAdapter();
|
// 确保适配器已初始化
|
||||||
|
if (easeChatAdapter == null) {
|
||||||
|
initChatAdapter();
|
||||||
|
}
|
||||||
|
if (easeChatAdapter != null) {
|
||||||
|
easeChatAdapter.clearData();
|
||||||
|
}
|
||||||
|
toChatUsername = roomInfoResp.getRoom_info().getChatrooms();
|
||||||
|
this.roomId = roomInfoResp.getRoom_info().getRoom_id();
|
||||||
|
|
||||||
|
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
||||||
|
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
||||||
|
// 加入群组成功
|
||||||
|
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
||||||
|
onChatRoomViewCreation();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 如果视图尚未准备好,延迟执行
|
||||||
|
if (getActivity() != null) {
|
||||||
|
getActivity().runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
// 使用post延迟执行,确保视图已创建
|
||||||
|
if (getView() != null) {
|
||||||
|
getView().post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
getUpRoomInfo(resp);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
easeChatAdapter.clearData();
|
|
||||||
// roomInfoResp = (RoomInfoResp) arguments.getSerializable("roomInfo");
|
|
||||||
toChatUsername = roomInfoResp.getRoom_info().getChatrooms();
|
|
||||||
this.roomId = roomInfoResp.getRoom_info().getRoom_id();
|
|
||||||
RoomMessageEvent.T t = new RoomMessageEvent.T();
|
|
||||||
t.setText("秘地严禁未成年人进行直播或打赏,官方将24小时在线巡查。我们提倡绿色直播,直播间严禁出现涉政、涉恐、涉黄、涉赌等违法违规内容,严禁宣传封建迷信、宗教极端思想、出现低俗色情、吸烟酗酒等内容,严禁违反社会主义核心价值观、践踏社会道德底线、诱导打赏、低俗 PK 、买卖金币等行为,请大家共同遵守、监督并及时举报。请勿相信各类刷钻、购买礼包、游戏币及电商贩卖等非官方广告信息,谨防网络诈骗。");
|
|
||||||
// 加入群组成功
|
|
||||||
handleRoomMessage(new RoomMessageEvent(1000, roomId, t));
|
|
||||||
onChatRoomViewCreation();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||||
mBinding.recycleView.setLayoutManager(linearLayoutManager);
|
mBinding.recycleViewPublic.setLayoutManager(linearLayoutManager);
|
||||||
initChatAdapter();
|
initChatAdapter();
|
||||||
// mBinding.recycleView.setAdapter(easeChatAdapter = new EaseChatAdapter());
|
// mBinding.recycleView.setAdapter(easeChatAdapter = new EaseChatAdapter());
|
||||||
// easeChatAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
// easeChatAdapter.setOnItemChildClickListener((adapter, view, position) -> {
|
||||||
@@ -282,8 +376,9 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
private void initChatAdapter() {
|
private void initChatAdapter() {
|
||||||
if (easeChatAdapter == null) {
|
if (easeChatAdapter == null) {
|
||||||
easeChatAdapter = new EaseChatAdapter();
|
easeChatAdapter = new EaseChatAdapter();
|
||||||
if (mBinding.recycleView != null) {
|
// 添加空值检查,确保mBinding和recycleViewPublic都不为null
|
||||||
mBinding.recycleView.setAdapter(easeChatAdapter);
|
if (mBinding != null) {
|
||||||
|
mBinding.recycleViewPublic.setAdapter(easeChatAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -330,11 +425,11 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
private void setUpPublicScreen() {
|
private void setUpPublicScreen() {
|
||||||
// if (roomInfoResp.getRoom_info().getChat_status() == 1) {
|
// if (roomInfoResp.getRoom_info().getChat_status() == 1) {
|
||||||
// //如果有数据或者recycle view有item view就删除;否则程序崩溃,找不到item
|
// //如果有数据或者recycle view有item view就删除;否则程序崩溃,找不到item
|
||||||
if (mBinding.recycleView.getChildCount() > 0) {
|
if (mBinding.recycleViewPublic.getChildCount() > 0) {
|
||||||
mBinding.recycleView.removeAllViews();
|
mBinding.recycleViewPublic.removeAllViews();
|
||||||
// easeChatAdapter.clearData();
|
// easeChatAdapter.clearData();
|
||||||
}
|
}
|
||||||
mBinding.recycleView.setVisibility(View.VISIBLE);//开启消息列表
|
mBinding.recycleViewPublic.setVisibility(View.VISIBLE);//开启消息列表
|
||||||
mBinding.llHeadTab.setVisibility(View.VISIBLE);
|
mBinding.llHeadTab.setVisibility(View.VISIBLE);
|
||||||
mBinding.tvClose.setVisibility(View.GONE);
|
mBinding.tvClose.setVisibility(View.GONE);
|
||||||
// } else {
|
// } else {
|
||||||
@@ -456,8 +551,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabAll.setTextSize(14);
|
mBinding.tvTabAll.setTextSize(14);
|
||||||
|
|
||||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#CCCCCC"));
|
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#CCCCCC"));
|
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabSystem.setBackgroundResource(0);
|
mBinding.tvTabSystem.setBackgroundResource(0);
|
||||||
mBinding.tvTabUser.setBackgroundResource(0);
|
mBinding.tvTabUser.setBackgroundResource(0);
|
||||||
mBinding.tvTabUser.setTextSize(12);
|
mBinding.tvTabUser.setTextSize(12);
|
||||||
@@ -468,8 +563,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabUser.setTextSize(14);
|
mBinding.tvTabUser.setTextSize(14);
|
||||||
|
|
||||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#CCCCCC"));
|
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#CCCCCC"));
|
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabSystem.setBackgroundResource(0);
|
mBinding.tvTabSystem.setBackgroundResource(0);
|
||||||
mBinding.tvTabAll.setBackgroundResource(0);
|
mBinding.tvTabAll.setBackgroundResource(0);
|
||||||
mBinding.tvTabAll.setTextSize(12);
|
mBinding.tvTabAll.setTextSize(12);
|
||||||
@@ -480,14 +575,14 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
mBinding.tvTabSystem.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabSystem.setTextSize(14);
|
mBinding.tvTabSystem.setTextSize(14);
|
||||||
|
|
||||||
mBinding.tvTabAll.setTextColor(Color.parseColor("#CCCCCC"));
|
mBinding.tvTabAll.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabUser.setTextColor(Color.parseColor("#CCCCCC"));
|
mBinding.tvTabUser.setTextColor(Color.parseColor("#FFFFFF"));
|
||||||
mBinding.tvTabUser.setBackgroundResource(0);
|
mBinding.tvTabUser.setBackgroundResource(0);
|
||||||
mBinding.tvTabAll.setBackgroundResource(0);
|
mBinding.tvTabAll.setBackgroundResource(0);
|
||||||
mBinding.tvTabAll.setTextSize(12);
|
mBinding.tvTabAll.setTextSize(12);
|
||||||
mBinding.tvTabUser.setTextSize(12);
|
mBinding.tvTabUser.setTextSize(12);
|
||||||
} else if (view_id == R.id.tv_count) {
|
} else if (view_id == R.id.tv_count) {
|
||||||
mBinding.recycleView.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
mBinding.recycleViewPublic.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||||
mBinding.tvCount.setVisibility(View.GONE);
|
mBinding.tvCount.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,8 +1003,15 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
|
|
||||||
private void addSingleMessage(RoomMessageEvent message) {
|
private void addSingleMessage(RoomMessageEvent message) {
|
||||||
if (easeChatAdapter != null) {
|
if (easeChatAdapter != null) {
|
||||||
easeChatAdapter.addData(new EMMessageInfo(message));
|
if (message.getMsgType()==1049 ){
|
||||||
scrollToBottomIfNeed();
|
if (message.getText().getStep() != 3){
|
||||||
|
easeChatAdapter.addData(new EMMessageInfo(message));
|
||||||
|
scrollToBottomIfNeed();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
easeChatAdapter.addData(new EMMessageInfo(message));
|
||||||
|
scrollToBottomIfNeed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -927,10 +1029,10 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
|
|
||||||
// 优化 scrollToBottomIfNeed 方法
|
// 优化 scrollToBottomIfNeed 方法
|
||||||
private void scrollToBottomIfNeed() {
|
private void scrollToBottomIfNeed() {
|
||||||
if (isBottom && mBinding.recycleView != null && easeChatAdapter != null) {
|
if (isBottom && mBinding.recycleViewPublic != null && easeChatAdapter != null) {
|
||||||
int itemCount = easeChatAdapter.getItemCount();
|
int itemCount = easeChatAdapter.getItemCount();
|
||||||
if (itemCount > 0) {
|
if (itemCount > 0) {
|
||||||
mBinding.recycleView.scrollToPosition(itemCount - 1);
|
mBinding.recycleViewPublic.scrollToPosition(itemCount - 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
count++;
|
count++;
|
||||||
@@ -1219,8 +1321,8 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
private void refreshSelectLast() {
|
private void refreshSelectLast() {
|
||||||
if (mBinding.recycleView != null) {
|
if (mBinding.recycleViewPublic != null) {
|
||||||
mBinding.recycleView.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
mBinding.recycleViewPublic.scrollToPosition(easeChatAdapter.getItemCount() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import android.content.Context;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.ViewStub;
|
import android.view.ViewStub;
|
||||||
@@ -19,8 +20,11 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.blankj.utilcode.util.TimeUtils;
|
import com.blankj.utilcode.util.TimeUtils;
|
||||||
import com.example.moduleroom.R;
|
import com.example.moduleroom.R;
|
||||||
@@ -37,7 +41,9 @@ import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
|||||||
import com.example.moduleroom.presenter.RoomAuctionPresenterTow;
|
import com.example.moduleroom.presenter.RoomAuctionPresenterTow;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.orhanobut.logger.Logger;
|
import com.orhanobut.logger.Logger;
|
||||||
|
import com.xscm.moduleutil.activity.WebViewActivity;
|
||||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||||
import com.xscm.moduleutil.bean.UserInfo;
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||||
@@ -47,6 +53,8 @@ import com.xscm.moduleutil.bean.room.RoomBean;
|
|||||||
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.dialog.ConfirmDialog;
|
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||||
|
import com.xscm.moduleutil.dialog.WebViewDialog;
|
||||||
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.ClickUtils;
|
import com.xscm.moduleutil.utils.ClickUtils;
|
||||||
import com.xscm.moduleutil.utils.ColorManager;
|
import com.xscm.moduleutil.utils.ColorManager;
|
||||||
import com.xscm.moduleutil.utils.ImageUtils;
|
import com.xscm.moduleutil.utils.ImageUtils;
|
||||||
@@ -54,6 +62,7 @@ import com.xscm.moduleutil.utils.SpUtil;
|
|||||||
import com.xscm.moduleutil.utils.StringUtil;
|
import com.xscm.moduleutil.utils.StringUtil;
|
||||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||||
import com.xscm.moduleutil.widget.RoomMakeWheatView;
|
import com.xscm.moduleutil.widget.RoomMakeWheatView;
|
||||||
|
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -107,6 +116,23 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
// return fragment;
|
// return fragment;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
//
|
||||||
|
// // 观察专门给子Fragment的数据
|
||||||
|
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||||
|
// if (data != null) {
|
||||||
|
// // 处理数据
|
||||||
|
// roomInfoUpdate(data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
@@ -177,7 +203,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
roomPitBean1.setPit_number("888");
|
roomPitBean1.setPit_number("888");
|
||||||
roomPitBean1.setIs_pm(1);
|
roomPitBean1.setIs_pm(1);
|
||||||
wheatView2.setData(roomPitBean1);
|
wheatView2.setData(roomPitBean1);
|
||||||
mBinding.tvPB.setText(StringUtil.toWan2(auctionUserBean.getCharm(),1));
|
mBinding.tvPB.setText(StringUtil.toWan2(auctionUserBean.getCharm(), 1));
|
||||||
countDownTime(auctionUserBean.getDuration());
|
countDownTime(auctionUserBean.getDuration());
|
||||||
|
|
||||||
if (auctionUserBean.getAuction_id() != null) {
|
if (auctionUserBean.getAuction_id() != null) {
|
||||||
@@ -371,6 +397,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
mBinding.user5.setOnClickListener(this::onChock);
|
mBinding.user5.setOnClickListener(this::onChock);
|
||||||
mBinding.user6.setOnClickListener(this::onChock);
|
mBinding.user6.setOnClickListener(this::onChock);
|
||||||
mBinding.tvPB.setOnClickListener(this::onChock);
|
mBinding.tvPB.setOnClickListener(this::onChock);
|
||||||
|
mBinding.questionMark.setOnClickListener(this::onChock);
|
||||||
getTextView();
|
getTextView();
|
||||||
// initOverlayButtons();
|
// initOverlayButtons();
|
||||||
// steView(type);
|
// steView(type);
|
||||||
@@ -534,6 +561,16 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
RoomCharmDialog.newInstance(roomInfoResp.getRoom_info().getRoom_id(), wheatView2.pitBean.getUser_id()).show(getChildFragmentManager(), "RoomCharmDialog");
|
||||||
|
}else if (id == R.id.question_mark){
|
||||||
|
// Bundle bundle = new Bundle();
|
||||||
|
// bundle.putString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl()+"api/Page/page_show?id=22");
|
||||||
|
// WebViewDialog dialog = new WebViewDialog(getActivity(), bundle);
|
||||||
|
// dialog.show();
|
||||||
|
if (type==1) {
|
||||||
|
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=23").withString("title", "真爱拍规则").navigation();
|
||||||
|
}else {
|
||||||
|
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getServerUrl() + "/api/Page/page_show?id=22").withString("title", "亲密拍规则").navigation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1031,34 +1068,44 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
|
|
||||||
|
|
||||||
RoomPitBean pitBean = wheatView.pitBean;
|
RoomPitBean pitBean = wheatView.pitBean;
|
||||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
if (pitBean.getUser_id()!=null) {
|
||||||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||||
wheatView.setData(pitBean);
|
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||||||
return;
|
wheatView.setData(pitBean);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
if (pitBean2.getUser_id()!=null) {
|
||||||
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||||
wheatView2.setData(pitBean2);
|
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
||||||
return;
|
wheatView2.setData(pitBean2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
if (pitBean3.getUser_id()!=null) {
|
||||||
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||||
mBinding.ivAuction1.setData(pitBean3);
|
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
||||||
return;
|
mBinding.ivAuction1.setData(pitBean3);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
if (pitBean4.getUser_id()!=null) {
|
||||||
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||||
mBinding.ivAuction2.setData(pitBean4);
|
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
||||||
return;
|
mBinding.ivAuction2.setData(pitBean4);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
if (pitBean5.getUser_id()!=null) {
|
||||||
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||||
mBinding.ivAuction3.setData(pitBean5);
|
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
||||||
return;
|
mBinding.ivAuction3.setData(pitBean5);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (auctionList != null && auctionList.size() > 0) {
|
if (auctionList != null && auctionList.size() > 0) {
|
||||||
for (int i = 0; i < auctionList.size(); i++) {
|
for (int i = 0; i < auctionList.size(); i++) {
|
||||||
@@ -1159,6 +1206,21 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
|
|
||||||
public void event1021(RoomMessageEvent messageEvent) {
|
public void event1021(RoomMessageEvent messageEvent) {
|
||||||
mBinding.tvPB.setText("0");
|
mBinding.tvPB.setText("0");
|
||||||
|
if (mBinding.ivAuction1.pitBean != null) {
|
||||||
|
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||||
|
pitBean3.setCharm("");
|
||||||
|
mBinding.ivAuction1.setData(pitBean3);
|
||||||
|
}
|
||||||
|
if (mBinding.ivAuction2.pitBean != null) {
|
||||||
|
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||||
|
pitBean4.setCharm("");
|
||||||
|
mBinding.ivAuction2.setData(pitBean4);
|
||||||
|
}
|
||||||
|
if (mBinding.ivAuction3.pitBean != null) {
|
||||||
|
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||||
|
pitBean5.setCharm("");
|
||||||
|
mBinding.ivAuction3.setData(pitBean5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void event1027(RoomMessageEvent messageEvent) {
|
public void event1027(RoomMessageEvent messageEvent) {
|
||||||
@@ -1295,7 +1357,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
|||||||
|
|
||||||
// 特殊处理拍卖主持人(888号麦位)
|
// 特殊处理拍卖主持人(888号麦位)
|
||||||
if (wheatView2.getUserId().equals(userId)) {
|
if (wheatView2.getUserId().equals(userId)) {
|
||||||
mBinding.tvPB.setText(StringUtil.toWan2(charm,1));
|
mBinding.tvPB.setText(StringUtil.toWan2(charm, 1));
|
||||||
wheatView2.pitBean.setCharm(charm);
|
wheatView2.pitBean.setCharm(charm);
|
||||||
wheatView2.setData(wheatView2.pitBean);
|
wheatView2.setData(wheatView2.pitBean);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class RoomBackgroundDialogFragment extends BaseMvpDialogFragment<RoomBack
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(type)
|
.setMaxSelectNum(type)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
.forResult(requestCode); //结果回调onActivityResult code
|
.forResult(requestCode); //结果回调onActivityResult code
|
||||||
|
|||||||
@@ -14,13 +14,18 @@ import android.os.Bundle;
|
|||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
import android.view.SurfaceView;
|
import android.view.SurfaceView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.activity.result.ActivityResultLauncher;
|
import androidx.activity.result.ActivityResultLauncher;
|
||||||
import androidx.activity.result.contract.ActivityResultContracts;
|
import androidx.activity.result.contract.ActivityResultContracts;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AlertDialog;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
@@ -47,6 +52,7 @@ import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
|||||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
|
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||||
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@@ -150,7 +156,21 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
//
|
||||||
|
// // 观察专门给子Fragment的数据
|
||||||
|
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||||
|
// if (data != null) {
|
||||||
|
// // 处理数据
|
||||||
|
// roomInfoUpdate(data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
@@ -627,7 +647,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
|||||||
public void quitRoom() {
|
public void quitRoom() {
|
||||||
if (getActivity() instanceof RoomActivity) {
|
if (getActivity() instanceof RoomActivity) {
|
||||||
LogUtils.e("lxj", "退出房间时间:" + TimeUtils.date2String(new Date())+":退出的roomId"+roomId);
|
LogUtils.e("lxj", "退出房间时间:" + TimeUtils.date2String(new Date())+":退出的roomId"+roomId);
|
||||||
MessageListenerSingleton.quitGroup(roomId);
|
MessageListenerSingleton.getInstance().quitGroup(roomId);
|
||||||
((RoomActivity) getActivity()).quit();
|
((RoomActivity) getActivity()).quit();
|
||||||
((RoomActivity) getActivity()).quitRoom2(roomId);
|
((RoomActivity) getActivity()).quitRoom2(roomId);
|
||||||
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
if (label_id!=null && label_id.equals(LABEL_ID_MOVIE)){
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
package com.example.moduleroom.fragment;
|
package com.example.moduleroom.fragment;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.media.metrics.Event;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
@@ -16,19 +12,10 @@ import androidx.fragment.app.FragmentTransaction;
|
|||||||
import android.os.CountDownTimer;
|
import android.os.CountDownTimer;
|
||||||
import android.text.Spannable;
|
import android.text.Spannable;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.text.style.ForegroundColorSpan;
|
import android.text.style.ForegroundColorSpan;
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
import android.view.inputmethod.InputMethodManager;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.RelativeLayout;
|
|
||||||
|
|
||||||
import com.blankj.utilcode.util.LogUtils;
|
import com.blankj.utilcode.util.LogUtils;
|
||||||
import com.blankj.utilcode.util.TimeUtils;
|
import com.blankj.utilcode.util.TimeUtils;
|
||||||
@@ -36,20 +23,12 @@ import com.example.moduleroom.R;
|
|||||||
import com.example.moduleroom.activity.RoomActivity;
|
import com.example.moduleroom.activity.RoomActivity;
|
||||||
import com.example.moduleroom.contacts.RoomContacts;
|
import com.example.moduleroom.contacts.RoomContacts;
|
||||||
import com.example.moduleroom.databinding.FragmentRoomBinding;
|
import com.example.moduleroom.databinding.FragmentRoomBinding;
|
||||||
import com.example.moduleroom.dialog.RequestDialogFragment;
|
|
||||||
import com.example.moduleroom.dialog.RoomGiftDialogFragment;
|
|
||||||
import com.example.moduleroom.dialog.RoomMessageDialogFragment;
|
|
||||||
import com.example.moduleroom.dialog.RoomPkDialogFragment;
|
|
||||||
import com.example.moduleroom.dialog.RoomSettingFragment;
|
|
||||||
import com.example.moduleroom.dialog.SoundEffectsDialogFragment;
|
|
||||||
import com.example.moduleroom.dialog.WheatFeedingDialogFragment;
|
import com.example.moduleroom.dialog.WheatFeedingDialogFragment;
|
||||||
import com.example.moduleroom.presenter.RoomPresenter;
|
import com.example.moduleroom.presenter.RoomPresenter;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.xscm.moduleutil.base.BaseMvpFragment;
|
import com.xscm.moduleutil.base.BaseMvpFragment;
|
||||||
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
import com.xscm.moduleutil.bean.RoomCharmRankBean;
|
||||||
import com.xscm.moduleutil.bean.RoomInputEvent;
|
|
||||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||||
import com.xscm.moduleutil.bean.UserInfo;
|
|
||||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||||
import com.xscm.moduleutil.bean.room.FriendInfo;
|
import com.xscm.moduleutil.bean.room.FriendInfo;
|
||||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||||
@@ -60,19 +39,15 @@ import com.xscm.moduleutil.bean.room.RoomOnline;
|
|||||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||||
import com.xscm.moduleutil.event.QXRoomSeatViewType;
|
import com.xscm.moduleutil.event.QXRoomSeatViewType;
|
||||||
import com.xscm.moduleutil.event.RoomWheatEvent;
|
|
||||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
|
||||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
import com.tencent.imsdk.v2.V2TIMManager;
|
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||||
import com.tencent.imsdk.v2.V2TIMValueCallback;
|
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -83,7 +58,6 @@ import java.util.List;
|
|||||||
* @description:房间fragment
|
* @description:房间fragment
|
||||||
*/
|
*/
|
||||||
public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBinding> implements RoomContacts.View {
|
public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBinding> implements RoomContacts.View {
|
||||||
|
|
||||||
public static RoomFragment newInstance() {
|
public static RoomFragment newInstance() {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
RoomFragment fragment = new RoomFragment();
|
RoomFragment fragment = new RoomFragment();
|
||||||
@@ -129,6 +103,41 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
|
|
||||||
super.initArgs(arguments);
|
super.initArgs(arguments);
|
||||||
}
|
}
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
|
||||||
|
// 获取 ViewModel
|
||||||
|
|
||||||
|
// 通知 Activity Fragment 已就绪
|
||||||
|
// sharedViewModel.setFragmentReady(true);
|
||||||
|
//
|
||||||
|
// // 观察数据变化
|
||||||
|
// sharedViewModel.getDataForFragment().observe(getViewLifecycleOwner(), data -> {
|
||||||
|
// if (data != null) {
|
||||||
|
// // 处理接收到的数据
|
||||||
|
// refreshData(data, qxRoomSeatViewType);
|
||||||
|
// // 可选:清除数据以避免重复处理
|
||||||
|
// // sharedViewModel.clearData();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// sharedViewModel.getSeatViewType().observe(getViewLifecycleOwner(), type -> {
|
||||||
|
// if (type != null) {
|
||||||
|
// // 处理数据
|
||||||
|
// setqxRoomSeatViewType(type);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected RoomPresenter bindPresenter() {
|
protected RoomPresenter bindPresenter() {
|
||||||
@@ -138,6 +147,10 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
// 清理ViewModel数据
|
||||||
|
// if (sharedViewModel != null) {
|
||||||
|
// sharedViewModel.clearChildFragmentData();
|
||||||
|
// }
|
||||||
onFragmentShowDestroy();
|
onFragmentShowDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +463,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
mRoomInfoResp = resp;
|
mRoomInfoResp = resp;
|
||||||
loadSubFragment(qxRoomSeatViewType);
|
loadSubFragment(qxRoomSeatViewType);
|
||||||
// upView(qxRoomSeatViewType);
|
// upView(qxRoomSeatViewType);
|
||||||
// 更新子Fragment视图
|
// // 更新子Fragment视图
|
||||||
// updateChildFragmentViews();
|
// updateChildFragmentViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -517,30 +530,37 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
|
FriendshipRoomFragment friendshipRoomFragment = findFragmentByTag(FriendshipRoomFragment.class);
|
||||||
if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
|
if (friendshipRoomFragment != null && friendshipRoomFragment.isAdded()) {
|
||||||
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
friendshipRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
||||||
|
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||||
}
|
}
|
||||||
} else if ("2".equals(typeId)) {
|
} else if ("2".equals(typeId)) {
|
||||||
RoomAuctionFragment auctionRoomFragment = findFragmentByTag(RoomAuctionFragment.class);
|
RoomAuctionFragment auctionRoomFragment = findFragmentByTag(RoomAuctionFragment.class);
|
||||||
if (auctionRoomFragment != null && auctionRoomFragment.isAdded()) {
|
if (auctionRoomFragment != null && auctionRoomFragment.isAdded()) {
|
||||||
auctionRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
auctionRoomFragment.roomInfoUpdate(mRoomInfoResp);
|
||||||
|
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||||
}
|
}
|
||||||
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId) || "8".equals(typeId)) {
|
} else if ("1".equals(typeId) || "3".equals(typeId) || "4".equals(typeId) || "8".equals(typeId)) {
|
||||||
if ("2".equals(labelId)) {
|
if ("2".equals(labelId)) {
|
||||||
RoomKtvFragment roomKtvFragment = findFragmentByTag(RoomKtvFragment.class);
|
RoomKtvFragment roomKtvFragment = findFragmentByTag(RoomKtvFragment.class);
|
||||||
if (roomKtvFragment != null && roomKtvFragment.isAdded()) {
|
if (roomKtvFragment != null && roomKtvFragment.isAdded()) {
|
||||||
roomKtvFragment.roomInfoUpdate(mRoomInfoResp);
|
roomKtvFragment.roomInfoUpdate(mRoomInfoResp);
|
||||||
|
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||||
}
|
}
|
||||||
} else if ("1".equals(labelId)) {
|
} else if ("1".equals(labelId)) {
|
||||||
SingSongFragment singSongFragment = findFragmentByTag(SingSongFragment.class);
|
SingSongFragment singSongFragment = findFragmentByTag(SingSongFragment.class);
|
||||||
if (singSongFragment != null && singSongFragment.isAdded()) {
|
if (singSongFragment != null && singSongFragment.isAdded()) {
|
||||||
singSongFragment.roomInfoUpdate(mRoomInfoResp);
|
singSongFragment.roomInfoUpdate(mRoomInfoResp);
|
||||||
|
// sharedViewModel.setDataForFragment(mRoomInfoResp);
|
||||||
|
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ("6".equals(typeId)) {
|
} else if ("6".equals(typeId)) {
|
||||||
RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
|
RoomCabinFragment roomCabinFragment = findFragmentByTag(RoomCabinFragment.class);
|
||||||
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
if (roomCabinFragment != null && roomCabinFragment.isAdded()) {
|
||||||
roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
|
roomCabinFragment.roomInfoUpdate(mRoomInfoResp);
|
||||||
|
// sharedViewModel.setChildFragmentData(mRoomInfoResp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -562,6 +582,10 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
friendshipRoomFragment.upDataFriendship(FriendshipRoomFragment.FriendshipPartType.HAND, friend_id, end_time, friendshipUserBean);
|
friendshipRoomFragment.upDataFriendship(FriendshipRoomFragment.FriendshipPartType.HAND, friend_id, end_time, friendshipUserBean);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//这里是进行判断,当已经弹起选择关系的页面的时候,这里直接退出
|
||||||
|
public void clearDialog(){
|
||||||
|
friendshipRoomFragment.clearDialog();
|
||||||
|
}
|
||||||
|
|
||||||
/// 交友房时间发生延时
|
/// 交友房时间发生延时
|
||||||
public void friendTimeDelayWithTime(long end_time) {
|
public void friendTimeDelayWithTime(long end_time) {
|
||||||
@@ -616,6 +640,8 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
|||||||
getView().post(() -> {
|
getView().post(() -> {
|
||||||
if (isAdded() && getActivity() != null) {
|
if (isAdded() && getActivity() != null) {
|
||||||
performLoadSubFragment(qxRoomSeatViewType);
|
performLoadSubFragment(qxRoomSeatViewType);
|
||||||
|
}else {
|
||||||
|
// loadSubFragment(qxRoomSeatViewType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -794,12 +820,6 @@ 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
|
|
||||||
//
|
|
||||||
// FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
|
||||||
// callSpecificDestroyMethod(newFragment);
|
|
||||||
// transaction.replace(containerId, newFragment, tag);
|
|
||||||
// transaction.commitAllowingStateLoss();
|
|
||||||
// 检查Fragment是否已经附加到Activity
|
// 检查Fragment是否已经附加到Activity
|
||||||
if (!isAdded() || getActivity() == null) {
|
if (!isAdded() || getActivity() == null) {
|
||||||
// 如果Fragment还没有附加,则延迟执行
|
// 如果Fragment还没有附加,则延迟执行
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import android.os.Bundle;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -47,6 +48,7 @@ import com.xscm.moduleutil.utils.ClickUtils;
|
|||||||
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.RoomKtvWheatView;
|
import com.xscm.moduleutil.widget.RoomKtvWheatView;
|
||||||
|
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
@@ -109,6 +111,22 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
|||||||
// parent.setTouchDelegate(new TouchDelegate(bounds, muZc));
|
// parent.setTouchDelegate(new TouchDelegate(bounds, muZc));
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
//
|
||||||
|
// // 观察专门给子Fragment的数据
|
||||||
|
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||||
|
// if (data != null) {
|
||||||
|
// // 处理数据
|
||||||
|
// roomInfoUpdate(data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
}
|
||||||
|
|
||||||
public View getNegativeMarginView() {
|
public View getNegativeMarginView() {
|
||||||
return mBinding.muZc;
|
return mBinding.muZc;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||||
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
|
|
||||||
import com.blankj.utilcode.util.ObjectUtils;
|
import com.blankj.utilcode.util.ObjectUtils;
|
||||||
import com.example.moduleroom.R;
|
import com.example.moduleroom.R;
|
||||||
@@ -68,6 +69,7 @@ import com.xscm.moduleutil.utils.logger.Logger;
|
|||||||
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
import com.xscm.moduleutil.widget.GifAvatarOvalView;
|
||||||
import com.xscm.moduleutil.widget.RoomDefaultWheatView;
|
import com.xscm.moduleutil.widget.RoomDefaultWheatView;
|
||||||
import com.xscm.moduleutil.widget.RoomSingSongWheatView;
|
import com.xscm.moduleutil.widget.RoomSingSongWheatView;
|
||||||
|
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||||
import com.xscm.moduleutil.widget.WheatLayoutManager;
|
import com.xscm.moduleutil.widget.WheatLayoutManager;
|
||||||
import com.xscm.moduleutil.widget.WheatLayoutSingManager;
|
import com.xscm.moduleutil.widget.WheatLayoutSingManager;
|
||||||
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
import com.xscm.moduleutil.widget.dialog.CommonDialog;
|
||||||
@@ -106,7 +108,7 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
|||||||
CountDownTimer mCountDownTimersta;
|
CountDownTimer mCountDownTimersta;
|
||||||
private RoomFragment parentFragment;
|
private RoomFragment parentFragment;
|
||||||
List<RoomPitBean> pitList;
|
List<RoomPitBean> pitList;
|
||||||
|
private SharedViewModel sharedViewModel;
|
||||||
public static SingSongFragment newInstance() {
|
public static SingSongFragment newInstance() {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
SingSongFragment fragment = new SingSongFragment();
|
SingSongFragment fragment = new SingSongFragment();
|
||||||
@@ -151,6 +153,15 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||||
|
//
|
||||||
|
// // 观察专门给子Fragment的数据
|
||||||
|
// sharedViewModel.getChildFragmentData().observe(getViewLifecycleOwner(), data -> {
|
||||||
|
// if (data != null) {
|
||||||
|
// // 处理数据
|
||||||
|
// roomInfoUpdate(data);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
return super.onCreateView(inflater, container, savedInstanceState);
|
return super.onCreateView(inflater, container, savedInstanceState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1742,5 +1753,12 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
|||||||
}
|
}
|
||||||
mBinding.flexboxLayout.removeAllViews();
|
mBinding.flexboxLayout.removeAllViews();
|
||||||
mBinding.flexboxLayout2.removeAllViews();
|
mBinding.flexboxLayout2.removeAllViews();
|
||||||
|
if (sharedViewModel != null) {
|
||||||
|
sharedViewModel.clearChildFragmentData();
|
||||||
|
}
|
||||||
|
if (MvpPre != null) {
|
||||||
|
MvpPre.detachView();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,13 +9,16 @@ import com.xscm.moduleutil.http.BaseObserver;
|
|||||||
import com.xscm.moduleutil.http.RetrofitClient;
|
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.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.reactivex.disposables.Disposable;
|
import io.reactivex.disposables.Disposable;
|
||||||
|
|
||||||
public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.View> implements RoomAuctionContacts.IRoomDataListPre {
|
public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.View> implements RoomAuctionContacts.IRoomDataListPre {
|
||||||
|
RoomAuctionContacts.View mView;
|
||||||
public RoomAuctionPresenterTow(RoomAuctionContacts.View view, Context context) {
|
public RoomAuctionPresenterTow(RoomAuctionContacts.View view, Context context) {
|
||||||
super(view, context);
|
super(view, context);
|
||||||
|
mView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -28,6 +31,9 @@ public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.V
|
|||||||
|
|
||||||
@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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -43,6 +49,9 @@ public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.V
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(AuctionBean auctionBean) {
|
public void onNext(AuctionBean auctionBean) {
|
||||||
|
if (MvpRef==null){
|
||||||
|
MvpRef=new WeakReference<>(mView);
|
||||||
|
}
|
||||||
MvpRef.get().roomAuction(auctionBean);
|
MvpRef.get().roomAuction(auctionBean);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -105,6 +114,9 @@ public class RoomAuctionPresenterTow extends BasePresenter<RoomAuctionContacts.V
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNext(List<UserOnlineStatusBean> userOnlineStatusBean) {
|
public void onNext(List<UserOnlineStatusBean> userOnlineStatusBean) {
|
||||||
|
if (MvpRef==null){
|
||||||
|
MvpRef=new WeakReference<>(mView);
|
||||||
|
}
|
||||||
MvpRef.get().userOnlineStatus(userOnlineStatusBean);
|
MvpRef.get().userOnlineStatus(userOnlineStatusBean);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,9 +60,17 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
|||||||
}
|
}
|
||||||
LogUtils.e("token",token);
|
LogUtils.e("token",token);
|
||||||
LogUtils.e("roomId:",roomId);
|
LogUtils.e("roomId:",roomId);
|
||||||
|
|
||||||
|
if (getView()!= null && getView().getSelfActivity()!=null){
|
||||||
|
AgoraManager.getInstance(getView().getSelfActivity())
|
||||||
|
.joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||||
|
}else {
|
||||||
|
AgoraManager.getInstance(mContext.getApplicationContext())
|
||||||
|
.joinRoom(token, roomId, uid, enableMic,enableJs);
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化 Agora 并加入房间
|
// 初始化 Agora 并加入房间
|
||||||
AgoraManager.getInstance(getView().getSelfActivity())
|
|
||||||
.joinRoom(token, roomId, uid, enableMic,enableJs);
|
|
||||||
|
|
||||||
// RtcCore rtcCore = RtcCore.getInstance(getView().getSelfActivity());
|
// RtcCore rtcCore = RtcCore.getInstance(getView().getSelfActivity());
|
||||||
// rtcCore.initAgora(appId);
|
// rtcCore.initAgora(appId);
|
||||||
@@ -78,6 +86,9 @@ public class RoomPresenter extends BasePresenter<RoomContacts.View> implements R
|
|||||||
@Override
|
@Override
|
||||||
public void onError(Throwable e) {
|
public void onError(Throwable e) {
|
||||||
super.onError(e);
|
super.onError(e);
|
||||||
|
if (MvpRef==null){
|
||||||
|
MvpRef=new WeakReference<>(mView);
|
||||||
|
}
|
||||||
if (e instanceof APIException) {
|
if (e instanceof APIException) {
|
||||||
APIException apiException = (APIException) e;
|
APIException apiException = (APIException) e;
|
||||||
if (apiException.getCode() == 10000) {
|
if (apiException.getCode() == 10000) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class SingSongPresenter extends BaseRoomPresenter<SingSongContacts.View>
|
|||||||
private SingSongContacts.View mView;
|
private SingSongContacts.View mView;
|
||||||
public SingSongPresenter(SingSongContacts.View view, Context context) {
|
public SingSongPresenter(SingSongContacts.View view, Context context) {
|
||||||
super(view, context);
|
super(view, context);
|
||||||
|
mView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -239,6 +239,7 @@
|
|||||||
android:layout_width="@dimen/dp_52"
|
android:layout_width="@dimen/dp_52"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="-20dp"
|
android:layout_marginTop="-20dp"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
app:layout_constraintStart_toEndOf="@+id/wheat_view9"
|
app:layout_constraintStart_toEndOf="@+id/wheat_view9"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view9"
|
app:layout_constraintTop_toBottomOf="@+id/wheat_view9"
|
||||||
app:layout_constraintTop_toTopOf="@id/background_image"
|
app:layout_constraintTop_toTopOf="@id/background_image"
|
||||||
@@ -250,6 +251,7 @@
|
|||||||
android:layout_width="@dimen/dp_52"
|
android:layout_width="@dimen/dp_52"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="-20dp"
|
android:layout_marginTop="-20dp"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view1"
|
app:layout_constraintEnd_toStartOf="@+id/wheat_view1"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view1"
|
app:layout_constraintTop_toBottomOf="@+id/wheat_view1"
|
||||||
app:room_make_pic="@mipmap/jiaoy"
|
app:room_make_pic="@mipmap/jiaoy"
|
||||||
@@ -260,6 +262,7 @@
|
|||||||
android:layout_width="@dimen/dp_52"
|
android:layout_width="@dimen/dp_52"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="-10dp"
|
android:layout_marginTop="-10dp"
|
||||||
|
android:layout_marginStart="@dimen/dp_10"
|
||||||
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"
|
||||||
app:room_make_pic="@mipmap/jiaoy"
|
app:room_make_pic="@mipmap/jiaoy"
|
||||||
@@ -269,6 +272,7 @@
|
|||||||
android:id="@+id/wheat_view6"
|
android:id="@+id/wheat_view6"
|
||||||
android:layout_width="@dimen/dp_52"
|
android:layout_width="@dimen/dp_52"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/wheat_view1"
|
app:layout_constraintBottom_toBottomOf="@+id/wheat_view1"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view10"
|
app:layout_constraintEnd_toStartOf="@+id/wheat_view10"
|
||||||
app:layout_constraintTop_toTopOf="@id/wheat_view1"
|
app:layout_constraintTop_toTopOf="@id/wheat_view1"
|
||||||
@@ -279,6 +283,7 @@
|
|||||||
android:id="@+id/wheat_view5"
|
android:id="@+id/wheat_view5"
|
||||||
android:layout_width="@dimen/dp_52"
|
android:layout_width="@dimen/dp_52"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/wheat_view2"
|
app:layout_constraintBottom_toBottomOf="@+id/wheat_view2"
|
||||||
app:layout_constraintStart_toEndOf="@+id/wheat_view6"
|
app:layout_constraintStart_toEndOf="@+id/wheat_view6"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view6"
|
app:layout_constraintTop_toBottomOf="@+id/wheat_view6"
|
||||||
@@ -290,6 +295,7 @@
|
|||||||
android:id="@+id/wheat_view4"
|
android:id="@+id/wheat_view4"
|
||||||
android:layout_width="@dimen/dp_52"
|
android:layout_width="@dimen/dp_52"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dp_10"
|
||||||
app:layout_constraintBottom_toBottomOf="@id/wheat_view3"
|
app:layout_constraintBottom_toBottomOf="@id/wheat_view3"
|
||||||
app:layout_constraintEnd_toStartOf="@+id/wheat_view5"
|
app:layout_constraintEnd_toStartOf="@+id/wheat_view5"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/wheat_view5"
|
app:layout_constraintTop_toBottomOf="@+id/wheat_view5"
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="#ccc"
|
android:textColor="#FFF"
|
||||||
android:text="聊天"/>
|
android:text="聊天"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
android:layout_marginLeft="5dp"
|
android:layout_marginLeft="5dp"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textColor="#ccc"
|
android:textColor="#FFF"
|
||||||
android:text="礼物"/>
|
android:text="礼物"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recycle_view"
|
android:id="@+id/recycle_view_public"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@+id/ll_vertical_scroll"
|
android:layout_below="@+id/ll_vertical_scroll"
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
android:paddingStart="@dimen/dp_16"
|
android:paddingStart="@dimen/dp_16"
|
||||||
android:paddingTop="@dimen/dp_25"
|
android:paddingTop="@dimen/dp_25"
|
||||||
android:paddingEnd="@dimen/dp_16"
|
android:paddingEnd="@dimen/dp_16"
|
||||||
|
android:paddingBottom="@dimen/dp_10"
|
||||||
|
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ public class AlbumDetailActivity extends BaseMvpActivity<AlbumDetailPresenter, A
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(type)
|
.setMaxSelectNum(type)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
|
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public class CreateAlbumActivity extends BaseMvpActivity<MyAlbumPresenter, Activ
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(type)
|
.setMaxSelectNum(type)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
|||||||
// mRoomTypeAdapter.setNewData(roomTypeInfos);
|
// mRoomTypeAdapter.setNewData(roomTypeInfos);
|
||||||
|
|
||||||
// MvpPre.roomLabel("create");
|
// MvpPre.roomLabel("create");
|
||||||
handler.post(showPopupRunnable);
|
|
||||||
// roomInfoResp = (RoomInfoResp) getIntent().getSerializableExtra("roomInfo");
|
// roomInfoResp = (RoomInfoResp) getIntent().getSerializableExtra("roomInfo");
|
||||||
|
|
||||||
if (roomInfoResp!=null){
|
if (roomInfoResp!=null){
|
||||||
@@ -99,6 +99,12 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
|||||||
mBinding.edNickName.setText(roomInfoResp.getRoom_info().getRoom_name());
|
mBinding.edNickName.setText(roomInfoResp.getRoom_info().getRoom_name());
|
||||||
mBinding.etG.setText(roomInfoResp.getRoom_info().getRoom_intro());
|
mBinding.etG.setText(roomInfoResp.getRoom_info().getRoom_intro());
|
||||||
roomUrl=roomInfoResp.getRoom_info().getRoom_cover();
|
roomUrl=roomInfoResp.getRoom_info().getRoom_cover();
|
||||||
|
}else {
|
||||||
|
if (handler!=null ){
|
||||||
|
if (showPopupRunnable!=null){
|
||||||
|
handler.post(showPopupRunnable);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,15 +135,17 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popupWindow = new CustomPopWindow.PopupWindowBuilder(this)
|
if (roomInfoResp == null) {
|
||||||
.setView(R.layout.pop_layout1)//显示的布局
|
popupWindow = new CustomPopWindow.PopupWindowBuilder(this)
|
||||||
.setFocusable(false) // 关键点:不要抢占焦点
|
.setView(R.layout.pop_layout1)//显示的布局
|
||||||
.create();//创建PopupWindow
|
.setFocusable(false) // 关键点:不要抢占焦点
|
||||||
mBinding.tvSave.post(() -> {
|
.create();//创建PopupWindow
|
||||||
if (!isFinishing() && !isDestroyed()) {
|
mBinding.tvSave.post(() -> {
|
||||||
popupWindow.showAsDropDown(mBinding.tvSave);
|
if (!isFinishing() && !isDestroyed()) {
|
||||||
}
|
popupWindow.showAsDropDown(mBinding.tvSave);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
mBinding.tvSujRoomName.setOnClickListener(this::onClick);
|
mBinding.tvSujRoomName.setOnClickListener(this::onClick);
|
||||||
|
|
||||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvSave, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvSave, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||||
@@ -147,9 +155,13 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
|||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
handler.removeCallbacks(showPopupRunnable);
|
if (handler!=null ) {
|
||||||
if (popupWindow != null) {
|
if (showPopupRunnable!=null) {
|
||||||
popupWindow.dissmiss();
|
handler.removeCallbacks(showPopupRunnable);
|
||||||
|
if (popupWindow != null) {
|
||||||
|
popupWindow.dissmiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +221,7 @@ public class CreatedRoomActivity extends BaseMvpActivity<CreatedRoomPresenter, A
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(1)
|
.setMaxSelectNum(1)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class EditUserInfoActivity extends BaseMvpActivity<EditUserPresenter, Act
|
|||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setMaxSelectNum(type)
|
.setMaxSelectNum(type)
|
||||||
.isPreviewImage(true)
|
.isPreviewImage(true)
|
||||||
.isDisplayCamera(true)
|
.isDisplayCamera(false)
|
||||||
.setOutputCameraDir(Constants.FILE_PATH)
|
.setOutputCameraDir(Constants.FILE_PATH)
|
||||||
.isOriginalSkipCompress(true)
|
.isOriginalSkipCompress(true)
|
||||||
|
|
||||||
@@ -199,6 +199,7 @@ public class EditUserInfoActivity extends BaseMvpActivity<EditUserPresenter, Act
|
|||||||
.isGif(isVideo)
|
.isGif(isVideo)
|
||||||
.setMaxSelectNum(type)
|
.setMaxSelectNum(type)
|
||||||
.isPreviewImage(false)
|
.isPreviewImage(false)
|
||||||
|
.isDisplayCamera(false)
|
||||||
.setImageEngine(GlideEngine.createGlideEngine())
|
.setImageEngine(GlideEngine.createGlideEngine())
|
||||||
.setImageEngine(GlideEngine.createGlideEngine()) // 选择器展示不出图片则添加
|
.setImageEngine(GlideEngine.createGlideEngine()) // 选择器展示不出图片则添加
|
||||||
.setCropEngine(new CropFileEngine() {
|
.setCropEngine(new CropFileEngine() {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.example.modulevocal.presenter.MyMoneyPresenter;
|
|||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.bean.BindType;
|
import com.xscm.moduleutil.bean.BindType;
|
||||||
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
import com.xscm.moduleutil.bean.WalletBean;
|
import com.xscm.moduleutil.bean.WalletBean;
|
||||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||||
import com.xscm.moduleutil.utils.SpUtil;
|
import com.xscm.moduleutil.utils.SpUtil;
|
||||||
@@ -45,6 +46,8 @@ public class MyMoneyActivity extends BaseMvpActivity<MyMoneyPresenter, ActivityM
|
|||||||
super.onResume();
|
super.onResume();
|
||||||
MvpPre.wallet();
|
MvpPre.wallet();
|
||||||
MvpPre.bindType(SpUtil.getUserId() + "");
|
MvpPre.bindType(SpUtil.getUserId() + "");
|
||||||
|
MvpPre.getMyInfo();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onClick(View view) {
|
private void onClick(View view) {
|
||||||
@@ -125,4 +128,9 @@ public class MyMoneyActivity extends BaseMvpActivity<MyMoneyPresenter, ActivityM
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void myInfoSuccess(UserInfo data) {
|
||||||
|
SpUtil.saveUserInfo(data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,7 @@ import com.example.modulevocal.presenter.MyRoomPresenter;
|
|||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.AttentionResp;
|
import com.xscm.moduleutil.bean.AttentionResp;
|
||||||
import com.xscm.moduleutil.bean.ManageRoomResp;
|
import com.xscm.moduleutil.bean.ManageRoomResp;
|
||||||
import com.xscm.moduleutil.bean.MyCpRoom;
|
import com.xscm.moduleutil.bean.MyCpRoom;
|
||||||
@@ -200,7 +201,9 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
|||||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||||
}
|
}
|
||||||
if (CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
|
if (CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), CommonAppContext.getInstance().playId,"");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,17 @@
|
|||||||
package com.example.modulevocal.activity;
|
package com.example.modulevocal.activity;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.facade.annotation.Autowired;
|
import com.alibaba.android.arouter.facade.annotation.Autowired;
|
||||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||||
|
import com.blankj.utilcode.util.ToastUtils;
|
||||||
import com.example.moduletablayout.listener.CustomTabEntity;
|
import com.example.moduletablayout.listener.CustomTabEntity;
|
||||||
import com.example.modulevocal.R;
|
import com.example.modulevocal.R;
|
||||||
import com.example.modulevocal.conacts.UserHomepageConacts;
|
import com.example.modulevocal.conacts.UserHomepageConacts;
|
||||||
@@ -16,6 +20,7 @@ import com.example.modulevocal.fragment.UserHomepageFragment;
|
|||||||
import com.example.modulevocal.presenter.UserHomepagePresenter;
|
import com.example.modulevocal.presenter.UserHomepagePresenter;
|
||||||
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
import com.xscm.moduleutil.activity.BaseMvpActivity;
|
||||||
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
import com.xscm.moduleutil.adapter.MyFragmentPagerAdapter;
|
||||||
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
import com.xscm.moduleutil.bean.CircleListBean;
|
import com.xscm.moduleutil.bean.CircleListBean;
|
||||||
import com.xscm.moduleutil.bean.UserInfo;
|
import com.xscm.moduleutil.bean.UserInfo;
|
||||||
import com.xscm.moduleutil.bean.XBannerData;
|
import com.xscm.moduleutil.bean.XBannerData;
|
||||||
@@ -67,6 +72,30 @@ public class UserHomepageActivity extends BaseMvpActivity<UserHomepagePresenter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||||
|
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||||
|
finish();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onKeyDown(keyCode, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (getOnBackPressedDispatcher() != null) {
|
||||||
|
getOnBackPressedDispatcher().addCallback(this, new androidx.activity.OnBackPressedCallback(true) {
|
||||||
|
@Override
|
||||||
|
public void handleOnBackPressed() {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
super.initView();
|
super.initView();
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.example.modulevocal.R;
|
|||||||
import com.makeramen.roundedimageview.RoundedImageView;
|
import com.makeramen.roundedimageview.RoundedImageView;
|
||||||
import com.xscm.moduleutil.RoomAutionTimeBean;
|
import com.xscm.moduleutil.RoomAutionTimeBean;
|
||||||
import com.xscm.moduleutil.base.CommonAppContext;
|
import com.xscm.moduleutil.base.CommonAppContext;
|
||||||
|
import com.xscm.moduleutil.base.RoomManager;
|
||||||
import com.xscm.moduleutil.bean.MyCpRoom;
|
import com.xscm.moduleutil.bean.MyCpRoom;
|
||||||
import com.xscm.moduleutil.bean.MyFootResp;
|
import com.xscm.moduleutil.bean.MyFootResp;
|
||||||
import com.xscm.moduleutil.bean.MyRoomBean;
|
import com.xscm.moduleutil.bean.MyRoomBean;
|
||||||
@@ -322,8 +323,10 @@ public class MyCreateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
queren(itemView.getContext());
|
queren(itemView.getContext());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
RoomManager.getInstance().fetchRoomDataAndEnter(itemView.getContext(), item.getRoom_id() +"","");
|
||||||
|
|
||||||
// TODO: 跳转到房间
|
// TODO: 跳转到房间
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tv_room_bt.setOnClickListener(new View.OnClickListener() {
|
tv_room_bt.setOnClickListener(new View.OnClickListener() {
|
||||||
@@ -334,7 +337,9 @@ public class MyCreateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
queren(itemView.getContext());
|
queren(itemView.getContext());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_ALLOWANCE).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(itemView.getContext(), item.getRoom_id() +"","");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_ALLOWANCE).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -401,16 +406,19 @@ public class MyCreateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
// TODO: 跳转到房间详情页面
|
// TODO: 跳转到房间详情页面
|
||||||
|
RoomManager.getInstance().fetchRoomDataAndEnter(itemView.getContext(), item.getRoom_id() +"","");
|
||||||
|
|
||||||
// startActivity(new Intent(getContext(), RoomDetailsActivity.class));
|
// startActivity(new Intent(getContext(), RoomDetailsActivity.class));
|
||||||
ARouter.getInstance().build(ARouteConstants.MY_ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
|
// ARouter.getInstance().build(ARouteConstants.MY_ROOM_DETAILS).withString("roomId", item.getRoom_id() + "").navigation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cl_my_room_list.setOnClickListener(new View.OnClickListener() {//跳转房间
|
cl_my_room_list.setOnClickListener(new View.OnClickListener() {//跳转房间
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
RoomManager.getInstance().fetchRoomDataAndEnter(itemView.getContext(), item.getRoom_id() +"","");
|
||||||
|
|
||||||
// TODO: 跳转到房间
|
// TODO: 跳转到房间
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -472,7 +480,9 @@ public class MyCreateAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
|
|||||||
rl_root.setOnClickListener(new View.OnClickListener() {
|
rl_root.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
RoomManager.getInstance().fetchRoomDataAndEnter(itemView.getContext(), item.getRoom_id() +"","");
|
||||||
|
|
||||||
|
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("from", "我的界面").withString("roomId", item.getRoom_id() + "").navigation();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class TaskBoxAdapter extends BaseQuickAdapter<GiftBoxBean.GiftBean, BaseV
|
|||||||
unlockView.setClickable(false);
|
unlockView.setClickable(false);
|
||||||
unlockView.setEnabled(false);
|
unlockView.setEnabled(false);
|
||||||
// 可选:改变颜色或透明度来视觉反馈
|
// 可选:改变颜色或透明度来视觉反馈
|
||||||
unlockView.setAlpha(0.5f); // 半透明表示不可点击
|
unlockView.setAlpha(0.9f); // 半透明表示不可点击
|
||||||
}else if (item.getStatus().equals("1")){
|
}else if (item.getStatus().equals("1")){
|
||||||
unlockView.setClickable(true);
|
unlockView.setClickable(true);
|
||||||
unlockView.setEnabled(true);
|
unlockView.setEnabled(true);
|
||||||
@@ -95,7 +95,7 @@ public class TaskBoxAdapter extends BaseQuickAdapter<GiftBoxBean.GiftBean, BaseV
|
|||||||
unlockView.setClickable(false);
|
unlockView.setClickable(false);
|
||||||
unlockView.setEnabled(false);
|
unlockView.setEnabled(false);
|
||||||
// 可选:改变颜色或透明度来视觉反馈
|
// 可选:改变颜色或透明度来视觉反馈
|
||||||
unlockView.setAlpha(0.5f); // 半透明表示不可点击
|
unlockView.setAlpha(0.8f); // 半透明表示不可点击
|
||||||
}
|
}
|
||||||
|
|
||||||
helper.getView(R.id.iv_unlock).setOnClickListener(new View.OnClickListener() {
|
helper.getView(R.id.iv_unlock).setOnClickListener(new View.OnClickListener() {
|
||||||
|
|||||||
@@ -44,7 +44,17 @@ public class TaskDataAdapter extends BaseQuickAdapter<GiftBoxBean.TaskDataBean.D
|
|||||||
// textView.setBackground(mContext.getResources().getDrawable(com.qxcm.moduleutil.R.mipmap.ylq));
|
// textView.setBackground(mContext.getResources().getDrawable(com.qxcm.moduleutil.R.mipmap.ylq));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
textView.setText(item.getTask_type_str().equals("去完成")?"未完成": (item.getTask_type_str().equals("领取金币")?"待领取":item.getTask_type_str()));
|
// textView.setText(item.getTask_type_str().equals("去完成")?"未完成": (item.getTask_type_str().equals("领取金币")?"待领取":item.getTask_type_str()));
|
||||||
|
if (item.getTask_type_str().equals("去完成")){
|
||||||
|
textView.setText("未完成");
|
||||||
|
}else if (item.getTask_type_str().equals("领取金币")){
|
||||||
|
textView.setText("");
|
||||||
|
textView.setBackgroundResource(com.xscm.moduleutil.R.mipmap.task_lq);
|
||||||
|
}else {
|
||||||
|
textView.setText("");
|
||||||
|
textView.setBackgroundResource(com.xscm.moduleutil.R.mipmap.task_ylq);
|
||||||
|
}
|
||||||
|
|
||||||
ImageUtils.loadHeadCC(item.getIcon(), helper.getView(R.id.task_pic));
|
ImageUtils.loadHeadCC(item.getIcon(), helper.getView(R.id.task_pic));
|
||||||
helper.setText(R.id.task_name, item.getTask_name())
|
helper.setText(R.id.task_name, item.getTask_name())
|
||||||
.setText(R.id.task_jb_number, "+"+item.getGold_reward());
|
.setText(R.id.task_jb_number, "+"+item.getGold_reward());
|
||||||
|
|||||||