1:修改换麦逻辑
2:添加闪屏不在直接关闭
This commit is contained in:
@@ -64,22 +64,22 @@ android {
|
||||
]
|
||||
}
|
||||
|
||||
// 测试版配置
|
||||
beta {
|
||||
dimension "environment"
|
||||
// 测试版包名:基础包名 + .beta(com.example.myapp.beta)
|
||||
applicationIdSuffix ".beta"
|
||||
// 测试版版本名:1.0-beta
|
||||
versionNameSuffix "-beta"
|
||||
|
||||
// 【测试版应用名称】动态生成带标识的名称
|
||||
resValue "string", "app_name", "秘地-测试版"
|
||||
|
||||
// 【测试版图标】替换为测试专用图标
|
||||
manifestPlaceholders = [
|
||||
appIcon: "@mipmap/ic_launcher_app_bat" // 需在main/res/mipmap放置该图标
|
||||
]
|
||||
}
|
||||
// // 测试版配置
|
||||
// beta {
|
||||
// dimension "environment"
|
||||
// // 测试版包名:基础包名 + .beta(com.example.myapp.beta)
|
||||
// applicationIdSuffix ".beta"
|
||||
// // 测试版版本名:1.0-beta
|
||||
// versionNameSuffix "-beta"
|
||||
//
|
||||
// // 【测试版应用名称】动态生成带标识的名称
|
||||
// resValue "string", "app_name", "秘地-测试版"
|
||||
//
|
||||
// // 【测试版图标】替换为测试专用图标
|
||||
// manifestPlaceholders = [
|
||||
// appIcon: "@mipmap/ic_launcher_app_bat" // 需在main/res/mipmap放置该图标
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
|
||||
@@ -28,8 +28,8 @@ isBuildModule=false
|
||||
#org.gradle.deamon=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.1.3
|
||||
APP_VERSION_CODE=165
|
||||
APP_VERSION_NAME=1.1.6
|
||||
APP_VERSION_CODE=168
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
|
||||
@@ -124,7 +124,7 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
//initLocation();
|
||||
}
|
||||
});
|
||||
V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
|
||||
// V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
|
||||
|
||||
}
|
||||
|
||||
@@ -136,12 +136,15 @@ public abstract class BaseMvpActivity<P extends IPresenter, VDB extends ViewData
|
||||
@Override
|
||||
public void onConnectSuccess() {//重连成功
|
||||
if (CommonAppContext.getInstance().playId!=null){
|
||||
LogUtils.e("@@@", "重连成功");
|
||||
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectFailed(int code, String error) {
|
||||
LogUtils.e("@@@", "断开连接");
|
||||
CommonAppContext.getInstance().onConnectFailed=true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.xscm.moduleutil.bean.UserBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.event.AppLifecycleEvent;
|
||||
import com.xscm.moduleutil.event.UnreadCountEvent;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
import com.xscm.moduleutil.interfaces.AppLifecycleUtil;
|
||||
import com.xscm.moduleutil.listener.MessageListenerSingleton;
|
||||
import com.xscm.moduleutil.rtc.AgoraManager;
|
||||
@@ -52,6 +53,7 @@ import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.UtilConfig;
|
||||
import com.xscm.moduleutil.utils.config.EnvironmentEnum;
|
||||
import com.xscm.moduleutil.utils.config.EnvironmentPrefs;
|
||||
import com.xscm.moduleutil.utils.IMServiceManager;
|
||||
import com.xscm.moduleutil.widget.CommonAppConfig;
|
||||
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
|
||||
import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator;
|
||||
@@ -70,7 +72,9 @@ import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -126,6 +130,17 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
|
||||
private AppStateListener appStateListener;
|
||||
private boolean isListeningUnreadCount = false;
|
||||
public boolean onConnectFailed=false;//是否重连
|
||||
|
||||
public Map<String, Integer> onlineMap=new HashMap<>();
|
||||
|
||||
public void setOnlineMap(Map<String, Integer> onlineMap) {
|
||||
this.onlineMap = onlineMap;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getOnlineMap() {
|
||||
return onlineMap;
|
||||
}
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
@@ -441,6 +456,9 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
// 每次启动应用时重置状态
|
||||
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
|
||||
startInitSdk();
|
||||
|
||||
// 启动IM连接服务
|
||||
// IMServiceManager.getInstance().startIMService(this);
|
||||
}
|
||||
}
|
||||
// piaoPingManager = PiaoPingManager.getInstance(this);
|
||||
@@ -790,6 +808,10 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
@Override
|
||||
public void onActivityStarted(@NonNull Activity activity) {
|
||||
AppLifecycleUtil.onAppFrontGround();
|
||||
|
||||
// if (playId!=null && !playId.equals("")){
|
||||
// RetrofitClient.getInstance().userRoomBack(playId, "1");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -803,6 +825,9 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
// AppStateManager.setRoomActivityMinimized(false);
|
||||
AppLifecycleUtil.onAppFrontGround();
|
||||
}
|
||||
if (playId!=null && !playId.equals("")){
|
||||
RetrofitClient.getInstance().userRoomBack(playId, "2");
|
||||
}
|
||||
activityCount++;
|
||||
}
|
||||
|
||||
@@ -814,6 +839,11 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
if (appStateListener != null) {
|
||||
appStateListener.onAppBackground();
|
||||
}
|
||||
|
||||
if (playId!=null && !playId.equals("")){
|
||||
RetrofitClient.getInstance().userRoomBack(playId, "1");
|
||||
}
|
||||
|
||||
AppLifecycleUtil.onAppBackGround();
|
||||
// handleAppBackground(activity);
|
||||
// AppStateManager.setRoomActivityMinimized( true);
|
||||
@@ -888,4 +918,10 @@ public class CommonAppContext extends MultiDexApplication implements Applicatio
|
||||
// appStateListener.onRoomActivityDestroyed();
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTerminate() {
|
||||
super.onTerminate();
|
||||
LogUtils.e("@@@", "onTerminate");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,10 @@ public interface ApiServer {
|
||||
@POST(Constants.BIND_MOBILE)
|
||||
Call<BaseModel<String>> mobileView2(@Field("new_mobile") String new_mobile, @Field("sms_code") String sms_code);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.USER_ROOM_BACK)
|
||||
Call<ResponseBody> userRoomBack(@Field("room_id")String room_id,@Field("type")String type);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.USER_LOGIN)
|
||||
Call<BaseModel<List<UserBean>>> userLogin(@Field("user_login") String user_login, @Field("password") String password);
|
||||
|
||||
@@ -292,6 +292,20 @@ public class RetrofitClient {
|
||||
});
|
||||
}
|
||||
|
||||
public void userRoomBack(String room_id,String type){//用户退出前后台保留数据操作 type:1:切后台 2:切前台
|
||||
sApiServer.userRoomBack(room_id,type).enqueue(new Callback<ResponseBody>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void mobileView2(String new_mobile, String sms_code, BaseObserver<String> observer) {
|
||||
sApiServer.mobileView2(new_mobile, sms_code).enqueue(new Callback<BaseModel<String>>() {
|
||||
@Override
|
||||
|
||||
@@ -51,7 +51,7 @@ public class EnvironmentPrefs {
|
||||
// }
|
||||
|
||||
// 默认使用生产环境
|
||||
String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.TEST.name());
|
||||
String envName = sharedPreferences.getString(KEY_ENV, EnvironmentEnum.PRODUCTION.name());
|
||||
try {
|
||||
return EnvironmentEnum.valueOf(envName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.base.RoomRollModel;
|
||||
import com.xscm.moduleutil.bean.FaceBean;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
@@ -39,6 +40,8 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class BaseWheatView extends ConstraintLayout implements IBaseWheat {
|
||||
public ImageView mRiv;
|
||||
public ImageView mIvGift;
|
||||
@@ -108,6 +111,9 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
oX = mIvGift.getX();
|
||||
oY = mIvGift.getY();
|
||||
initPit(context, attrs);
|
||||
if (!EventBus.getDefault().isRegistered( this)){
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void initPit(Context context, AttributeSet attrs);
|
||||
@@ -162,11 +168,22 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
|
||||
setCardiac(pitBean.getCharm(), getTzbl());
|
||||
setPitData(bean);
|
||||
if (bean.getIs_online() == 2 && bean.getUser_id()!=null && !bean.getUser_id().equals("0") && !bean.getUser_id().isEmpty()){
|
||||
iv_on_line.setVisibility(VISIBLE);
|
||||
|
||||
if (bean.getUser_id()!=null && !bean.getUser_id().equals("0") && !bean.getUser_id().isEmpty()) {
|
||||
if (CommonAppContext.getInstance().getOnlineMap()!=null&&CommonAppContext.getInstance().getOnlineMap().get(bean.getUser_id())!=null) {
|
||||
iv_on_line.setVisibility(CommonAppContext.getInstance().getOnlineMap().get(bean.getUser_id()) == 1 ? GONE : VISIBLE);
|
||||
}else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
|
||||
// if (bean.getIs_online() == 2 && bean.getUser_id()!=null && !bean.getUser_id().equals("0") && !bean.getUser_id().isEmpty()){
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
// }else {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
// }
|
||||
// if (bean.getIs_online() == 0 &&bean.getUser_id() != null && !bean.getUser_id().equals("0") && !bean.getUser_id().isEmpty()) {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
// } else {
|
||||
@@ -241,6 +258,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
if (soundLevel == 0) {
|
||||
mIvRipple.post(() -> {
|
||||
mIvRipple.stopAnimation(true);
|
||||
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(),1);
|
||||
mIvRipple.setVisibility(GONE);
|
||||
});
|
||||
mIvRipple.setVisibility(GONE);
|
||||
@@ -249,8 +267,9 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
mIvRipple.post(() -> {
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(),1);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
iv_on_line.setVisibility(GONE);
|
||||
|
||||
});
|
||||
}
|
||||
@@ -269,8 +288,9 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
mIvRipple.post(() -> {
|
||||
if (!mIvRipple.isAnimating()) {
|
||||
mIvRipple.startAnimation();
|
||||
CommonAppContext.getInstance().onlineMap.put(pitBean.getUser_id(),1);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
iv_on_line.setVisibility(GONE);
|
||||
|
||||
});
|
||||
}
|
||||
@@ -351,18 +371,27 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void setOnlineStatus() {
|
||||
// if (pitBean!=null) {
|
||||
// if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
// if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
// if (isOnline.getIs_online() == 1) {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
// } else {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public void setOnlineStatus(UserOnlineStatusBean isOnline) {
|
||||
if (pitBean!=null) {
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
if (isOnline.getIs_online() == 1) {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
} else {
|
||||
iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
if (pitBean.getUser_id()!=null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (CommonAppContext.getInstance().getOnlineMap()!=null&&CommonAppContext.getInstance().getOnlineMap().get(pitBean.getUser_id())!=null) {
|
||||
iv_on_line.setVisibility(CommonAppContext.getInstance().getOnlineMap().get(pitBean.getUser_id()) == 1 ? GONE : VISIBLE);
|
||||
}else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}else {
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -390,6 +390,7 @@ public class Constants {
|
||||
public static final String POST_ROOM_USER_CHARM_LIST = "/api/Room/room_user_charm_list";//房间用户当前魅力值列表
|
||||
public static final String GET_GIFT_PACK_LIST_COUNT = "/api/UserGiftPack/get_gift_pack_list_count";//背包礼物总价值
|
||||
public static final String ROOM_USER_RECONNECT = "/api/Room/user_reconnect";//用户重连
|
||||
public static final String USER_ROOM_BACK = "/api/Room/user_in_room_background";//用户在房间内切后台保留数据操作
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -298,17 +298,17 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
||||
|
||||
}
|
||||
|
||||
public void setOnlineStatus(UserOnlineStatusBean isOnline) {
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
if (isOnline.getIs_online() == 1) {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
} else {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// public void setOnlineStatus(UserOnlineStatusBean isOnline) {
|
||||
// if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
// if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
// if (isOnline.getIs_online() == 1) {
|
||||
//// iv_on_line.setVisibility(GONE);
|
||||
// } else {
|
||||
//// iv_on_line.setVisibility(VISIBLE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/// 设置是否显示助力按钮
|
||||
public void setLockZl(boolean lock) {
|
||||
|
||||
@@ -287,7 +287,7 @@ public class WheatLayoutManager {
|
||||
int pitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||
RoomDefaultWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
if (wheatView != null) {
|
||||
wheatView.setOnlineStatus(bean);
|
||||
wheatView.setOnlineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.bean.RoomMessageEvent;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomPitBean;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -381,6 +383,40 @@ public class WheatLayoutSingManager {
|
||||
return metrics.widthPixels;
|
||||
}
|
||||
|
||||
public void setUpData(RoomMessageEvent event){
|
||||
String fromPit=event.getText().getFrom_pit_number()!=null?event.getText().getFrom_pit_number():"";
|
||||
String toPitNumber=event.getText().getTo_pit_number()!=null?event.getText().getTo_pit_number():"";
|
||||
if (fromPit.equals("") || toPitNumber.equals("")){
|
||||
return;
|
||||
}
|
||||
RoomSingSongWheatView fromWheatView = findWheatViewByPitNumber(Integer.parseInt(fromPit));
|
||||
RoomSingSongWheatView toWheatView = findWheatViewByPitNumber(Integer.parseInt(toPitNumber));
|
||||
RoomPitBean fromPitBean=fromWheatView.pitBean;
|
||||
RoomPitBean toPitBean=toWheatView.pitBean;
|
||||
String tmpNumber=fromPitBean.getPit_number();
|
||||
fromPitBean.setPit_number(toPitBean.getPit_number());
|
||||
toPitBean.setPit_number(tmpNumber);
|
||||
toWheatView.setData(fromPitBean);
|
||||
fromWheatView.setData(toPitBean);
|
||||
for (RoomSingSongWheatView view : multiWheatViews){
|
||||
if (view.pitBean.getUser_id().equals(event.getText().getFromUserInfo().getUser_id()+"")){
|
||||
if (!view.pitBean.getPit_number().equals(toPitNumber)){
|
||||
RoomPitBean bean=view.pitBean;
|
||||
bean.setCharm("");
|
||||
bean.setUser_id("");
|
||||
bean.setDress("");
|
||||
bean.setAvatar("");
|
||||
bean.setNickname("");
|
||||
bean.setSex("");
|
||||
bean.setUser_code("");
|
||||
bean.setDress_picture("");
|
||||
view.setData(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新指定 pitNumber 的麦位信息(用于局部刷新)
|
||||
*/
|
||||
@@ -478,7 +514,7 @@ public class WheatLayoutSingManager {
|
||||
int pitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||
RoomSingSongWheatView wheatView = findWheatViewByPitNumber(pitNumber);
|
||||
if (wheatView != null) {
|
||||
wheatView.setOnlineStatus(bean); // 刷新数据
|
||||
wheatView.setOnlineStatus(); // 刷新数据
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,8 @@ import com.orhanobut.logger.Logger
|
||||
import com.petterp.floatingx.assist.helper.FxScopeHelper
|
||||
import com.petterp.floatingx.listener.control.IFxControl
|
||||
import com.tencent.imsdk.v2.V2TIMManager
|
||||
import com.tencent.imsdk.v2.V2TIMSDKListener
|
||||
import com.tencent.imsdk.v2.V2TIMUserFullInfo
|
||||
import com.tencent.imsdk.v2.V2TIMValueCallback
|
||||
import com.xscm.moduleutil.activity.BaseMvpActivity
|
||||
import com.xscm.moduleutil.adapter.CommonPageAdapter
|
||||
@@ -161,8 +163,7 @@ import java.util.stream.Collectors
|
||||
|
||||
@Route(path = ARouteConstants.ROOM_DETAILS)
|
||||
class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
RoomContacts.View, PermissionCallbacks, OnMessageReceivedListener
|
||||
{
|
||||
RoomContacts.View, PermissionCallbacks, OnMessageReceivedListener {
|
||||
private var roomFragment: RoomFragment? = null
|
||||
var commonPageAdapter: CommonPageAdapter? = null
|
||||
private var mRoomBean: RoomBean? = null
|
||||
@@ -670,8 +671,45 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
// 恢复房间状态
|
||||
resumeRoomState()
|
||||
}
|
||||
|
||||
V2TIMManager.getInstance().addIMSDKListener(imSdkListener);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private val imSdkListener = object : V2TIMSDKListener() {
|
||||
override fun onConnecting() {}
|
||||
|
||||
override fun onConnectSuccess() { //重连成功
|
||||
if (CommonAppContext.getInstance().playId != null) {
|
||||
LogUtils.e("@@@", "重连成功")
|
||||
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onConnectFailed(code: Int, error: String?) {
|
||||
LogUtils.e("@@@", "断开连接")
|
||||
CommonAppContext.getInstance().onConnectFailed = true
|
||||
}
|
||||
|
||||
override fun onKickedOffline() {
|
||||
// queren1();
|
||||
if (CommonAppContext.getInstance().playId != null) {
|
||||
ToastUtils.show("您的账号已被挤下线")
|
||||
try {
|
||||
CommonAppContext.getInstance().clearLoginInfo()
|
||||
} catch (e: ClassNotFoundException) {
|
||||
throw RuntimeException(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUserSigExpired() {}
|
||||
|
||||
override fun onSelfInfoUpdated(info: V2TIMUserFullInfo?) {}
|
||||
}
|
||||
|
||||
|
||||
private fun setview(resp: RoomInfoResp) {
|
||||
this.mRoomInfoResp = resp
|
||||
val roomBean = resp.room_info
|
||||
@@ -1501,6 +1539,12 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
} else if (msgType == 1028) {
|
||||
roomFragment!!.handleMsgType1028(messageEvent)
|
||||
} else if (msgType == 1058) {
|
||||
var userId = messageEvent!!.text!!.user_id!!
|
||||
LogUtils.e("messageEvent!!.text.type"+messageEvent!!.text.type)
|
||||
CommonAppContext.getInstance().onlineMap.set(
|
||||
userId?.toString() ?: "",
|
||||
messageEvent!!.text.type
|
||||
)
|
||||
if (mRoomInfoResp != null && mRoomInfoResp!!.room_info != null) {
|
||||
if (mRoomInfoResp!!.room_info.type_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" ||
|
||||
mRoomInfoResp!!.room_info.type_id == "4" || mRoomInfoResp!!.room_info.type_id == "8"
|
||||
@@ -1516,6 +1560,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
roomFragment!!.friendshipRoomFragmentEvent(messageEvent)
|
||||
}
|
||||
}
|
||||
|
||||
CommonAppContext.getInstance().getOnlineMap()
|
||||
} else if (msgType == 1059) { // 1059清除个人魅力 1058在离线
|
||||
if (mRoomInfoResp != null && mRoomInfoResp!!.room_info != null) {
|
||||
if (mRoomInfoResp!!.room_info.type_id == "1" || mRoomInfoResp!!.room_info.type_id == "3" ||
|
||||
@@ -1664,10 +1710,10 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
|
||||
val pitList = mRoomInfoResp!!.room_info.pit_list
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
pitMap.clear() // 避免数据累积
|
||||
for (roomPitBean in pitList) {
|
||||
pitMap[roomPitBean.pit_number] = roomPitBean
|
||||
}
|
||||
// pitMap.clear() // 避免数据累积
|
||||
// for (roomPitBean in pitList) {
|
||||
// pitMap[roomPitBean.pit_number] = roomPitBean
|
||||
// }
|
||||
|
||||
if (text == null) {
|
||||
return
|
||||
@@ -1688,104 +1734,97 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
toPitNumber: String,
|
||||
messageEvent: RoomMessageEvent
|
||||
) {
|
||||
if (TextUtils.isEmpty(fromPitNumber) || TextUtils.isEmpty(toPitNumber)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) {
|
||||
LogUtils.e("Room info is null")
|
||||
return
|
||||
}
|
||||
|
||||
val pitList = mRoomInfoResp!!.room_info.pit_list
|
||||
if (pitList == null || pitList.isEmpty()) {
|
||||
LogUtils.e("pit_list is null or empty")
|
||||
return
|
||||
}
|
||||
|
||||
var fromBean: RoomPitBean? = null
|
||||
var toBean: RoomPitBean? = null
|
||||
val pitListCopy: MutableList<RoomPitBean> = ArrayList()
|
||||
|
||||
for (bean in pitList) {
|
||||
if (bean == null) continue
|
||||
if (fromPitNumber == bean.pit_number) {
|
||||
fromBean = bean
|
||||
pitListCopy.add(bean)
|
||||
} else if (toPitNumber == bean.pit_number) {
|
||||
toBean = bean
|
||||
pitListCopy.add(bean)
|
||||
}
|
||||
}
|
||||
|
||||
if (fromBean == null || toBean == null) {
|
||||
LogUtils.e("Cannot find pit number: from=$fromPitNumber, to=$toPitNumber")
|
||||
return
|
||||
}
|
||||
|
||||
// 交换 pit_number
|
||||
val temp = fromBean.pit_number
|
||||
fromBean.pit_number = toBean.pit_number
|
||||
toBean.pit_number = temp
|
||||
|
||||
// 构造新的 pitList
|
||||
val newPitList: MutableList<RoomPitBean> = ArrayList()
|
||||
for (bean in pitList) {
|
||||
if (!pitListCopy.contains(bean)) {
|
||||
newPitList.add(bean)
|
||||
}
|
||||
}
|
||||
newPitList.add(fromBean)
|
||||
newPitList.add(toBean)
|
||||
// 排序 - 更简洁的 Kotlin 写法
|
||||
newPitList.sortWith(compareBy {
|
||||
try {
|
||||
it.pit_number.toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
it.pit_number
|
||||
}
|
||||
})
|
||||
// // 排序
|
||||
// newPitList.sort(java.util.Comparator<RoomPitBean> { a: RoomPitBean, b: RoomPitBean ->
|
||||
mRoomInfoResp!!.user_info.pit_number = Integer.parseInt(toPitNumber)
|
||||
// if (TextUtils.isEmpty(fromPitNumber) || TextUtils.isEmpty(toPitNumber)) {
|
||||
// return
|
||||
// }
|
||||
////
|
||||
// if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) {
|
||||
// LogUtils.e("Room info is null")
|
||||
// return
|
||||
// }
|
||||
////
|
||||
// val pitList = mRoomInfoResp!!.room_info.pit_list
|
||||
// if (pitList == null || pitList.isEmpty()) {
|
||||
// LogUtils.e("pit_list is null or empty")
|
||||
// return
|
||||
// }
|
||||
////
|
||||
// var fromBean: RoomPitBean? = null
|
||||
// var toBean: RoomPitBean? = null
|
||||
// val pitListCopy: MutableList<RoomPitBean> = ArrayList()
|
||||
//
|
||||
// for (bean in pitList) {
|
||||
// if (bean == null) continue
|
||||
// if (fromPitNumber == bean.pit_number) {
|
||||
// fromBean = bean
|
||||
// pitListCopy.add(bean)
|
||||
// } else if (toPitNumber == bean.pit_number) {
|
||||
// toBean = bean
|
||||
// pitListCopy.add(bean)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (fromBean == null || toBean == null) {
|
||||
// LogUtils.e("Cannot find pit number: from=$fromPitNumber, to=$toPitNumber")
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// // 交换 pit_number
|
||||
// val temp = fromBean.pit_number
|
||||
// fromBean.pit_number = toBean.pit_number
|
||||
// toBean.pit_number = temp
|
||||
//
|
||||
// // 构造新的 pitList
|
||||
// val newPitList: MutableList<RoomPitBean> = ArrayList()
|
||||
// for (bean in pitList) {
|
||||
// if (!pitListCopy.contains(bean)) {
|
||||
// newPitList.add(bean)
|
||||
// }
|
||||
// }
|
||||
// newPitList.add(fromBean)
|
||||
// newPitList.add(toBean)
|
||||
//// 排序 - 更简洁的 Kotlin 写法
|
||||
// newPitList.sortWith(compareBy {
|
||||
// try {
|
||||
// return@sort Integer.compare(a.pit_number.toInt(), b.pit_number.toInt())
|
||||
// it.pit_number.toInt()
|
||||
// } catch (e: NumberFormatException) {
|
||||
// return@sort a.pit_number.compareTo(b.pit_number)
|
||||
// it.pit_number
|
||||
// }
|
||||
// })
|
||||
|
||||
mRoomInfoResp!!.room_info.pit_list = newPitList
|
||||
|
||||
// 更新当前用户 pit_number
|
||||
if (mRoomInfoResp!!.user_info != null) {
|
||||
val currentUserId = SpUtil.getUserId().toString()
|
||||
val fromUserId = fromBean.user_id
|
||||
val toUserId = toBean.user_id
|
||||
|
||||
if (fromUserId != null && fromUserId == currentUserId) {
|
||||
try {
|
||||
mRoomInfoResp!!.user_info.pit_number = fromBean.pit_number.toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
LogUtils.e("Invalid pit number: " + toBean.pit_number)
|
||||
}
|
||||
} else if (toUserId != null && toUserId == currentUserId) {
|
||||
try {
|
||||
mRoomInfoResp!!.user_info.pit_number = fromBean.pit_number.toInt()
|
||||
} catch (e: NumberFormatException) {
|
||||
LogUtils.e("Invalid pit number: " + toBean.pit_number)
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// mRoomInfoResp!!.room_info.pit_list = newPitList
|
||||
//
|
||||
// // 更新当前用户 pit_number
|
||||
// if (mRoomInfoResp!!.user_info != null) {
|
||||
// val currentUserId = SpUtil.getUserId().toString()
|
||||
// val fromUserId = fromBean.user_id
|
||||
// val toUserId = toBean.user_id
|
||||
//
|
||||
// if (fromUserId != null && fromUserId == currentUserId) {
|
||||
// try {
|
||||
// mRoomInfoResp!!.user_info.pit_number = fromBean.pit_number.toInt()
|
||||
// } catch (e: NumberFormatException) {
|
||||
// LogUtils.e("Invalid pit number: " + toBean.pit_number)
|
||||
// }
|
||||
// } else if (toUserId != null && toUserId == currentUserId) {
|
||||
// try {
|
||||
// mRoomInfoResp!!.user_info.pit_number = fromBean.pit_number.toInt()
|
||||
// } catch (e: NumberFormatException) {
|
||||
// LogUtils.e("Invalid pit number: " + toBean.pit_number)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
dispatchRoomEvent(messageEvent)
|
||||
}
|
||||
|
||||
private fun dispatchRoomEvent(messageEvent: RoomMessageEvent) {
|
||||
if (mRoomInfoResp == null || mRoomInfoResp!!.room_info == null) return
|
||||
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
val typeId = mRoomInfoResp!!.room_info.type_id
|
||||
if ("2" == typeId) {
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
|
||||
roomFragment!!.handleAuctionMessageEvent(messageEvent)
|
||||
} else if ("3" == typeId || "4" == typeId || "1" == typeId || "8" == typeId) {
|
||||
val labelId = mRoomInfoResp!!.room_info.label_id
|
||||
@@ -1886,7 +1925,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CommonAppContext.getInstance().onlineMap.clear()
|
||||
MvpPre!!.postRoomInfo(roomId)
|
||||
}
|
||||
|
||||
@@ -1955,6 +1994,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if ("2" == labelId) {
|
||||
roomFragment!!.KtvFragmentEvent(messageEvent)
|
||||
} else if ("1" == labelId) {
|
||||
mRoomInfoResp!!.room_info.pit_list.set(pitNumber.toInt()-1, getPitBean(messageEvent))
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
roomFragment!!.SingSongEvent(messageEvent)
|
||||
}
|
||||
} else if ("7" == typeId) {
|
||||
@@ -2030,6 +2071,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if ("2" == labelId) {
|
||||
roomFragment!!.KtvFragmentEvent(messageEvent)
|
||||
} else if ("1" == labelId) {
|
||||
mRoomInfoResp!!.room_info.pit_list.set(pitNumber.toInt()-1, getPitBean2(messageEvent,pitNumber))
|
||||
roomFragment!!.upRoomInfoData(mRoomInfoResp)
|
||||
roomFragment!!.SingSongEvent(messageEvent)
|
||||
if (mRoomInfoResp!!.user_info.user_id == SpUtil.getUserId().toString() + "") {
|
||||
ivSoundEffects(false)
|
||||
@@ -2113,6 +2156,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if (text == null || text.fromUserInfo == null) return
|
||||
|
||||
if (text.fromUserInfo.user_id == SpUtil.getUserId()) {
|
||||
LogUtils.e("退出房间")
|
||||
MvpPre!!.quitRoom(roomId, SpUtil.getUserId().toString() + "")
|
||||
}
|
||||
}
|
||||
@@ -3340,10 +3384,30 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
mBinding!!.xlhRk.visibility = View.INVISIBLE
|
||||
releaseCountDownTimer1()
|
||||
}
|
||||
|
||||
// tzblChanged()
|
||||
// sharedViewModel.setDataForFragment(mRoomInfoResp);
|
||||
//
|
||||
}
|
||||
protected fun tzblChanged() {
|
||||
// mBinding.dhv9.updateTzbl(SpUtil.getTzbl(roomId));
|
||||
|
||||
val userIds = StringBuilder()
|
||||
for (i in 0 until mRoomInfoResp!!.room_info!!.pit_list!!.size) {
|
||||
val userId = mRoomInfoResp!!.room_info!!.pit_list[i]!!.user_id!!
|
||||
if (userId != null && userId != "0" && userId.isNotEmpty()) {
|
||||
if (userIds.isNotEmpty()) {
|
||||
userIds.append(",")
|
||||
}
|
||||
userIds.append(userId)
|
||||
}
|
||||
}
|
||||
|
||||
if (userIds.isNotEmpty() && roomId != null) {
|
||||
MvpPre!!.userOnlineStatus(userIds.toString(), roomId)
|
||||
} else {
|
||||
// updateWheatData()
|
||||
}
|
||||
}
|
||||
|
||||
private fun instView() { //隐藏视图
|
||||
|
||||
@@ -3623,7 +3687,16 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
CommonAppContext.getInstance().isRoomJoininj = false
|
||||
// 当Activity恢复时,重置标记
|
||||
userLeaving = true
|
||||
RetrofitClient.getInstance().roomUserReconnect(CommonAppContext.getInstance().playId)
|
||||
if(CommonAppContext.getInstance().onConnectFailed){//判断是否有有过断开腾讯IM
|
||||
CommonAppContext.getInstance().onConnectFailed=false
|
||||
if (CommonAppContext.getInstance().playId!=null && !CommonAppContext.getInstance().playId.isEmpty()) { //判断是否有roomId
|
||||
LogUtils.e("RoomActivity", "onResume playId:"+CommonAppContext.getInstance().playId)
|
||||
MvpPre!!.postRoomInfo(CommonAppContext.getInstance().playId)//当有过断开,然后重新连接
|
||||
LogUtils.e("RoomActivity", "onResume playId:"+CommonAppContext.getInstance().playId)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// // 正常启动或从后台恢复
|
||||
// if (isInBackground) {
|
||||
@@ -4064,7 +4137,14 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
if (!list.isEmpty()) {
|
||||
for (i in list.indices) {
|
||||
val userOnlineStatusBean = list[i]
|
||||
|
||||
var userId = userOnlineStatusBean!!.user_id
|
||||
CommonAppContext.getInstance().onlineMap.set(
|
||||
userId?.toString() ?: "",
|
||||
userOnlineStatusBean!!.is_online
|
||||
)
|
||||
EventBus.getDefault().post(userOnlineStatusBean)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4163,6 +4243,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
ThreadUtils.cancel()
|
||||
QXGiftPlayerManager.getInstance(applicationContext).destroyEffectSvga()
|
||||
stopkeepLiveService() //停止service
|
||||
CommonAppContext.getInstance().onlineMap.clear()
|
||||
} catch (e: Exception) {
|
||||
LogUtils.e("cleanupResources error: " + e.message)
|
||||
}
|
||||
@@ -4357,7 +4438,8 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
* 停止保活
|
||||
*/
|
||||
private fun stopkeepLiveService() {
|
||||
val isStartService = isServiceExisted(this, "com.example.modulerroom.service.RoomPlayService")
|
||||
val isStartService =
|
||||
isServiceExisted(this, "com.example.moduleroom.service.RoomPlayService")
|
||||
if (isStartService) {
|
||||
val stopIntent = Intent(
|
||||
this,
|
||||
|
||||
@@ -4,8 +4,11 @@ import android.app.Activity;
|
||||
|
||||
import com.xscm.moduleutil.activity.IPresenter;
|
||||
import com.xscm.moduleutil.activity.IView;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FriendshipRoomContacts {
|
||||
public interface View extends IView<Activity> {
|
||||
void applyPit();
|
||||
@@ -13,6 +16,8 @@ public class FriendshipRoomContacts {
|
||||
void endFriend(FriendUserBean friendUserBean);
|
||||
|
||||
void createRelation();
|
||||
|
||||
void userOnlineStatus(List<UserOnlineStatusBean> list);
|
||||
}
|
||||
|
||||
public interface IRoomPre extends IPresenter {
|
||||
@@ -25,5 +30,7 @@ public class FriendshipRoomContacts {
|
||||
void endFriend(String friend_id,String room_id);
|
||||
|
||||
void createRelation(String room_id,String friend_id,String user1_id,String user2_id,String relation_id);
|
||||
|
||||
void userOnlineStatus(String userId, String roomid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,11 +32,14 @@ import com.example.moduleroom.dialog.RoomGiftDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomOnlineDialogFragment;
|
||||
import com.example.moduleroom.dialog.RoomUserInfoFragment;
|
||||
import com.example.moduleroom.presenter.FriendshipRoomPresenter;
|
||||
import com.example.moduleroom.presenter.SingSongPresenter;
|
||||
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.RoomRelationBean;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.FriendInfo;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.bean.room.RoomInfoResp;
|
||||
@@ -48,6 +51,7 @@ import com.xscm.moduleutil.utils.ClickUtils;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.utils.StringUtil;
|
||||
import com.xscm.moduleutil.widget.RoomFriendshipWheatView;
|
||||
import com.xscm.moduleutil.widget.RoomSingSongWheatView;
|
||||
import com.xscm.moduleutil.widget.SharedViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -84,6 +88,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
private boolean bottomIsAnimate = false;
|
||||
RoomConcernDialogFragment dialogFragment;
|
||||
private Map<String, RoomFriendshipWheatView> userViewMap = new HashMap<>();
|
||||
|
||||
/// 底部的
|
||||
@Override
|
||||
public void applyPit() {
|
||||
@@ -109,11 +114,30 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOnlineStatus(List<UserOnlineStatusBean> list) {
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String userOnlineStatusBean = list.get(i).getUser_id();
|
||||
CommonAppContext.getInstance().onlineMap.put(userOnlineStatusBean, list.get(i).getIs_online());
|
||||
|
||||
}
|
||||
}
|
||||
for (RoomFriendshipWheatView roomFriendshipWheatView : mWheatViews) {
|
||||
if (roomFriendshipWheatView != null) {
|
||||
RoomPitBean pitBean = roomFriendshipWheatView.pitBean;
|
||||
roomFriendshipWheatView.setOnlineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SharedViewModel sharedViewModel;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup
|
||||
container, @Nullable Bundle savedInstanceState) {
|
||||
// sharedViewModel = new ViewModelProvider(requireActivity()).get(SharedViewModel.class);
|
||||
//
|
||||
// // 观察专门给子Fragment的数据
|
||||
@@ -127,7 +151,8 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConcernSelected(RoomRelationBean selectedDean, FriendUserBean relationshipList) {
|
||||
public void onConcernSelected(RoomRelationBean selectedDean, FriendUserBean
|
||||
relationshipList) {
|
||||
MvpPre.createRelation(roomId, roomInfoResp.getFriend_info().getFriend_id() + "", relationshipList.getUser1_id(), relationshipList.getUser2_id(), selectedDean.getRelation_id());
|
||||
}
|
||||
|
||||
@@ -195,7 +220,6 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
mWheatViews.add(mBinding.wheatView9);
|
||||
mWheatViews.add(mBinding.wheatView10);
|
||||
|
||||
|
||||
// 为每个麦位视图添加点击事件
|
||||
for (int i = 0; i < mWheatViews.size(); i++) {
|
||||
final int position = i;
|
||||
@@ -216,7 +240,6 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
public void onZhulClick(RoomFriendshipWheatView view, RoomPitBean pitBean) {
|
||||
|
||||
|
||||
|
||||
if (ClickUtils.isFastDoubleClick()) {
|
||||
return; // 快速重复点击,直接返回
|
||||
}
|
||||
@@ -251,6 +274,32 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
initPopupWindow();
|
||||
}
|
||||
|
||||
protected void tzblChanged() {
|
||||
// mBinding.dhv9.updateTzbl(SpUtil.getTzbl(roomId));
|
||||
|
||||
StringBuilder userIds = new StringBuilder();
|
||||
if (roomInfoResp != null && roomInfoResp.getRoom_info() != null && roomInfoResp.getRoom_info().getPit_list() != null) {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
String userId = roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id();
|
||||
if (userId != null && !userId.equals("0") && !userId.isEmpty()) {
|
||||
if (userIds.length() > 0) {
|
||||
userIds.append(",");
|
||||
}
|
||||
userIds.append(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (userIds.length() > 0 && roomId != null) {
|
||||
if (MvpPre == null) {
|
||||
MvpPre = new FriendshipRoomPresenter(this, getActivity());
|
||||
}
|
||||
MvpPre.userOnlineStatus(userIds.toString(), roomId);
|
||||
} else {
|
||||
// updateWheatData();
|
||||
}
|
||||
}
|
||||
|
||||
public void upRoomInfo(RoomInfoResp roomInfoResp) {
|
||||
this.roomInfoResp = roomInfoResp;
|
||||
}
|
||||
@@ -270,26 +319,29 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
int pitNumber = position + 1; // 麦位编号(1-10)
|
||||
|
||||
// 示例处理逻辑
|
||||
if (roomInfoResp != null && roomInfoResp.getRoom_info() != null) {
|
||||
if (position < roomInfoResp.getRoom_info().getPit_list().size()) {
|
||||
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(position);
|
||||
// if (roomInfoResp != null && roomInfoResp.getRoom_info() != null) {
|
||||
// if (position < roomInfoResp.getRoom_info().getPit_list().size()) {
|
||||
if (wheatView.pitBean != null) {
|
||||
RoomPitBean pitBean = wheatView.pitBean;
|
||||
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(position);
|
||||
|
||||
// 根据麦位状态处理点击事件
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
// 麦位上有人,可以查看用户信息等操作
|
||||
handleUserClick(pitBean);
|
||||
} else {
|
||||
if (currentPartType.value == 2 || currentPartType.value == 3) {
|
||||
if (pitBean.getPit_number().equals("9") || pitBean.getPit_number().equals("10")) {
|
||||
handleEmptyPitClick(wheatView, pitBean);
|
||||
}
|
||||
return;
|
||||
// 根据麦位状态处理点击事件
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
// 麦位上有人,可以查看用户信息等操作
|
||||
handleUserClick(pitBean);
|
||||
} else {
|
||||
if (currentPartType.value == 2 || currentPartType.value == 3) {
|
||||
if (pitBean.getPit_number().equals("9") || pitBean.getPit_number().equals("10")) {
|
||||
handleEmptyPitClick(wheatView, pitBean);
|
||||
}
|
||||
// 麦位空闲,可以申请上麦等操作
|
||||
handleEmptyPitClick(wheatView, pitBean);
|
||||
return;
|
||||
}
|
||||
// 麦位空闲,可以申请上麦等操作
|
||||
handleEmptyPitClick(wheatView, pitBean);
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -368,129 +420,134 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/9/12 清除个人魅力
|
||||
// TODO: 2025/9/12 清除个人魅力
|
||||
public void event1059(RoomMessageEvent messageEvent) {
|
||||
RoomPitBean pitBean = mBinding.wheatView9.pitBean;
|
||||
if (pitBean.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean.setCharm("");
|
||||
mBinding.wheatView9.setCardiac(pitBean.getCharm(),1f);
|
||||
mBinding.wheatView9.setCardiac(pitBean.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean1 = mBinding.wheatView10.pitBean;
|
||||
if (pitBean1.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean1.setCharm("");
|
||||
mBinding.wheatView10.setCardiac(pitBean1.getCharm(),1f);
|
||||
mBinding.wheatView10.setCardiac(pitBean1.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean2 = mBinding.wheatView1.pitBean;
|
||||
if (pitBean2.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean2.setCharm("");
|
||||
mBinding.wheatView1.setCardiac(pitBean2.getCharm(),1f);
|
||||
mBinding.wheatView1.setCardiac(pitBean2.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean3 = mBinding.wheatView2.pitBean;
|
||||
if (pitBean3.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean3.setCharm("");
|
||||
mBinding.wheatView2.setCardiac(pitBean3.getCharm(),1f);
|
||||
mBinding.wheatView2.setCardiac(pitBean3.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean4 = mBinding.wheatView3.pitBean;
|
||||
if (pitBean4.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean4.setCharm("");
|
||||
mBinding.wheatView3.setCardiac(pitBean4.getCharm(),1f);
|
||||
mBinding.wheatView3.setCardiac(pitBean4.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean5 = mBinding.wheatView4.pitBean;
|
||||
if (pitBean5.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean5.setCharm("");
|
||||
mBinding.wheatView4.setCardiac(pitBean5.getCharm(),1f);
|
||||
mBinding.wheatView4.setCardiac(pitBean5.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean6 = mBinding.wheatView5.pitBean;
|
||||
if (pitBean6.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean6.setCharm("");
|
||||
mBinding.wheatView5.setCardiac(pitBean6.getCharm(),1f);
|
||||
mBinding.wheatView5.setCardiac(pitBean6.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
RoomPitBean pitBean7 = mBinding.wheatView6.pitBean;
|
||||
if (pitBean7.getUser_id().equals(messageEvent.getText().getUser_id())) {
|
||||
pitBean7.setCharm("");
|
||||
mBinding.wheatView6.setCardiac(pitBean7.getCharm(),1f);
|
||||
mBinding.wheatView6.setCardiac(pitBean7.getCharm(), 1f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void event1003(RoomMessageEvent messageEvent){
|
||||
public void event1003(RoomMessageEvent messageEvent) {
|
||||
UserInfo fromUserInfo = messageEvent.getText().getFromUserInfo();
|
||||
if (fromUserInfo == null) return;
|
||||
|
||||
String pitNumber = messageEvent.getText().getPit_number();
|
||||
int userId = fromUserInfo.getUser_id();
|
||||
List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
try {
|
||||
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
pitBean.setUser_id(userId + "");
|
||||
pitBean.setAvatar(fromUserInfo.getAvatar());
|
||||
pitBean.setNickname(fromUserInfo.getNickname());
|
||||
pitBean.setSex(fromUserInfo.getSex() + "");
|
||||
pitBean.setCharm(fromUserInfo.getCharm());
|
||||
pitBean.setDress(fromUserInfo.getDress());
|
||||
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
if (userId==SpUtil.getUserId() && pitNumber.equals("9")){
|
||||
myPitNumber=9;
|
||||
configGameOptionBtn();
|
||||
// List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
|
||||
// if (pitList != null && !pitList.isEmpty()) {
|
||||
// try {
|
||||
// RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
RoomPitBean pitBean = mWheatViews.get(Integer.parseInt(pitNumber) - 1).pitBean;
|
||||
pitBean.setUser_id(userId + "");
|
||||
pitBean.setAvatar(fromUserInfo.getAvatar());
|
||||
pitBean.setNickname(fromUserInfo.getNickname());
|
||||
pitBean.setSex(fromUserInfo.getSex() + "");
|
||||
pitBean.setCharm(fromUserInfo.getCharm());
|
||||
pitBean.setDress(fromUserInfo.getDress());
|
||||
// pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
mWheatViews.get(Integer.parseInt(pitNumber) - 1).pitBean = pitBean;
|
||||
if (userId == SpUtil.getUserId() && pitNumber.equals("9")) {
|
||||
myPitNumber = 9;
|
||||
configGameOptionBtn();
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).ivSoundEffects(true);
|
||||
// }
|
||||
}
|
||||
for (int i = 0; i < mWheatViews.size(); i++){
|
||||
if (i==Integer.parseInt(pitNumber) - 1){
|
||||
mWheatViews.get(i).setData(pitBean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
// Handle exception
|
||||
}
|
||||
for (int i = 0; i < mWheatViews.size(); i++) {
|
||||
if (i == Integer.parseInt(pitNumber) - 1) {
|
||||
mWheatViews.get(i).setData(pitBean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// } catch (NumberFormatException e) {
|
||||
// // Handle exception
|
||||
// }
|
||||
// }
|
||||
|
||||
initUserViewMap();
|
||||
}
|
||||
|
||||
public void event1004(RoomMessageEvent messageEvent){
|
||||
public void event1004(RoomMessageEvent messageEvent) {
|
||||
String pitNumber = messageEvent.getText().getPit_number();
|
||||
List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
|
||||
if (pitList != null && !pitList.isEmpty()) {
|
||||
try {
|
||||
RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
pitBean.setUser_id("");
|
||||
pitBean.setAvatar("");
|
||||
pitBean.setNickname("");
|
||||
pitBean.setSex("");
|
||||
pitBean.setCharm("");
|
||||
pitBean.setDress("");
|
||||
pitList.set(Integer.parseInt(pitNumber) - 1, pitBean);
|
||||
if (pitNumber.equals("9")){
|
||||
myPitNumber=0;
|
||||
configGameOptionBtn();
|
||||
// List<RoomPitBean> pitList = roomInfoResp.getRoom_info().getPit_list();
|
||||
// if (pitList != null && !pitList.isEmpty()) {
|
||||
// try {
|
||||
// RoomPitBean pitBean = pitList.get(Integer.parseInt(pitNumber) - 1);
|
||||
RoomPitBean pitBean = mWheatViews.get(Integer.parseInt(pitNumber) - 1).pitBean;
|
||||
pitBean.setUser_id("");
|
||||
pitBean.setAvatar("");
|
||||
pitBean.setNickname("");
|
||||
pitBean.setSex("");
|
||||
pitBean.setCharm("");
|
||||
pitBean.setDress("");
|
||||
mWheatViews.get(Integer.parseInt(pitNumber) - 1).pitBean = pitBean;
|
||||
if (pitNumber.equals("9")) {
|
||||
myPitNumber = 0;
|
||||
configGameOptionBtn();
|
||||
// if (getActivity() instanceof RoomActivity) {
|
||||
// ((RoomActivity) getActivity()).ivSoundEffects(false);
|
||||
// }
|
||||
}
|
||||
for (int i = 0; i < mWheatViews.size(); i++){
|
||||
if (i==Integer.parseInt(pitNumber) - 1){
|
||||
mWheatViews.get(i).setData(pitBean);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// Handle exception
|
||||
}
|
||||
for (int i = 0; i < mWheatViews.size(); i++) {
|
||||
if (i == Integer.parseInt(pitNumber) - 1) {
|
||||
mWheatViews.get(i).setData(pitBean);
|
||||
break;
|
||||
}
|
||||
// }
|
||||
// } catch (NumberFormatException e) {
|
||||
// // Handle exception
|
||||
// }
|
||||
}
|
||||
initUserViewMap();
|
||||
}
|
||||
|
||||
public void event1035(RoomMessageEvent message) {
|
||||
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
@@ -510,28 +567,69 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
}
|
||||
}
|
||||
public void event1039(RoomMessageEvent messageEvent){
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
|
||||
if (roomPitBean.getPit_number().equals("7") || roomPitBean.getPit_number().equals("8")) {
|
||||
continue;
|
||||
}
|
||||
if (Integer.parseInt(!roomPitBean.getPit_number().isEmpty() ? roomPitBean.getPit_number() : "0") > 10) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RoomFriendshipWheatView object = mWheatViews.get(Integer.parseInt(roomPitBean.getPit_number()) - 1);
|
||||
public void event1039(RoomMessageEvent messageEvent) {
|
||||
|
||||
if (object != null) {
|
||||
object.setData(roomPitBean);
|
||||
} else {
|
||||
continue;
|
||||
String fromPit = messageEvent.getText().getFrom_pit_number();
|
||||
String toPitNumber = messageEvent.getText().getTo_pit_number();
|
||||
if (fromPit.equals("") || toPitNumber.equals("")) {
|
||||
return;
|
||||
}
|
||||
RoomFriendshipWheatView fromWheatView = mWheatViews.get(Integer.parseInt(fromPit) - 1);
|
||||
RoomFriendshipWheatView toWheatView = mWheatViews.get(Integer.parseInt(toPitNumber) - 1);
|
||||
RoomPitBean fromPitBean = fromWheatView.pitBean;
|
||||
RoomPitBean toPitBean = toWheatView.pitBean;
|
||||
String tmpNumber = fromPitBean.getPit_number();
|
||||
fromPitBean.setPit_number(toPitBean.getPit_number());
|
||||
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(fromPit) - 1, fromPitBean);
|
||||
toPitBean.setPit_number(tmpNumber);
|
||||
toWheatView.setData(fromPitBean);
|
||||
fromWheatView.setData(toPitBean);
|
||||
for (RoomFriendshipWheatView view : mWheatViews) {
|
||||
if (view == null) {
|
||||
return;
|
||||
}
|
||||
if (view.pitBean != null && view.pitBean.getUser_id() != null) {
|
||||
if (view.pitBean.getUser_id().equals(messageEvent.getText().getFromUserInfo().getUser_id() + "")) {
|
||||
if (!view.pitBean.getPit_number().equals(toPitNumber)) {
|
||||
RoomPitBean bean = view.pitBean;
|
||||
bean.setCharm("");
|
||||
bean.setUser_id("");
|
||||
bean.setDress("");
|
||||
bean.setAvatar("");
|
||||
bean.setNickname("");
|
||||
bean.setSex("");
|
||||
bean.setUser_code("");
|
||||
bean.setDress_picture("");
|
||||
view.setData(bean);
|
||||
// roomInfoResp.getRoom_info().getPit_list().set(Integer.parseInt(view.pitBean.getPit_number()) - 1, bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
// RoomPitBean roomPitBean = roomInfoResp.getRoom_info().getPit_list().get(i);
|
||||
// if (roomPitBean.getPit_number().equals("7") || roomPitBean.getPit_number().equals("8")) {
|
||||
// continue;
|
||||
// }
|
||||
// if (Integer.parseInt(!roomPitBean.getPit_number().isEmpty() ? roomPitBean.getPit_number() : "0") > 10) {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// RoomFriendshipWheatView object = mWheatViews.get(Integer.parseInt(roomPitBean.getPit_number()) - 1);
|
||||
//
|
||||
// if (object != null) {
|
||||
// object.setData(roomPitBean);
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
// 在 initData() 方法中初始化映射关系
|
||||
//初始化对应的map
|
||||
//初始化对应的map
|
||||
private void initUserViewMap() {
|
||||
userViewMap.clear();
|
||||
// 注意:这里需要确保 pitBean 和 getUser_id() 在初始化时已经设置
|
||||
@@ -545,6 +643,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
addToUserViewMap(mBinding.wheatView9);
|
||||
addToUserViewMap(mBinding.wheatView10);
|
||||
}
|
||||
|
||||
private void addToUserViewMap(RoomFriendshipWheatView view) {
|
||||
if (view != null && view.pitBean != null &&
|
||||
view.pitBean.getUser_id() != null &&
|
||||
@@ -566,8 +665,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
view.setCharm(charm);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: 2025/9/12 更新火热值
|
||||
public void event1005(RoomMessageEvent messageEvent){
|
||||
public void event1005(RoomMessageEvent messageEvent) {
|
||||
|
||||
List<UserInfo> toUserInfos = messageEvent.getText().getToUserInfos();
|
||||
|
||||
@@ -948,7 +1048,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
* 心动数值变化
|
||||
*/
|
||||
public void friendHeartNumberDidChanged(List<FriendInfo.HeartList> heartLists) {
|
||||
if (roomInfoResp.getFriend_info()!=null) {
|
||||
if (roomInfoResp.getFriend_info() != null) {
|
||||
// 更新心动数值显示
|
||||
roomInfoResp.getFriend_info().setHeart_list(heartLists);
|
||||
}
|
||||
@@ -962,9 +1062,9 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
* @param pitArr 麦位数组
|
||||
*/
|
||||
public void friendSeatDidChanged(List<RoomPitBean> pitArr) { // 使用实际的麦位模型类
|
||||
boolean isHaveMe=false;
|
||||
boolean isHaveMe = false;
|
||||
if (myPitNumber == 9 || myPitNumber == 10) {
|
||||
isHaveMe=true;
|
||||
isHaveMe = true;
|
||||
} else {
|
||||
myPitNumber = -1;
|
||||
}
|
||||
@@ -983,16 +1083,16 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
friendshipWheatView.setData(roomPitBean);
|
||||
if (pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
myPitNumber = Integer.parseInt(pitBean.getPit_number());
|
||||
isHaveMe=true;
|
||||
isHaveMe = true;
|
||||
}
|
||||
}
|
||||
if (!isHaveMe){
|
||||
if (!isHaveMe) {
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setrlMic(false);
|
||||
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding);
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled( false,SpUtil.getUserId()+"");
|
||||
AgoraManager.getInstance(getActivity()).setLocalAudioEnabled(false, SpUtil.getUserId() + "");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
((RoomActivity) getActivity()).setrlMic(true);
|
||||
((RoomActivity) getActivity()).ivWheatFeeding(com.xscm.moduleutil.R.mipmap.room_wheat_feeding_up);
|
||||
@@ -1032,6 +1132,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
} else {
|
||||
myPitNumber = -1;
|
||||
}
|
||||
tzblChanged();
|
||||
updateFriendshipState(FriendshipPartType.fromValue(roomInfoResp.getFriend_info().getStep()));
|
||||
configGameOptionBtn();
|
||||
configTime();
|
||||
@@ -1112,7 +1213,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
mBinding.imX1.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv11.setVisibility(View.VISIBLE);
|
||||
mBinding.tv1.setVisibility(View.VISIBLE);
|
||||
mBinding.tv1.setText(StringUtil.toWan2(heartList2.getHeartNum()+"", 1));
|
||||
mBinding.tv1.setText(StringUtil.toWan2(heartList2.getHeartNum() + "", 1));
|
||||
// mBinding.tv1.setText(heartList2.getHeartNum() + "");
|
||||
// if (!topIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
@@ -1134,7 +1235,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
mBinding.imX3.setVisibility(View.VISIBLE);
|
||||
// mBinding.iv33.setVisibility(View.VISIBLE);
|
||||
mBinding.tv3.setVisibility(View.VISIBLE);
|
||||
mBinding.tv3.setText(StringUtil.toWan2(heartList3.getHeartNum() + "",2));
|
||||
mBinding.tv3.setText(StringUtil.toWan2(heartList3.getHeartNum() + "", 2));
|
||||
// if (!bottomIsAnimate) {
|
||||
// // 强制刷新视图
|
||||
// mBinding.iv33.requestLayout();
|
||||
@@ -1170,7 +1271,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
mBinding.tv3.setVisibility(GONE);
|
||||
}
|
||||
return;
|
||||
}else if (currentPartType.value == 1) {
|
||||
} else if (currentPartType.value == 1) {
|
||||
//隐藏中间心动值 、心动背景 、隐藏连线 连线停止动画
|
||||
mBinding.imX2.setVisibility(GONE);
|
||||
mBinding.imX1.setVisibility(GONE);
|
||||
@@ -1234,7 +1335,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
}
|
||||
|
||||
private void songGift(RoomPitBean pitBean){
|
||||
private void songGift(RoomPitBean pitBean) {
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setAvatar(pitBean.getAvatar());
|
||||
userInfo.setNickname(pitBean.getNickname());
|
||||
@@ -1253,55 +1354,55 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
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() + "")){
|
||||
if (pitBean != null && pitBean.getUser_id() != null && pitBean.getUser_id().equals(SpUtil.getUserId() + "")) {
|
||||
ToastUtils.showShort("不能给自己助力哦");
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("1")){
|
||||
if (pitBean.getPit_number().equals("1")) {
|
||||
if (md2 != null && md2.getHeartNum() > 0 && mBinding.wheatView6.pitBean != null) {
|
||||
// 弹出礼物视图
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("2")){
|
||||
if (pitBean.getPit_number().equals("2")) {
|
||||
if (md1 != null && md1.getHeartNum() > 0 && mBinding.wheatView5.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("3")){
|
||||
if (pitBean.getPit_number().equals("3")) {
|
||||
if (md3 != null && md3.getHeartNum() > 0 && mBinding.wheatView4.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("4")){
|
||||
if (pitBean.getPit_number().equals("4")) {
|
||||
if (md3 != null && md3.getHeartNum() > 0 && mBinding.wheatView3.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("5")){
|
||||
if (pitBean.getPit_number().equals("5")) {
|
||||
if (md1 != null && md1.getHeartNum() > 0 && mBinding.wheatView2.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (pitBean.getPit_number().equals("6")){
|
||||
if (pitBean.getPit_number().equals("6")) {
|
||||
if (md2 != null && md2.getHeartNum() > 0 && mBinding.wheatView1.pitBean != null) {
|
||||
songGift(pitBean);
|
||||
}else {
|
||||
} else {
|
||||
ToastUtils.showShort("暂未有心动连线,快去送TA礼物");
|
||||
}
|
||||
return;
|
||||
@@ -1309,7 +1410,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
}
|
||||
|
||||
private void setVisibilityZL(){
|
||||
private void setVisibilityZL() {
|
||||
FriendInfo.HeartList md1 = null; //中心的集合
|
||||
FriendInfo.HeartList md2 = null; //顶部的集合
|
||||
FriendInfo.HeartList md3 = null; //底部的集合
|
||||
@@ -1477,7 +1578,7 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
|
||||
mBinding.tvJsq.setVisibility(VISIBLE);
|
||||
mBinding.tvJsq.setText(time1 + "");
|
||||
if (time1==0){
|
||||
if (time1 == 0) {
|
||||
mBinding.tvJsq.setVisibility(GONE);
|
||||
}
|
||||
} else {
|
||||
@@ -1528,7 +1629,8 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
}
|
||||
|
||||
// TODO: 2025/8/21 交友房阶段发生变化
|
||||
public void upDataFriendship(FriendshipPartType type, int friend_id, long end_time, FriendUserBean userBean) {
|
||||
public void upDataFriendship(FriendshipPartType type, int friend_id,
|
||||
long end_time, FriendUserBean userBean) {
|
||||
|
||||
// updateFriendshipState(type);
|
||||
// countDownTime(end_time);
|
||||
@@ -1562,13 +1664,14 @@ public class FriendshipRoomFragment extends BaseRoomFragment<FriendshipRoomPrese
|
||||
/// self.cpView.model=relationModel;[self.cpView showInView:KEYWINDOW];
|
||||
}
|
||||
|
||||
public void clearDialog(){
|
||||
public void clearDialog() {
|
||||
dialogFragment = (RoomConcernDialogFragment) getChildFragmentManager().findFragmentByTag("RoomConcernDialogFragment");
|
||||
if (dialogFragment != null && dialogFragment.isAdded()) {
|
||||
dialogFragment.dismiss();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerWheatViews() {
|
||||
|
||||
|
||||
@@ -872,6 +872,7 @@ public class PublicScreenEaseChatFragment extends BaseMvpFragment<PublicScreenEa
|
||||
break;
|
||||
case 1002:
|
||||
case 1012:
|
||||
case 1011:
|
||||
case 1014:
|
||||
case 1013:
|
||||
case 1026:
|
||||
|
||||
@@ -812,6 +812,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
wheatView2.setOnlineStatus(bean);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
|
||||
@@ -1412,17 +1412,17 @@ public class RoomKtvFragment extends BaseMvpFragment<RoomPresenter, FragmentRoom
|
||||
for (UserOnlineStatusBean bean : list) {
|
||||
if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().isEmpty()) {
|
||||
if (bean.getUser_id().equals(pitBean.getUser_id())) {
|
||||
mBinding.muZc.setOnlineStatus(bean);
|
||||
mBinding.muZc.setOnlineStatus();
|
||||
}
|
||||
}
|
||||
if (pitBean2 != null && pitBean2.getUser_id() != null && !pitBean2.getUser_id().isEmpty()) {
|
||||
if (bean.getUser_id().equals(pitBean2.getUser_id())) {
|
||||
mBinding.muJb.setOnlineStatus(bean);
|
||||
mBinding.muJb.setOnlineStatus();
|
||||
}
|
||||
}
|
||||
if (pitBean3 != null && pitBean3.getUser_id() != null && !pitBean3.getUser_id().isEmpty()) {
|
||||
if (bean.getUser_id().equals(pitBean3.getUser_id())) {
|
||||
mBinding.muYc.setOnlineStatus(bean);
|
||||
mBinding.muYc.setOnlineStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.google.android.flexbox.FlexboxLayout;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.luck.picture.lib.utils.DoubleUtils;
|
||||
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.UserOnlineStatusBean;
|
||||
@@ -458,7 +459,8 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
wheatLayoutSingManager.setOnWheatClickListener(new WheatLayoutSingManager.OnWheatClickListener() {
|
||||
@Override
|
||||
public void onWheatClick(RoomSingSongWheatView view, int pitNumber1) {
|
||||
RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(pitNumber1 - 1);
|
||||
// RoomPitBean pitBean = roomInfoResp.getRoom_info().getPit_list().get(pitNumber1 - 1);
|
||||
RoomPitBean pitBean = view.pitBean;
|
||||
|
||||
// 可选:点击事件处理
|
||||
Log.d("Wheat", "Clicked pit: " + pitNumber1);
|
||||
@@ -804,14 +806,21 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
@Override
|
||||
public void userOnlineStatus(List<UserOnlineStatusBean> list) {
|
||||
// if (list != null) {
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
// wheatLayoutSingManager.updateSingleOnlineWheat(list.get(i));
|
||||
// } else {
|
||||
// wheatLayoutManager1.updateSingleOnlineWheat(list.get(i));
|
||||
// }
|
||||
//// EventBus.getDefault().post(list.get(i));
|
||||
// }
|
||||
// }
|
||||
|
||||
if (list != null) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
wheatLayoutSingManager.updateSingleOnlineWheat(list.get(i));
|
||||
} else {
|
||||
wheatLayoutManager1.updateSingleOnlineWheat(list.get(i));
|
||||
}
|
||||
// EventBus.getDefault().post(list.get(i));
|
||||
String userOnlineStatusBean = list.get(i).getUser_id();
|
||||
CommonAppContext.getInstance().onlineMap.put(userOnlineStatusBean, list.get(i).getIs_online());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1337,9 +1346,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
|
||||
public void event1039(RoomMessageEvent message) {
|
||||
if (roomInfoRespPk == null || roomInfoRespPk.getPk_info() == null) {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
wheatLayoutSingManager.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
}
|
||||
// for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
// wheatLayoutSingManager.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
// }
|
||||
wheatLayoutSingManager.setUpData(message);
|
||||
} else {
|
||||
for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
wheatLayoutManager1.updateSingleWheat(roomInfoResp.getRoom_info().getPit_list().get(i), i + 1);
|
||||
|
||||
@@ -4,8 +4,13 @@ import android.content.Context;
|
||||
|
||||
import com.example.moduleroom.contacts.FriendshipRoomContacts;
|
||||
import com.xscm.moduleutil.base.BaseRoomPresenter;
|
||||
import com.xscm.moduleutil.bean.UserOnlineStatusBean;
|
||||
import com.xscm.moduleutil.bean.room.FriendUserBean;
|
||||
import com.xscm.moduleutil.http.BaseObserver;
|
||||
import com.xscm.moduleutil.http.RetrofitClient;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
@@ -96,4 +101,22 @@ public class FriendshipRoomPresenter extends BaseRoomPresenter<FriendshipRoomCon
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOnlineStatus(String userId, String roomid) {
|
||||
RetrofitClient.getInstance().userOnlineStatus(userId, roomid, new BaseObserver<List<UserOnlineStatusBean>>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<UserOnlineStatusBean> userOnlineStatusBean) {
|
||||
if (MvpRef==null){
|
||||
MvpRef=new WeakReference<>(mView);
|
||||
}
|
||||
MvpRef.get().userOnlineStatus(userOnlineStatusBean);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.tencent.imsdk.v2.V2TIMManager
|
||||
import java.util.*
|
||||
|
||||
//前台服务
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
@@ -93,7 +94,12 @@
|
||||
<activity android:name="com.tencent.qcloud.tuikit.tuichat.minimalistui.page.GroupNoticeMinimalistActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<!-- **************** Minimalist UI End **************** -->
|
||||
|
||||
<service
|
||||
android:name=".TUIChatService"
|
||||
android:authorities="${applicationId}.TUIChat.Init"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
tools:ignore="Instantiatable" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
Reference in New Issue
Block a user