房间开箱入口适配小屏手机

This commit is contained in:
huangjian
2022-08-26 11:28:59 +08:00
parent c464778834
commit 45b31d88f8
6 changed files with 114 additions and 56 deletions

View File

@@ -273,8 +273,8 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
GiftValueMrg.get().updateRoomGiftValue(false)
ivRadishEntrance?.isVisible =
(UserModel.get().cacheLoginUserInfo?.userLevelVo?.getExperLevelSeq() ?: 0) >=
(InitialModel.get().cacheInitInfo?.linearlyPoolOpenLevel ?: 999)
!GoldBoxHelper.needIntegrateBoxEntrance() && GoldBoxHelper.isShowRadish()
}
@CallSuper

View File

@@ -147,13 +147,16 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
updatePkScoreBoard();
initRoomPkOrder(AvRoomDataManager.get().showPkBeginTime, AvRoomDataManager.get().pkBeginTime);
getMvpPresenter().getBannerList();
UserModel.get().getCurrentUserInfo()
.compose(bindToLifecycle())
.subscribe(userInfo -> {
if (userInfo.isFirstCharge()) {
gameBinding.ivFirstChargeEnter.setVisibility(View.VISIBLE);
}
});
if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
UserModel.get().getCurrentUserInfo()
.compose(bindToLifecycle())
.subscribe(userInfo -> {
if (userInfo.isFirstCharge()) {
gameBinding.ivFirstChargeEnter.setVisibility(View.VISIBLE);
}
});
}
}
@Override
@@ -803,30 +806,37 @@ public class HomePartyRoomFragment extends BaseRoomFragment<IHomePartyView, Home
} else {
gameBinding.tvHourRank.setVisibility(View.GONE);
}
GoldBoxHelper.isHideBox().subscribe(
hide -> {
if (hide != null && !hide) {
if (AvRoomDataManager.get().isCpRoom()) {
gameBinding.ivTreasureBoxCp.setVisibility(View.VISIBLE);
gameBinding.ivTreasureBox.setVisibility(View.GONE);
if (!GoldBoxHelper.needIntegrateBoxEntrance()) {
GoldBoxHelper.isHideBox().subscribe(
hide -> {
if (hide != null && !hide) {
if (AvRoomDataManager.get().isCpRoom()) {
gameBinding.ivTreasureBoxCp.setVisibility(View.VISIBLE);
gameBinding.ivTreasureBox.setVisibility(View.GONE);
} else {
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
gameBinding.ivTreasureBox.setVisibility(View.VISIBLE);
GlideApp.with(BasicConfig.INSTANCE.getAppContext())
.load(GoldBoxHelper.getBoxIcon())
.error(R.drawable.icon_room_treasure_box)
.into(gameBinding.ivTreasureBox);
}
} else {
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
gameBinding.ivTreasureBox.setVisibility(View.VISIBLE);
GlideApp.with(BasicConfig.INSTANCE.getAppContext())
.load(GoldBoxHelper.getBoxIcon())
.error(R.drawable.icon_room_treasure_box)
.into(gameBinding.ivTreasureBox);
gameBinding.ivTreasureBox.setVisibility(View.GONE);
}
} else {
},
throwable -> {
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
gameBinding.ivTreasureBox.setVisibility(View.GONE);
}
},
throwable -> {
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
gameBinding.ivTreasureBox.setVisibility(View.GONE);
});
});
} else {
gameBinding.ivTreasureBoxCp.setVisibility(View.GONE);
gameBinding.ivTreasureBox.setVisibility(View.GONE);
}
setDragonView();
}

View File

@@ -11,10 +11,12 @@ import com.netease.nimlib.sdk.chatroom.ChatRoomMessageBuilder;
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
import com.netease.nimlib.sdk.msg.constant.MsgTypeEnum;
import com.yizhuan.erban.avroom.view.IHomePartyView;
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
import com.yizhuan.erban.utils.UserUtils;
import com.yizhuan.xchat_android_core.Constants;
import com.yizhuan.xchat_android_core.auth.AuthModel;
import com.yizhuan.xchat_android_core.bean.RoomQueueInfo;
import com.yizhuan.xchat_android_core.home.bean.BannerInfo;
import com.yizhuan.xchat_android_core.im.custom.bean.CustomAttachment;
import com.yizhuan.xchat_android_core.im.custom.bean.FaceAttachment;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
@@ -64,7 +66,7 @@ public class HomePartyPresenter extends BaseRoomPresenter<IHomePartyView> {
return;
}
if (!isInviteUpMic) {
if (AvRoomDataManager.get().haveStartDragon) {
if (AvRoomDataManager.get().haveStartDragon) {
if (getMvpView() != null) {
getMvpView().onDragonBarChangeMic(micPosition, uId, isInviteUpMic, roomInfo);
}
@@ -299,7 +301,33 @@ public class HomePartyPresenter extends BaseRoomPresenter<IHomePartyView> {
mAvRoomModel.getRoomBanner()
.compose(bindToLifecycle())
.subscribe(bannerInfos -> {
getMvpView().onShowBanner(bannerInfos);
if (GoldBoxHelper.needIntegrateBoxEntrance()) {
final boolean firstCharge = UserUtils.getUserInfo().isFirstCharge();
if (firstCharge) {
BannerInfo bannerInfo = new BannerInfo();
bannerInfo.setFirstCharge(true);
bannerInfos.add(0, bannerInfo);
}
if (GoldBoxHelper.isShowRadish()) {
BannerInfo bannerInfo = new BannerInfo();
bannerInfo.setRadish(true);
bannerInfos.add(firstCharge ? 1 : 0, bannerInfo);
}
GoldBoxHelper.isHideBox()
.subscribe(isHide -> {
if (!isHide) {
BannerInfo bannerInfo = new BannerInfo();
bannerInfo.setBox(true);
int index = 0;
if (firstCharge) index++;
if (GoldBoxHelper.isShowRadish()) index++;
bannerInfos.add(index, bannerInfo);
}
getMvpView().onShowBanner(bannerInfos);
}, throwable -> getMvpView().onShowBanner(bannerInfos));
} else {
getMvpView().onShowBanner(bannerInfos);
}
});
}
}

View File

@@ -10,6 +10,7 @@ import android.widget.ImageView;
import com.netease.nim.uikit.support.glide.GlideApp;
import com.yizhuan.erban.R;
import com.yizhuan.erban.avroom.firstcharge.FirstChargeDialog;
import com.yizhuan.erban.shipantics.PullRadishActivity;
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
import com.yizhuan.erban.ui.widget.rollviewpager.adapter.StaticPagerAdapter;
@@ -38,7 +39,6 @@ public class RoomActAdapter extends StaticPagerAdapter {
View view = LayoutInflater.from(mContext).inflate(R.layout.item_room_act, container, false);
ImageView ivCover = view.findViewById(R.id.iv_cover);
BannerInfo bannerInfo = data.get(position);
String url = bannerInfo.getSkipUri();
String actId = String.valueOf(bannerInfo.getBannerId());
ivCover.setScaleType(ImageView.ScaleType.CENTER_CROP);
if (bannerInfo.isFirstCharge()) {
@@ -48,41 +48,41 @@ public class RoomActAdapter extends StaticPagerAdapter {
.load(GoldBoxHelper.getBoxIcon())
.error(R.drawable.icon_room_treasure_box)
.into(ivCover);
} else if (bannerInfo.isRadish()) {
ivCover.setImageResource(R.drawable.ic_radish_entrance);
} else {
ImageLoadUtils.loadImage(mContext, bannerInfo.getBannerPic(), ivCover, R.drawable.default_cover);
}
ivCover.setOnClickListener(v -> {
if (bannerInfo.isFirstCharge()) {
FirstChargeDialog.start(mContext);
} else if (bannerInfo.isBox()) {
GoldBoxHelper.handleBoxClick(mContext);
}
if (TextUtils.isEmpty(url)) return;
StatisticManager.Instance().onEvent(StatisticsProtocol.mp_room_activity, "普通房活动点击");
AvRoomModel.get().activityClickLog("2", actId).subscribe();
if (!TextUtils.isEmpty(actId) && "19".equals(actId)) {
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ROOM_RECOMMEND_CLICK, "我要上推荐");
}
if (bannerInfo.getSkipType() == 3 && bannerInfo.getShowType() != 1) {
if (listener != null) {
listener.onWebClick(bannerInfo.getSkipUri());
}
} else if (bannerInfo.isRadish()) {
PullRadishActivity.start(mContext);
} else {
CommonJumpHelper.bannerJump(mContext, bannerInfo);
}
//新埋点
String actName = bannerInfo.getBannerName();
if (actName == null) {
actName = "";
}
StatisticManager.Instance().onEvent(StatisticsProtocol.mp_room_activity, "普通房活动点击");
AvRoomModel.get().activityClickLog("2", actId).subscribe();
if (!TextUtils.isEmpty(actId) && "19".equals(actId)) {
StatisticManager.Instance().onEvent(StatisticsProtocol.EVENT_ROOM_RECOMMEND_CLICK, "我要上推荐");
}
if (bannerInfo.getSkipType() == 3 && bannerInfo.getShowType() != 1) {
if (listener != null) {
listener.onWebClick(bannerInfo.getSkipUri());
}
} else {
CommonJumpHelper.bannerJump(mContext, bannerInfo);
}
//新埋点
String actName = bannerInfo.getBannerName();
if (actName == null) {
actName = "";
}
StatisticManager.Instance().onEvent(
StatisticsProtocol.EVENT_ROOM_ACTIVITY_ENTRANCE_B,
"房间右下角活动入口-区分活动:" + actName);
StatisticManager.Instance().onEvent(
StatisticsProtocol.EVENT_ROOM_ACTIVITY_ENTRANCE_B,
"房间右下角活动入口-区分活动:" + actName);
}
});
return view;
}

View File

@@ -5,10 +5,12 @@ import android.content.Context;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentActivity;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.yizhuan.erban.treasure_box.activity.TreasureBoxActivity;
import com.yizhuan.erban.treasure_box.activity.TreasureBoxHonourActivity;
import com.yizhuan.erban.treasure_box.fragment.ChooseTreasureBoxDialogFragment;
import com.yizhuan.xchat_android_core.initial.InitialModel;
import com.yizhuan.xchat_android_core.initial.bean.InitInfo;
import com.yizhuan.xchat_android_core.level.UserLevelVo;
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager;
import com.yizhuan.xchat_android_core.market_verify.MarketVerifyModel;
@@ -87,4 +89,21 @@ public class GoldBoxHelper {
return AvRoomDataManager.get().mBoxSwitchVo.getDiamondBoxOpenTime();
}
public static boolean isShowRadish() {
InitInfo initInfo = InitialModel.get().getCacheInitInfo();
UserInfo userInfo = UserModel.get().getCacheLoginUserInfo();
if (initInfo == null || userInfo == null) return false;
return userInfo.getUserLevelVo().getExperLevelSeq() >= initInfo.getLinearlyPoolOpenLevel();
}
/**
* 屏幕宽高比小于2的机型房间活动入口和开箱入口整合,个播房不需要整合
*
* @return
*/
public static boolean needIntegrateBoxEntrance() {
return !AvRoomDataManager.get().isSingleRoom() && ScreenUtil.screenHeight / ScreenUtil.screenWidth < 2;
}
}