feat:寻爱飘屏实现方案调整(改用新飘屏方案实现)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.chwl.app.avroom.activity;
|
||||
|
||||
import static android.view.View.VISIBLE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL;
|
||||
@@ -9,7 +8,6 @@ import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIF
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ROOM_PK;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_DRAW_GIFT_L5;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_ROOM_PK_NOTIFY;
|
||||
|
||||
@@ -42,7 +40,7 @@ import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chwl.app.notify.room.RoomNotify;
|
||||
import com.chwl.app.notify.RoomNotifyManager;
|
||||
import com.chwl.core.monsterhunting.bean.MonsterDataBean;
|
||||
import com.chwl.core.support.room.RoomWidget;
|
||||
import com.netease.nim.uikit.StatusBarUtil;
|
||||
@@ -95,8 +93,6 @@ import com.chwl.core.im.custom.bean.CustomAttachment;
|
||||
import com.chwl.core.im.custom.bean.FairyMsgAttachment;
|
||||
import com.chwl.core.im.custom.bean.NotifyH5Attachment;
|
||||
import com.chwl.core.im.custom.bean.NotifyH5Info;
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeInfo;
|
||||
import com.chwl.core.im.custom.bean.RoomLuckySeaAttachment;
|
||||
import com.chwl.core.im.custom.bean.RoomLuckySeaMsgBean;
|
||||
import com.chwl.core.im.custom.bean.RoomPKAttachment;
|
||||
@@ -153,7 +149,6 @@ import java.lang.ref.WeakReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Objects;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleObserver;
|
||||
@@ -222,7 +217,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
// 是否禁用VP滑动(true:不允许滑动;false:某些条件下可以滑动)
|
||||
private boolean viewPagerInputDisable;
|
||||
|
||||
private RoomNotify roomNotify;
|
||||
private RoomNotifyManager roomNotify;
|
||||
|
||||
public static void start(Context context, long roomUid) {
|
||||
startForFromType(context, roomUid, FROM_TYPE_NORMAL, null, null);
|
||||
@@ -502,7 +497,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
});
|
||||
|
||||
roomNotify = new RoomNotify(this);
|
||||
roomNotify = new RoomNotifyManager(this);
|
||||
roomNotify.setOnShowUserCard(new Function1<String, Unit>() {
|
||||
@Override
|
||||
public Unit invoke(String s) {
|
||||
@@ -1201,33 +1196,33 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
|
||||
roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
|
||||
roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
|
||||
roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
|
||||
roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
|
||||
roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
|
||||
roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
|
||||
if (AvRoomDataManager.get().isOpenPureMode()) {
|
||||
// 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
||||
if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
IMNetEaseManager.get().addMessages(message);
|
||||
}
|
||||
} else {
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
IMNetEaseManager.get().addMessages(message);
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.onNext(new RoomEvent()
|
||||
.setEvent(RoomEvent.BOX_NOTIFY_SVGA)
|
||||
.setChatRoomMessage(message));
|
||||
}
|
||||
}
|
||||
break;
|
||||
// case CUSTOM_MSG_BOX://寻爱之旅
|
||||
// if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
// RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
// RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
// roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
|
||||
// roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
|
||||
// roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
|
||||
// roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
|
||||
// roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
|
||||
// roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
|
||||
// roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
|
||||
// if (AvRoomDataManager.get().isOpenPureMode()) {
|
||||
// // 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
||||
// if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// }
|
||||
// } else {
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
// .onNext(new RoomEvent()
|
||||
// .setEvent(RoomEvent.BOX_NOTIFY_SVGA)
|
||||
// .setChatRoomMessage(message));
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT:
|
||||
if (baseProtocol.getSecond() == CustomAttachment.CUSTOM_MESS_TAROT_SENIOR_PRIZE_WINNING) {
|
||||
TarotMsgBean tarotMsgBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), TarotMsgBean.class);
|
||||
|
@@ -151,8 +151,8 @@ class RoomEffectBoxView @JvmOverloads constructor(
|
||||
.subscribe { roomEvent: RoomEvent? ->
|
||||
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
||||
when (roomEvent.event) {
|
||||
RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
// RoomEvent.BOX_NOTIFY -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
// RoomEvent.BOX_NOTIFY_SVGA -> addBoxNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.DATING_ALL_NOTIFY -> addDatingAllNotify(roomEvent.chatRoomMessage)
|
||||
RoomEvent.RADISH_NOTIFY,
|
||||
RoomEvent.RADISH_NOTIFY_SVGA -> addRadishNotify(roomEvent.chatRoomMessage)
|
||||
|
@@ -165,13 +165,13 @@ class RoomEffectView @JvmOverloads constructor(
|
||||
.subscribe { roomEvent: RoomEvent? ->
|
||||
if (roomEvent == null || AvRoomDataManager.get().isSelfGamePlaying) return@subscribe
|
||||
when (roomEvent.event) {
|
||||
RoomEvent.BOX_NOTIFY -> {//寻爱
|
||||
addPlayNotify(RoomEvent.BOX_NOTIFY, roomEvent.chatRoomMessage)
|
||||
}
|
||||
|
||||
RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱svga
|
||||
addPlayNotify(RoomEvent.BOX_NOTIFY_SVGA, roomEvent.chatRoomMessage)
|
||||
}
|
||||
// RoomEvent.BOX_NOTIFY -> {//寻爱
|
||||
// addPlayNotify(RoomEvent.BOX_NOTIFY, roomEvent.chatRoomMessage)
|
||||
// }
|
||||
//
|
||||
// RoomEvent.BOX_NOTIFY_SVGA -> {//寻爱svga
|
||||
// addPlayNotify(RoomEvent.BOX_NOTIFY_SVGA, roomEvent.chatRoomMessage)
|
||||
// }
|
||||
|
||||
RoomEvent.TAROT_NOTIFY,
|
||||
RoomEvent.TAROT_NOTIFY_SVGA -> {
|
||||
|
@@ -4,10 +4,8 @@ import static com.chwl.core.Constants.DEBUG_MAX_UID;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MESS_HEAD_NOBLE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_OPENNOBLE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MESS_SUB_RENEWNOBLE;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_BOX;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_FAIRY;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_GIFT_SERVER_ALL;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_LUCKY_SEA;
|
||||
@@ -50,7 +48,7 @@ import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chwl.app.notify.global.GlobalNotify;
|
||||
import com.chwl.app.notify.GlobalNotifyManager;
|
||||
import com.chwl.library.language.LanguageHelper;
|
||||
import com.google.gson.Gson;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
@@ -179,7 +177,7 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
if (roomEvent == null) return;
|
||||
onReceiveChatRoomEvent(roomEvent);
|
||||
}));
|
||||
GlobalNotify.INSTANCE.bindActivity(this);
|
||||
GlobalNotifyManager.INSTANCE.bindActivity(this);
|
||||
}
|
||||
|
||||
protected void onReceiveChatRoomEvent(RoomEvent roomEvent) {
|
||||
@@ -977,35 +975,35 @@ public abstract class BaseActivity extends RxAppCompatActivity
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||
// || this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|
||||
|| UserUtils.getUserInfo() == null)
|
||||
return;
|
||||
if (playEffectList == null) {
|
||||
playEffectList = new LinkedList<>();
|
||||
}
|
||||
RoomBoxPrizeInfo roomBoxPrizeInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
if (roomBoxPrizeInfo == null) return;
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||
playEffectInfo.setSecond(CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
playEffectInfo.setRoomBoxPrizeInfo(roomBoxPrizeInfo);
|
||||
playEffectList.add(playEffectInfo);
|
||||
if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||
// 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||
if (dataBean != null) {
|
||||
return;
|
||||
} else {
|
||||
playEffectDialog.dismiss();
|
||||
}
|
||||
} else {
|
||||
showPlayEffectDialog();
|
||||
}
|
||||
}
|
||||
break;
|
||||
// case CUSTOM_MSG_BOX://寻爱之旅
|
||||
// if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||
// if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||
//// || this instanceof TreasureBoxActivity || this instanceof HomeFairyActivity
|
||||
// || UserUtils.getUserInfo() == null)
|
||||
// return;
|
||||
// if (playEffectList == null) {
|
||||
// playEffectList = new LinkedList<>();
|
||||
// }
|
||||
// RoomBoxPrizeInfo roomBoxPrizeInfo = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
// if (roomBoxPrizeInfo == null) return;
|
||||
// if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
// PlayEffectInfo playEffectInfo = new PlayEffectInfo();
|
||||
// playEffectInfo.setSecond(CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
// playEffectInfo.setRoomBoxPrizeInfo(roomBoxPrizeInfo);
|
||||
// playEffectList.add(playEffectInfo);
|
||||
// if (playEffectDialog != null && playEffectDialog.isShowing()) {
|
||||
// // 如果当前以及有礼物弹窗在展示,则需要等到他 dismiss 后再显示下一个
|
||||
// PlayEffectInfo dataBean = playEffectList.peekFirst();
|
||||
// if (dataBean != null) {
|
||||
// return;
|
||||
// } else {
|
||||
// playEffectDialog.dismiss();
|
||||
// }
|
||||
// } else {
|
||||
// showPlayEffectDialog();
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case CustomAttachment.CUSTOM_MESS_TAROT:
|
||||
if (!isValid() || getWindow().getDecorView().getVisibility() != View.VISIBLE) return;
|
||||
if (this instanceof AddUserInfoActivity || this instanceof AVRoomActivity
|
||||
|
@@ -1,4 +1,4 @@
|
||||
package com.chwl.app.notify.global
|
||||
package com.chwl.app.notify
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -19,13 +19,19 @@ import com.chwl.app.ui.setting.ResetPasswordActivity
|
||||
import com.chwl.core.auth.AuthModel
|
||||
import com.chwl.core.bean.BaseProtocol
|
||||
import com.chwl.core.im.custom.bean.CustomAttachment
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeInfo
|
||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
import com.chwl.core.manager.IMNetEaseManager
|
||||
import com.chwl.core.noble.bean.AllServiceGiftProtocol
|
||||
import com.example.lib_utils.log.ILog
|
||||
import com.google.gson.Gson
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.netease.nimlib.sdk.NIMSDK
|
||||
import com.netease.nimlib.sdk.Observer
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage
|
||||
import com.netease.nimlib.sdk.msg.model.BroadcastMessage
|
||||
import kotlinx.coroutines.cancel
|
||||
|
||||
@@ -33,7 +39,7 @@ import kotlinx.coroutines.cancel
|
||||
* Created by Max on 2024/3/20 19:30
|
||||
* Desc:
|
||||
**/
|
||||
object GlobalNotify : Observer<BroadcastMessage>, ILog {
|
||||
object GlobalNotifyManager : Observer<BroadcastMessage>, ILog {
|
||||
|
||||
private val blackActivityList = listOf(
|
||||
SplashActivity::class.java,
|
||||
@@ -128,6 +134,7 @@ object GlobalNotify : Observer<BroadcastMessage>, ILog {
|
||||
|
||||
private fun onReceivedNimBroadcastMessage(protocol: BaseProtocol<*>) {
|
||||
if (protocol.first == CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY) {
|
||||
// 通用飘屏
|
||||
if (protocol.second == CustomAttachment.CUSTOM_MSG_TEMPLATE_NOTIFY_ALL) {
|
||||
val data = Gson().fromJson<RoomTemplateNotifyMsgBean>(
|
||||
protocol.data.toString(),
|
||||
@@ -136,6 +143,7 @@ object GlobalNotify : Observer<BroadcastMessage>, ILog {
|
||||
queue.addLast(data)
|
||||
}
|
||||
} else if (protocol.first == CustomAttachment.CUSTOM_MSG_HEADER_TYPE_GIFT) {
|
||||
// 礼物
|
||||
if (protocol.second == CustomAttachment.CUSTOM_MSG_ALL_SERVICE_GIFT) {
|
||||
val data = Gson().fromJson<AllServiceGiftProtocol.DataBean>(
|
||||
protocol.data.toString(),
|
||||
@@ -143,6 +151,48 @@ object GlobalNotify : Observer<BroadcastMessage>, ILog {
|
||||
)
|
||||
queue.addLast(data)
|
||||
}
|
||||
} else if (protocol.first == CustomAttachment.CUSTOM_MSG_BOX) {
|
||||
// 寻爱之旅
|
||||
if (protocol.second == CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
handleFindLive(protocol)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleFindLive(protocol: BaseProtocol<*>) {
|
||||
val data = Gson().fromJson<RoomBoxPrizeInfo>(
|
||||
protocol.data.toString(),
|
||||
RoomBoxPrizeInfo::class.java
|
||||
)
|
||||
val roomBoxPrizeAttachment = RoomBoxPrizeAttachment(
|
||||
CustomAttachment.CUSTOM_MSG_BOX,
|
||||
CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA
|
||||
)
|
||||
roomBoxPrizeAttachment.uid = data.uid
|
||||
roomBoxPrizeAttachment.prizeName = data.prizeName
|
||||
roomBoxPrizeAttachment.nick = data.nick
|
||||
roomBoxPrizeAttachment.boxTypeStr = data.boxTypeStr
|
||||
roomBoxPrizeAttachment.roomUid = data.roomUid
|
||||
roomBoxPrizeAttachment.prizeNum = data.prizeNum
|
||||
roomBoxPrizeAttachment.userLevelLimit = data.userLevelLimit
|
||||
val roomId = AvRoomDataManager.get().roomId
|
||||
var message: ChatRoomMessage? = null
|
||||
if (roomId > 0) {
|
||||
message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
roomId.toString(),
|
||||
roomBoxPrizeAttachment
|
||||
)
|
||||
}
|
||||
if (AvRoomDataManager.get().isOpenPureMode) {
|
||||
// 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
||||
if (message != null && roomBoxPrizeAttachment.uid == AuthModel.get().currentUid) {
|
||||
IMNetEaseManager.get().addMessages(message)
|
||||
}
|
||||
} else {
|
||||
if (message != null) {
|
||||
IMNetEaseManager.get().addMessages(message)
|
||||
}
|
||||
queue.addLast(roomBoxPrizeAttachment)
|
||||
}
|
||||
}
|
||||
}
|
52
app/src/main/java/com/chwl/app/notify/NotifyAdapter.kt
Normal file
52
app/src/main/java/com/chwl/app/notify/NotifyAdapter.kt
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.chwl.app.notify
|
||||
|
||||
import android.content.Context
|
||||
import com.chwl.app.notify.views.FindLoveImageNotify
|
||||
import com.chwl.app.notify.views.FindLoveSvgaNotify
|
||||
import com.chwl.app.notify.views.TemplateImageNotify
|
||||
import com.chwl.app.notify.views.TemplateSvgaNotify
|
||||
import com.chwl.app.notify.views.GiftNotify
|
||||
import com.chwl.app.notify.views.TestNotify
|
||||
import com.chwl.app.support.float.FloatView
|
||||
import com.chwl.app.support.float.FloatViewAdapter
|
||||
import com.chwl.app.support.float.FloatWindow
|
||||
import com.chwl.core.im.custom.bean.CustomAttachment
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment
|
||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean
|
||||
import com.chwl.core.noble.bean.AllServiceGiftProtocol
|
||||
|
||||
|
||||
class NotifyAdapter : FloatViewAdapter {
|
||||
var onShowUserCard: ((String) -> Unit)? = null
|
||||
|
||||
override fun onCreateFloatView(context: Context, item: Any): FloatView? {
|
||||
if (item is RoomTemplateNotifyMsgBean) {
|
||||
if (item.resourceType == RoomTemplateNotifyMsgBean.TYPE_IMAGE) {
|
||||
return TemplateImageNotify(context).apply {
|
||||
onShowUserCard = this@NotifyAdapter.onShowUserCard
|
||||
}
|
||||
} else if (item.resourceType == RoomTemplateNotifyMsgBean.TYPE_SVGA) {
|
||||
return TemplateSvgaNotify(context).apply {
|
||||
onShowUserCard = this@NotifyAdapter.onShowUserCard
|
||||
}
|
||||
}
|
||||
} else if (item is RoomBoxPrizeAttachment) {
|
||||
if (item.second == CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
return FindLoveSvgaNotify(context)
|
||||
} else if (item.second == CustomAttachment.CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY) {
|
||||
return FindLoveImageNotify(context)
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
} else if (item is AllServiceGiftProtocol.DataBean) {
|
||||
return GiftNotify(context)
|
||||
} else if (item is String) {
|
||||
return TestNotify(context)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun onBindFloatView(window: FloatWindow, floatView: FloatView, item: Any) {
|
||||
floatView.onAttached(window, item)
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.chwl.app.notify.room
|
||||
package com.chwl.app.notify
|
||||
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.Lifecycle
|
||||
@@ -6,12 +6,11 @@ import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.chwl.app.base.TitleBar
|
||||
import com.chwl.app.notify.global.GlobalNotify
|
||||
import com.chwl.app.notify.global.NotifyAdapter
|
||||
import com.chwl.app.support.float.DoubleQueue
|
||||
import com.chwl.app.support.float.FloatWindowEngine
|
||||
import com.chwl.app.support.float.SimpleFloatWindow
|
||||
import com.chwl.app.support.float.SimpleFloatQueue
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment
|
||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyAttachment
|
||||
import com.chwl.core.manager.AvRoomDataManager
|
||||
import com.chwl.core.manager.IMNetEaseManager
|
||||
@@ -25,12 +24,13 @@ import kotlinx.coroutines.cancel
|
||||
* Created by Max on 2024/3/22 14:47
|
||||
* Desc:
|
||||
**/
|
||||
class RoomNotify(activity: FragmentActivity) : LifecycleEventObserver, ILog {
|
||||
class RoomNotifyManager(activity: FragmentActivity) : LifecycleEventObserver, ILog {
|
||||
val queue = SimpleFloatQueue()
|
||||
|
||||
private val compositeDisposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
var onShowUserCard: ((String) -> Unit)? = null
|
||||
|
||||
init {
|
||||
bindActivity(activity)
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class RoomNotify(activity: FragmentActivity) : LifecycleEventObserver, ILog {
|
||||
statusHeight = ScreenUtil.getStatusBarHeight(activity)
|
||||
}
|
||||
widget.getView().setPadding(0, statusHeight, 0, 0)
|
||||
val queue = DoubleQueue(GlobalNotify.queue, queue)
|
||||
val queue = DoubleQueue(GlobalNotifyManager.queue, queue)
|
||||
val engine = FloatWindowEngine(widget, queue)
|
||||
engine.interceptor = { _ ->
|
||||
if (AvRoomDataManager.get().isSelfGamePlaying) {
|
||||
@@ -105,6 +105,12 @@ class RoomNotify(activity: FragmentActivity) : LifecycleEventObserver, ILog {
|
||||
val data = attachment?.getTemplateMsg() ?: return
|
||||
queue.addLast(data)
|
||||
}
|
||||
|
||||
RoomEvent.BOX_NOTIFY, RoomEvent.BOX_NOTIFY_SVGA -> {
|
||||
val attachment =
|
||||
roomEvent.chatRoomMessage.attachment as? RoomBoxPrizeAttachment ?: return
|
||||
queue.addLast(attachment)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,36 +0,0 @@
|
||||
package com.chwl.app.notify.global
|
||||
|
||||
import android.content.Context
|
||||
import com.chwl.app.support.float.FloatView
|
||||
import com.chwl.app.support.float.FloatViewAdapter
|
||||
import com.chwl.app.support.float.FloatWindow
|
||||
import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean
|
||||
import com.chwl.core.noble.bean.AllServiceGiftProtocol
|
||||
|
||||
|
||||
class NotifyAdapter : FloatViewAdapter {
|
||||
var onShowUserCard: ((String) -> Unit)? = null
|
||||
|
||||
override fun onCreateFloatView(context: Context, item: Any): FloatView? {
|
||||
if (item is RoomTemplateNotifyMsgBean) {
|
||||
if (item.resourceType == "IMAGE") {
|
||||
return TemplateImageNotifyView(context).apply {
|
||||
onShowUserCard = this@NotifyAdapter.onShowUserCard
|
||||
}
|
||||
} else if (item.resourceType == "SVGA") {
|
||||
return TemplateSvgaNotifyView(context).apply {
|
||||
onShowUserCard = this@NotifyAdapter.onShowUserCard
|
||||
}
|
||||
}
|
||||
} else if (item is AllServiceGiftProtocol.DataBean) {
|
||||
return GiftNotifyView(context)
|
||||
} else if (item is String) {
|
||||
return TestNotifyView(context)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun onBindFloatView(window: FloatWindow, floatView: FloatView, item: Any) {
|
||||
floatView.onAttached(window, item)
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
package com.chwl.app.notify.views
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.support.float.BaseFloatView
|
||||
import com.chwl.app.utils.SpannableBuilder
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment
|
||||
import com.chwl.core.utils.extension.subAndReplaceDot
|
||||
import com.chwl.library.utils.ResUtil
|
||||
|
||||
|
||||
class FindLoveImageNotify(context: Context) : BaseFloatView(context) {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_template_notify_image, this, true)
|
||||
}
|
||||
|
||||
override fun onBind(item: Any) {
|
||||
val data = item as? RoomBoxPrizeAttachment
|
||||
if (data == null) {
|
||||
requestRemoveSelf()
|
||||
return
|
||||
}
|
||||
val textView = rootView.findViewById<TextView>(R.id.tv_text)
|
||||
textView.textSize = 12f
|
||||
textView.setTextColor(Color.WHITE)
|
||||
val text = SpannableBuilder()
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_08),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
data.nick.subAndReplaceDot(8),
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.treasure_in_find_love) + ResUtil.getString(
|
||||
R.string.avroom_widget_roomeffectview_09
|
||||
), ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
data.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
if (data.prizeNum > 1) {
|
||||
text.append("x" + data.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
}
|
||||
textView.text = text.build()
|
||||
val bgView = rootView.findViewById<ImageView>(R.id.iv_bg)
|
||||
bgView.setImageResource(R.drawable.bg_box_notice)
|
||||
startEnterAnim()
|
||||
startDelayRemove()
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
package com.chwl.app.notify.views
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.TextView
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.common.svga.SimpleSvgaCallback
|
||||
import com.chwl.app.support.float.BaseFloatView
|
||||
import com.chwl.app.utils.SpannableBuilder
|
||||
import com.chwl.core.im.custom.bean.RoomBoxPrizeAttachment
|
||||
import com.chwl.library.utils.ResUtil
|
||||
import com.chwl.library.utils.StringUtils
|
||||
import com.opensource.svgaplayer.SVGADrawable
|
||||
import com.opensource.svgaplayer.SVGAImageView
|
||||
import com.opensource.svgaplayer.SVGAParser
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity
|
||||
|
||||
|
||||
class FindLoveSvgaNotify(context: Context) : BaseFloatView(context) {
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_find_love_notify_svga, this, true)
|
||||
}
|
||||
|
||||
override fun onBind(item: Any) {
|
||||
val data = item as? RoomBoxPrizeAttachment
|
||||
if (data == null) {
|
||||
requestRemoveSelf()
|
||||
return
|
||||
}
|
||||
val svgaView = rootView.findViewById<SVGAImageView>(R.id.iv_bg)
|
||||
val textView = rootView.findViewById<TextView>(R.id.tv_text)
|
||||
val text = SpannableBuilder()
|
||||
.append(
|
||||
ResUtil.getString(R.string.avroom_widget_roomeffectview_011),
|
||||
ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
StringUtils.abbreviate(data.nick, 8) + " ",
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
.append(
|
||||
ResUtil.getString(R.string.treasure_in_find_love) + ResUtil.getString(
|
||||
R.string.avroom_widget_roomeffectview_012
|
||||
), ForegroundColorSpan(Color.WHITE)
|
||||
)
|
||||
.append(
|
||||
data.prizeName,
|
||||
ForegroundColorSpan(resources.getColor(R.color.notice_nick))
|
||||
)
|
||||
if (data.prizeNum > 1) {
|
||||
text.append("x" + data.prizeNum, ForegroundColorSpan(Color.WHITE))
|
||||
}
|
||||
svgaView.callback = object : SimpleSvgaCallback() {
|
||||
override fun onFinished() {
|
||||
startDelayRemove(0)
|
||||
}
|
||||
}
|
||||
SVGAParser.shareParser()
|
||||
.decodeFromAssets("svga/box_notify.svga", object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
this@FindLoveSvgaNotify.startEnterAnim()
|
||||
val drawable = SVGADrawable(videoItem)
|
||||
svgaView.setImageDrawable(drawable)
|
||||
svgaView.stepToFrame(0, true)
|
||||
textView.text = text.build()
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
requestRemoveSelf()
|
||||
}
|
||||
}, null)
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.chwl.app.notify.global
|
||||
package com.chwl.app.notify.views
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
@@ -18,7 +18,7 @@ import com.example.lib_utils.ktx.getColorById
|
||||
import com.example.lib_utils.ktx.singleClick
|
||||
import com.example.lib_utils.spannable.SpannableTextBuilder
|
||||
|
||||
class GiftNotifyView(context: Context) : BaseFloatView(context) {
|
||||
class GiftNotify(context: Context) : BaseFloatView(context) {
|
||||
private val view = TextView(context)
|
||||
|
||||
private var binding: LayoutGiftNotifyBinding? = null
|
||||
@@ -53,7 +53,7 @@ class GiftNotifyView(context: Context) : BaseFloatView(context) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
this@GiftNotifyView.isVisible = false
|
||||
this@GiftNotify.isVisible = false
|
||||
post {
|
||||
requestRemoveSelf()
|
||||
}
|
@@ -1,12 +1,10 @@
|
||||
package com.chwl.app.notify.global
|
||||
package com.chwl.app.notify.views
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import com.bumptech.glide.request.target.CustomTarget
|
||||
@@ -20,7 +18,7 @@ import com.chwl.core.im.custom.bean.RoomTemplateNotifyMsgBean
|
||||
import com.netease.nim.uikit.support.glide.GlideApp
|
||||
|
||||
|
||||
class TemplateImageNotifyView(context: Context) : BaseFloatView(context),
|
||||
class TemplateImageNotify(context: Context) : BaseFloatView(context),
|
||||
TemplateMessageAdapter.Listener {
|
||||
|
||||
private val templateMessageAdapter = TemplateMessageAdapter(this)
|
||||
@@ -37,7 +35,7 @@ class TemplateImageNotifyView(context: Context) : BaseFloatView(context),
|
||||
requestRemoveSelf()
|
||||
return
|
||||
}
|
||||
if (data.resourceType != "IMAGE") {
|
||||
if (data.resourceType != RoomTemplateNotifyMsgBean.TYPE_IMAGE) {
|
||||
requestRemoveSelf()
|
||||
return
|
||||
}
|
||||
@@ -76,7 +74,7 @@ class TemplateImageNotifyView(context: Context) : BaseFloatView(context),
|
||||
rootView.setOnClickListener(clickAction)
|
||||
textView.setOnClickListener(clickAction)
|
||||
}
|
||||
startDelayRemove(5000)
|
||||
startDelayRemove()
|
||||
}
|
||||
|
||||
override fun onLoadCleared(placeholder: Drawable?) {
|
||||
@@ -90,29 +88,6 @@ class TemplateImageNotifyView(context: Context) : BaseFloatView(context),
|
||||
})
|
||||
}
|
||||
|
||||
private fun startEnterAnim() {
|
||||
val inAnimation = AnimationUtils.loadAnimation(context, R.anim.anim_right_in)
|
||||
this.startAnimation(inAnimation)
|
||||
}
|
||||
|
||||
private fun startDelayRemove(delayMillis: Long) {
|
||||
postDelayed({
|
||||
val outAnimation = AnimationUtils.loadAnimation(context, R.anim.anim_left_out)
|
||||
outAnimation.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationStart(animation: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
requestRemoveSelf()
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animation?) {
|
||||
}
|
||||
})
|
||||
this.startAnimation(outAnimation)
|
||||
}, delayMillis)
|
||||
}
|
||||
|
||||
override fun onShowUserCard(uid: String) {
|
||||
onShowUserCard?.invoke(uid)
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.chwl.app.notify.global
|
||||
package com.chwl.app.notify.views
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
@@ -20,7 +20,7 @@ import com.opensource.svgaplayer.SVGAVideoEntity
|
||||
import java.net.URL
|
||||
|
||||
|
||||
class TemplateSvgaNotifyView(context: Context) : BaseFloatView(context),
|
||||
class TemplateSvgaNotify(context: Context) : BaseFloatView(context),
|
||||
TemplateMessageAdapter.Listener {
|
||||
|
||||
private val templateMessageAdapter = TemplateMessageAdapter(this)
|
||||
@@ -40,7 +40,7 @@ class TemplateSvgaNotifyView(context: Context) : BaseFloatView(context),
|
||||
requestRemoveSelf()
|
||||
return
|
||||
}
|
||||
if (data.resourceType != "SVGA") {
|
||||
if (data.resourceType != RoomTemplateNotifyMsgBean.TYPE_SVGA) {
|
||||
requestRemoveSelf()
|
||||
return
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package com.chwl.app.notify.global
|
||||
package com.chwl.app.notify.views
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
@@ -10,7 +10,7 @@ import androidx.core.view.isVisible
|
||||
import com.chwl.app.R
|
||||
import com.chwl.app.support.float.BaseFloatView
|
||||
|
||||
class TestNotifyView(context: Context) : BaseFloatView(context) {
|
||||
class TestNotify(context: Context) : BaseFloatView(context) {
|
||||
private val view = TextView(context)
|
||||
|
||||
init {
|
||||
@@ -37,7 +37,7 @@ class TestNotifyView(context: Context) : BaseFloatView(context) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
this@TestNotifyView.isVisible = false
|
||||
this@TestNotify.isVisible = false
|
||||
post {
|
||||
requestRemoveSelf()
|
||||
}
|
@@ -3,8 +3,11 @@ package com.chwl.app.support.float
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.animation.Animation
|
||||
import android.view.animation.AnimationUtils
|
||||
import androidx.annotation.CallSuper
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.chwl.app.R
|
||||
|
||||
|
||||
abstract class BaseFloatView : ConstraintLayout, FloatView {
|
||||
@@ -52,4 +55,28 @@ abstract class BaseFloatView : ConstraintLayout, FloatView {
|
||||
override fun getView(): View {
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
protected open fun startEnterAnim() {
|
||||
val inAnimation = AnimationUtils.loadAnimation(context, R.anim.anim_right_in)
|
||||
this.startAnimation(inAnimation)
|
||||
}
|
||||
|
||||
protected open fun startDelayRemove(delayMillis: Long = 5000) {
|
||||
postDelayed({
|
||||
val outAnimation = AnimationUtils.loadAnimation(context, R.anim.anim_left_out)
|
||||
outAnimation.setAnimationListener(object : Animation.AnimationListener {
|
||||
override fun onAnimationStart(animation: Animation?) {
|
||||
}
|
||||
|
||||
override fun onAnimationEnd(animation: Animation?) {
|
||||
requestRemoveSelf()
|
||||
}
|
||||
|
||||
override fun onAnimationRepeat(animation: Animation?) {
|
||||
}
|
||||
})
|
||||
this.startAnimation(outAnimation)
|
||||
}, delayMillis)
|
||||
}
|
||||
}
|
@@ -75,6 +75,7 @@ open class FloatWindowEngine(
|
||||
|
||||
protected open fun handleFirstItem() {
|
||||
if (window.canShow()) {
|
||||
logD("handleFirstItem() pollFirst")
|
||||
queue.pollFirst()?.let {
|
||||
window.onShow(it.data)
|
||||
}
|
||||
|
@@ -12,8 +12,8 @@ import com.chwl.app.UIHelper
|
||||
import com.chwl.app.base.BaseViewBindingActivity
|
||||
import com.chwl.app.common.widget.dialog.DialogManager.OkCancelDialogListener
|
||||
import com.chwl.app.databinding.ActivitySettingBinding
|
||||
import com.chwl.app.notify.global.GlobalNotify
|
||||
import com.chwl.app.notify.room.RoomNotify
|
||||
import com.chwl.app.notify.GlobalNotifyManager
|
||||
import com.chwl.app.notify.RoomNotifyManager
|
||||
import com.chwl.app.ui.im.avtivity.BlackListManageActivity
|
||||
import com.chwl.app.ui.language.LanguageActivity
|
||||
import com.chwl.app.ui.login.BindPhoneActivity
|
||||
@@ -50,14 +50,14 @@ import kotlin.random.Random
|
||||
class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.OnClickListener,
|
||||
ILog {
|
||||
|
||||
private var notify: RoomNotify? = null
|
||||
private var notify: RoomNotifyManager? = null
|
||||
|
||||
override fun init() {
|
||||
EventBus.getDefault().register(this)
|
||||
initWhiteTitleBar(ResUtil.getString(R.string.me_setting))
|
||||
initView()
|
||||
initListener()
|
||||
notify = RoomNotify(this)
|
||||
notify = RoomNotifyManager(this)
|
||||
notify?.start()
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class SettingActivity : BaseViewBindingActivity<ActivitySettingBinding>(), View.
|
||||
// CommonWebViewActivity.start(this,"https://api.molistar.xyz/molistar/activity/2024-invitationFission/index.html")
|
||||
// startActivity(Intent(this, LanguageActivity::class.java))
|
||||
|
||||
GlobalNotify.queue.addLast("G#" + i)
|
||||
GlobalNotifyManager.queue.addLast("G#" + i)
|
||||
notify?.queue?.addLast("R#" + i)
|
||||
i++
|
||||
debugTemplate()
|
||||
|
39
app/src/main/res/layout/layout_find_love_notify_svga.xml
Normal file
39
app/src/main/res/layout/layout_find_love_notify_svga.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/iv_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:clearsAfterDetached="true"
|
||||
app:layout_constraintDimensionRatio="75:11"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:loopCount="1"
|
||||
tools:src="@drawable/bg_box_notice" />
|
||||
|
||||
<com.coorchice.library.SuperTextView
|
||||
android:id="@+id/tv_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="center"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:lineSpacingExtra="0dp"
|
||||
android:lineSpacingMultiplier="0.8"
|
||||
android:maxLines="2"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_bg"
|
||||
app:layout_constraintEnd_toEndOf="@id/iv_bg"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_bg"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_bg"
|
||||
app:layout_constraintWidth_percent="0.65"
|
||||
tools:layout_height="wrap_content"
|
||||
tools:text="Message" />
|
||||
</merge>
|
@@ -461,33 +461,33 @@ public class TreasureBoxActivity extends BaseBindingActivity<ActivityTreasureBox
|
||||
}
|
||||
if (baseProtocol == null) return;
|
||||
switch (baseProtocol.getFirst()) {
|
||||
case CUSTOM_MSG_BOX://寻爱之旅
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
|
||||
roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
|
||||
roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
|
||||
roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
|
||||
roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
|
||||
roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
|
||||
roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
|
||||
if (AvRoomDataManager.get().isOpenPureMode()) {
|
||||
// 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
||||
if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
IMNetEaseManager.get().addMessages(message);
|
||||
}
|
||||
} else {
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
IMNetEaseManager.get().addMessages(message);
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.onNext(new RoomEvent()
|
||||
.setEvent(RoomEvent.BOX_NOTIFY_SVGA)
|
||||
.setChatRoomMessage(message));
|
||||
}
|
||||
}
|
||||
break;
|
||||
// case CUSTOM_MSG_BOX://寻爱之旅
|
||||
// if (baseProtocol.getSecond() == CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA) {
|
||||
// RoomBoxPrizeAttachment roomBoxPrizeAttachment = new RoomBoxPrizeAttachment(CUSTOM_MSG_BOX, CUSTOM_MSG_SUB_BOX_ALL_ROOM_NOTIFY_BY_SVGA);
|
||||
// RoomBoxPrizeInfo roomBoxPrizeBean = JSON.parseObject(String.valueOf(baseProtocol.getData()), RoomBoxPrizeInfo.class);
|
||||
// roomBoxPrizeAttachment.setUid(roomBoxPrizeBean.getUid());
|
||||
// roomBoxPrizeAttachment.setPrizeName(roomBoxPrizeBean.getPrizeName());
|
||||
// roomBoxPrizeAttachment.setNick(roomBoxPrizeBean.getNick());
|
||||
// roomBoxPrizeAttachment.setBoxTypeStr(roomBoxPrizeBean.getBoxTypeStr());
|
||||
// roomBoxPrizeAttachment.setRoomUid(roomBoxPrizeBean.getRoomUid());
|
||||
// roomBoxPrizeAttachment.setPrizeNum(roomBoxPrizeBean.getPrizeNum());
|
||||
// roomBoxPrizeAttachment.setUserLevelLimit(roomBoxPrizeBean.getUserLevelLimit());
|
||||
// if (AvRoomDataManager.get().isOpenPureMode()) {
|
||||
// // 純凈模式打開後,僅能看跟自己相關的砸蛋消息
|
||||
// if (Objects.equals(roomBoxPrizeAttachment.getUid(), AuthModel.get().getCurrentUid())) {
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// }
|
||||
// } else {
|
||||
// ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(String.valueOf(AvRoomDataManager.get().getRoomId()), roomBoxPrizeAttachment);
|
||||
// IMNetEaseManager.get().addMessages(message);
|
||||
// IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
// .onNext(new RoomEvent()
|
||||
// .setEvent(RoomEvent.BOX_NOTIFY_SVGA)
|
||||
// .setChatRoomMessage(message));
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
case CUSTOM_MSG_LUCKY_SEA://星级厨房
|
||||
if (baseProtocol.getSecond() == CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL) {
|
||||
RoomLuckySeaAttachment attachment = new RoomLuckySeaAttachment(CUSTOM_MSG_LUCKY_SEA, CUSTOM_MSG_LUCKY_SEA_GIFT_SERVER_ALL);
|
||||
|
@@ -23,4 +23,16 @@ class I18N : HashMap<String, String>(), Serializable {
|
||||
content
|
||||
}
|
||||
}
|
||||
|
||||
fun setZH(value: String) {
|
||||
put(LanguageHelper.ZH, value)
|
||||
}
|
||||
|
||||
fun setEN(value: String) {
|
||||
put(LanguageHelper.EN, value)
|
||||
}
|
||||
|
||||
fun setAR(value: String) {
|
||||
put(LanguageHelper.AR, value)
|
||||
}
|
||||
}
|
@@ -1,6 +1,10 @@
|
||||
package com.chwl.core.im.custom.bean
|
||||
|
||||
class RoomTemplateNotifyMsgBean : TemplateMessage() {
|
||||
companion object {
|
||||
const val TYPE_SVGA = "SVGA"
|
||||
const val TYPE_IMAGE = "IMAGE"
|
||||
}
|
||||
var fontSize: Int? = null
|
||||
|
||||
// IMAGE、SVGA
|
||||
|
@@ -14,6 +14,9 @@ import java.util.*
|
||||
* Desc:语言助手
|
||||
*/
|
||||
object LanguageHelper : ILog {
|
||||
const val ZH = "zh"
|
||||
const val EN = "en"
|
||||
const val AR = "ar"
|
||||
|
||||
private var currentLocale: Locale? = null
|
||||
|
||||
@@ -51,13 +54,13 @@ object LanguageHelper : ILog {
|
||||
fun getCurrentLanguageType(): String {
|
||||
val locale = getCurrentLanguage()
|
||||
return if (locale == Locale.ENGLISH) {
|
||||
"en"
|
||||
EN
|
||||
} else if (locale == Locale.TRADITIONAL_CHINESE) {
|
||||
"zh"
|
||||
ZH
|
||||
} else if (locale.language.equals("ar", true)) {
|
||||
return "ar"
|
||||
return AR
|
||||
} else {
|
||||
"en"
|
||||
EN
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,15 +70,15 @@ object LanguageHelper : ILog {
|
||||
*/
|
||||
fun getLocaleByLanguageType(language: String?): Locale? {
|
||||
return when (language) {
|
||||
"zh" -> {
|
||||
ZH -> {
|
||||
Locale.TRADITIONAL_CHINESE
|
||||
}
|
||||
|
||||
"en" -> {
|
||||
EN -> {
|
||||
Locale.ENGLISH
|
||||
}
|
||||
|
||||
"ar" -> {
|
||||
AR -> {
|
||||
Locale("ar")
|
||||
}
|
||||
|
||||
@@ -172,15 +175,15 @@ object LanguageHelper : ILog {
|
||||
filePrinter = true
|
||||
)
|
||||
when (locale.language) {
|
||||
"ar" -> {
|
||||
AR -> {
|
||||
return Locale("ar")
|
||||
}
|
||||
|
||||
"en" -> {
|
||||
EN -> {
|
||||
return Locale.ENGLISH
|
||||
}
|
||||
|
||||
"zh" -> {
|
||||
ZH -> {
|
||||
return Locale.TRADITIONAL_CHINESE
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user