1:修改交友房
2:修改拍卖房 3:修改飘屏(没有修改成功)
This commit is contained in:
@@ -30,7 +30,7 @@ isBuildModule=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.0.3
|
||||
APP_VERSION_CODE=152
|
||||
APP_VERSION_CODE=155
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
|
||||
@@ -184,7 +184,7 @@ public class LoginPresenter extends BasePresenter<LoginContacter.View> implement
|
||||
|
||||
public void loginSuccess(List<UserBean> userBean) {
|
||||
if (userBean == null) {
|
||||
ToastUtils.showShort("登录失败请重试");
|
||||
// ToastUtils.showShort("登录失败请重试");
|
||||
return;
|
||||
}
|
||||
if (userBean.size() == 1) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.xscm.moduleutil.activity;
|
||||
|
||||
import static androidx.core.content.ContextCompat.getSystemService;
|
||||
|
||||
import static com.xscm.moduleutil.base.CommonAppContext.postDelayed;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -23,7 +25,9 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -53,6 +57,8 @@ import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.DisplayUtil;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.SystemUtils;
|
||||
import com.xscm.moduleutil.widget.QXGiftDriftView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -98,7 +104,7 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
ActivityUtils.finishAllActivities();
|
||||
}
|
||||
|
||||
|
||||
QXGiftDriftView qxGiftDriftView;
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -141,7 +147,6 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 在Activity中
|
||||
@@ -414,10 +419,10 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
synchronized (mqttQueueLock) {
|
||||
|
||||
mqttMessageQueue.addAll(mqttBean.getList());
|
||||
if (!isMqttPlaying) {
|
||||
isMqttPlaying = true;
|
||||
// if (!isMqttPlaying) {
|
||||
// isMqttPlaying = true;
|
||||
processNextMqttMessage();
|
||||
}
|
||||
// }
|
||||
}
|
||||
}else {
|
||||
mqttMessageQueue.clear();
|
||||
@@ -472,6 +477,11 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
ViewGroup decorView1;
|
||||
|
||||
private void showFloatingMessage(MqttBean.ListBean mqttBean) {
|
||||
|
||||
// QXGiftDriftView.getInstance( this).addGiftModel(mqttBean);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
// 清理之前的视图(如果存在)
|
||||
if (currentMqttView != null && currentMqttView.getParent() != null) {
|
||||
@@ -569,35 +579,92 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
view.setTranslationX(screenWidth);
|
||||
|
||||
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
|
||||
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", getScreenWidth(), (getScreenWidth() - view.getMeasuredWidth()) / 2f);
|
||||
animator1.setDuration(1500);
|
||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
animator1.start();
|
||||
TranslateAnimation enterAnim = new TranslateAnimation(
|
||||
Animation.ABSOLUTE, screenWidth,
|
||||
Animation.ABSOLUTE, (screenWidth - SystemUtils.getWidth(316)) / 2,
|
||||
Animation.ABSOLUTE, 0,
|
||||
Animation.ABSOLUTE, 0
|
||||
);
|
||||
enterAnim.setDuration(1500);
|
||||
enterAnim.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
|
||||
view.postDelayed(() -> {
|
||||
try {
|
||||
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.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
animator2.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
onAnimationEnd.run();
|
||||
}
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
// 停留后退出
|
||||
postDelayed(() -> {
|
||||
TranslateAnimation exitAnim = new TranslateAnimation(
|
||||
Animation.ABSOLUTE, (screenWidth - SystemUtils.getWidth(316)) / 2,
|
||||
Animation.ABSOLUTE, -screenWidth,
|
||||
Animation.ABSOLUTE, 0,
|
||||
Animation.ABSOLUTE, 0
|
||||
);
|
||||
exitAnim.setDuration(2000);
|
||||
exitAnim.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationCancel(Animator animation) {
|
||||
onAnimationEnd.run();
|
||||
}
|
||||
});
|
||||
animator2.start();
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("MQTT动画执行失败", e);
|
||||
onAnimationEnd.run();
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
// 移除视图并处理下一个
|
||||
// ViewGroup rootView = (ViewGroup) getParent();
|
||||
// if (rootView != null) {
|
||||
// rootView.removeView(QXGiftDriftView.this);
|
||||
// }
|
||||
//
|
||||
// if (!dataArray.isEmpty()) {
|
||||
// dataArray.remove(0);
|
||||
// }
|
||||
// isPlaying = false;
|
||||
//
|
||||
// if (!dataArray.isEmpty()) {
|
||||
// giftAction();
|
||||
// }
|
||||
onAnimationEnd.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
});
|
||||
view.startAnimation(exitAnim);
|
||||
}, 3000); // 停留1秒
|
||||
}
|
||||
}, 3000);
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
});
|
||||
view.startAnimation(enterAnim);
|
||||
|
||||
|
||||
|
||||
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(view, "translationX", view.getWidth(), 0f);
|
||||
// animator1.setDuration(1500);
|
||||
// animator1.setInterpolator(new DecelerateInterpolator(1f));
|
||||
// animator1.start();
|
||||
|
||||
// view.postDelayed(() -> {
|
||||
// try {
|
||||
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(view, "translationX", 0f, -view.getWidth());
|
||||
// animator2.setDuration(3000);
|
||||
// animator2.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
// animator2.addListener(new AnimatorListenerAdapter() {
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// onAnimationEnd.run();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationCancel(Animator animation) {
|
||||
// onAnimationEnd.run();
|
||||
// }
|
||||
// });
|
||||
// animator2.start();
|
||||
// } catch (Exception e) {
|
||||
// LogUtils.e("MQTT动画执行失败", e);
|
||||
// onAnimationEnd.run();
|
||||
// }
|
||||
// }, 3000);
|
||||
} catch (Exception e) {
|
||||
LogUtils.e("MQTT动画启动失败", e);
|
||||
onAnimationEnd.run();
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -21,8 +23,11 @@ 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.RoomManager;
|
||||
import com.xscm.moduleutil.bean.UserBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.dialog.ConfirmDialog;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.utils.LanguageUtil;
|
||||
import com.xscm.moduleutil.utils.location.LocationProvider;
|
||||
@@ -96,6 +101,25 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
LogUtils.e("@@@", "成功");
|
||||
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
||||
@Override
|
||||
public void onSuccess(Long aLong) {
|
||||
// 通知未读数变化
|
||||
UnreadCountEvent event =CommonAppContext.getInstance().unreadCountEvent;
|
||||
if (event==null){
|
||||
event=new UnreadCountEvent();
|
||||
}
|
||||
event.setALong(aLong);
|
||||
// 使用EventBus通知
|
||||
CommonAppContext.getInstance().setUnreadCountEvent(event);
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
// 错误处理
|
||||
}
|
||||
});
|
||||
initLocation();
|
||||
}
|
||||
});
|
||||
@@ -121,6 +145,8 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
|
||||
@Override
|
||||
public void onKickedOffline() {
|
||||
// queren1();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,6 +158,32 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
}
|
||||
};
|
||||
|
||||
private void queren1() {
|
||||
// 创建并显示确认对话框
|
||||
new ConfirmDialog(this,
|
||||
"温馨提示",
|
||||
"您的账号已在别处登录,请确认密码是否已经泄露",
|
||||
"知道了",
|
||||
"",
|
||||
v -> {
|
||||
// 点击“确认”按钮时执行删除操作
|
||||
|
||||
if (CommonAppContext.getInstance().playId!=null){
|
||||
RoomManager.getInstance().exitRoom(CommonAppContext.getInstance().playId);
|
||||
}
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
},
|
||||
v -> {
|
||||
// 点击“取消”按钮时什么都不做
|
||||
|
||||
}, false, 0).show();
|
||||
}
|
||||
|
||||
private SystemLocationProvider locationProvider;
|
||||
|
||||
private void initLocation() {
|
||||
@@ -178,6 +230,20 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Resources getResources() {
|
||||
Resources resources = super.getResources();
|
||||
if (resources != null) {
|
||||
Configuration configuration = resources.getConfiguration();
|
||||
if (configuration != null) {
|
||||
// 设置字体缩放比例不随系统变化
|
||||
configuration.fontScale = 1.0f; // 1.0f表示默认大小
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
}
|
||||
}
|
||||
return resources;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void userInfoEvent(UserInfo event) {
|
||||
// V2TIMUserFullInfo userFullInfo = new V2TIMUserFullInfo();
|
||||
|
||||
@@ -17,6 +17,7 @@ import android.os.Handler;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Base64;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -71,6 +72,7 @@ import java.security.MessageDigest;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -92,6 +94,8 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
public boolean isPlaying;
|
||||
|
||||
public String playId;
|
||||
public String lable_id;
|
||||
public boolean isMicPlace;
|
||||
public String playCover;
|
||||
public boolean showSelf;//盲盒是否能送自己
|
||||
public String playName;
|
||||
@@ -114,27 +118,13 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
|
||||
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;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public UnreadCountEvent unreadCountEvent;
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
@@ -148,7 +138,26 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
registerActivityLifecycleCallbacks(this);
|
||||
appStateListener = AppStateManager.getInstance();
|
||||
startListeningUnreadMessageCount();
|
||||
// 全局设置字体不缩放
|
||||
adjustFontScale(getResources().getConfiguration());
|
||||
|
||||
}
|
||||
|
||||
public void adjustFontScale(Configuration configuration) {
|
||||
if (configuration.fontScale != 1.0f) {
|
||||
configuration.fontScale = 1.0f;
|
||||
DisplayMetrics metrics = getResources().getDisplayMetrics();
|
||||
getResources().updateConfiguration(configuration, metrics);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
// 配置变化时重新应用字体设置
|
||||
adjustFontScale(newConfig);
|
||||
}
|
||||
|
||||
// 在适当的位置(如onCreate或onResume)添加实时监听
|
||||
protected void startListeningUnreadMessageCount() {
|
||||
if (!isListeningUnreadCount) {
|
||||
@@ -181,7 +190,6 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
V2TIMManager.getConversationManager().getTotalUnreadMessageCount(new V2TIMValueCallback<Long>() {
|
||||
@Override
|
||||
public void onSuccess(Long aLong) {
|
||||
CommonAppContext.getInstance().setMasageCount(aLong != null ? aLong : 0L);
|
||||
// 通知未读数变化
|
||||
notifyUnreadCountChanged(aLong != null ? aLong : 0L);
|
||||
}
|
||||
@@ -189,7 +197,6 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
@Override
|
||||
public void onError(int code, String desc) {
|
||||
// 错误处理
|
||||
CommonAppContext.getInstance().setMasageCount(0L);
|
||||
notifyUnreadCountChanged(0L);
|
||||
}
|
||||
});
|
||||
@@ -197,10 +204,14 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
|
||||
// 通知未读数变化的方法(可以发送广播或EventBus事件)
|
||||
private void notifyUnreadCountChanged(long unreadCount) {
|
||||
UnreadCountEvent event =unreadCountEvent;
|
||||
if (event==null){
|
||||
event=new UnreadCountEvent();
|
||||
}
|
||||
event.setALong(unreadCount);
|
||||
// 使用EventBus通知
|
||||
EventBus.getDefault().post(new UnreadCountEvent(unreadCount,0));
|
||||
|
||||
|
||||
CommonAppContext.getInstance().setUnreadCountEvent(event);
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
/**
|
||||
* 优化内存设置
|
||||
@@ -359,6 +370,7 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
|
||||
// 每次启动应用时重置状态
|
||||
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
|
||||
startInitSdk();
|
||||
}
|
||||
}
|
||||
// piaoPingManager = PiaoPingManager.getInstance(this);
|
||||
|
||||
@@ -43,7 +43,8 @@ public class RoomManager {
|
||||
// 缓存有效期(5分钟)
|
||||
private static final long CACHE_DURATION = 5 * 60 * 1000;
|
||||
|
||||
private RoomManager() {}
|
||||
private RoomManager() {
|
||||
}
|
||||
|
||||
public static synchronized RoomManager getInstance() {
|
||||
if (instance == null) {
|
||||
@@ -54,8 +55,9 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 进入房间 - 自动获取房间数据
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param roomId 房间ID
|
||||
*/
|
||||
public void enterRoom(Context context, String roomId) {
|
||||
enterRoom(context, roomId, null, null);
|
||||
@@ -63,8 +65,9 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 进入房间 - 使用密码
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param password 房间密码
|
||||
*/
|
||||
public void enterRoom(Context context, String roomId, String password) {
|
||||
@@ -73,9 +76,10 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 进入房间 - 使用缓存数据
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param password 房间密码
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param password 房间密码
|
||||
* @param cachedData 缓存的房间数据
|
||||
*/
|
||||
public void enterRoom(Context context, String roomId, String password, RoomInfoResp cachedData) {
|
||||
@@ -98,8 +102,9 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 获取房间数据并进入房间
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param password 房间密码
|
||||
*/
|
||||
public void fetchRoomDataAndEnter(Context context, String roomId, String password) {
|
||||
@@ -110,10 +115,17 @@ public class RoomManager {
|
||||
// RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||
// 检查是否是当前房间且用户在线
|
||||
// boolean isCurrentRoom = isCurrentRoom(roomId);
|
||||
if (CommonAppContext.getInstance().playId==null){
|
||||
if (CommonAppContext.getInstance().playId == null) {
|
||||
fetchAndJoinRoom(context, roomId, password);
|
||||
}else {
|
||||
} else {
|
||||
if (!CommonAppContext.getInstance().playId.equals(roomId)) {
|
||||
exitRoom(CommonAppContext.getInstance().playId);
|
||||
} else if (CommonAppContext.getInstance().lable_id.equals("6")) {
|
||||
upInfo(context, roomId, password, true, null, true);
|
||||
return;
|
||||
}
|
||||
isUserOnline(context, roomId, password, null);
|
||||
|
||||
}
|
||||
|
||||
// try {
|
||||
@@ -166,12 +178,12 @@ public class RoomManager {
|
||||
// navigateToRoom(context, roomId, password, null);
|
||||
}
|
||||
|
||||
private void upInfo(Context context, String roomId, String password,boolean isOnline, RoomInfoResp roomInfo,boolean isCurrentRoom){
|
||||
private void upInfo(Context context, String roomId, String password, boolean isOnline, RoomInfoResp roomInfo, boolean isCurrentRoom) {
|
||||
|
||||
|
||||
if (isOnline){
|
||||
navigateToRoom(context, roomId, password, roomInfo,isOnline);
|
||||
}else {
|
||||
if (isOnline) {
|
||||
navigateToRoom(context, roomId, password, roomInfo, isOnline);
|
||||
} else {
|
||||
// CommonAppContext.getInstance().isShow = false;
|
||||
// CommonAppContext.getInstance().isPlaying = false;
|
||||
// EventBus.getDefault().post(new RoomOutEvent());
|
||||
@@ -184,7 +196,6 @@ public class RoomManager {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (isCurrentRoom&& isOnline) {
|
||||
// if (roomInfo != null) {
|
||||
// navigateToRoom(context, roomId, password, roomInfo);
|
||||
@@ -214,7 +225,7 @@ public class RoomManager {
|
||||
|
||||
// cacheRoomData(roomId, roomInfo);
|
||||
// navigateToRoom(context, roomId, password, roomInfo);
|
||||
return;
|
||||
return;
|
||||
// }
|
||||
|
||||
// 其他情况,获取新的房间数据并加入房间
|
||||
@@ -223,8 +234,9 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 获取新的房间数据并加入房间
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param password 房间密码
|
||||
*/
|
||||
private void fetchAndJoinRoom(Context context, String roomId, String password) {
|
||||
@@ -236,7 +248,7 @@ public class RoomManager {
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
navigateToRoom(context, roomId, password, null,false);
|
||||
navigateToRoom(context, roomId, password, null, false);
|
||||
|
||||
// RetrofitClient.getInstance().roomGetIn(roomId, password, new BaseObserver<RoomInfoResp>() {
|
||||
//
|
||||
@@ -270,6 +282,7 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 检查是否是当前房间
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @return true表示是当前房间,false表示不是
|
||||
*/
|
||||
@@ -279,24 +292,26 @@ public class RoomManager {
|
||||
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||
|
||||
RoomInfoResp roomInfo = getCachedRoomData(roomId);
|
||||
if (roomInfo != null){
|
||||
if (roomInfo.getRoom_info().getRoom_id().equals(roomId)){
|
||||
if (roomInfo != null) {
|
||||
if (roomInfo.getRoom_info().getRoom_id().equals(roomId)) {
|
||||
return true;
|
||||
}else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转到房间页面
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param roomId 房间ID
|
||||
* @param password 房间密码
|
||||
* @param roomInfo 房间信息
|
||||
*/
|
||||
private void navigateToRoom(Context context, String roomId, String password, RoomInfoResp roomInfo,boolean isOnline) {
|
||||
private void navigateToRoom(Context context, String roomId, String password, RoomInfoResp roomInfo, boolean isOnline) {
|
||||
try {
|
||||
// 构建跳转参数
|
||||
Bundle bundle = new Bundle();
|
||||
@@ -325,7 +340,8 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 缓存房间数据
|
||||
* @param roomId 房间ID
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @param roomInfo 房间信息
|
||||
*/
|
||||
public void cacheRoomData(String roomId, RoomInfoResp roomInfo) {
|
||||
@@ -342,6 +358,7 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 获取缓存的房间数据
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @return 房间信息,如果缓存无效则返回null
|
||||
*/
|
||||
@@ -365,12 +382,14 @@ public class RoomManager {
|
||||
|
||||
return roomDataCache.get(roomId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否在线
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @return true表示用户在线,false表示不在线
|
||||
*/
|
||||
private boolean isUserOnline(Context context, String roomId,String password,RoomInfoResp roomInfo) {
|
||||
private boolean isUserOnline(Context context, String roomId, String password, RoomInfoResp roomInfo) {
|
||||
// 这里应该实现检查用户是否在线的逻辑
|
||||
// 可以通过检查Agora是否还在房间中,或者通过服务端接口查询用户状态等方式实现
|
||||
// 目前返回false,需要根据实际需求实现具体逻辑
|
||||
@@ -420,10 +439,12 @@ public class RoomManager {
|
||||
}
|
||||
}
|
||||
});
|
||||
return isOnline[0];
|
||||
return isOnline[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除指定房间的缓存数据
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
*/
|
||||
public void clearRoomCache(String roomId) {
|
||||
@@ -443,6 +464,7 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 退出房间
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
*/
|
||||
public void exitRoom(String roomId) {
|
||||
@@ -452,11 +474,24 @@ public class RoomManager {
|
||||
// 可以在这里添加其他退出房间的逻辑
|
||||
// 例如:通知服务器用户已退出、清理房间相关资源等
|
||||
|
||||
RetrofitClient.getInstance().quitRoom(roomId, SpUtil.getUserId() + "", new BaseObserver<String>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(String s) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Logger.d(TAG, "退出房间: " + roomId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量退出房间
|
||||
*
|
||||
* @param roomIds 房间ID列表
|
||||
*/
|
||||
public void exitRooms(String... roomIds) {
|
||||
@@ -469,6 +504,7 @@ public class RoomManager {
|
||||
|
||||
/**
|
||||
* 获取房间缓存状态
|
||||
*
|
||||
* @param roomId 房间ID
|
||||
* @return 缓存状态信息
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ public class RoomPitBean implements Serializable {
|
||||
private int is_lock;//0未锁麦 1锁麦
|
||||
private int is_mute;//0未禁麦 1禁麦
|
||||
private int count_down;//麦位倒计时
|
||||
private String user_id;//麦位上用户id
|
||||
private String user_id="";//麦位上用户id
|
||||
private String nickname;//麦位上用户昵称
|
||||
private String avatar;//用户头像
|
||||
private String sex;//性别
|
||||
|
||||
@@ -58,7 +58,7 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
||||
android.util.DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||
// 设置高度为屏幕高度的80%
|
||||
android.view.WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.height = (int) (displayMetrics.heightPixels * 0.7);
|
||||
params.height = (int) (displayMetrics.heightPixels * 0.9);
|
||||
params.width = android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
getWindow().setAttributes(params);
|
||||
}
|
||||
@@ -102,6 +102,32 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
||||
|
||||
|
||||
public void initData1() {
|
||||
// WebSettings webSettings = mBinding.webView.getSettings();
|
||||
// webSettings.setUseWideViewPort(true);
|
||||
// webSettings.setLoadWithOverviewMode(true);
|
||||
// webSettings.setJavaScriptEnabled(true);
|
||||
// webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE); //关闭webview中缓存
|
||||
// //增加JSBridge
|
||||
// mBinding.webView.addJavascriptInterface(new WebAppInterface(getContext()), "Android");
|
||||
//// mBinding.webView.addJavascriptInterface(new WebViewBridgeConfig(title), WebViewBridgeConfig.NAME);
|
||||
// webSettings.setBuiltInZoomControls(false);
|
||||
// webSettings.setSupportZoom(false);
|
||||
// webSettings.setDomStorageEnabled(true);
|
||||
// webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
// // 启用 WebView 内容的滚动
|
||||
// mBinding.webView.setVerticalScrollBarEnabled(true);
|
||||
// mBinding.webView.setScrollbarFadingEnabled(true);
|
||||
// webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
// webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
// mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
// mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||
// mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
// mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
// mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
//
|
||||
// mBinding.webView.requestFocus();
|
||||
// mBinding.webView.loadUrl(mUrl);
|
||||
|
||||
WebSettings webSettings = mBinding.webView.getSettings();
|
||||
webSettings.setUseWideViewPort(true);
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
@@ -116,12 +142,16 @@ public class WebViewDialog extends BaseDialog<WebViewDialogBinding> {
|
||||
webSettings.setBlockNetworkImage(false);//解决图片不显示
|
||||
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
|
||||
// 启用 WebView 内容的滚动,但隐藏滚动条
|
||||
mBinding.webView.setHorizontalScrollBarEnabled(false);//水平不显示
|
||||
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示
|
||||
mBinding.webView.setVerticalScrollBarEnabled(false); //垂直不显示滚动条
|
||||
mBinding.webView.setWebViewClient(new WebViewClient());
|
||||
mBinding.webView.setBackgroundColor(Color.TRANSPARENT);
|
||||
mBinding.webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
|
||||
// 确保内容可以滚动
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
|
||||
mBinding.webView.requestFocus();
|
||||
mBinding.webView.loadUrl(mUrl);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,16 @@ public class UnreadCountEvent {
|
||||
private long aLong;
|
||||
private long bLong;
|
||||
|
||||
public UnreadCountEvent(long aLong, long bLong) {
|
||||
this.aLong = aLong;
|
||||
this.bLong = bLong;
|
||||
}
|
||||
|
||||
|
||||
// public UnreadCountEvent(long aLong, long bLong) {
|
||||
// this.aLong = aLong;
|
||||
// this.bLong = bLong;
|
||||
// }
|
||||
//
|
||||
// public UnreadCountEvent() {
|
||||
// }
|
||||
// public UnreadCountEvent(long aLong) {
|
||||
// this.aLong = aLong;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.LOGIN)
|
||||
Observable<BaseModel<List<UserBean>>> login(@Field("user_login") String user_login, @Field("sms_code") String sms_code);
|
||||
Call<BaseModel<List<UserBean>>> login(@Field("user_login") String user_login, @Field("sms_code") String sms_code);
|
||||
|
||||
@FormUrlEncoded //手机换绑
|
||||
@POST(Constants.MODIFY_MOBILE)
|
||||
|
||||
@@ -53,9 +53,11 @@ public abstract class BaseObserver<T> implements Observer<T> {
|
||||
} else if (e instanceof APIException) {
|
||||
APIException apiException = (APIException) e;
|
||||
if (apiException.getCode() == 301) {
|
||||
EventBus.getDefault().post(new LogOutEvent());
|
||||
|
||||
try {
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
ToastUtils.show(extractChinese(apiException.getMessage()));
|
||||
// com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
EventBus.getDefault().post(new LogOutEvent());
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
|
||||
@@ -2,8 +2,13 @@ package com.xscm.moduleutil.http;
|
||||
|
||||
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.ObservableSource;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
@@ -23,17 +28,44 @@ public class DefaultTransformer<T> implements ObservableTransformer<BaseModel<T>
|
||||
return upstream
|
||||
.map(response -> {
|
||||
if (response.isTokenExpired()) {
|
||||
// 触发登出事件(EventBus)
|
||||
com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
throw new APIException(-1, "登录已过期");
|
||||
if (response.getCode()==301){
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(response.getMsg());
|
||||
}else {
|
||||
// 触发登出事件(EventBus)
|
||||
// com.blankj.utilcode.util.ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
}
|
||||
throw new APIException(response.getCode(), response.getMsg());
|
||||
}
|
||||
|
||||
if (!response.isSuccess()) {
|
||||
throw new APIException(response.getCode(), response.getMsg());
|
||||
}
|
||||
|
||||
return response.getData();
|
||||
// 确保不会返回null值
|
||||
T data = response.getData();
|
||||
if (data == null) {
|
||||
return getDefaultValue();
|
||||
// 根据类型返回默认值
|
||||
// if (data instanceof String) {
|
||||
// data = (T) "";
|
||||
// } else if (data instanceof List) {
|
||||
// data = (T) new ArrayList<>();
|
||||
// } else if (data instanceof Integer) {
|
||||
// data = (T) Integer.valueOf(0);
|
||||
// } else if (data instanceof Long) {
|
||||
// data = (T) Long.valueOf(0L);
|
||||
// } else if (data instanceof Double) {
|
||||
// data = (T) Double.valueOf(0.0);
|
||||
// } else if (data instanceof Float) {
|
||||
// data = (T) Float.valueOf(0.0f);
|
||||
// } else if (data instanceof Boolean) {
|
||||
// data = (T) Boolean.FALSE;
|
||||
// } else {
|
||||
// data= ;
|
||||
// }
|
||||
}
|
||||
return data;
|
||||
})
|
||||
.onErrorResumeNext(throwable -> {
|
||||
// 可以在这里统一处理异常
|
||||
@@ -45,4 +77,14 @@ public class DefaultTransformer<T> implements ObservableTransformer<BaseModel<T>
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T getDefaultValue() {
|
||||
try {
|
||||
// 尝试返回合理类型的默认值
|
||||
return (T) new Object();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.xscm.moduleutil.http;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.xscm.moduleutil.utils.GsonUtils;
|
||||
|
||||
@@ -25,21 +26,76 @@ public class ResponseBodyConverter<T> implements Converter<ResponseBody, T> {
|
||||
@Override
|
||||
public T convert(@NonNull ResponseBody value) throws IOException {
|
||||
String json = value.string();
|
||||
BaseModel obj = GsonUtils.GsonToBean(json, BaseModel.class);
|
||||
if (obj.getCode() != 1) {
|
||||
String info = obj.getMsg();
|
||||
if ("当前余额不足".equals(info)) {
|
||||
value.close();
|
||||
return adapter.fromJson(json);
|
||||
} else {
|
||||
if(!info.contains("更新失败")) {
|
||||
try {
|
||||
BaseModel obj = GsonUtils.GsonToBean(json, BaseModel.class);
|
||||
if (obj.getCode() != 1) {
|
||||
String info = obj.getMsg();
|
||||
if ("当前余额不足".equals(info)) {
|
||||
value.close();
|
||||
return parseDataSafely(json);
|
||||
} else {
|
||||
if (!info.contains("更新失败")) {
|
||||
// ToastUtils.showShort(info);
|
||||
}
|
||||
}
|
||||
// throw new APIException(obj.getCode(), info);
|
||||
}
|
||||
}
|
||||
value.close();
|
||||
return parseDataSafely(json);
|
||||
} catch (Exception e) {
|
||||
// 处理解析异常,避免崩溃
|
||||
value.close();
|
||||
try {
|
||||
// 尝试返回默认值
|
||||
return createDefaultInstance();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 安全地解析数据,处理各种可能的返回类型
|
||||
*/
|
||||
private T parseDataSafely(String json) {
|
||||
try {
|
||||
return adapter.fromJson(json);
|
||||
} catch (IOException | JsonParseException e) {
|
||||
// 当解析失败时,尝试其他方式处理
|
||||
try {
|
||||
// 尝试返回默认值
|
||||
return createDefaultInstance();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
value.close();
|
||||
return adapter.fromJson(json);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建默认实例以避免null返回
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private T createDefaultInstance() {
|
||||
try {
|
||||
// 对于基本类型和常见集合类型,返回默认值
|
||||
Class<?> rawType = adapter.getClass();
|
||||
if (rawType.isAssignableFrom(String.class)) {
|
||||
return (T) "";
|
||||
} else if (rawType.isAssignableFrom(Boolean.class) || rawType.isAssignableFrom(boolean.class)) {
|
||||
return (T) Boolean.FALSE;
|
||||
} else if (rawType.isAssignableFrom(Integer.class) || rawType.isAssignableFrom(int.class)) {
|
||||
return (T) Integer.valueOf(0);
|
||||
} else if (rawType.isAssignableFrom(Long.class) || rawType.isAssignableFrom(long.class)) {
|
||||
return (T) Long.valueOf(0L);
|
||||
} else if (rawType.isAssignableFrom(Double.class) || rawType.isAssignableFrom(double.class)) {
|
||||
return (T) Double.valueOf(0.0);
|
||||
} else if (rawType.isAssignableFrom(Float.class) || rawType.isAssignableFrom(float.class)) {
|
||||
return (T) Float.valueOf(0.0f);
|
||||
} else {
|
||||
// 对于其他类型,返回null而不是抛出异常
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,30 @@ public class RetrofitClient {
|
||||
}
|
||||
|
||||
public void login(String mobile, String password, BaseObserver<List<UserBean>> observer) {
|
||||
sApiServer.login(mobile, password).compose(new DefaultTransformer<>()).subscribe(observer);
|
||||
sApiServer.login(mobile, password).enqueue(new Callback<BaseModel<List<UserBean>>>() {
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<List<UserBean>>> call, Response<BaseModel<List<UserBean>>> response) {
|
||||
if (response.code() == 200){
|
||||
BaseModel<List<UserBean>> listBaseModel=response.body();
|
||||
if (listBaseModel!=null){
|
||||
int code=listBaseModel.getCode();
|
||||
if (code==1){
|
||||
observer.onNext(listBaseModel.getData());
|
||||
}else if (code==301){
|
||||
ToastUtils.showShort(listBaseModel.getMsg());
|
||||
}else {
|
||||
ToastUtils.showShort(listBaseModel.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<List<UserBean>>> call, Throwable t) {
|
||||
t.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void userLogin(String mobile, String password, BaseObserver<List<UserBean>> observer) {
|
||||
@@ -316,14 +339,18 @@ public class RetrofitClient {
|
||||
if (code == 1) {
|
||||
observer.onNext(string.getData());
|
||||
} else if (code == 301) {
|
||||
try {
|
||||
ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
// try {
|
||||
ToastUtils.showShort(string.getMsg());
|
||||
// ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
// CommonAppContext.getInstance().clearLoginInfo();
|
||||
// } catch (ClassNotFoundException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
}else {
|
||||
|
||||
ToastUtils.showShort(string.getMsg());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -833,7 +860,12 @@ public class RetrofitClient {
|
||||
public void onResponse(Call<BaseModel<List<UserBean>>> call, Response<BaseModel<List<UserBean>>> response) {
|
||||
if (response.code() == 200) {
|
||||
BaseModel<List<UserBean>> baseModel = response.body();
|
||||
observer.onNext(baseModel.getData());
|
||||
if (baseModel.getCode()==1) {
|
||||
observer.onNext(baseModel.getData());
|
||||
}else if (baseModel.getCode()==301){
|
||||
ToastUtils.showShort(baseModel.getMsg());
|
||||
observer.onNext(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2048,14 +2080,16 @@ public class RetrofitClient {
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
|
||||
ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
// ToastUtils.showShort("提示当前账号已在别的地方登陆,如果不是本人操作请修改密码");
|
||||
if (t.toString().contains("登录失效")) {
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo();
|
||||
ToastUtils.showShort(t.toString());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
ToastUtils.showShort(t.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.blankj.utilcode.util.GsonUtils;
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.HeadlineBean;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.room.EMMessageInfo;
|
||||
@@ -512,7 +513,15 @@ public class MessageListenerSingleton {
|
||||
@Override
|
||||
public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
|
||||
super.onTotalUnreadMessageCountChanged(totalUnreadCount);
|
||||
EventBus.getDefault().post(new UnreadCountEvent(totalUnreadCount,0));
|
||||
|
||||
UnreadCountEvent event = CommonAppContext.getInstance().getUnreadCountEvent();
|
||||
if (event== null){
|
||||
event = new UnreadCountEvent();
|
||||
event.setBLong(0);
|
||||
}
|
||||
event.setALong( totalUnreadCount);
|
||||
CommonAppContext.getInstance().setUnreadCountEvent(event);
|
||||
EventBus.getDefault().post(event);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
|
||||
});
|
||||
}
|
||||
@@ -270,7 +270,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
}
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,273 @@
|
||||
package com.xscm.moduleutil.widget;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.event.MqttBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QXGiftDriftView extends ViewGroup {
|
||||
|
||||
private static QXGiftDriftView instance;
|
||||
|
||||
private ImageView bgImageView;
|
||||
private TextView titleLabel;
|
||||
private ImageView giftImageView;
|
||||
private TextView countLabel;
|
||||
private boolean isPlaying=false;
|
||||
private boolean isClose;
|
||||
|
||||
private List<MqttBean.ListBean> dataArray = new ArrayList<>();
|
||||
private MqttBean.ListBean model;
|
||||
|
||||
private Context context;
|
||||
private int screenWidth;
|
||||
|
||||
public static QXGiftDriftView getInstance(Context context) {
|
||||
if (instance == null) {
|
||||
instance = new QXGiftDriftView(context);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
private QXGiftDriftView(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
|
||||
// 获取屏幕宽度
|
||||
screenWidth = context.getResources().getDisplayMetrics().widthPixels;
|
||||
|
||||
// 初始化视图
|
||||
initSubviews();
|
||||
|
||||
// 从SharedPreferences读取设置
|
||||
SharedPreferences prefs = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE);
|
||||
isClose = prefs.getBoolean("kIsCloseDrifPop", false);
|
||||
}
|
||||
|
||||
private void initSubviews() {
|
||||
// 设置视图尺寸
|
||||
int width = scaleWidth(316);
|
||||
int height = scaleWidth(50);
|
||||
setLayoutParams(new LayoutParams(width, height));
|
||||
|
||||
// 背景图片
|
||||
bgImageView = new ImageView(context);
|
||||
bgImageView.setImageResource(R.mipmap.gift_p_b);
|
||||
addView(bgImageView);
|
||||
|
||||
// 标题标签
|
||||
titleLabel = new TextView(context);
|
||||
titleLabel.setTextSize(14);
|
||||
titleLabel.setTextColor(Color.WHITE);
|
||||
addView(titleLabel);
|
||||
|
||||
// 礼物图片
|
||||
giftImageView = new ImageView(context);
|
||||
giftImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||
addView(giftImageView);
|
||||
|
||||
// 数量标签
|
||||
countLabel = new TextView(context);
|
||||
countLabel.setTextSize(14);
|
||||
countLabel.setTextColor(Color.WHITE);
|
||||
addView(countLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
// 布局子视图
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
|
||||
// 背景图片填满整个视图
|
||||
bgImageView.layout(0, 0, width, height);
|
||||
|
||||
// 标题标签居中偏左
|
||||
int titleWidth = titleLabel.getMeasuredWidth();
|
||||
int titleHeight = titleLabel.getMeasuredHeight();
|
||||
int titleLeft = (width - titleWidth) / 2 - scaleWidth(30);
|
||||
int titleTop = (height - titleHeight) / 2;
|
||||
titleLabel.layout(titleLeft, titleTop, titleLeft + titleWidth, titleTop + titleHeight);
|
||||
|
||||
// 礼物图片在标题右侧
|
||||
int giftSize = scaleWidth(20);
|
||||
int giftLeft = titleLeft + titleWidth + scaleWidth(5);
|
||||
int giftTop = titleTop + (titleHeight - giftSize) / 2;
|
||||
giftImageView.layout(giftLeft, giftTop, giftLeft + giftSize, giftTop + giftSize);
|
||||
|
||||
// 数量标签在礼物图片右侧
|
||||
int countWidth = countLabel.getMeasuredWidth();
|
||||
int countLeft = giftLeft + giftSize;
|
||||
countLabel.layout(countLeft, titleTop, countLeft + countWidth, titleTop + titleHeight);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int width = scaleWidth(316);
|
||||
int height = scaleWidth(50);
|
||||
setMeasuredDimension(width, height);
|
||||
|
||||
// 测量子视图
|
||||
measureChildren(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
public void addGiftModel(MqttBean.ListBean model) {
|
||||
if (isClose) {
|
||||
return;
|
||||
}
|
||||
dataArray.add(model);
|
||||
giftAction();
|
||||
}
|
||||
|
||||
public void addGiftModelList(List<MqttBean.ListBean> list) {
|
||||
dataArray.addAll(list);
|
||||
giftAction();
|
||||
}
|
||||
|
||||
private void giftAction() {
|
||||
if (isPlaying) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dataArray.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
isPlaying = true;
|
||||
model = dataArray.get(0);
|
||||
|
||||
// 添加到窗口(这里需要根据实际情况获取根布局)
|
||||
ViewGroup rootView = (ViewGroup) ((Activity) context).getWindow().getDecorView();
|
||||
rootView.addView(QXGiftDriftView.getInstance( context));
|
||||
|
||||
// 设置初始位置(屏幕右侧外)
|
||||
setX(screenWidth);
|
||||
|
||||
// 进入动画
|
||||
TranslateAnimation enterAnim = new TranslateAnimation(
|
||||
Animation.ABSOLUTE, screenWidth,
|
||||
Animation.ABSOLUTE, (screenWidth - scaleWidth(316)) / 2,
|
||||
Animation.ABSOLUTE, 0,
|
||||
Animation.ABSOLUTE, 0
|
||||
);
|
||||
enterAnim.setDuration(1500);
|
||||
enterAnim.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
// 停留后退出
|
||||
postDelayed(() -> {
|
||||
TranslateAnimation exitAnim = new TranslateAnimation(
|
||||
Animation.ABSOLUTE, (screenWidth - scaleWidth(316)) / 2,
|
||||
Animation.ABSOLUTE, -screenWidth,
|
||||
Animation.ABSOLUTE, 0,
|
||||
Animation.ABSOLUTE, 0
|
||||
);
|
||||
exitAnim.setDuration(2000);
|
||||
exitAnim.setAnimationListener(new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart(Animation animation) {}
|
||||
|
||||
@Override
|
||||
public void onAnimationEnd(Animation animation) {
|
||||
// 移除视图并处理下一个
|
||||
ViewGroup rootView = (ViewGroup) getParent();
|
||||
if (rootView != null) {
|
||||
rootView.removeView(QXGiftDriftView.getInstance( context));
|
||||
}
|
||||
|
||||
if (!dataArray.isEmpty()) {
|
||||
dataArray.remove(0);
|
||||
}
|
||||
isPlaying = false;
|
||||
|
||||
if (!dataArray.isEmpty()) {
|
||||
giftAction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
});
|
||||
startAnimation(exitAnim);
|
||||
}, 1000); // 停留1秒
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimationRepeat(Animation animation) {}
|
||||
});
|
||||
startAnimation(enterAnim);
|
||||
}
|
||||
|
||||
public void setModel(MqttBean.ListBean model) {
|
||||
this.model = model;
|
||||
|
||||
String text = String.format("%s送给%s", model.getFromUserName(), model.getToUserName());
|
||||
// 这里需要使用SpannableString来实现富文本效果
|
||||
// 简化处理,直接设置文本
|
||||
titleLabel.setText(text);
|
||||
|
||||
// 加载图片 - 使用图片加载库如Glide
|
||||
// Glide.with(context).load(model.getGiftPicture()).into(giftImageView);
|
||||
|
||||
countLabel.setText(String.format("X%s", model.getNumber()));
|
||||
}
|
||||
|
||||
public void drifPopIsClose(boolean isClose) {
|
||||
this.isClose = isClose;
|
||||
setVisibility(isClose ? View.GONE : View.VISIBLE);
|
||||
|
||||
SharedPreferences prefs = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE);
|
||||
prefs.edit().putBoolean("kIsCloseDrifPop", isClose).apply();
|
||||
|
||||
if (isClose) {
|
||||
ViewGroup rootView = (ViewGroup) getParent();
|
||||
if (rootView != null) {
|
||||
rootView.removeView(this);
|
||||
}
|
||||
dataArray.clear();
|
||||
isPlaying = false;
|
||||
}
|
||||
}
|
||||
|
||||
private int scaleWidth(int width) {
|
||||
// 根据屏幕密度进行缩放
|
||||
float density = context.getResources().getDisplayMetrics().density;
|
||||
return (int) (width * density);
|
||||
}
|
||||
|
||||
// QXGiftScrollModel 类(需要单独定义)
|
||||
public static class QXGiftScrollModel {
|
||||
private String fromUserName;
|
||||
private String toUserName;
|
||||
private String giftPicture;
|
||||
private String number;
|
||||
|
||||
// getters and setters
|
||||
public String getFromUserName() { return fromUserName; }
|
||||
public void setFromUserName(String fromUserName) { this.fromUserName = fromUserName; }
|
||||
|
||||
public String getToUserName() { return toUserName; }
|
||||
public void setToUserName(String toUserName) { this.toUserName = toUserName; }
|
||||
|
||||
public String getGiftPicture() { return giftPicture; }
|
||||
public void setGiftPicture(String giftPicture) { this.giftPicture = giftPicture; }
|
||||
|
||||
public String getNumber() { return number; }
|
||||
public void setNumber(String number) { this.number = number; }
|
||||
}
|
||||
}
|
||||
@@ -64,6 +64,7 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
||||
public void onClick(View v) {
|
||||
if (mOnZhulClickListener != null && pitBean != null) {
|
||||
mOnZhulClickListener.onZhulClick(RoomFriendshipWheatView.this, pitBean);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/line"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_14"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/tv_name"
|
||||
android:layout_marginStart="@dimen/dp_2"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_600"
|
||||
android:background="@color/transparent"
|
||||
android:layout_marginStart="@dimen/dp_25"
|
||||
android:layout_marginEnd="@dimen/dp_25"
|
||||
android:hardwareAccelerated="true"
|
||||
app:layout_constraintTop_toBottomOf="@+id/im_gz"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -114,8 +114,8 @@ public class ExpandColumnAdapter extends BaseQuickAdapter<ExpandColumnBean, Base
|
||||
|
||||
ImageView imageView = new ImageView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, mContext.getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
|
||||
@@ -68,7 +68,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="@dimen/dp_9"
|
||||
android:gravity="center_vertical"/>
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@@ -551,24 +551,33 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(UnreadCountEvent event) {
|
||||
if (event.getALong() == 0) {
|
||||
if (event.getBLong()==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) {
|
||||
long aLong = event.getALong();
|
||||
long bLong = event.getBLong();
|
||||
if (aLong==0 && bLong==0){
|
||||
mBinding.tvMessage.setVisibility(View.GONE);
|
||||
}else {
|
||||
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()));
|
||||
}
|
||||
|
||||
mBinding.tvMessage.setText(String.valueOf(event.getALong()+event.getBLong()));
|
||||
}
|
||||
|
||||
// if (event.getALong() == 0) {
|
||||
// if (event.getBLong()==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) {
|
||||
// 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()));
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,6 +53,15 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
MvpPre.getMyInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
if (!hidden){
|
||||
MvpPre.getOfficialNotice();
|
||||
MvpPre.getMyInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initView () {
|
||||
|
||||
@@ -135,13 +144,19 @@ public class NewsFragment extends BaseMvpFragment<NewsPresenter, FragmentNewsBin
|
||||
mBinding.tvXtCount.setVisibility(View.GONE);
|
||||
}
|
||||
if (newsDataBeans.getAnnouncement_read_count()>0) {
|
||||
CommonAppContext.getInstance().setAnnouncement_read_count(newsDataBeans.getAnnouncement_read_count());
|
||||
mBinding.tvOfficialCount.setText(newsDataBeans.getAnnouncement_read_count()+"");
|
||||
}else {
|
||||
mBinding.tvOfficialCount.setVisibility(View.GONE);
|
||||
}
|
||||
int count = newsDataBeans.getSystem_no_read_count()+newsDataBeans.getAnnouncement_read_count();
|
||||
EventBus.getDefault().post(new UnreadCountEvent(0,(long)count));
|
||||
UnreadCountEvent event = CommonAppContext.getInstance().getUnreadCountEvent();
|
||||
if (event== null){
|
||||
event = new UnreadCountEvent();
|
||||
event.setALong(0);
|
||||
}
|
||||
event.setBLong( (long)count);
|
||||
CommonAppContext.getInstance().setUnreadCountEvent(event);
|
||||
EventBus.getDefault().post(event);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -250,14 +250,14 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
// mRoomInfoResp = (RoomInfoResp) getIntent().getSerializableExtra("roomInfo");
|
||||
if (roomId.equals(mRoomId) || TextUtils.isEmpty(mRoomId)) {
|
||||
sDestroied = false;
|
||||
if (mRoomInfoResp==null){
|
||||
mRoomInfoResp=AppStateManager.getInstance().getRoomInfo();
|
||||
if (mRoomInfoResp == null) {
|
||||
mRoomInfoResp = AppStateManager.getInstance().getRoomInfo();
|
||||
}
|
||||
if (!isOnline) {
|
||||
releaseRoom();
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}else {
|
||||
} else {
|
||||
MvpPre.postRoomInfo(roomId);
|
||||
}
|
||||
|
||||
@@ -424,12 +424,17 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
// // 保持Activity alive,不调用finish()
|
||||
// minimizeToBackground();
|
||||
// }
|
||||
if (mRoomInfoResp!=null) {
|
||||
if (!mRoomInfoResp.getRoom_info().getType_id().equals("6")) {
|
||||
// 只有在用户主动离开应用时才执行最小化操作
|
||||
if (!userLeaving) {
|
||||
// 保持Activity alive,不调用finish()
|
||||
|
||||
// 只有在用户主动离开应用时才执行最小化操作
|
||||
if (!userLeaving) {
|
||||
// 保持Activity alive,不调用finish()
|
||||
minimizeToBackground();
|
||||
userLeaving = false; // 重置标记
|
||||
minimizeToBackground();
|
||||
userLeaving = false; // 重置标记
|
||||
}
|
||||
}
|
||||
userLeaving = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1368,7 +1373,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if (msgType == 1024) {
|
||||
handleMsgType1024(messageEvent, text);
|
||||
} else if (msgType == 1025) {
|
||||
if (roomFragment==null){
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1377,7 +1382,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
} else if (msgType == 1026) {
|
||||
if (roomFragment==null){
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1386,7 +1391,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
} else if (msgType == 1027) {
|
||||
if (roomFragment==null){
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1415,7 +1420,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if (msgType == 1051) {
|
||||
handleMsgType1051(messageEvent, text);
|
||||
} else if (msgType == 1052) {
|
||||
if (roomFragment==null){
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1432,7 +1437,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if (msgType == 1035) {
|
||||
handleMsgType1035(messageEvent, text);
|
||||
} else if (msgType == 1030 || msgType == 1031 || msgType == 1032 || msgType == 1033 || msgType == 1015 || msgType == 1037) {
|
||||
if (roomFragment==null){
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1458,7 +1463,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if (msgType == 1039) {
|
||||
handleMsgType1039(messageEvent, text);
|
||||
} else if (msgType == 1028) {
|
||||
if (roomFragment==null){
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1466,8 +1471,30 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
roomFragment.handleMsgType1028(messageEvent);
|
||||
} else if (msgType == 1059 || msgType == 1058) {// 1059清除个人魅力 1058在离线
|
||||
if (roomFragment==null){
|
||||
}else if ( msgType == 1058) {
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.vp_room_pager, roomFragment)
|
||||
.commitAllowingStateLoss();
|
||||
}
|
||||
if (mRoomInfoResp != null && mRoomInfoResp.getRoom_info() != null) {
|
||||
if (mRoomInfoResp.getRoom_info().getType_id().equals("1") || mRoomInfoResp.getRoom_info().getType_id().equals("3") ||
|
||||
mRoomInfoResp.getRoom_info().getType_id().equals("4") || mRoomInfoResp.getRoom_info().getType_id().equals("8")) {
|
||||
if (mRoomInfoResp.getRoom_info().getLabel_id().equals("1")) {
|
||||
roomFragment.SingSongEvent(messageEvent);
|
||||
} else {
|
||||
roomFragment.KtvFragmentEvent(messageEvent);
|
||||
}
|
||||
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("2")) {
|
||||
roomFragment.handleAuctionMessageEvent(messageEvent);
|
||||
} else if (mRoomInfoResp.getRoom_info().getType_id().equals("7")) {
|
||||
roomFragment.friendshipRoomFragmentEvent(messageEvent);
|
||||
}
|
||||
}
|
||||
} else if (msgType == 1059) {// 1059清除个人魅力 1058在离线
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -1750,8 +1777,8 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
}
|
||||
|
||||
private void handleMsgType1003(RoomMessageEvent messageEvent, RoomMessageEvent.T text) {
|
||||
if (text == null || mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null ) return;
|
||||
if (roomFragment==null){
|
||||
if (text == null || mRoomInfoResp == null || mRoomInfoResp.getRoom_info() == null) return;
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
@@ -2586,18 +2613,22 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
|
||||
// 添加前后台状态检测
|
||||
private boolean isAppInForeground() {
|
||||
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
|
||||
if (appProcesses == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String packageName = getPackageName();
|
||||
for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
|
||||
if (appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
|
||||
&& appProcess.processName.equals(packageName)) {
|
||||
return true;
|
||||
if (!mRoomInfoResp.getRoom_info().getLabel_id().equals("6")) {
|
||||
ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
|
||||
List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager.getRunningAppProcesses();
|
||||
if (appProcesses == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String packageName = getPackageName();
|
||||
for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
|
||||
if (appProcess.importance == ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND
|
||||
&& appProcess.processName.equals(packageName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}else {
|
||||
return true ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -3697,7 +3728,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
private void resetFragment() {
|
||||
String typeId = mRoomInfoResp.getRoom_info().getType_id();
|
||||
String labelId = mRoomInfoResp.getRoom_info().getLabel_id();
|
||||
|
||||
CommonAppContext.getInstance().lable_id = typeId;
|
||||
if (roomFragment == null) {
|
||||
roomFragment = RoomFragment.newInstance();
|
||||
getSupportFragmentManager()
|
||||
@@ -3738,6 +3769,7 @@ public class RoomActivity extends BaseMvpActivity<RoomPresenter, ActivityRoomBin
|
||||
} else if ("6".equals(typeId)) {
|
||||
changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||
setvisibTop(false);
|
||||
|
||||
// sharedViewModel.setSeatViewType(QXRoomSeatViewType.CABIN);
|
||||
roomFragment.refreshData(mRoomInfoResp, QXRoomSeatViewType.CABIN);
|
||||
}
|
||||
|
||||
@@ -192,8 +192,8 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(helper.itemView.getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_14)
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
@@ -224,8 +224,8 @@ public class EaseChatAdapter extends BaseMultiItemQuickAdapter<EMMessageInfo, Ba
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(helper.itemView.getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_14)
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
|
||||
@@ -65,8 +65,8 @@ public class RankingAutcionAdapter extends BaseQuickAdapter<RoomAuction.AuctionL
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.moduleroom.R;
|
||||
import com.xscm.moduleutil.bean.CharmRankingResp;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -36,7 +37,7 @@ public class RankingCharmListAdapter extends BaseQuickAdapter<CharmRankingResp,
|
||||
//数据绑定赋值
|
||||
helper.setText(R.id.room_item_seq, String.valueOf(helper.getAdapterPosition() + 4));//从第四个开始设置值
|
||||
helper.setText(R.id.room_item_name, item.getNickname());
|
||||
helper.setText(R.id.room_item_pop, item.getTotal());
|
||||
helper.setText(R.id.room_item_pop, StringUtil.toWan2(item.getTotal(),2));
|
||||
// if (GG.equals(item.getSex())) {
|
||||
// helper.setBackgroundRes(R.id.room_item_pop, R.mipmap.room_bg_wheat_charm_gg_sr);
|
||||
// } else {
|
||||
@@ -67,8 +68,8 @@ public class RankingCharmListAdapter extends BaseQuickAdapter<CharmRankingResp,
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
|
||||
@@ -43,8 +43,8 @@ public class RoomCharmAdapter extends BaseQuickAdapter<RoomUserCharmListBean, Ba
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
|
||||
@@ -98,8 +98,8 @@ public class RoomOnlineAdapter extends BaseMultiItemQuickAdapter<RoomOnlineBean,
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(helper.itemView.getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, helper.itemView.getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
|
||||
@@ -89,8 +89,8 @@ public class BidListDialogFragment extends BaseMvpDialogFragment<BidListPresente
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
@@ -119,8 +119,8 @@ public class BidListDialogFragment extends BaseMvpDialogFragment<BidListPresente
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
@@ -149,8 +149,8 @@ public class BidListDialogFragment extends BaseMvpDialogFragment<BidListPresente
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
|
||||
@@ -132,8 +132,8 @@ public class RoomHostAddFragment extends BaseMvpDialogFragment<RoomHostPresenter
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.widget.Switch;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.blankj.utilcode.util.LogUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.activity.RoomActivity;
|
||||
import com.example.moduleroom.contacts.FriendshipRoomContacts;
|
||||
@@ -222,9 +223,13 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
wheatView.setOnZhulClickListener(new RoomFriendshipWheatView.OnZhulClickListener() {
|
||||
@Override
|
||||
public void onZhulClick(RoomFriendshipWheatView view, RoomPitBean pitBean) {
|
||||
|
||||
|
||||
|
||||
if (ClickUtils.isFastDoubleClick()) {
|
||||
return; // 快速重复点击,直接返回
|
||||
}
|
||||
// configPower(pitBean);
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setAvatar(pitBean.getAvatar());
|
||||
userInfo.setNickname(pitBean.getNickname());
|
||||
@@ -312,21 +317,28 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
|
||||
public void upFriendList() {
|
||||
mBinding.wheatView1.pitBean.setCharm("0");
|
||||
mBinding.wheatView1.setData(mBinding.wheatView1.pitBean);
|
||||
mBinding.wheatView1.setCharm("0");
|
||||
mBinding.wheatView2.pitBean.setCharm("0");
|
||||
mBinding.wheatView2.setData(mBinding.wheatView2.pitBean);
|
||||
mBinding.wheatView2.setCharm("0");
|
||||
// mBinding.wheatView2.setData(mBinding.wheatView2.pitBean);
|
||||
mBinding.wheatView3.pitBean.setCharm("0");
|
||||
mBinding.wheatView3.setData(mBinding.wheatView3.pitBean);
|
||||
mBinding.wheatView3.setCharm("0");
|
||||
// mBinding.wheatView3.setData(mBinding.wheatView3.pitBean);
|
||||
mBinding.wheatView4.pitBean.setCharm("0");
|
||||
mBinding.wheatView4.setData(mBinding.wheatView4.pitBean);
|
||||
mBinding.wheatView4.setCharm("0");
|
||||
// mBinding.wheatView4.setData(mBinding.wheatView4.pitBean);
|
||||
mBinding.wheatView5.pitBean.setCharm("0");
|
||||
mBinding.wheatView5.setData(mBinding.wheatView5.pitBean);
|
||||
mBinding.wheatView5.setCharm("0");
|
||||
// mBinding.wheatView5.setData(mBinding.wheatView5.pitBean);
|
||||
mBinding.wheatView6.pitBean.setCharm("0");
|
||||
mBinding.wheatView6.setData(mBinding.wheatView6.pitBean);
|
||||
mBinding.wheatView6.setCharm("0");
|
||||
// mBinding.wheatView6.setData(mBinding.wheatView6.pitBean);
|
||||
mBinding.wheatView9.pitBean.setCharm("0");
|
||||
mBinding.wheatView9.setData(mBinding.wheatView9.pitBean);
|
||||
mBinding.wheatView9.setCharm("0");
|
||||
// mBinding.wheatView9.setData(mBinding.wheatView9.pitBean);
|
||||
mBinding.wheatView10.pitBean.setCharm("0");
|
||||
mBinding.wheatView10.setData(mBinding.wheatView10.pitBean);
|
||||
mBinding.wheatView10.setCharm("0");
|
||||
// mBinding.wheatView10.setData(mBinding.wheatView10.pitBean);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -950,7 +962,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
roomInfoResp.getFriend_info().setHeart_list(heartLists);
|
||||
}
|
||||
configHeart();
|
||||
// configPowerBtn();
|
||||
configPowerBtn();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1231,8 +1243,99 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
}
|
||||
|
||||
private void songGift(RoomPitBean pitBean){
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setAvatar(pitBean.getAvatar());
|
||||
userInfo.setNickname(pitBean.getNickname());
|
||||
userInfo.setUser_id(Integer.parseInt(pitBean.getUser_id()));
|
||||
userInfo.setPit_number("0");
|
||||
RoomGiftDialogFragment.show(null, userInfo, roomId, 0, pitBean.getHeartId() + "", getParentFragmentManager());
|
||||
}
|
||||
|
||||
private void configPower(RoomPitBean pitBean) {
|
||||
FriendInfo.HeartList md1 = null; //中心的集合
|
||||
FriendInfo.HeartList md2 = null; //顶部的集合
|
||||
FriendInfo.HeartList md3 = null; //底部的集合
|
||||
if (roomInfoResp.getFriend_info().getHeart_list() != null && !roomInfoResp.getFriend_info().getHeart_list().isEmpty()) {
|
||||
if (roomInfoResp.getFriend_info().getHeart_list().size() >= 3) {
|
||||
md1 = roomInfoResp.getFriend_info().getHeart_list().get(0);
|
||||
md2 = roomInfoResp.getFriend_info().getHeart_list().get(1);
|
||||
md3 = roomInfoResp.getFriend_info().getHeart_list().get(2);
|
||||
}
|
||||
if (pitBean != null && pitBean.getUser_id() != null && pitBean.getUser_id().equals(SpUtil.getUserId() + "")){
|
||||
ToastUtils.showShort("不能给自己助力哦");
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("1")){
|
||||
if (md2 != null && md2.getHeartNum() > 0 && mBinding.wheatView6.pitBean != null) {
|
||||
// 弹出礼物视图
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("2")){
|
||||
if (md1 != null && md1.getHeartNum() > 0 && mBinding.wheatView5.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("3")){
|
||||
if (md3 != null && md3.getHeartNum() > 0 && mBinding.wheatView4.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("4")){
|
||||
if (md3 != null && md3.getHeartNum() > 0 && mBinding.wheatView3.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("5")){
|
||||
if (md1 != null && md1.getHeartNum() > 0 && mBinding.wheatView2.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("6")){
|
||||
if (md2 != null && md2.getHeartNum() > 0 && mBinding.wheatView1.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setVisibilityZL(){
|
||||
FriendInfo.HeartList md1 = null; //中心的集合
|
||||
FriendInfo.HeartList md2 = null; //顶部的集合
|
||||
FriendInfo.HeartList md3 = null; //底部的集合
|
||||
if (roomInfoResp.getFriend_info().getHeart_list() != null && !roomInfoResp.getFriend_info().getHeart_list().isEmpty()) {
|
||||
if (roomInfoResp.getFriend_info().getHeart_list().size() >= 3) {
|
||||
md1 = roomInfoResp.getFriend_info().getHeart_list().get(0);
|
||||
md2 = roomInfoResp.getFriend_info().getHeart_list().get(1);
|
||||
md3 = roomInfoResp.getFriend_info().getHeart_list().get(2);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// 设置中线展示
|
||||
private void configPowerBtn() {
|
||||
|
||||
FriendInfo.HeartList md1 = null; //中心的集合
|
||||
FriendInfo.HeartList md2 = null; //顶部的集合
|
||||
FriendInfo.HeartList md3 = null; //底部的集合
|
||||
@@ -1262,14 +1365,21 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
} else {
|
||||
mBinding.wheatView5.setLockZl(true);
|
||||
}
|
||||
RoomPitBean pitBean2 = mBinding.wheatView2.pitBean;
|
||||
pitBean2.setHeartNum(md1.getHeartNum());
|
||||
pitBean2.setHeartId(md1.getHeartId());
|
||||
mBinding.wheatView2.setData(pitBean2);
|
||||
RoomPitBean pitBean5 = mBinding.wheatView5.pitBean;
|
||||
pitBean5.setHeartNum(md1.getHeartNum());
|
||||
pitBean5.setHeartId(md1.getHeartId());
|
||||
mBinding.wheatView2.setData(pitBean5);
|
||||
|
||||
mBinding.wheatView2.pitBean.setHeartNum(md1.getHeartNum());
|
||||
mBinding.wheatView2.pitBean.setHeartId(md1.getHeartId());
|
||||
mBinding.wheatView5.pitBean.setHeartNum(md1.getHeartNum());
|
||||
mBinding.wheatView5.pitBean.setHeartId(md1.getHeartId());
|
||||
|
||||
|
||||
// RoomPitBean pitBean2 = mBinding.wheatView2.pitBean;
|
||||
// pitBean2.setHeartNum(md1.getHeartNum());
|
||||
// pitBean2.setHeartId(md1.getHeartId());
|
||||
// mBinding.wheatView2.setData(pitBean2);
|
||||
// RoomPitBean pitBean5 = mBinding.wheatView5.pitBean;
|
||||
// pitBean5.setHeartNum(md1.getHeartNum());
|
||||
// pitBean5.setHeartId(md1.getHeartId());
|
||||
// mBinding.wheatView2.setData(pitBean5);
|
||||
} else {
|
||||
mBinding.wheatView2.setLockZl(false);
|
||||
mBinding.wheatView5.setLockZl(false);
|
||||
@@ -1286,14 +1396,20 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
} else {
|
||||
mBinding.wheatView6.setLockZl(true);
|
||||
}
|
||||
RoomPitBean pitBean1 = mBinding.wheatView1.pitBean;
|
||||
pitBean1.setHeartNum(md2.getHeartNum());
|
||||
pitBean1.setHeartId(md2.getHeartId());
|
||||
mBinding.wheatView1.setData(pitBean1);
|
||||
RoomPitBean pitBean6 = mBinding.wheatView6.pitBean;
|
||||
pitBean6.setHeartNum(md2.getHeartNum());
|
||||
pitBean6.setHeartId(md2.getHeartId());
|
||||
mBinding.wheatView6.setData(pitBean6);
|
||||
|
||||
mBinding.wheatView1.pitBean.setHeartNum(md2.getHeartNum());
|
||||
mBinding.wheatView1.pitBean.setHeartId(md2.getHeartId());
|
||||
mBinding.wheatView6.pitBean.setHeartNum(md2.getHeartNum());
|
||||
mBinding.wheatView6.pitBean.setHeartId(md2.getHeartId());
|
||||
|
||||
// RoomPitBean pitBean1 = mBinding.wheatView1.pitBean;
|
||||
// pitBean1.setHeartNum(md2.getHeartNum());
|
||||
// pitBean1.setHeartId(md2.getHeartId());
|
||||
// mBinding.wheatView1.setData(pitBean1);
|
||||
// RoomPitBean pitBean6 = mBinding.wheatView6.pitBean;
|
||||
// pitBean6.setHeartNum(md2.getHeartNum());
|
||||
// pitBean6.setHeartId(md2.getHeartId());
|
||||
// mBinding.wheatView6.setData(pitBean6);
|
||||
} else {
|
||||
mBinding.wheatView1.setLockZl(false);
|
||||
mBinding.wheatView6.setLockZl(false);
|
||||
@@ -1311,14 +1427,19 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
} else {
|
||||
mBinding.wheatView4.setLockZl(true);
|
||||
}
|
||||
RoomPitBean pitBean4 = mBinding.wheatView4.pitBean;
|
||||
pitBean4.setHeartNum(md3.getHeartNum());
|
||||
pitBean4.setHeartId(md3.getHeartId());
|
||||
mBinding.wheatView4.setData(pitBean4);
|
||||
RoomPitBean pitBean3 = mBinding.wheatView3.pitBean;
|
||||
pitBean3.setHeartNum(md3.getHeartNum());
|
||||
pitBean3.setHeartId(md3.getHeartId());
|
||||
mBinding.wheatView3.setData(pitBean3);
|
||||
mBinding.wheatView3.pitBean.setHeartNum(md3.getHeartNum());
|
||||
mBinding.wheatView3.pitBean.setHeartId(md3.getHeartId());
|
||||
mBinding.wheatView4.pitBean.setHeartNum(md3.getHeartNum());
|
||||
mBinding.wheatView4.pitBean.setHeartId(md3.getHeartId());
|
||||
|
||||
// RoomPitBean pitBean4 = mBinding.wheatView4.pitBean;
|
||||
// pitBean4.setHeartNum(md3.getHeartNum());
|
||||
// pitBean4.setHeartId(md3.getHeartId());
|
||||
// mBinding.wheatView4.setData(pitBean4);
|
||||
// RoomPitBean pitBean3 = mBinding.wheatView3.pitBean;
|
||||
// pitBean3.setHeartNum(md3.getHeartNum());
|
||||
// pitBean3.setHeartId(md3.getHeartId());
|
||||
// mBinding.wheatView3.setData(pitBean3);
|
||||
} else {
|
||||
mBinding.wheatView3.setLockZl(false);
|
||||
mBinding.wheatView4.setLockZl(false);
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.xscm.moduleutil.bean.CharmRankingResp;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.widget.CommonEmptyView;
|
||||
|
||||
import java.util.List;
|
||||
@@ -187,7 +188,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
public void setNo1(CharmRankingResp listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop1HeadIcon);
|
||||
mBinding.roomTop1Name.setText(listsBean.getNickname());
|
||||
mBinding.roomHeadTop1Label.setText(listsBean.getTotal());
|
||||
mBinding.roomHeadTop1Label.setText(StringUtil.toWan2(listsBean.getTotal(), 2));
|
||||
setview(listsBean.getIcon(), mBinding.llVip1);
|
||||
mBinding.roomRankTop1HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -203,7 +204,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
public void setNo2(CharmRankingResp listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop2HeadIcon);
|
||||
mBinding.roomTop2Name.setText(listsBean.getNickname());
|
||||
mBinding.roomHeadTop2Label.setText(listsBean.getTotal());
|
||||
mBinding.roomHeadTop2Label.setText(StringUtil.toWan2(listsBean.getTotal(), 2));
|
||||
setview(listsBean.getIcon(), mBinding.llVip2);
|
||||
mBinding.roomRankTop2HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
@@ -222,8 +223,8 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
@@ -241,7 +242,7 @@ public class RankingChildFragment extends BaseMvpFragment<DataListPresenter, Roo
|
||||
public void setNo3(CharmRankingResp listsBean) {
|
||||
ImageUtils.loadHeadCC(listsBean.getAvatar(), mBinding.roomRankTop3HeadIcon);
|
||||
mBinding.roomTop3Name.setText(listsBean.getNickname());
|
||||
mBinding.roomHeadTop3Label.setText(listsBean.getTotal());
|
||||
mBinding.roomHeadTop3Label.setText(StringUtil.toWan2(listsBean.getTotal(), 2));
|
||||
setview(listsBean.getIcon(), mBinding.llVip3);
|
||||
mBinding.roomRankTop3HeadIcon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
||||
@@ -1030,35 +1030,45 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
// TODO: 2025/9/12 清除个人魅力
|
||||
public void event1059(RoomMessageEvent messageEvent) {
|
||||
RoomPitBean pitBean = wheatView.pitBean;
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setCharm("");
|
||||
wheatView.setData(pitBean);
|
||||
return;
|
||||
if (pitBean!=null) {
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setCharm("");
|
||||
wheatView.setCharm("0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setCharm("");
|
||||
wheatView2.setData(pitBean2);
|
||||
mBinding.tvPB.setText("0");
|
||||
return;
|
||||
if (pitBean2!=null) {
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setCharm("");
|
||||
wheatView2.setCharm("0");
|
||||
mBinding.tvPB.setText("0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||
if (pitBean3!=null){
|
||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean3.setCharm("");
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
mBinding.ivAuction1.setCharm("0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setCharm("");
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
return;
|
||||
if (pitBean4!=null) {
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setCharm("");
|
||||
mBinding.ivAuction2.setCharm("0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setCharm("");
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
return;
|
||||
if (pitBean5!=null) {
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setCharm("");
|
||||
mBinding.ivAuction3.setCharm("0");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1068,7 +1078,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
|
||||
RoomPitBean pitBean = wheatView.pitBean;
|
||||
if (pitBean.getUser_id()!=null) {
|
||||
if (pitBean!=null) {
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView.setData(pitBean);
|
||||
@@ -1076,7 +1086,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean2 = wheatView2.pitBean;
|
||||
if (pitBean2.getUser_id()!=null) {
|
||||
if (pitBean2!=null) {
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setIs_online(type == 1 ? 1 : 2);
|
||||
wheatView2.setData(pitBean2);
|
||||
@@ -1084,7 +1094,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||
if (pitBean3.getUser_id()!=null) {
|
||||
if (pitBean3!=null) {
|
||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean3.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
@@ -1092,7 +1102,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||
if (pitBean4.getUser_id()!=null) {
|
||||
if (pitBean4!=null) {
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
@@ -1100,7 +1110,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||
if (pitBean5.getUser_id()!=null) {
|
||||
if (pitBean5!=null) {
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setIs_online(type == 1 ? 1 : 2);
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
@@ -1209,17 +1219,17 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
if (mBinding.ivAuction1.pitBean != null) {
|
||||
RoomPitBean pitBean3 = mBinding.ivAuction1.pitBean;
|
||||
pitBean3.setCharm("");
|
||||
mBinding.ivAuction1.setData(pitBean3);
|
||||
mBinding.ivAuction1.setCharm("0");
|
||||
}
|
||||
if (mBinding.ivAuction2.pitBean != null) {
|
||||
RoomPitBean pitBean4 = mBinding.ivAuction2.pitBean;
|
||||
pitBean4.setCharm("");
|
||||
mBinding.ivAuction2.setData(pitBean4);
|
||||
mBinding.ivAuction2.setCharm("0");
|
||||
}
|
||||
if (mBinding.ivAuction3.pitBean != null) {
|
||||
RoomPitBean pitBean5 = mBinding.ivAuction3.pitBean;
|
||||
pitBean5.setCharm("");
|
||||
mBinding.ivAuction3.setData(pitBean5);
|
||||
mBinding.ivAuction3.setCharm("0");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1277,14 +1287,17 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
public void event1035(RoomMessageEvent messageEvent) {
|
||||
RoomPitBean pitBean = mBinding.roomMakeWheat.pitBean;
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||||
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||||
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||||
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||||
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||||
mBinding.roomMakeWheat.setData(pitBean);
|
||||
if (pitBean!=null) {
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||||
pitBean.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||||
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||||
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||||
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||||
mBinding.roomMakeWheat.setData(pitBean);
|
||||
}
|
||||
}
|
||||
RoomPitBean pitBean2 = mBinding.roomMakeWheat2.pitBean;
|
||||
if (pitBean2 != null){
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||||
pitBean2.setAvatar(messageEvent.getText().getFromUserInfo().getAvatar());
|
||||
pitBean2.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||||
@@ -1292,6 +1305,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
pitBean2.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||||
mBinding.roomMakeWheat2.setData(pitBean2);
|
||||
}
|
||||
}
|
||||
|
||||
if (auctionList != null && auctionList.size() > 0) {
|
||||
for (int i = 0; i < auctionList.size(); i++) {
|
||||
@@ -1359,7 +1373,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
if (wheatView2.getUserId().equals(userId)) {
|
||||
mBinding.tvPB.setText(StringUtil.toWan2(charm, 1));
|
||||
wheatView2.pitBean.setCharm(charm);
|
||||
wheatView2.setData(wheatView2.pitBean);
|
||||
wheatView2.setCharm(charm);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1375,7 +1389,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
if (targetWheatView != null) {
|
||||
targetWheatView.pitBean.setCharm(charm);
|
||||
targetWheatView.setData(targetWheatView.pitBean);
|
||||
targetWheatView.setCharm(charm);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1665,6 +1679,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
}
|
||||
isButtonsInflated = false;
|
||||
releaseCountDownTimer();
|
||||
closeCardRelationshipFragment();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.example.moduleroom.presenter.RoomCabinPresenter;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.xscm.moduleutil.base.BaseRoomFragment;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.room.RoomCpUserBean;
|
||||
@@ -119,6 +120,13 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
// ((RoomActivity) getActivity()).changeBackground(com.xscm.moduleutil.R.mipmap.cabin_bj);
|
||||
// ((RoomActivity) getActivity()).setvisibTop(false);
|
||||
// }
|
||||
|
||||
if (CommonAppContext.getInstance().lable_id.equals("6") && CommonAppContext.getInstance().isMicPlace){
|
||||
joinChannel();
|
||||
isMicPlace = true;
|
||||
mBinding.im3.setImageResource(com.xscm.moduleutil.R.mipmap.clogs_car);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void enableNotifications() {
|
||||
@@ -127,15 +135,15 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
return;
|
||||
}
|
||||
Log.d("RoomCabinFragment", "Notifications not enable!");
|
||||
new AlertDialog.Builder(requireContext())
|
||||
new AlertDialog.Builder(getActivity())
|
||||
.setTitle("提示")
|
||||
.setMessage("请打开通知权限,防止后台共享屏幕中断")
|
||||
.setPositiveButton("设置", (dialog, which) -> {
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, requireContext().getPackageName());
|
||||
intent.putExtra(Settings.EXTRA_CHANNEL_ID, requireContext().getApplicationInfo().uid);
|
||||
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getActivity().getPackageName());
|
||||
intent.putExtra(Settings.EXTRA_CHANNEL_ID, getActivity().getApplicationInfo().uid);
|
||||
} else {
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
}
|
||||
@@ -155,6 +163,7 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
if (roomInfoResp == null) return;
|
||||
|
||||
|
||||
|
||||
}
|
||||
private SharedViewModel sharedViewModel;
|
||||
@Nullable
|
||||
@@ -212,12 +221,14 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
joinChannel();
|
||||
isMicPlace = true;
|
||||
mBinding.im3.setImageResource(com.xscm.moduleutil.R.mipmap.clogs_car);
|
||||
CommonAppContext.getInstance().isMicPlace = true;
|
||||
|
||||
} else {
|
||||
isMicPlace = false;
|
||||
ToastUtils.show("将停止屏幕共享");
|
||||
AgoraManager.getInstance(getActivity()).stopScreenCapture();
|
||||
mBinding.im3.setImageResource(com.xscm.moduleutil.R.mipmap.gongxiang);
|
||||
CommonAppContext.getInstance().isMicPlace = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -685,8 +696,8 @@ public class RoomCabinFragment extends BaseRoomFragment<RoomCabinPresenter, Room
|
||||
|
||||
private void joinChannel() {
|
||||
|
||||
AgoraManager.getInstance(getContext()).updateChannelMediaOptions();
|
||||
AgoraManager.getInstance(getContext()).post();
|
||||
AgoraManager.getInstance(getActivity()).updateChannelMediaOptions();
|
||||
AgoraManager.getInstance(getActivity()).post();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1302,6 +1302,12 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
}
|
||||
|
||||
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
if (pitBean!=null ){
|
||||
if (pitBean.getUser_id() != null){
|
||||
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
wheatLayoutSingManager.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
} else {
|
||||
wheatLayoutManager1.updateSingleWheat(pitBean, Integer.parseInt(pitBean.getPit_number()));
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_top1"
|
||||
app:layout_constraintTop_toBottomOf="@+id/room_top1_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_vip1"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_top1"
|
||||
app:layout_constraintStart_toStartOf="@id/view_top1"
|
||||
app:layout_constraintBottom_toTopOf="@+id/ll_vip1"
|
||||
@@ -264,7 +264,7 @@
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_9"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/view_top3"
|
||||
app:layout_constraintTop_toBottomOf="@+id/room_top3_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ll_vip3"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_top3"
|
||||
app:layout_constraintStart_toStartOf="@id/view_top3"
|
||||
tools:text="00000" />
|
||||
@@ -272,7 +272,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_vip2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_top2"
|
||||
@@ -326,7 +326,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/ll_vip3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintEnd_toEndOf="@id/view_top3"
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/bnv_rank_list_rich"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/room_item_head"
|
||||
|
||||
@@ -32,16 +32,20 @@ import com.xscm.moduleutil.bean.ManageRoomResp;
|
||||
import com.xscm.moduleutil.bean.MyCpRoom;
|
||||
import com.xscm.moduleutil.bean.MyFootResp;
|
||||
import com.xscm.moduleutil.bean.MyRoomBean;
|
||||
import com.xscm.moduleutil.event.RoomOutEvent;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.ImageLoader;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.CustomTopBar;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*@author
|
||||
*@data 2025/5/15
|
||||
*@description: 我的房间
|
||||
* @author
|
||||
* @data 2025/5/15
|
||||
* @description: 我的房间
|
||||
*/
|
||||
@Route(path = ARouteConstants.MY_ROOM)
|
||||
public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivityMyRoomBinding> implements MyRoomListContacts.View {
|
||||
@@ -186,6 +190,15 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
||||
mBinding.topBar.setRightIcon(com.xscm.moduleutil.R.mipmap.trend_icon);
|
||||
mBinding.topBar.setImgPaddingRight(35);
|
||||
mBinding.topBar.setRightImgVIsible(true);
|
||||
mBinding.riv.setOnClickListener(v -> {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), CommonAppContext.getInstance().playId, "");
|
||||
});
|
||||
mBinding.ivGuanbi.setOnClickListener(v -> {
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
CommonAppContext.getInstance().isShow = false;
|
||||
CommonAppContext.getInstance().isPlaying = false;
|
||||
EventBus.getDefault().post(new RoomOutEvent());
|
||||
});
|
||||
initListener();
|
||||
}
|
||||
|
||||
@@ -200,11 +213,11 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
||||
} else {
|
||||
mBinding.ll.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
if (CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
|
||||
RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), CommonAppContext.getInstance().playId,"");
|
||||
|
||||
// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
}
|
||||
// if (CommonAppContext.getInstance().isPlaying && CommonAppContext.getInstance().isShow) {
|
||||
// RoomManager.getInstance().fetchRoomDataAndEnter(getApplicationContext(), CommonAppContext.getInstance().playId,"");
|
||||
//
|
||||
//// ARouter.getInstance().build(ARouteConstants.ROOM_DETAILS).withString("form", "首页").withString("roomId", CommonAppContext.getInstance().playId).navigation();
|
||||
// }
|
||||
}
|
||||
|
||||
private final Runnable mRivAnimationTask = () -> {
|
||||
@@ -224,13 +237,13 @@ public class MyRoomActivity extends BaseMvpActivity<MyRoomPresenter, RoomActivit
|
||||
// }
|
||||
// startActivity(new Intent(MyRoomActivity.this,CreatedRoomActivity.class));
|
||||
// }
|
||||
if (!SpUtil.getRealName()){
|
||||
if (!SpUtil.getRealName()) {
|
||||
ToastUtils.show("实名认证后才能创建直播间");
|
||||
ARouter.getInstance().build(ARouteConstants.REAL_NAME_ACTIVITY2).navigation();
|
||||
// startActivity(new Intent(MyRoomActivity.this, RealName1Activity.class));
|
||||
return;
|
||||
}
|
||||
startActivity(new Intent(MyRoomActivity.this,CreatedRoomActivity.class));
|
||||
startActivity(new Intent(MyRoomActivity.this, CreatedRoomActivity.class));
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -100,8 +100,8 @@ public class BlackAdapter extends BaseQuickAdapter<BlackUserBean, BaseViewHolder
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView1 = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView1.setLayoutParams(params);
|
||||
|
||||
@@ -130,8 +130,8 @@ public class UserHomepageFragment extends BaseMvpFragment<UserHomepagePresenter,
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
|
||||
@@ -264,22 +264,24 @@ public class VocalRangeFragment extends BaseMvpFragment<MePresenter, FragmentVoc
|
||||
llContainer.removeAllViews(); // 清空旧的 ImageView
|
||||
|
||||
List<String> images = data.getIcon(); // 获取图片列表
|
||||
if (images != null && !images.isEmpty()) {
|
||||
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_37),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_15)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
for (String url : images) {
|
||||
if (url.contains("http")) {
|
||||
ImageView imageView = new ImageView(getContext());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_74),
|
||||
getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_17)
|
||||
);
|
||||
params.setMargins(0, 0, getContext().getResources().getDimensionPixelSize(com.xscm.moduleutil.R.dimen.dp_5), 0); // 右边距
|
||||
imageView.setLayoutParams(params);
|
||||
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView);
|
||||
// 使用 Glide 加载图片
|
||||
ImageUtils.loadHeadCC(url, imageView);
|
||||
|
||||
llContainer.addView(imageView);
|
||||
llContainer.addView(imageView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user