新增房间新用户打招呼弹窗
This commit is contained in:
@@ -57,6 +57,7 @@ import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.widget.CircleImageView;
|
||||
import com.yizhuan.erban.common.widget.CustomImageSpan;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.home.dialog.HelloMessageDialog;
|
||||
import com.yizhuan.erban.ui.patriarch.help.LimitEnterRoomHelper;
|
||||
import com.yizhuan.erban.ui.pay.ChargeActivity;
|
||||
import com.yizhuan.erban.ui.user.UserInfoActivity;
|
||||
@@ -75,6 +76,7 @@ import com.yizhuan.xchat_android_core.DemoCache;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.auth.event.LogoutEvent;
|
||||
import com.yizhuan.xchat_android_core.bean.BaseProtocol;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPKAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||
@@ -125,6 +127,7 @@ import java.lang.ref.WeakReference;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -968,6 +971,9 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
//获取管理员
|
||||
getMvpPresenter().getNormalChatMember();
|
||||
getMvpPresenter().getSuperAdminList();
|
||||
if (fromType == FROM_TYPE_HELLO) {
|
||||
getMvpPresenter().checkHelloMessage();
|
||||
}
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
|
||||
@@ -996,6 +1002,11 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showHelloMessageDialog(HelloMessageInfo helloMessageInfo) {
|
||||
HelloMessageDialog.Companion.newInstance(helloMessageInfo).show(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dismissLoadingDialog() {
|
||||
if (mLoadingDialog != null && mLoadingDialog.isShowing()) {
|
||||
|
@@ -28,6 +28,8 @@ import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomMicInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.channel_page.model.ChannelPageModel;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPkBean;
|
||||
import com.yizhuan.xchat_android_core.manager.AudioEngineManager;
|
||||
@@ -154,17 +156,17 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
getMvpView().enterRoomSuccess();
|
||||
}
|
||||
mAvRoomModel.userRoomIn(
|
||||
String.valueOf(uid),
|
||||
roomInfo.getUid(),
|
||||
fromType == AVRoomActivity.FROM_TYPE_GAME_RECOMMEND ? 1 : 0
|
||||
, fromUid)
|
||||
String.valueOf(uid),
|
||||
roomInfo.getUid(),
|
||||
fromType == AVRoomActivity.FROM_TYPE_GAME_RECOMMEND ? 1 : 0
|
||||
, fromUid)
|
||||
.subscribe((stringServiceResult) -> EventBus.getDefault().post(new AudioPartyOpenEvent()));
|
||||
}, this::dealEnterRoomError);
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void initAnotherPKData(){
|
||||
if (AvRoomDataManager.get().isOpenAnotherPKMode()){
|
||||
private void initAnotherPKData() {
|
||||
if (AvRoomDataManager.get().isOpenAnotherPKMode()) {
|
||||
RoomPKModel.INSTANCE.getRoomPKData(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(roomPkBean -> AvRoomDataManager.get().roomPkLiveData.setValue(roomPkBean));
|
||||
@@ -227,10 +229,10 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
|
||||
//进入房间失败发送阿里log
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_CHANNEL
|
||||
)
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_IM_LOG,
|
||||
LogProtocol.Event.EVENT_IM_CHANNEL
|
||||
)
|
||||
.append("roomUid", roomUid)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("type", "1")
|
||||
@@ -369,10 +371,10 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
}
|
||||
//获取房间信息失败 发送log 到阿里
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_ROOM_GET
|
||||
)
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_ROOM_GET
|
||||
)
|
||||
.append("targetUid", uId)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("error", "{code:" + "" + " reason:" + " RoomInfo == null || RoomInfo.getRoomId() == 0" + "}"));
|
||||
@@ -407,10 +409,10 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
|
||||
//获取房间信息失败 发送log 到阿里
|
||||
StatisticManager.Instance().sendAliyunLog(LogFactory.create(
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_ROOM_GET
|
||||
)
|
||||
LogProtocol.LogLevel.LEVEL_ERROR,
|
||||
LogProtocol.Topic.TOPIC_BUSINESS_LOG,
|
||||
LogProtocol.Event.EVENT_ROOM_GET
|
||||
)
|
||||
.append("targetUid", uId)
|
||||
.append("uid", String.valueOf(AuthModel.get().getCurrentUid()))
|
||||
.append("error", "{code:" + roomResult.getCode()
|
||||
@@ -457,6 +459,25 @@ public class AvRoomPresenter extends BaseMvpPresenter<IAvRoomView> {
|
||||
.subscribe(chatRoomMembers -> AvRoomDataManager.get().setAllRoomSuperAdminList(chatRoomMembers));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否需要显示新用户打招呼消息弹窗
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
public void checkHelloMessage() {
|
||||
|
||||
if (AvRoomDataManager.get().mCurrentRoomInfo == null) return;
|
||||
|
||||
Single.timer(5, TimeUnit.SECONDS)
|
||||
.flatMap(aLong -> ChannelPageModel.get().checkHelloMessage())
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(helloMessageInfo -> {
|
||||
if (getMvpView() != null && helloMessageInfo.getRoomPopup()) {
|
||||
getMvpView().showHelloMessageDialog(helloMessageInfo);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void startGetOnlineMemberNumberJob() {
|
||||
Observable.interval(1, 10, TimeUnit.SECONDS, Schedulers.from(ThreadPoolManager.instance().getScheduleExecutor()))
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.yizhuan.erban.avroom.view;
|
||||
|
||||
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.monsterhunting.bean.MonsterInfo;
|
||||
import com.yizhuan.xchat_android_core.redPacket.bean.ActionDialogInfo;
|
||||
@@ -41,6 +42,11 @@ public interface IAvRoomView extends IMvpBaseView {
|
||||
*/
|
||||
void showBlackEnterRoomView();
|
||||
|
||||
/**
|
||||
* 显示新用户打招呼消息
|
||||
*/
|
||||
void showHelloMessageDialog(HelloMessageInfo helloMessageInfo);
|
||||
|
||||
/**
|
||||
* 取消loading弹窗
|
||||
*/
|
||||
|
@@ -33,6 +33,7 @@ import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -1870,14 +1871,13 @@ public class MessageView extends FrameLayout {
|
||||
private void addCommonTag(ChatRoomMessage chatRoomMessage, @NonNull SpannableBuilder builder, TextView tvContent) {
|
||||
ChatRoomMessageExtension extension = chatRoomMessage.getChatRoomMessageExtension();
|
||||
String userLevel = NobleUtil.getLevel(UserLevelResourceType.EXPER_URL, chatRoomMessage);
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
boolean isOfficial = NobleUtil.getIsOfficial(UserInfo.IS_OFFICIAL, chatRoomMessage);
|
||||
String vipIcon = NobleUtil.getResource(UserInfo.VIP_ICON, chatRoomMessage);
|
||||
builder.append(vipIcon, expLevelHeight)
|
||||
.append(isOfficial ? ResourcesCompat.getDrawable(getResources(),
|
||||
R.mipmap.ic_user_official_13dp, null) : null,
|
||||
badgeWidth, badgeHeight)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(AvRoomDataManager.get().isSuperAdmin(chatRoomMessage.getFromAccount()) ? ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.ic_room_super_admin, null) : null,
|
||||
SizeUtils.dp2px(tvContent.getContext(), 23), expLevelHeight);
|
||||
@@ -1941,9 +1941,8 @@ public class MessageView extends FrameLayout {
|
||||
*/
|
||||
private void setMsgRoomTip(TextView tvContent, RoomTipAttachment roomTipAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
if (TextUtils.isEmpty(roomTipAttachment.getNick())) roomTipAttachment.setNick("");
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(RegexUtil.getPrintableString(roomTipAttachment.getNick()), new ForegroundColorSpan(roomTipColor))
|
||||
.append(roomTipAttachment.getSecond() == CustomAttachment.CUSTOM_MSG_SUB_TYPE_ROOM_TIP_SHARE_ROOM ?
|
||||
" 分享了房间" : " 关注了房主", new ForegroundColorSpan(greyColor));
|
||||
@@ -1958,9 +1957,8 @@ public class MessageView extends FrameLayout {
|
||||
*/
|
||||
private void setFollowRoomTip(TextView tvContent, RoomTipAttachment roomTipAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
if (TextUtils.isEmpty(roomTipAttachment.getNick())) roomTipAttachment.setNick("");
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(RegexUtil.getPrintableString(roomTipAttachment.getNick()), new ForegroundColorSpan(roomTipColor))
|
||||
.append(" 收藏了房间", new ForegroundColorSpan(greyColor));
|
||||
tvContent.setText(text.build());
|
||||
@@ -1980,7 +1978,6 @@ public class MessageView extends FrameLayout {
|
||||
List<FaceReceiveInfo> faceReceiveInfos = faceAttachment.getFaceReceiveInfos();
|
||||
FaceReceiveInfo faceReceiveInfo;
|
||||
FaceInfo faceInfo;
|
||||
String logNick = null;
|
||||
for (int i = 0; i < faceReceiveInfos.size(); i++) {
|
||||
faceReceiveInfo = faceReceiveInfos.get(i);
|
||||
faceInfo = DynamicFaceModel.get().findFaceInfoById(faceReceiveInfo.getFaceId());
|
||||
@@ -1988,9 +1985,7 @@ public class MessageView extends FrameLayout {
|
||||
faceReceiveInfo.getResultIndexes().size() <= 0 || faceInfo == null)
|
||||
continue;
|
||||
String nick = RegexUtil.getPrintableString(faceReceiveInfo.getNick());
|
||||
logNick = nick;
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
builder.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
builder.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(greyColor))
|
||||
.append(": " + (faceReceiveInfo.getResultIndexes().size() > 1 ? "\n" : ""), new ForegroundColorSpan(greyColor));
|
||||
List<Integer> resultIndexes = faceReceiveInfo.getResultIndexes();
|
||||
@@ -2021,9 +2016,8 @@ public class MessageView extends FrameLayout {
|
||||
private void setMsgMultiGift(TextView tvContent, MultiGiftAttachment giftAttachment, ChatRoomMessage chatRoomMessage) {
|
||||
GiftInfo giftInfo = giftAttachment.getMultiGiftReceiveInfo().getGift();
|
||||
String nick = RegexUtil.getPrintableString(giftAttachment.getMultiGiftReceiveInfo().getNick());
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2058,9 +2052,8 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
String nick = RegexUtil.getPrintableString(giftAttachment.getMultiLuckyGiftReceiveInfo().getNick());
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2114,9 +2107,8 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
}
|
||||
String nick = RegexUtil.getPrintableString(giftAttachment.getMultiLuckyGiftReceiveInfo().getNick());
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2165,9 +2157,8 @@ public class MessageView extends FrameLayout {
|
||||
private void setMsgBatchGift(TextView tvContent, GiftBatchAttachment attachment, ChatRoomMessage chatRoomMessage) {
|
||||
GiftInfo giftInfo = attachment.getGiftMultiReceiverInfo().getGift();
|
||||
String nick = RegexUtil.getPrintableString(attachment.getGiftMultiReceiverInfo().getNick());
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2213,9 +2204,8 @@ public class MessageView extends FrameLayout {
|
||||
MagicInfo magicInfo = MagicModel.get().getMagicInfo(multiMagicReceivedInfo.getMagicId());
|
||||
String nick = RegexUtil.getPrintableString(multiMagicReceivedInfo.getNick());
|
||||
boolean showEffect = multiMagicReceivedInfo.isNeedShowExplode();
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage, chatRoomMessage.getFromAccount());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
@@ -2248,9 +2238,8 @@ public class MessageView extends FrameLayout {
|
||||
MagicInfo magicInfo = MagicModel.get().getMagicInfo(magicMultiReceiverInfo.getMagicId());
|
||||
String nick = RegexUtil.getPrintableString(magicMultiReceiverInfo.getNick());
|
||||
boolean showEffect = magicMultiReceiverInfo.isNeedShowExplode();
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage, chatRoomMessage.getFromAccount());
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(newUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
@Override
|
||||
public void onClick(@NonNull View widget) {
|
||||
@@ -2301,10 +2290,8 @@ public class MessageView extends FrameLayout {
|
||||
boolean showEffect = magicReceivedInfo.isNeedShowExplodeEffect();
|
||||
String nick = RegexUtil.getPrintableString(magicReceivedInfo.getNick());
|
||||
String targetNick = RegexUtil.getPrintableString(magicReceivedInfo.getTargetNick());
|
||||
boolean sendNewUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage, chatRoomMessage.getFromAccount());
|
||||
boolean receiverNewUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage, String.valueOf(magicReceivedInfo.getTargetUid()));
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(sendNewUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2315,7 +2302,6 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
})
|
||||
.append(" 给 ", new ForegroundColorSpan(getResources().getColor(R.color.white)))
|
||||
.append(receiverNewUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(targetNick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2346,11 +2332,9 @@ public class MessageView extends FrameLayout {
|
||||
if (giftReceiveInfo == null) return;
|
||||
String nick = RegexUtil.getPrintableString(giftReceiveInfo.getNick());
|
||||
String targetNick = RegexUtil.getPrintableString(giftReceiveInfo.getTargetNick());
|
||||
boolean sendNewUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage, chatRoomMessage.getFromAccount());
|
||||
boolean receiverNewUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage, String.valueOf(giftReceiveInfo.getTargetUid()));
|
||||
String num = "X" + giftReceiveInfo.getGiftNum();
|
||||
SpannableBuilder text = new SpannableBuilder(tvContent)
|
||||
.append(sendNewUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(getNewUserDrawable(chatRoomMessage), badgeWidth, badgeHeight)
|
||||
.append(nick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2361,7 +2345,6 @@ public class MessageView extends FrameLayout {
|
||||
}
|
||||
})
|
||||
.append(" 送给 ", new ForegroundColorSpan(getResources().getColor(R.color.white)))
|
||||
.append(receiverNewUser ? Constants.NEW_USER_ICON : "", badgeWidth, badgeHeight)
|
||||
.append(targetNick, new ForegroundColorSpan(roomTipNickColor), new OriginalDrawStatusClickSpan() {
|
||||
|
||||
@Override
|
||||
@@ -2709,15 +2692,19 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 进入公聊大厅页面,加载历史记录
|
||||
*/
|
||||
public void fetchHistory() {
|
||||
IMMessage anchor = MessageBuilder.createEmptyMessage(AvRoomDataManager.get().getRoomId() + "", SessionTypeEnum.P2P, System.currentTimeMillis());
|
||||
InvocationFuture<List<IMMessage>> listInvocationFuture = IMMessageManager.get().pullMessageHistory(anchor, 50, false);
|
||||
Log.e(TAG, "fetchHistory: " + listInvocationFuture);
|
||||
@Nullable
|
||||
private Drawable getNewUserDrawable(ChatRoomMessage chatRoomMessage) {
|
||||
boolean newUser = NobleUtil.getIsNewUser(UserInfo.IS_NEW_USER, chatRoomMessage);
|
||||
boolean isHelloUser = NobleUtil.getIsNewUser(UserInfo.IS_FROM_SAY_HELLO_CHANNEL, chatRoomMessage);
|
||||
if (newUser) {
|
||||
return ResourcesCompat.getDrawable(getResources(),
|
||||
isHelloUser ? R.drawable.ic_new_user_hello : R.drawable.ic_new_user,
|
||||
null);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@@ -2,12 +2,19 @@ package com.yizhuan.erban.home.dialog
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.Gravity
|
||||
import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import androidx.core.view.isGone
|
||||
import androidx.core.view.isVisible
|
||||
import com.netease.nim.uikit.common.util.sys.ScreenUtil
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.base.BaseDialog
|
||||
import com.yizhuan.erban.databinding.DialogHelloMessageBinding
|
||||
import com.yizhuan.erban.databinding.DialogNewUserHelloBinding
|
||||
import com.yizhuan.erban.ui.utils.load
|
||||
import com.yizhuan.tutu.room_chat.activity.RoomMsgActivity
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.NewUserHelloInfo
|
||||
import com.yizhuan.xchat_android_core.utils.subAndReplaceDot
|
||||
|
||||
@@ -15,9 +22,9 @@ class HelloMessageDialog : BaseDialog<DialogHelloMessageBinding>() {
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(newUserHelloInfo: NewUserHelloInfo): HelloMessageDialog {
|
||||
fun newInstance(helloMessageInfo: HelloMessageInfo): HelloMessageDialog {
|
||||
val args = Bundle()
|
||||
args.putSerializable("newUserHelloInfo", newUserHelloInfo)
|
||||
args.putSerializable("helloMessageInfo", helloMessageInfo)
|
||||
val fragment = HelloMessageDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
@@ -26,14 +33,34 @@ class HelloMessageDialog : BaseDialog<DialogHelloMessageBinding>() {
|
||||
}
|
||||
|
||||
override var width: Int = WindowManager.LayoutParams.MATCH_PARENT
|
||||
override var height: Int = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
override var gravity: Int = Gravity.TOP
|
||||
override var dimAmount: Float = 0f
|
||||
|
||||
private val newUserHelloInfo: NewUserHelloInfo by lazy {
|
||||
requireArguments().getSerializable("newUserHelloInfo") as NewUserHelloInfo
|
||||
private val helloMessageInfo: HelloMessageInfo by lazy {
|
||||
requireArguments().getSerializable("helloMessageInfo") as HelloMessageInfo
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult", "SetTextI18n")
|
||||
override fun init() {
|
||||
val avatarList = listOf<ImageView>(binding.ivAvatar0, binding.ivAvatar1, binding.ivAvatar2)
|
||||
avatarList.forEachIndexed { index, imageView ->
|
||||
val avatarUrl = helloMessageInfo.sayHelloUserAvatarList?.getOrNull(index)
|
||||
imageView.load(avatarUrl)
|
||||
imageView.isGone = avatarUrl.isNullOrEmpty()
|
||||
}
|
||||
binding.tvContent.text = if (helloMessageInfo.sayHelloUserAvatarList?.size == 1) {
|
||||
"Ta给你发送了一条消息~"
|
||||
} else {
|
||||
"Ta们向你发送了多条消息~"
|
||||
}
|
||||
binding.tvView.setOnClickListener {
|
||||
RoomMsgActivity.start(context)
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
binding.ivClose.setOnClickListener {
|
||||
dismissAllowingStateLoss()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,9 @@ class RoomHelloDialog : BaseDialog<DialogNewUserHelloBinding>() {
|
||||
AVRoomActivity.startForFromType(
|
||||
requireContext(),
|
||||
newUserHelloInfo.roomUid,
|
||||
AVRoomActivity.FROM_TYPE_HELLO
|
||||
AVRoomActivity.FROM_TYPE_HELLO,
|
||||
newUserHelloInfo.sayHelloUserNickname,
|
||||
newUserHelloInfo.sayHelloUserUid.toString()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/ic_new_user.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_new_user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
BIN
app/src/main/res/drawable-xhdpi/ic_new_user_hello.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/ic_new_user_hello.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
app/src/main/res/drawable-xhdpi/new_user_hello_bg_room.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/new_user_hello_bg_room.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
BIN
app/src/main/res/drawable-xhdpi/new_user_hello_ic_room_close.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/new_user_hello_ic_room_close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 398 B |
8
app/src/main/res/drawable/shape_white_6dp_round.xml
Normal file
8
app/src/main/res/drawable/shape_white_6dp_round.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FFFFFF" />
|
||||
|
||||
<corners android:radius="6dp" />
|
||||
</shape>
|
@@ -1,12 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout 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"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
tools:background="#af000000">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="345dp"
|
||||
android:layout_height="80dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="52dp"
|
||||
android:background="@drawable/new_user_hello_bg_room"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_avatar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="13dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_0"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="@color/white"
|
||||
app:cborder_width="1dp" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_1"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="38dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="@color/white"
|
||||
app:cborder_width="1dp" />
|
||||
|
||||
<com.yizhuan.erban.common.widget.CircleImageView
|
||||
android:id="@+id/iv_avatar_2"
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="44dp"
|
||||
android:layout_marginStart="76dp"
|
||||
android:src="@drawable/default_avatar"
|
||||
app:cborder_color="@color/white"
|
||||
app:cborder_width="1dp" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="12dp"
|
||||
android:text="Ta们向你发送了多条消息~"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintStart_toEndOf="@id/fl_avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/fl_avatar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_view"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/shape_white_6dp_round"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="点击查看"
|
||||
android:textColor="@color/color_333333"
|
||||
android:textSize="12sp"
|
||||
app:layout_constraintEnd_toEndOf="@id/tv_content"
|
||||
app:layout_constraintStart_toStartOf="@id/tv_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_content" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="22dp"
|
||||
android:src="@drawable/new_user_hello_ic_room_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
@@ -41,6 +41,7 @@ public class UserInfo implements Serializable {
|
||||
public static final transient int GENDER_MALE = 1;
|
||||
public static final transient int GENDER_FEMALE = 2;
|
||||
public static String IS_NEW_USER = "newUser";
|
||||
public static String IS_FROM_SAY_HELLO_CHANNEL = "fromSayHelloChannel";
|
||||
public static String GENDER = "gender";
|
||||
public static String IS_OFFICIAL = "official";
|
||||
public static String DEF_USER = "defUser";
|
||||
@@ -252,6 +253,9 @@ public class UserInfo implements Serializable {
|
||||
private boolean newUser;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean fromSayHelloChannel;
|
||||
@Getter
|
||||
@Setter
|
||||
private LiveTagInfo userInfoSkillVo;
|
||||
|
||||
@Getter
|
||||
@@ -581,6 +585,7 @@ public class UserInfo implements Serializable {
|
||||
map.put(GENDER, userInfo.getGender());
|
||||
map.put(IS_OFFICIAL, userInfo.getDefUser() == USER_TYPE_OFFICIAL);
|
||||
map.put(IS_NEW_USER, isNewUser());
|
||||
map.put(IS_FROM_SAY_HELLO_CHANNEL, isFromSayHelloChannel());
|
||||
map.put(DEF_USER, userInfo.getDefUser());
|
||||
map.put(HAS_PRETTY, userInfo.isHasPrettyErbanNo());
|
||||
|
||||
|
@@ -0,0 +1,9 @@
|
||||
package com.yizhuan.xchat_android_core.channel_page.bean
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
data class HelloMessageInfo(
|
||||
val roomPopup: Boolean = false,
|
||||
val sayHelloUserAvatarList: List<String>? = null,
|
||||
val sayHelloUserNum: Int = 0,
|
||||
) : Serializable
|
@@ -3,7 +3,9 @@ package com.yizhuan.xchat_android_core.channel_page.model;
|
||||
import com.yizhuan.xchat_android_core.base.BaseModel;
|
||||
import com.yizhuan.xchat_android_core.bean.response.ServiceResult;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.ChannelPageInfo;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.NewUserHelloInfo;
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
|
||||
import com.yizhuan.xchat_android_core.user.bean.InviteUserInfo;
|
||||
import com.yizhuan.xchat_android_core.utils.net.RxHelper;
|
||||
import com.yizhuan.xchat_android_library.net.rxnet.RxNet;
|
||||
@@ -74,6 +76,13 @@ public class ChannelPageModel extends BaseModel implements IChannelPageModel {
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<HelloMessageInfo> checkHelloMessage() {
|
||||
return api.checkHelloMessage(AvRoomDataManager.get().getRoomUid())
|
||||
.compose(RxHelper.handleBeanData())
|
||||
.compose(RxHelper.handleSchAndExce());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -144,6 +153,12 @@ public class ChannelPageModel extends BaseModel implements IChannelPageModel {
|
||||
@GET("/newUserStart/indexSayHello")
|
||||
Single<ServiceResult<NewUserHelloInfo>> checkNewUserInRoom();
|
||||
|
||||
/**
|
||||
* 新用户推荐房间进入房间后收到消息提示弹窗
|
||||
*/
|
||||
@GET("/newUserStart/roomSayHello")
|
||||
Single<ServiceResult<HelloMessageInfo>> checkHelloMessage(@Query("roomUid") Long roomUid);
|
||||
|
||||
/**
|
||||
* 字节跳动推广接口
|
||||
*/
|
||||
|
@@ -1,6 +1,7 @@
|
||||
package com.yizhuan.xchat_android_core.channel_page.model;
|
||||
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.ChannelPageInfo;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.HelloMessageInfo;
|
||||
import com.yizhuan.xchat_android_core.channel_page.bean.NewUserHelloInfo;
|
||||
import com.yizhuan.xchat_android_core.user.bean.InviteUserInfo;
|
||||
|
||||
@@ -18,6 +19,8 @@ public interface IChannelPageModel {
|
||||
|
||||
Single<NewUserHelloInfo> checkNewUserInRoom();
|
||||
|
||||
Single<HelloMessageInfo> checkHelloMessage();
|
||||
|
||||
void checkAd();
|
||||
|
||||
void checkByteDanceAd(String evenType);
|
||||
|
Reference in New Issue
Block a user