个播房新增向下滑动切换房间功能
This commit is contained in:
@@ -15,6 +15,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
@@ -30,6 +31,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -47,19 +50,20 @@ import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.orhanobut.logger.Logger;
|
||||
import com.tencent.bugly.crashreport.CrashReport;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.avroom.fragment.FakeSingleRoomFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.InputPwdDialogFragment;
|
||||
import com.yizhuan.erban.avroom.presenter.AvRoomPresenter;
|
||||
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
|
||||
import com.yizhuan.erban.avroom.redpackage.RedPackageOpenDialog;
|
||||
import com.yizhuan.erban.avroom.view.IAvRoomView;
|
||||
import com.yizhuan.erban.avroom.widget.VerticalViewPagerAdapter;
|
||||
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;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.LoadingDialog;
|
||||
@@ -127,7 +131,6 @@ 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;
|
||||
@@ -160,10 +163,10 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
* 管理限制进房
|
||||
*/
|
||||
LimitEnterRoomHelper limitEnterRoomHelper;
|
||||
boolean isLast = true;
|
||||
private int fromType = FROM_TYPE_NORMAL;// 入口类型 0 其他 1 推荐 2 个人主页或者广场
|
||||
private String fromNick = "";// 从萌圈进入时 需要传入作品发布者的昵称
|
||||
private String fromUid = "";
|
||||
private SVGAImageView svgaRoomBg;
|
||||
private RelativeLayout finishLayout;
|
||||
private ViewStub mVsRoomOffline;
|
||||
private ImageView avatarBg;
|
||||
@@ -172,14 +175,17 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
private ViewStub mVsNobleOpen;
|
||||
private NobleOpenNoticeView mNobleOpenNoticeView;
|
||||
private long roomUid;
|
||||
@Nullable
|
||||
private HomePartyFragment mCurrentFragment;
|
||||
private InputPwdDialogFragment mPwdDialogFragment;
|
||||
@Nullable
|
||||
private RoomInfo mRoomInfo;
|
||||
private ImageView ivHeadWear;
|
||||
private MonsterDialog monsterDialog;
|
||||
private LoadingDialog mLoadingDialog;
|
||||
private List<RedPackageOpenDialog> openDialogs;
|
||||
private String[] bgPicture = new String[]{""};
|
||||
private ViewPager2 viewpager;
|
||||
private VerticalViewPagerAdapter mAdapter;
|
||||
/*********************************显示全服礼物***************************************/
|
||||
|
||||
private GiftBroadcastObserver giftObserver;
|
||||
@@ -190,7 +196,15 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
public static void start(Context context, long roomUid) {
|
||||
Intent intent = new Intent(context, AVRoomActivity.class);
|
||||
intent.putExtra(Constants.ROOM_UID, roomUid);
|
||||
AvRoomDataManager.get().setIsParty(false);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_INTO_ROOM_CLICK, "进入房间");
|
||||
}
|
||||
|
||||
public static void start(Context context, @NonNull RoomInfo roomInfo) {
|
||||
Intent intent = new Intent(context, AVRoomActivity.class);
|
||||
intent.putExtra(Constants.ROOM_INFO, (Parcelable) roomInfo);
|
||||
intent.putExtra(Constants.ROOM_UID, roomInfo.getRoomUid());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_INTO_ROOM_CLICK, "进入房间");
|
||||
@@ -253,8 +267,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
if (!StringUtils.isBlank(roomInfo.getBackPic())) {
|
||||
int resourceType = NobleUtil.getResourceType(roomInfo.getBackPic());
|
||||
if (resourceType == NobleResourceType.URLS) {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(View.VISIBLE);
|
||||
if (!roomInfo.getBackPic().equals(bgPicture[0])) {
|
||||
bgPicture[0] = roomInfo.getBackPic();
|
||||
ImageLoadUtils.loadRoomBgBackground(context, bgPicture[0], svgaRoomBg);
|
||||
@@ -263,16 +275,11 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
if (!roomInfo.getBackPic().equals(bgPicture[0])) {
|
||||
bgPicture[0] = roomInfo.getBackPic();
|
||||
playSvgaUrlBg(svgaRoomBg, bgPicture[0]);
|
||||
} else {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bgPicture[0] = "";
|
||||
if (roomInfo.getType() == RoomInfo.ROOMTYPE_CP) {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(VISIBLE);
|
||||
if (roomInfo.isOpenGame) {
|
||||
svgaRoomBg.setImageResource(R.drawable.room_cp_game_bg);
|
||||
} else {
|
||||
@@ -281,9 +288,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
} else if (roomInfo.getType() == RoomInfo.ROOM_TYPE_SINGLE) {
|
||||
playSvgaBg(svgaRoomBg, "svga/single_back.svga");
|
||||
} else {
|
||||
//不再使用头像作为房间默认背景
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(VISIBLE);
|
||||
if (roomInfo.getRoomModeType() == RoomModeType.OPEN_PK_MODE) {
|
||||
svgaRoomBg.setImageResource(R.drawable.bg_room_pk);
|
||||
} else {
|
||||
@@ -291,9 +295,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,20 +352,26 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
fromType = intent.getIntExtra("fromType", 0);
|
||||
fromNick = intent.getStringExtra("fromNick");
|
||||
fromUid = intent.getStringExtra("fromUid");
|
||||
mRoomInfo = (RoomInfo) intent.getParcelableExtra(Constants.ROOM_INFO);
|
||||
if (newRoomUid != 0 && newRoomUid == roomUid) {
|
||||
updateRoomInfo();
|
||||
//updateRoomInfo之后进入云信进房逻辑后直接return了,不会再次调用addRoomFragment()
|
||||
showRedPackage(AvRoomDataManager.get().mCurrentRoomInfo);
|
||||
addRoomFragment(false);
|
||||
dismissLoadingDialog();
|
||||
return;
|
||||
}
|
||||
roomUid = newRoomUid;
|
||||
// 相同类型的房间,但是是不同人的房间
|
||||
if (AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid)) {
|
||||
svgaRoomBg.clearAnimation();
|
||||
svgaRoomBg.setVisibility(View.INVISIBLE);
|
||||
dismissRedPackageDialog();
|
||||
getDialogManager().showProgressDialog(this, getString(R.string.waiting_text), true);
|
||||
updateRoomInfo();
|
||||
showLoadingDialog();
|
||||
if (mRoomInfo == null) {
|
||||
updateRoomInfo();
|
||||
} else {
|
||||
requestRoomInfoSuccessView(mRoomInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,6 +384,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
fromType = getIntent().getIntExtra("fromType", 0);
|
||||
fromNick = getIntent().getStringExtra("fromNick");
|
||||
fromUid = getIntent().getStringExtra("fromUid");
|
||||
mRoomInfo = (RoomInfo) getIntent().getSerializableExtra(Constants.ROOM_INFO);
|
||||
boolean isParty = getIntent().getBooleanExtra(Constants.IS_PARTY, false);
|
||||
//如果是嗨聊房入口roomUid就不从intent中取值
|
||||
if (isParty) {
|
||||
@@ -385,11 +393,9 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
roomUid = roomUidList.get(0).getUid();
|
||||
}
|
||||
}
|
||||
|
||||
svgaRoomBg = findViewById(R.id.svga_image_view_bg);
|
||||
mVsRoomOffline = findViewById(R.id.vs_room_offline);
|
||||
mVsNobleOpen = findViewById(R.id.vs_noble_open_notice);
|
||||
|
||||
viewpager = findViewById(R.id.fragment_container);
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
.compose(bindToLifecycle())
|
||||
.subscribe(this::onRoomEventReceive);
|
||||
@@ -397,16 +403,51 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
if (roomUid != AuthModel.get().getCurrentUid()) {
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ENTERROOM, "进入别人房间");
|
||||
}
|
||||
|
||||
EventBus.getDefault().register(this);
|
||||
//第一次进来
|
||||
if (AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid)) {
|
||||
getDialogManager().showProgressDialog(this, getString(R.string.waiting_text), false);
|
||||
updateRoomInfo();
|
||||
return;
|
||||
|
||||
if (mAdapter == null) {
|
||||
mAdapter = new VerticalViewPagerAdapter(this);
|
||||
viewpager.setOffscreenPageLimit(2);
|
||||
viewpager.setOrientation(ViewPager2.ORIENTATION_VERTICAL);
|
||||
((RecyclerView) viewpager.getChildAt(0)).setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
viewpager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
((FakeSingleRoomFragment) mAdapter.getItem(1)).requestPreRoomInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
if (state == 0 && viewpager.getCurrentItem() == 1) {
|
||||
showLoadingDialog();
|
||||
((FakeSingleRoomFragment) mAdapter.getItem(1)).tryJumpRoom();
|
||||
viewpager.setUserInputEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
viewpager.setAdapter(mAdapter);
|
||||
}
|
||||
|
||||
addRoomFragment(true);
|
||||
viewpager.post(() -> {
|
||||
mCurrentFragment = (HomePartyFragment) mAdapter.getItem(0);
|
||||
//第一次进来
|
||||
if (AvRoomDataManager.get().isFirstEnterRoomOrChangeOtherRoom(roomUid)) {
|
||||
showLoadingDialog();
|
||||
if (mRoomInfo == null) {
|
||||
updateRoomInfo();
|
||||
} else {
|
||||
requestRoomInfoSuccessView(mRoomInfo);
|
||||
}
|
||||
return;
|
||||
}
|
||||
addRoomFragment(true);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -465,9 +506,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
roomEvent.mRoomNobleMsgAttachment.type);
|
||||
}
|
||||
break;
|
||||
case RoomEvent.ROOM_INFO_UPDATE:
|
||||
setBackBg(this, AvRoomDataManager.get().mCurrentRoomInfo, svgaRoomBg, bgPicture);
|
||||
break;
|
||||
case RoomEvent.MONSTER_STATUS_CHANGED:
|
||||
MonsterProtocol.DataBean dataBean = roomEvent.getMonsterStatusAttachment().getDataBean();
|
||||
Log.e(TAG, "onRoomEventReceive: monster status changed: " + dataBean);
|
||||
@@ -570,17 +608,14 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
* @param isRoomMin 如果是最小化,则传ture
|
||||
*/
|
||||
private void addRoomFragment(boolean isRoomMin) {
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null) {
|
||||
mCurrentFragment = HomePartyFragment.newInstance(roomUid, isRoomMin);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.fragment_container, mCurrentFragment)
|
||||
.commit();
|
||||
showRedPackage(roomInfo);
|
||||
}
|
||||
mCurrentFragment = (HomePartyFragment) mAdapter.getItem(0);
|
||||
viewpager.setUserInputEnabled(AvRoomDataManager.get().isSingleRoom());
|
||||
viewpager.setCurrentItem(0, false);
|
||||
if (isRoomMin) {
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture);
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.setRoomBg(roomInfo);
|
||||
}
|
||||
getMvpPresenter().judgeIsLimitEnter();
|
||||
}
|
||||
}
|
||||
@@ -807,9 +842,6 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
monsterDialog.dismiss();
|
||||
monsterDialog = null;
|
||||
}
|
||||
if (svgaRoomBg.isAnimating()) {
|
||||
svgaRoomBg.clearAnimation();
|
||||
}
|
||||
if (giftDialog != null && giftDialog.isShowing()) {
|
||||
giftDialog.setOnDismissListener(null);
|
||||
giftDialog.dismiss();
|
||||
@@ -889,7 +921,12 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
@Override
|
||||
public void requestRoomInfoSuccessView(RoomInfo roomInfo) {
|
||||
mRoomInfo = roomInfo;
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture);
|
||||
if (roomInfo.getType() != RoomInfo.ROOM_TYPE_SINGLE) {
|
||||
viewpager.setUserInputEnabled(false);
|
||||
}
|
||||
if (mCurrentFragment != null) {
|
||||
mCurrentFragment.setRoomBg(roomInfo);
|
||||
}
|
||||
// 超管绕过密码直接进房
|
||||
if (SuperAdminUtil.isSuperAdmin()) {
|
||||
enterRoom(roomInfo);
|
||||
@@ -972,7 +1009,7 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
getMvpPresenter().getNormalChatMember();
|
||||
getMvpPresenter().getSuperAdminList();
|
||||
if (fromType == FROM_TYPE_HELLO) {
|
||||
getMvpPresenter().checkHelloMessage();
|
||||
getMvpPresenter().checkHelloMessage();
|
||||
}
|
||||
dismissLoadingDialog();
|
||||
}
|
||||
@@ -1037,8 +1074,9 @@ public class AVRoomActivity extends BaseMvpActivity<IAvRoomView, AvRoomPresenter
|
||||
public void onPKStateEvent(PKStateEvent event) {
|
||||
isPKModel = event != null && event.isCreate();
|
||||
RoomInfo roomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (roomInfo != null)
|
||||
setBackBg(this, roomInfo, svgaRoomBg, bgPicture);
|
||||
if (roomInfo != null && mCurrentFragment != null) {
|
||||
mCurrentFragment.setRoomBg(roomInfo);
|
||||
}
|
||||
}
|
||||
|
||||
public Single<String> giveUpDragonBar() {
|
||||
|
@@ -0,0 +1,90 @@
|
||||
package com.yizhuan.erban.avroom.fragment
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.View
|
||||
import com.opensource.svgaplayer.SVGADrawable
|
||||
import com.opensource.svgaplayer.SVGAImageView
|
||||
import com.opensource.svgaplayer.SVGAParser
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity
|
||||
import com.yizhuan.erban.base.BaseViewBindingFragment
|
||||
import com.yizhuan.erban.databinding.FragmentFakeSingleRoomBinding
|
||||
import com.yizhuan.xchat_android_core.room.bean.RoomInfo
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel
|
||||
import com.yizhuan.xchat_android_core.utils.CurrentTimeUtils
|
||||
import com.yizhuan.xchat_android_core.utils.StringUtils
|
||||
|
||||
class FakeSingleRoomFragment : BaseViewBindingFragment<FragmentFakeSingleRoomBinding>() {
|
||||
|
||||
private var preRoomInfo: RoomInfo? = null
|
||||
private var needJump = false
|
||||
private var lastRequestTime = 0L
|
||||
private var index = 1
|
||||
private val minRequestTime = 60 * 1000
|
||||
private val bgPicture = arrayOf("")
|
||||
|
||||
override fun init() {
|
||||
playSvgaBg(binding.svgaImageViewBg, "svga/single_back.svga")
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun requestPreRoomInfo() {
|
||||
if (CurrentTimeUtils.getCurrentTime() - lastRequestTime < minRequestTime) {
|
||||
return
|
||||
}
|
||||
preRoomInfo = null
|
||||
lastRequestTime = CurrentTimeUtils.getCurrentTime()
|
||||
index++
|
||||
AvRoomModel.get()
|
||||
.requestRoomInfo(if (index % 2 == 0) "1000429" else "1003696")
|
||||
.subscribe({
|
||||
if (needJump) {
|
||||
AVRoomActivity.start(mContext, it)
|
||||
reSet()
|
||||
} else {
|
||||
preRoomInfo = it
|
||||
if (!StringUtils.isBlank(it.backPic)) {
|
||||
AVRoomActivity.setBackBg(mContext, it, binding.svgaImageViewBg, bgPicture)
|
||||
}
|
||||
}
|
||||
}, {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
fun tryJumpRoom() {
|
||||
preRoomInfo?.let {
|
||||
AVRoomActivity.start(mContext, it)
|
||||
reSet()
|
||||
} ?: run {
|
||||
needJump = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun reSet() {
|
||||
preRoomInfo = null
|
||||
lastRequestTime = 0
|
||||
needJump = false
|
||||
}
|
||||
|
||||
private fun playSvgaBg(svgaRoomBg: SVGAImageView, assets: String) {
|
||||
svgaRoomBg.clearAnimation()
|
||||
svgaRoomBg.visibility = View.VISIBLE
|
||||
val mSVGAParser = SVGAParser(svgaRoomBg.context)
|
||||
mSVGAParser.decodeFromAssets(assets, object : SVGAParser.ParseCompletion {
|
||||
override fun onComplete(videoItem: SVGAVideoEntity) {
|
||||
svgaRoomBg.visibility = View.VISIBLE
|
||||
val drawable = SVGADrawable(videoItem)
|
||||
svgaRoomBg.setImageDrawable(drawable)
|
||||
svgaRoomBg.startAnimation()
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
svgaRoomBg.visibility = View.GONE
|
||||
}
|
||||
|
||||
|
||||
}, null)
|
||||
}
|
||||
}
|
@@ -20,38 +20,29 @@ import com.netease.nim.uikit.common.util.string.StringUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.trello.rxlifecycle3.android.FragmentEvent;
|
||||
import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.avroom.activity.RoomOnlineUserActivity;
|
||||
import com.yizhuan.erban.avroom.adapter.SelectGameAdapter;
|
||||
import com.yizhuan.erban.avroom.dialog.ExitRoomPopupWindow;
|
||||
import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
|
||||
import com.yizhuan.erban.avroom.widget.GiftV2View;
|
||||
import com.yizhuan.erban.base.BaseFragment;
|
||||
import com.yizhuan.erban.base.BaseMvpActivity;
|
||||
import com.yizhuan.erban.common.widget.dialog.DialogManager;
|
||||
import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding;
|
||||
import com.yizhuan.erban.friend.view.SelectFriendActivity;
|
||||
import com.yizhuan.erban.home.helper.OpenRoomHelper;
|
||||
import com.yizhuan.erban.ui.widget.ButtonItem;
|
||||
import com.yizhuan.erban.ui.widget.ShareDialog;
|
||||
import com.yizhuan.erban.utils.RegexUtil;
|
||||
import com.yizhuan.xchat_android_constants.XChatConstants;
|
||||
import com.yizhuan.xchat_android_core.Constants;
|
||||
import com.yizhuan.xchat_android_core.auth.AuthModel;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftMultiReceiverInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.GiftReceiveInfo;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.LuckyBagGifts;
|
||||
import com.yizhuan.xchat_android_core.gift.bean.MultiGiftReceiveInfo;
|
||||
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
|
||||
import com.yizhuan.xchat_android_core.home.event.FollowRoomEvent;
|
||||
import com.yizhuan.xchat_android_core.home.event.ShareRoomEvent;
|
||||
import com.yizhuan.xchat_android_core.home.model.CollectionRoomModel;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.FansTeamMsgAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomInfoAttachment;
|
||||
import com.yizhuan.xchat_android_core.magic.bean.MagicReceivedInfo;
|
||||
import com.yizhuan.xchat_android_core.magic.bean.MultiMagicReceivedInfo;
|
||||
@@ -78,8 +69,6 @@ import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import cn.sharesdk.framework.Platform;
|
||||
@@ -105,12 +94,14 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
private ImageView roomMore;
|
||||
private ImageView ivRoomShare;
|
||||
|
||||
private long mTargetRoomUid;
|
||||
private boolean isRoomMin;
|
||||
|
||||
private GiftV2View giftView;
|
||||
private ViewStub mVsGift2View;
|
||||
|
||||
private SVGAImageView svgaRoomBg;
|
||||
private String[] bgPicture = new String[]{""};
|
||||
|
||||
private UserInfo mUserInfo;
|
||||
private FragmentChatroomGameMainBinding gameMainBinding;
|
||||
|
||||
@@ -121,10 +112,9 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
private SelectGameAdapter gameAdapter;
|
||||
|
||||
|
||||
public static HomePartyFragment newInstance(long roomUid, boolean isRoomMin) {
|
||||
public static HomePartyFragment newInstance(boolean isRoomMin) {
|
||||
HomePartyFragment homePartyFragment = new HomePartyFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putLong(Constants.ROOM_UID, roomUid);
|
||||
//是否是最小化进来
|
||||
bundle.putBoolean(Constants.IS_ROOM_MIN, isRoomMin);
|
||||
homePartyFragment.setArguments(bundle);
|
||||
@@ -159,7 +149,6 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
protected void onInitArguments(Bundle bundle) {
|
||||
super.onInitArguments(bundle);
|
||||
if (bundle != null) {
|
||||
mTargetRoomUid = bundle.getLong(Constants.ROOM_UID, 0);
|
||||
isRoomMin = bundle.getBoolean(Constants.IS_ROOM_MIN, false);
|
||||
}
|
||||
}
|
||||
@@ -185,6 +174,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
mVsGift2View = mView.findViewById(R.id.vs_gift_view);
|
||||
mIvGoodNumber = mView.findViewById(R.id.iv_good_number);
|
||||
ivFollowRoom = mView.findViewById(R.id.iv_follow_room);
|
||||
svgaRoomBg = mView.findViewById(R.id.svga_image_view_bg);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,6 +284,11 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
currentRoomInfo.getRoomModeType() == 4);
|
||||
}
|
||||
|
||||
public void setRoomBg(RoomInfo roomInfo) {
|
||||
if (svgaRoomBg == null) return;
|
||||
AVRoomActivity.setBackBg(mContext, roomInfo, svgaRoomBg, bgPicture);
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@Override
|
||||
@@ -313,6 +308,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
addTipMsg();
|
||||
case RoomEvent.ROOM_INFO_UPDATE:
|
||||
updateView();
|
||||
setRoomBg(AvRoomDataManager.get().mCurrentRoomInfo);
|
||||
break;
|
||||
case RoomEvent.RECEIVE_NORMALE_GIFT:
|
||||
onReceiveGiftMsg(roomEvent.getGiftReceiveInfo());
|
||||
@@ -531,7 +527,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
if (currentRoomInfo == null) {
|
||||
return;
|
||||
}
|
||||
CollectionRoomModel.get().followRoom(FOLLOW_ROOM_TYPE, mTargetRoomUid)
|
||||
CollectionRoomModel.get().followRoom(FOLLOW_ROOM_TYPE, currentRoomInfo.getUid())
|
||||
.compose(bindUntilEvent(FragmentEvent.DESTROY))
|
||||
.doOnError(throwable -> {
|
||||
toast(throwable.getMessage());
|
||||
@@ -542,7 +538,7 @@ public class HomePartyFragment extends BaseFragment implements View.OnClickListe
|
||||
ivFollowRoom.setImageResource(AvRoomDataManager.get().isRoomFans ? R.drawable.icon_room_liked : R.drawable.icon_room_like);
|
||||
if (AvRoomDataManager.get().isRoomFans) {
|
||||
SingleToastUtil.showToast("收藏成功!");
|
||||
PraiseModel.get().setFollowRoomSuccessRoomTip(mTargetRoomUid);
|
||||
PraiseModel.get().setFollowRoomSuccessRoomTip(currentRoomInfo.getUid());
|
||||
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ROOM_FOLLOW_BUTTON_CLICK, "语音房_收藏顶部按钮");
|
||||
}
|
||||
});
|
||||
|
@@ -65,6 +65,7 @@ import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.widget.DividerItemDecoration;
|
||||
import com.yizhuan.erban.ui.widget.MyItemAnimator;
|
||||
import com.yizhuan.erban.ui.widget.RecyclerViewNoViewpagerScroll;
|
||||
import com.yizhuan.erban.ui.widget.UserInfoDialog;
|
||||
import com.yizhuan.erban.ui.widget.magicindicator.buildins.UIUtil;
|
||||
import com.yizhuan.erban.ui.widget.marqueeview.Utils;
|
||||
@@ -290,7 +291,7 @@ public class MessageView extends FrameLayout {
|
||||
// 内容区域
|
||||
layoutManger = new LinearLayoutManager(context, RecyclerView.VERTICAL, false);
|
||||
FrameLayout.LayoutParams params = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
messageListView = new RecyclerView(context);
|
||||
messageListView = new RecyclerViewNoViewpagerScroll(context);
|
||||
messageListView.setLayoutParams(params);
|
||||
messageListView.setFadingEdgeLength(60);
|
||||
messageListView.setVerticalFadingEdgeEnabled(true);
|
||||
|
@@ -0,0 +1,54 @@
|
||||
package com.yizhuan.erban.avroom.widget;
|
||||
|
||||
import android.util.SparseArray;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.yizhuan.erban.avroom.fragment.FakeSingleRoomFragment;
|
||||
import com.yizhuan.erban.avroom.fragment.HomePartyFragment;
|
||||
|
||||
|
||||
/**
|
||||
* 作者: ch
|
||||
* 时间: 2018/7/30 0030-下午 3:42
|
||||
* 描述:
|
||||
* 来源:
|
||||
*/
|
||||
|
||||
|
||||
public class VerticalViewPagerAdapter extends FragmentStateAdapter {
|
||||
private final SparseArray<Fragment> fragmentList;
|
||||
|
||||
public VerticalViewPagerAdapter(FragmentActivity fm) {
|
||||
super(fm);
|
||||
fragmentList = new SparseArray<>();
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
Fragment fragment = fragmentList.get(position);
|
||||
if (fragment == null) {
|
||||
if (position == 0) {
|
||||
fragment = HomePartyFragment.newInstance(false);
|
||||
} else {
|
||||
fragment = new FakeSingleRoomFragment();
|
||||
}
|
||||
fragmentList.put(position, fragment);
|
||||
}
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public Fragment getItem(int position) {
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
}
|
@@ -2,43 +2,38 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_room_normal_default_pic">
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_image_view_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="房间的背景"
|
||||
android:scaleType="centerCrop"
|
||||
app:autoPlay="true" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="true" />
|
||||
android:clipToPadding="true"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_room_offline"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout="@layout/layout_room_live_finish"
|
||||
android:clipToPadding="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="true" />
|
||||
android:layout="@layout/layout_room_live_finish" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_noble_open_notice"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout="@layout/room_noble_open_viewstub_layout"
|
||||
android:clipToPadding="true"
|
||||
android:fitsSystemWindows="true"
|
||||
android:clipToPadding="true" />
|
||||
android:layout="@layout/room_noble_open_viewstub_layout" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/vs_gift_value_tips"
|
||||
android:visibility="gone"
|
||||
android:layout="@layout/vs_gift_value_first_show_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
android:layout_height="match_parent"
|
||||
android:layout="@layout/vs_gift_value_first_show_layout"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
@@ -21,6 +21,14 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:background="@color/blue">
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_image_view_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="房间的背景"
|
||||
android:scaleType="centerCrop"
|
||||
app:autoPlay="true" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
|
17
app/src/main/res/layout/fragment_fake_single_room.xml
Normal file
17
app/src/main/res/layout/fragment_fake_single_room.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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="match_parent"
|
||||
tools:background="@color/blue">
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_image_view_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
app:autoPlay="true" />
|
||||
|
||||
</FrameLayout>
|
||||
|
@@ -481,8 +481,9 @@ public final class IMNetEaseManager {
|
||||
MLog.info(TAG, "登录中...");
|
||||
} else if (chatRoomStatusChangeData.status == StatusCode.LOGINED) {
|
||||
MLog.info(TAG, "云信聊天室已登录成功");
|
||||
noticeImNetReLogin(mCacheRoomQueueInfo);
|
||||
|
||||
if (mCacheRoomQueueInfo != null) {
|
||||
noticeImNetReLogin(mCacheRoomQueueInfo);
|
||||
}
|
||||
Map<String, String> parans = new HashMap<>(3);
|
||||
parans.put("user_id", String.valueOf(currentUid));
|
||||
parans.put("net_type", NetworkUtils.getNetworkTypeName(BasicConfig.INSTANCE.getAppContext()));
|
||||
@@ -1316,10 +1317,10 @@ public final class IMNetEaseManager {
|
||||
UserModel.get().getCacheLoginUserInfo().setGroupType(PKTeamInfo.TEAM_NONE);
|
||||
//在麦上就更新信息
|
||||
AvRoomModel.get().updateMyMicQueue(
|
||||
AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()),
|
||||
String.valueOf(AvRoomDataManager.get().mCurrentRoomInfo.getRoomId()),
|
||||
UserModel.get().getCacheLoginUserInfo()
|
||||
)
|
||||
AvRoomDataManager.get().getMicPosition(AuthModel.get().getCurrentUid()),
|
||||
String.valueOf(AvRoomDataManager.get().mCurrentRoomInfo.getRoomId()),
|
||||
UserModel.get().getCacheLoginUserInfo()
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
@@ -2002,31 +2003,31 @@ public final class IMNetEaseManager {
|
||||
|
||||
public Single<List<ChatRoomMember>> fetchRoomMembersByIds(final List<String> accounts) {
|
||||
return Single.create((SingleOnSubscribe<List<ChatRoomMember>>) e -> {
|
||||
final RoomInfo mCurrentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (mCurrentRoomInfo == null || ListUtils.isListEmpty(accounts)) {
|
||||
e.onError(new IllegalArgumentException("RoomInfo is null or accounts is null"));
|
||||
return;
|
||||
}
|
||||
NIMChatRoomSDK.getChatRoomService()
|
||||
.fetchRoomMembersByIds(String.valueOf(mCurrentRoomInfo.getRoomId()), accounts)
|
||||
.setCallback(new RequestCallback<List<ChatRoomMember>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ChatRoomMember> param) {
|
||||
e.onSuccess(param);
|
||||
}
|
||||
final RoomInfo mCurrentRoomInfo = AvRoomDataManager.get().mCurrentRoomInfo;
|
||||
if (mCurrentRoomInfo == null || ListUtils.isListEmpty(accounts)) {
|
||||
e.onError(new IllegalArgumentException("RoomInfo is null or accounts is null"));
|
||||
return;
|
||||
}
|
||||
NIMChatRoomSDK.getChatRoomService()
|
||||
.fetchRoomMembersByIds(String.valueOf(mCurrentRoomInfo.getRoomId()), accounts)
|
||||
.setCallback(new RequestCallback<List<ChatRoomMember>>() {
|
||||
@Override
|
||||
public void onSuccess(List<ChatRoomMember> param) {
|
||||
e.onSuccess(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed(int code) {
|
||||
e.onError(new Exception("错误码: " + code));
|
||||
}
|
||||
@Override
|
||||
public void onFailed(int code) {
|
||||
e.onError(new Exception("错误码: " + code));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onException(Throwable exception) {
|
||||
e.onError(exception);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onException(Throwable exception) {
|
||||
e.onError(exception);
|
||||
}
|
||||
});
|
||||
|
||||
}).subscribeOn(Schedulers.computation())
|
||||
}).subscribeOn(Schedulers.computation())
|
||||
.observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
@@ -2242,16 +2243,16 @@ public final class IMNetEaseManager {
|
||||
if (roomInfo == null) return null;
|
||||
String downMicUid = AvRoomDataManager.get().getRoomQueueMemberUidByMicPosition(micPosition);
|
||||
return Single.create((SingleOnSubscribe<String>) e -> {
|
||||
RequestResult<Entry<String, String>> result = NIMClient.syncRequest(NIMChatRoomSDK.getChatRoomService()
|
||||
.pollQueue(String.valueOf(roomInfo.getRoomId()), String.valueOf(micPosition)));
|
||||
if (result.exception != null)
|
||||
e.onError(result.exception);
|
||||
else if (result.code != BaseMvpModel.RESULT_OK)
|
||||
e.onError(new Throwable("错误码: " + result.code));
|
||||
else {
|
||||
e.onSuccess("下麦回调成功");
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
RequestResult<Entry<String, String>> result = NIMClient.syncRequest(NIMChatRoomSDK.getChatRoomService()
|
||||
.pollQueue(String.valueOf(roomInfo.getRoomId()), String.valueOf(micPosition)));
|
||||
if (result.exception != null)
|
||||
e.onError(result.exception);
|
||||
else if (result.code != BaseMvpModel.RESULT_OK)
|
||||
e.onError(new Throwable("错误码: " + result.code));
|
||||
else {
|
||||
e.onSuccess("下麦回调成功");
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnSuccess(s -> GiftValueMrg.get().requestDownMic(micPosition, downMicUid));
|
||||
}
|
||||
|
||||
@@ -2320,10 +2321,10 @@ public final class IMNetEaseManager {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<String> e) throws Exception {
|
||||
NIMChatRoomSDK.getChatRoomService().kickMember(
|
||||
String.valueOf(roomId),
|
||||
String.valueOf(account),
|
||||
notifyExtension
|
||||
)
|
||||
String.valueOf(roomId),
|
||||
String.valueOf(account),
|
||||
notifyExtension
|
||||
)
|
||||
.setCallback(new RequestCallback<Void>() {
|
||||
@Override
|
||||
public void onSuccess(Void param) {
|
||||
@@ -2429,28 +2430,28 @@ public final class IMNetEaseManager {
|
||||
return Single.error(new ErrorThrowable(ErrorThrowable.ROOM_INFO_NULL_ERROR));
|
||||
final long micUid = baseInfo.getUid();
|
||||
return Single.create(
|
||||
new SingleOnSubscribe<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<ChatRoomMessage> e) throws Exception {
|
||||
RoomQueueMsgAttachment queueMsgAttachment = new RoomQueueMsgAttachment(CUSTOM_MSG_HEADER_TYPE_QUEUE,
|
||||
CUSTOM_MSG_HEADER_TYPE_QUEUE_INVITE);
|
||||
new SingleOnSubscribe<ChatRoomMessage>() {
|
||||
@Override
|
||||
public void subscribe(SingleEmitter<ChatRoomMessage> e) throws Exception {
|
||||
RoomQueueMsgAttachment queueMsgAttachment = new RoomQueueMsgAttachment(CUSTOM_MSG_HEADER_TYPE_QUEUE,
|
||||
CUSTOM_MSG_HEADER_TYPE_QUEUE_INVITE);
|
||||
|
||||
queueMsgAttachment.uid = String.valueOf(micUid);
|
||||
queueMsgAttachment.micPosition = position;
|
||||
queueMsgAttachment.handleUid = AuthModel.get().getCurrentUid();
|
||||
UserInfo myInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (myInfo != null) {
|
||||
queueMsgAttachment.handleNick = myInfo.getNick() == null ? "" : myInfo.getNick();
|
||||
}
|
||||
queueMsgAttachment.targetNick = baseInfo.getNick();
|
||||
if (baseInfo.getGroupType() != 0) {
|
||||
queueMsgAttachment.groupType = baseInfo.getGroupType();
|
||||
}
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(roomInfo.getRoomId()), queueMsgAttachment);
|
||||
e.onSuccess(message);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
queueMsgAttachment.uid = String.valueOf(micUid);
|
||||
queueMsgAttachment.micPosition = position;
|
||||
queueMsgAttachment.handleUid = AuthModel.get().getCurrentUid();
|
||||
UserInfo myInfo = UserModel.get().getCacheLoginUserInfo();
|
||||
if (myInfo != null) {
|
||||
queueMsgAttachment.handleNick = myInfo.getNick() == null ? "" : myInfo.getNick();
|
||||
}
|
||||
queueMsgAttachment.targetNick = baseInfo.getNick();
|
||||
if (baseInfo.getGroupType() != 0) {
|
||||
queueMsgAttachment.groupType = baseInfo.getGroupType();
|
||||
}
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(roomInfo.getRoomId()), queueMsgAttachment);
|
||||
e.onSuccess(message);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.filter(new Predicate<ChatRoomMessage>() {
|
||||
@Override
|
||||
@@ -2537,17 +2538,17 @@ public final class IMNetEaseManager {
|
||||
if (roomInfo == null)
|
||||
return Single.error(new ErrorThrowable(ErrorThrowable.ROOM_INFO_NULL_ERROR));
|
||||
return Single.create(
|
||||
(SingleOnSubscribe<ChatRoomMessage>) e -> {
|
||||
NobleAttachment nobleMsgAttachment = new NobleAttachment(CUSTOM_MESS_HEAD_NOBLE,
|
||||
CUSTOM_MESS_SUB_ROOM_WELCOME);
|
||||
nobleMsgAttachment.uid = uid;
|
||||
nobleMsgAttachment.nick = nick;
|
||||
nobleMsgAttachment.nobleInfo = nobleInfo;
|
||||
(SingleOnSubscribe<ChatRoomMessage>) e -> {
|
||||
NobleAttachment nobleMsgAttachment = new NobleAttachment(CUSTOM_MESS_HEAD_NOBLE,
|
||||
CUSTOM_MESS_SUB_ROOM_WELCOME);
|
||||
nobleMsgAttachment.uid = uid;
|
||||
nobleMsgAttachment.nick = nick;
|
||||
nobleMsgAttachment.nobleInfo = nobleInfo;
|
||||
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(roomInfo.getRoomId()), nobleMsgAttachment);
|
||||
e.onSuccess(message);
|
||||
}).subscribeOn(Schedulers.io())
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(roomInfo.getRoomId()), nobleMsgAttachment);
|
||||
e.onSuccess(message);
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.filter(chatRoomMessage -> nobleInfo != null && !TextUtils.isEmpty(nick) && uid != 0)
|
||||
.toSingle()
|
||||
@@ -2567,19 +2568,19 @@ public final class IMNetEaseManager {
|
||||
if (roomInfo == null)
|
||||
return Single.error(new ErrorThrowable(ErrorThrowable.ROOM_INFO_NULL_ERROR));
|
||||
return Single.create(
|
||||
(SingleOnSubscribe<ChatRoomMessage>) e -> {
|
||||
CarAttachment carAttachment = new CarAttachment(CUSTOM_MESS_HEAD_CAR,
|
||||
CUSTOM_MESS_SUB_CAR_ENTER_ROOM);
|
||||
carAttachment.uid = uid;
|
||||
carAttachment.nick = nick;
|
||||
carAttachment.effect = carInfo.getEffect();
|
||||
carAttachment.viewUrl = carInfo.getViewUrl();
|
||||
carAttachment.otherViewType = carInfo.getOtherViewType();
|
||||
(SingleOnSubscribe<ChatRoomMessage>) e -> {
|
||||
CarAttachment carAttachment = new CarAttachment(CUSTOM_MESS_HEAD_CAR,
|
||||
CUSTOM_MESS_SUB_CAR_ENTER_ROOM);
|
||||
carAttachment.uid = uid;
|
||||
carAttachment.nick = nick;
|
||||
carAttachment.effect = carInfo.getEffect();
|
||||
carAttachment.viewUrl = carInfo.getViewUrl();
|
||||
carAttachment.otherViewType = carInfo.getOtherViewType();
|
||||
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(roomInfo.getRoomId()), carAttachment);
|
||||
e.onSuccess(message);
|
||||
}).subscribeOn(Schedulers.io())
|
||||
ChatRoomMessage message = ChatRoomMessageBuilder.createChatRoomCustomMessage(
|
||||
String.valueOf(roomInfo.getRoomId()), carAttachment);
|
||||
e.onSuccess(message);
|
||||
}).subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.filter(chatRoomMessage -> carInfo != null && !TextUtils.isEmpty(nick) && uid != 0)
|
||||
.toSingle()
|
||||
@@ -2664,28 +2665,28 @@ public final class IMNetEaseManager {
|
||||
long delayTime, ReconnectListener listener) {
|
||||
|
||||
return Single.create((SingleOnSubscribe<RetryChatRoomMessage>) emitter -> {
|
||||
retryChatRoomMessage.setRetryCount(retryChatRoomMessage.getRetryCount() + 1);
|
||||
ImRetryManager.logIde("start send im msg :" + retryChatRoomMessage.getRetryCount());
|
||||
if (isExitRoom()) {
|
||||
String error = "exite room when send msg";
|
||||
emitter.onError(new Throwable(error));
|
||||
return;
|
||||
}
|
||||
if (isChangeRoom(retryChatRoomMessage.getMessage())) {
|
||||
String error = "changed room when send msg";
|
||||
emitter.onError(new Throwable(error));
|
||||
return;
|
||||
}
|
||||
sendChatRoomMessage(retryChatRoomMessage.getMessage(), false)
|
||||
.subscribe((message, throwable) -> {
|
||||
if (throwable == null) {
|
||||
retryChatRoomMessage.setMessage(message);
|
||||
emitter.onSuccess(retryChatRoomMessage);
|
||||
} else {
|
||||
emitter.onError(throwable);
|
||||
}
|
||||
});
|
||||
})
|
||||
retryChatRoomMessage.setRetryCount(retryChatRoomMessage.getRetryCount() + 1);
|
||||
ImRetryManager.logIde("start send im msg :" + retryChatRoomMessage.getRetryCount());
|
||||
if (isExitRoom()) {
|
||||
String error = "exite room when send msg";
|
||||
emitter.onError(new Throwable(error));
|
||||
return;
|
||||
}
|
||||
if (isChangeRoom(retryChatRoomMessage.getMessage())) {
|
||||
String error = "changed room when send msg";
|
||||
emitter.onError(new Throwable(error));
|
||||
return;
|
||||
}
|
||||
sendChatRoomMessage(retryChatRoomMessage.getMessage(), false)
|
||||
.subscribe((message, throwable) -> {
|
||||
if (throwable == null) {
|
||||
retryChatRoomMessage.setMessage(message);
|
||||
emitter.onSuccess(retryChatRoomMessage);
|
||||
} else {
|
||||
emitter.onError(throwable);
|
||||
}
|
||||
});
|
||||
})
|
||||
.retryWhen(flowable -> flowable
|
||||
.flatMap(new Function<Throwable, Publisher<?>>() {
|
||||
@Override
|
||||
|
@@ -83,6 +83,7 @@ public class Constants {
|
||||
|
||||
public static final String ROOM_UID = "ROOM_UID";
|
||||
public static final String ROOM_TYPE = "ROOM_TYPE";
|
||||
public static final String ROOM_INFO = "ROOM_INFO";
|
||||
public static final String IS_ROOM_MIN = "is_room_min";
|
||||
public static final String IS_PARTY = "is_party";
|
||||
|
||||
|
@@ -141,6 +141,140 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
|
||||
private long worldId; // >0:语音派对房
|
||||
|
||||
protected RoomInfo(Parcel in) {
|
||||
uid = in.readLong();
|
||||
officeUser = in.readInt();
|
||||
roomId = in.readLong();
|
||||
roomUid = in.readLong();
|
||||
title = in.readString();
|
||||
avatar = in.readString();
|
||||
type = in.readInt();
|
||||
roomDesc = in.readString();
|
||||
backPic = in.readString();
|
||||
speakTemplate = in.createStringArrayList();
|
||||
valid = in.readByte() != 0;
|
||||
operatorStatus = in.readInt();
|
||||
hasAnimationEffect = in.readByte() != 0;
|
||||
audioQuality = in.readInt();
|
||||
isCloseScreen = in.readByte() != 0;
|
||||
serverRedEnvelopeSwitch = in.readByte() != 0;
|
||||
hasDragonGame = in.readByte() != 0;
|
||||
meetingName = in.readString();
|
||||
roomPwd = in.readString();
|
||||
roomTag = in.readString();
|
||||
tagId = in.readInt();
|
||||
tagPict = in.readString();
|
||||
onlineNum = in.readInt();
|
||||
isRecom = in.readByte();
|
||||
isRoomFans = in.readByte() != 0;
|
||||
background = in.readParcelable(BackgroundBean.class.getClassLoader());
|
||||
hasKTVPriv = in.readByte() != 0;
|
||||
isOpenKTV = in.readByte() != 0;
|
||||
isOpenGame = in.readByte() != 0;
|
||||
boxSwitchVo = in.readParcelable(BoxSwitchVo.class.getClassLoader());
|
||||
singingMusicName = in.readString();
|
||||
limitType = in.readString();
|
||||
introduction = in.readString();
|
||||
roomModeType = in.readInt();
|
||||
isPermitRoom = in.readInt();
|
||||
isPureMode = in.readByte() != 0;
|
||||
closeBox = in.readByte() != 0;
|
||||
leaveMode = in.readByte() != 0;
|
||||
nick = in.readString();
|
||||
gender = in.readInt();
|
||||
worldId = in.readLong();
|
||||
showGiftValue = in.readByte() != 0;
|
||||
hideFlag = in.readInt();
|
||||
closeScreenFlag = in.readInt();
|
||||
redEnvelopeOpen = in.readByte() != 0;
|
||||
blindDateState = in.readString();
|
||||
blindDateVipUid = in.readLong();
|
||||
canOpenBlindDate = in.readByte() != 0;
|
||||
audioSdkType = in.readString();
|
||||
trtcSig = in.readString();
|
||||
isReselect = in.readByte() != 0;
|
||||
mgId = in.readLong();
|
||||
mgName = in.readString();
|
||||
mgMicNum = in.readInt();
|
||||
clearScreenTime = in.readLong();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(uid);
|
||||
dest.writeInt(officeUser);
|
||||
dest.writeLong(roomId);
|
||||
dest.writeLong(roomUid);
|
||||
dest.writeString(title);
|
||||
dest.writeString(avatar);
|
||||
dest.writeInt(type);
|
||||
dest.writeString(roomDesc);
|
||||
dest.writeString(backPic);
|
||||
dest.writeStringList(speakTemplate);
|
||||
dest.writeByte((byte) (valid ? 1 : 0));
|
||||
dest.writeInt(operatorStatus);
|
||||
dest.writeByte((byte) (hasAnimationEffect ? 1 : 0));
|
||||
dest.writeInt(audioQuality);
|
||||
dest.writeByte((byte) (isCloseScreen ? 1 : 0));
|
||||
dest.writeByte((byte) (serverRedEnvelopeSwitch ? 1 : 0));
|
||||
dest.writeByte((byte) (hasDragonGame ? 1 : 0));
|
||||
dest.writeString(meetingName);
|
||||
dest.writeString(roomPwd);
|
||||
dest.writeString(roomTag);
|
||||
dest.writeInt(tagId);
|
||||
dest.writeString(tagPict);
|
||||
dest.writeInt(onlineNum);
|
||||
dest.writeByte(isRecom);
|
||||
dest.writeByte((byte) (isRoomFans ? 1 : 0));
|
||||
dest.writeParcelable(background, flags);
|
||||
dest.writeByte((byte) (hasKTVPriv ? 1 : 0));
|
||||
dest.writeByte((byte) (isOpenKTV ? 1 : 0));
|
||||
dest.writeByte((byte) (isOpenGame ? 1 : 0));
|
||||
dest.writeParcelable(boxSwitchVo, flags);
|
||||
dest.writeString(singingMusicName);
|
||||
dest.writeString(limitType);
|
||||
dest.writeString(introduction);
|
||||
dest.writeInt(roomModeType);
|
||||
dest.writeInt(isPermitRoom);
|
||||
dest.writeByte((byte) (isPureMode ? 1 : 0));
|
||||
dest.writeByte((byte) (closeBox ? 1 : 0));
|
||||
dest.writeByte((byte) (leaveMode ? 1 : 0));
|
||||
dest.writeString(nick);
|
||||
dest.writeInt(gender);
|
||||
dest.writeLong(worldId);
|
||||
dest.writeByte((byte) (showGiftValue ? 1 : 0));
|
||||
dest.writeInt(hideFlag);
|
||||
dest.writeInt(closeScreenFlag);
|
||||
dest.writeByte((byte) (redEnvelopeOpen ? 1 : 0));
|
||||
dest.writeString(blindDateState);
|
||||
dest.writeLong(blindDateVipUid);
|
||||
dest.writeByte((byte) (canOpenBlindDate ? 1 : 0));
|
||||
dest.writeString(audioSdkType);
|
||||
dest.writeString(trtcSig);
|
||||
dest.writeByte((byte) (isReselect ? 1 : 0));
|
||||
dest.writeLong(mgId);
|
||||
dest.writeString(mgName);
|
||||
dest.writeInt(mgMicNum);
|
||||
dest.writeLong(clearScreenTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<RoomInfo> CREATOR = new Creator<RoomInfo>() {
|
||||
@Override
|
||||
public RoomInfo createFromParcel(Parcel in) {
|
||||
return new RoomInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoomInfo[] newArray(int size) {
|
||||
return new RoomInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取房间类型,目前是用于统计
|
||||
*/
|
||||
@@ -207,99 +341,6 @@ public class RoomInfo implements Parcelable,Serializable {
|
||||
public RoomInfo() {
|
||||
}
|
||||
|
||||
protected RoomInfo(Parcel in) {
|
||||
uid = in.readLong();
|
||||
officeUser = in.readInt();
|
||||
roomId = in.readLong();
|
||||
title = in.readString();
|
||||
type = in.readInt();
|
||||
roomDesc = in.readString();
|
||||
backPic = in.readString();
|
||||
valid = in.readByte() != 0;
|
||||
hasAnimationEffect = in.readByte() != 0;
|
||||
operatorStatus = in.readInt();
|
||||
meetingName = in.readString();
|
||||
// openTime = in.readLong();
|
||||
roomPwd = in.readString();
|
||||
roomTag = in.readString();
|
||||
tagId = in.readInt();
|
||||
audioQuality = in.readInt();
|
||||
tagPict = in.readString();
|
||||
onlineNum = in.readInt();
|
||||
limitType = in.readString();
|
||||
isRecom = in.readByte();
|
||||
isRoomFans = in.readByte()!=0;
|
||||
avatar = in.readString();
|
||||
isOpenGame = in.readByte()!=0;
|
||||
isOpenKTV = in.readByte() != 0;
|
||||
hasKTVPriv = in.readByte() != 0;
|
||||
introduction = in.readString();
|
||||
isPermitRoom = in.readInt();
|
||||
showGiftValue = in.readByte() != 0;
|
||||
serverRedEnvelopeSwitch = in.readByte() != 0;
|
||||
nick = in.readString();
|
||||
gender = in.readInt();
|
||||
hideFlag = in.readInt();
|
||||
closeScreenFlag = in.readInt();
|
||||
speakTemplate = in.createStringArrayList();
|
||||
boxSwitchVo = in.readParcelable(BoxSwitchVo.class.getClassLoader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeLong(uid);
|
||||
dest.writeInt(officeUser);
|
||||
dest.writeLong(roomId);
|
||||
dest.writeString(title);
|
||||
dest.writeInt(type);
|
||||
dest.writeString(roomDesc);
|
||||
dest.writeString(backPic);
|
||||
dest.writeByte((byte) (valid ? 1 : 0));
|
||||
dest.writeByte((byte) (hasAnimationEffect ? 1 : 0));
|
||||
dest.writeInt(operatorStatus);
|
||||
dest.writeString(meetingName);
|
||||
// dest.writeLong(openTime);
|
||||
dest.writeString(roomPwd);
|
||||
dest.writeString(roomTag);
|
||||
dest.writeInt(tagId);
|
||||
dest.writeInt(audioQuality);
|
||||
dest.writeString(tagPict);
|
||||
dest.writeInt(onlineNum);
|
||||
dest.writeByte(isRecom);
|
||||
dest.writeByte((byte) (isRoomFans ? 1 : 0));
|
||||
dest.writeString(limitType);
|
||||
dest.writeString(avatar);
|
||||
dest.writeByte((byte) (isOpenGame ? 1 : 0));
|
||||
dest.writeByte((byte) (isOpenKTV ? 1 : 0));
|
||||
dest.writeByte((byte) (hasKTVPriv ? 1 : 0));
|
||||
dest.writeString(introduction);
|
||||
dest.writeInt(isPermitRoom);
|
||||
dest.writeByte((byte) (showGiftValue ? 1 : 0));
|
||||
dest.writeByte((byte) (serverRedEnvelopeSwitch ? 1 : 0));
|
||||
dest.writeInt(gender);
|
||||
dest.writeString(nick);
|
||||
dest.writeStringList(speakTemplate);
|
||||
dest.writeInt(hideFlag);
|
||||
dest.writeInt(closeScreenFlag);
|
||||
dest.writeParcelable(boxSwitchVo, flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<RoomInfo> CREATOR = new Creator<RoomInfo>() {
|
||||
@Override
|
||||
public RoomInfo createFromParcel(Parcel in) {
|
||||
return new RoomInfo(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoomInfo[] newArray(int size) {
|
||||
return new RoomInfo[size];
|
||||
}
|
||||
};
|
||||
|
||||
public static class BackgroundBean implements Parcelable{
|
||||
/**
|
||||
|
Reference in New Issue
Block a user