feat: 完成礼物面板调整
This commit is contained in:
@@ -1,5 +1,13 @@
|
||||
package com.chwl.app.ui.widget;
|
||||
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_COUNTRY;
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_LUCKY;
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_NOBLE;
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_NORMAL;
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_SING_ROOM;
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_SUPER_LUCKY;
|
||||
import static com.chwl.app.ui.widget.magicindicator.GiftIndicator.TYPE_WEEK;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
@@ -38,6 +46,8 @@ import com.chwl.app.ui.webview.DialogWebViewActivity;
|
||||
import com.chwl.core.UriProvider;
|
||||
import com.chwl.core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.chwl.core.gift.bean.SimpleUserInfo;
|
||||
import com.chwl.core.gift.bean.TagsInfo;
|
||||
import com.chwl.core.home.bean.TabInfo;
|
||||
import com.chwl.core.room.anotherroompk.ShowUserInfoDialogEvent;
|
||||
import com.chwl.core.utils.extension.StringExtensionKt;
|
||||
import com.example.lib_utils.UiUtils;
|
||||
@@ -438,13 +448,16 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
sendGiftButton.setOnClickListener(this);
|
||||
giftNumLayout = root.findViewById(R.id.gift_number_layout);
|
||||
giftNumLayout.setOnClickListener(this);
|
||||
List<GiftTab> tabInfoList = new ArrayList<>();
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NORMAL, ResUtil.getString(R.string.ui_widget_giftdialog_01), ResUtil.getString(R.string.ui_widget_giftdialog_02)));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_LUCKY, ResUtil.getString(R.string.ui_widget_giftdialog_03), ResUtil.getString(R.string.ui_widget_giftdialog_04)));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, ResUtil.getString(R.string.ui_widget_giftdialog_05), ResUtil.getString(R.string.ui_widget_giftdialog_06)));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, ResUtil.getString(R.string.ui_widget_giftdialog_07), ResUtil.getString(R.string.ui_widget_giftdialog_08)));
|
||||
|
||||
List<GiftTab> tabInfoList = updateTabs();
|
||||
// MARK: 获取到新 API 数据后,tab 按这里的方式更新
|
||||
// List<GiftTab> tabInfoList = new ArrayList<>();
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NORMAL, ResUtil.getString(R.string.ui_widget_giftdialog_01), ResUtil.getString(R.string.ui_widget_giftdialog_02)));
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_LUCKY, ResUtil.getString(R.string.ui_widget_giftdialog_03), ResUtil.getString(R.string.ui_widget_giftdialog_04)));
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_NOBLE, ResUtil.getString(R.string.ui_widget_giftdialog_05), ResUtil.getString(R.string.ui_widget_giftdialog_06)));
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_WEEK, ResUtil.getString(R.string.ui_widget_giftdialog_07), ResUtil.getString(R.string.ui_widget_giftdialog_08)));
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_DRAW_GIFT, ResUtil.getString(R.string.ui_widget_giftdialog_09), ResUtil.getString(R.string.ui_widget_giftdialog_010)));
|
||||
tabInfoList.add(new GiftTab(GiftIndicator.TYPE_SING_ROOM, ResUtil.getString(R.string.ui_widget_giftdialog_hot), ResUtil.getString(R.string.ui_widget_giftdialog_hot)));
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_SING_ROOM, ResUtil.getString(R.string.ui_widget_giftdialog_hot), ResUtil.getString(R.string.ui_widget_giftdialog_hot)));
|
||||
// tabInfoList.add(new GiftTab(GiftIndicator.TYPE_KNAP, ResUtil.getString(R.string.ui_widget_giftdialog_011), ResUtil.getString(R.string.ui_widget_giftdialog_012)));
|
||||
giftIndicator = root.findViewById(R.id.gift_indicator);
|
||||
giftIndicator.initTab(
|
||||
@@ -503,24 +516,30 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
|
||||
if (giftId == 0) {
|
||||
// 更新所有礼物
|
||||
giftIndicator.setPosition(GiftIndicator.TYPE_NORMAL);
|
||||
giftIndicator.setPosition(TYPE_NORMAL);
|
||||
updateGiftView(giftIndicator.getCurrrentType());
|
||||
} else {
|
||||
int indicatorType = GiftIndicator.TYPE_NORMAL;
|
||||
int indicatorType = TYPE_NORMAL;
|
||||
GiftInfo giftInfo = GiftModel.get().findGiftInfoById(giftId);
|
||||
if (giftInfo != null) {
|
||||
switch (giftInfo.getGiftType()) {
|
||||
case GiftType.GIFT_TYPE_NORMAL:
|
||||
indicatorType = GiftIndicator.TYPE_NORMAL;
|
||||
indicatorType = TYPE_NORMAL;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_LUCKY:
|
||||
indicatorType = GiftIndicator.TYPE_LUCKY;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_SUPER_LUCKY:
|
||||
indicatorType = TYPE_SUPER_LUCKY;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_VIP:
|
||||
indicatorType = GiftIndicator.TYPE_NOBLE;
|
||||
indicatorType = TYPE_NOBLE;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_COUNTRY:
|
||||
indicatorType = TYPE_COUNTRY;
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_WEEK_STAR:
|
||||
indicatorType = GiftIndicator.TYPE_WEEK;
|
||||
indicatorType = TYPE_WEEK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -581,6 +600,34 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
});
|
||||
}
|
||||
|
||||
private List<GiftTab> updateTabs() {
|
||||
List<GiftTab> tabInfoList = new ArrayList<>();
|
||||
for (TagsInfo info: GiftModel.get().getTabList()) {
|
||||
tabInfoList.add(new GiftTab(swithGiftTypeToTabType(info), info.tagName(), info.tagName()));
|
||||
}
|
||||
return tabInfoList;
|
||||
}
|
||||
|
||||
private int swithGiftTypeToTabType(TagsInfo info) {
|
||||
switch (info.tagGiftType()) {
|
||||
case GiftType.GIFT_TYPE_NORMAL:
|
||||
return TYPE_NORMAL;
|
||||
case GiftType.GIFT_TYPE_LUCKY:
|
||||
return TYPE_LUCKY;
|
||||
case GiftType.GIFT_TYPE_SUPER_LUCKY:
|
||||
return TYPE_SUPER_LUCKY;
|
||||
case GiftType.GIFT_TYPE_VIP:
|
||||
return TYPE_NOBLE;
|
||||
case GiftType.GIFT_TYPE_WEEK_STAR:
|
||||
return TYPE_WEEK;
|
||||
case GiftType.GIFT_TYPE_COUNTRY:
|
||||
return TYPE_COUNTRY;
|
||||
case GiftType.GIFT_TYPE_SINGLE_ROOM:
|
||||
return TYPE_SING_ROOM;
|
||||
}
|
||||
return TYPE_NORMAL;
|
||||
}
|
||||
|
||||
private void showLoadingAnimation() {
|
||||
Animation rotateAnimation = new RotateAnimation(0, 360,
|
||||
Animation.RELATIVE_TO_SELF, 0.5f,
|
||||
@@ -656,31 +703,35 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
List<GiftInfo> nobleGiftInfos = getNobleGiftInfos();
|
||||
if (position == GiftIndicator.TYPE_KNAP) {
|
||||
currentGiftInfoList = GiftModel.get().getKnapList();
|
||||
} else if (position == GiftIndicator.TYPE_NOBLE) {
|
||||
} else if (position == TYPE_NOBLE) {
|
||||
currentGiftInfoList = nobleGiftInfos;
|
||||
} else if (position == GiftIndicator.TYPE_NORMAL) {
|
||||
} else if (position == TYPE_NORMAL) {
|
||||
currentGiftInfoList = getNormalGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_LUCKY) {
|
||||
currentGiftInfoList = getLuckyGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_WEEK) {
|
||||
} else if (position == TYPE_WEEK) {
|
||||
currentGiftInfoList = getWeekStarGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||
currentGiftInfoList = getDrawGiftInfos();
|
||||
} else if (position == GiftIndicator.TYPE_SING_ROOM) {
|
||||
currentGiftInfoList = getSingleRoomGiftInfos();
|
||||
} else if (position == TYPE_SUPER_LUCKY) {
|
||||
currentGiftInfoList = getSuperLuckyGiftInfos();
|
||||
} else if (position == TYPE_COUNTRY) {
|
||||
currentGiftInfoList = getCountryGiftInfos();
|
||||
}
|
||||
// 有贵族礼物才显示贵族礼物的tab
|
||||
if (ListUtils.isListEmpty(nobleGiftInfos)) {
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_NOBLE);
|
||||
giftIndicator.hidePosition(TYPE_NOBLE);
|
||||
} else {
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_NOBLE);
|
||||
giftIndicator.showPosition(TYPE_NOBLE);
|
||||
}
|
||||
// 有塗鴉礼物才显示塗鴉礼物的tab
|
||||
if (ListUtils.isListEmpty(getDrawGiftInfos())) {
|
||||
giftIndicator.hidePosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
} else {
|
||||
giftIndicator.showPosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
}
|
||||
// if (ListUtils.isListEmpty(getDrawGiftInfos())) {
|
||||
// giftIndicator.hidePosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
// } else {
|
||||
// giftIndicator.showPosition(GiftIndicator.TYPE_DRAW_GIFT);
|
||||
// }
|
||||
//是否背包礼物
|
||||
final boolean isKnap = (position == GiftIndicator.TYPE_KNAP);
|
||||
initEasyPop(isKnap);
|
||||
@@ -690,9 +741,11 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
// tvGiftValue.setVisibility(View.VISIBLE);
|
||||
showEmptyView();
|
||||
} else if (position == GiftIndicator.TYPE_LUCKY ||
|
||||
position == GiftIndicator.TYPE_WEEK ||
|
||||
position == TYPE_SUPER_LUCKY ||
|
||||
position == TYPE_WEEK ||
|
||||
position == GiftIndicator.TYPE_SING_ROOM ||
|
||||
position == GiftIndicator.TYPE_DRAW_GIFT) {
|
||||
position == GiftIndicator.TYPE_DRAW_GIFT ||
|
||||
position == TYPE_COUNTRY) {
|
||||
showEmptyView();
|
||||
updateWeekStarDesc();
|
||||
isShowDrawGiftModel = false;
|
||||
@@ -707,7 +760,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (currentGiftInfo.isSendMsg()) {
|
||||
etSendMessage.setVisibility(View.VISIBLE);
|
||||
}
|
||||
pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, position == GiftIndicator.TYPE_WEEK ? 4 : 8, currentGiftInfo);
|
||||
pagerList = beanTransformVm(context, currentGiftInfoList, isKnap, position == TYPE_WEEK ? 4 : 8, currentGiftInfo);
|
||||
setGridViewData(pagerList);
|
||||
if (isKnap) {
|
||||
// tvGiftValue.setVisibility(View.VISIBLE);
|
||||
@@ -723,7 +776,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
updateWeekStarDesc();
|
||||
updateDrawGift();
|
||||
giftIndicator.post(() -> {
|
||||
if (position < GiftIndicator.TYPE_WEEK) {
|
||||
if (position < TYPE_WEEK) {
|
||||
giftIndicator.fullScroll(View.FOCUS_LEFT);
|
||||
} else {
|
||||
giftIndicator.fullScroll(View.FOCUS_RIGHT);
|
||||
@@ -797,7 +850,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
|
||||
private void updateWeekStarDesc() {
|
||||
|
||||
if (giftIndicator.getCurrrentType() == GiftIndicator.TYPE_WEEK) {
|
||||
if (giftIndicator.getCurrrentType() == TYPE_WEEK) {
|
||||
flLuckyDesc.setVisibility(View.GONE);
|
||||
llStarWeek.setVisibility(View.GONE);
|
||||
mStarWeekBanner.setVisibility(View.VISIBLE);
|
||||
@@ -1116,6 +1169,11 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
return giftInfos;
|
||||
}
|
||||
|
||||
private List<TagsInfo> getAllTabsAndGiftInfos() {
|
||||
List<TagsInfo> tagsInfos = null;
|
||||
return tagsInfos;
|
||||
}
|
||||
|
||||
private List<GiftInfo> getNormalGiftInfos() {
|
||||
List<GiftInfo> giftInfos = loadGiftInfoList();
|
||||
List<GiftInfo> infos = new ArrayList<>();
|
||||
@@ -1152,6 +1210,18 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
GiftType.GIFT_TYPE_SINGLE_ROOM);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getSuperLuckyGiftInfos() {
|
||||
return GiftModel.get().getGiftInfosByType(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
GiftType.GIFT_TYPE_SUPER_LUCKY);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getCountryGiftInfos() {
|
||||
return GiftModel.get().getGiftInfosByType(
|
||||
String.valueOf(AvRoomDataManager.get().getRoomUid()),
|
||||
GiftType.GIFT_TYPE_COUNTRY);
|
||||
}
|
||||
|
||||
private List<GiftInfo> getNobleGiftInfos() {
|
||||
return GiftModel.get().getGiftInfoList(GiftType.GIFT_TYPE_VIP);
|
||||
}
|
||||
@@ -1449,10 +1519,10 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
|
||||
if (needShowLoading) showLoadingView();
|
||||
int currentType = giftIndicator.getCurrrentType();
|
||||
switch (currentType) {
|
||||
case GiftIndicator.TYPE_NORMAL:
|
||||
case TYPE_NORMAL:
|
||||
case GiftIndicator.TYPE_LUCKY:
|
||||
case GiftIndicator.TYPE_NOBLE:
|
||||
case GiftIndicator.TYPE_WEEK:
|
||||
case TYPE_NOBLE:
|
||||
case TYPE_WEEK:
|
||||
String roomUid = null;
|
||||
if (isInRoom) {
|
||||
if (AvRoomDataManager.get().getRoomUid() > 0) {
|
||||
|
@@ -67,6 +67,16 @@ public class GiftIndicator extends LinearLayout {
|
||||
*/
|
||||
public static final int TYPE_SING_ROOM = 6;
|
||||
|
||||
/**
|
||||
* 国家礼物
|
||||
*/
|
||||
public static final int TYPE_COUNTRY = 7;
|
||||
|
||||
/**
|
||||
* 超级幸运礼物
|
||||
*/
|
||||
public static final int TYPE_SUPER_LUCKY = 8;
|
||||
|
||||
private List<GiftTab> tabList = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
|
@@ -3,6 +3,7 @@ package com.chwl.core.gift;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_ALL_MIC_LUCKY_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_LUCKY_GIFT;
|
||||
import static com.chwl.core.im.custom.bean.CustomAttachment.CUSTOM_MSG_SUB_TYPE_SEND_MULTI_LUCK_GIFT;
|
||||
import static com.chwl.core.utils.extension.StringExtensionKt.toast;
|
||||
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
@@ -11,6 +12,9 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.core.gift.bean.GiftPanelInfo;
|
||||
import com.chwl.core.gift.bean.TagsInfo;
|
||||
import com.chwl.core.home.bean.TabInfo;
|
||||
import com.chwl.core.pay.event.UpdateWalletInfoEvent;
|
||||
import com.netease.nim.uikit.common.util.log.LogUtil;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
@@ -29,7 +33,6 @@ import com.chwl.core.gift.bean.GiftType;
|
||||
import com.chwl.core.gift.bean.LuckyBagGifts;
|
||||
import com.chwl.core.gift.bean.LuckyBagNoticeInfo;
|
||||
import com.chwl.core.gift.bean.MultiGiftReceiveInfo;
|
||||
import com.chwl.core.gift.bean.SimpleVipInfo;
|
||||
import com.chwl.core.gift.event.RoomFreeGiftEvent;
|
||||
import com.chwl.core.gift.event.UpdateKnapEvent;
|
||||
import com.chwl.core.gift.event.UpdateKnapFreeGiftEvent;
|
||||
@@ -49,14 +52,11 @@ import com.chwl.core.pay.PayModel;
|
||||
import com.chwl.core.room.bean.RoomInfo;
|
||||
import com.chwl.core.room.giftvalue.bean.GiftValueCommonUpdate;
|
||||
import com.chwl.core.room.giftvalue.helper.GiftValueMrg;
|
||||
import com.chwl.core.user.UserModel;
|
||||
import com.chwl.core.user.bean.UserInfo;
|
||||
import com.chwl.core.utils.CoreLogger;
|
||||
import com.chwl.core.utils.net.BalanceNotEnoughExeption;
|
||||
import com.chwl.core.utils.net.RadishNotEnoughException;
|
||||
import com.chwl.core.utils.net.RxHelper;
|
||||
import com.chwl.core.utils.net.VipLevelNotEnoughException;
|
||||
import com.chwl.core.vip.bean.UserVipInfo;
|
||||
import com.chwl.library.common.util.SPUtils;
|
||||
import com.chwl.library.net.rxnet.RxNet;
|
||||
import com.chwl.library.utils.ListUtils;
|
||||
@@ -71,7 +71,6 @@ import java.util.List;
|
||||
|
||||
import io.reactivex.Single;
|
||||
import io.reactivex.SingleSource;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.functions.Function;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
@@ -90,7 +89,9 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
private volatile static IGiftModel model;
|
||||
private Api api;
|
||||
private UiHandler handler;
|
||||
private GiftPanelInfo giftPanelInfo;
|
||||
private GiftListInfo allGiftListInfo;
|
||||
public List<TagsInfo> tabList;
|
||||
private List<GiftInfo> knapList;
|
||||
private List<CustomAttachment> giftQueue;
|
||||
private GiftFreeInfo giftFreeInfo;
|
||||
@@ -115,7 +116,8 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
@Override
|
||||
public void tryLoadGiftList() {
|
||||
if (AuthModel.get().isLogin()) {
|
||||
loadGiftInfoList(null).subscribe();
|
||||
loadTagsAndGiftInfoList(null).subscribe();
|
||||
// loadGiftInfoList(null).subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +135,9 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<GiftListInfo>> refreshGiftList(String roomUid) {
|
||||
return loadGiftInfoList(roomUid);
|
||||
public Single<ServiceResult<GiftPanelInfo>> refreshGiftList(String roomUid) {
|
||||
// return loadGiftInfoList(roomUid);
|
||||
return loadTagsAndGiftInfoList(roomUid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -143,8 +146,8 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
* @param roomUid 房间 UID
|
||||
* @return
|
||||
*/
|
||||
private Single<ServiceResult<GiftListInfo>> requestGiftInfos(String roomUid) {
|
||||
return loadGiftInfoList(roomUid);
|
||||
private Single<ServiceResult<GiftPanelInfo>> requestTagsAndGiftInfos(String roomUid) {
|
||||
return loadTagsAndGiftInfoList(roomUid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,14 +156,37 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
// @Override
|
||||
// public Single<ServiceResult<GiftPanelInfo>> loadGiftInfoList(String roomUid) {
|
||||
// return api.requestGiftInfos(roomUid)
|
||||
// .compose(new Transformer<>())
|
||||
// .doOnSuccess(response -> {
|
||||
// if (response.isSuccess()) {
|
||||
// giftPanelInfo = response.getData();
|
||||
// }
|
||||
// })
|
||||
// .doOnError(throwable -> toast(throwable.getMessage()));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 加载面板 tags 和普通礼物,不带上房间专属的礼物
|
||||
*
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Single<ServiceResult<GiftListInfo>> loadGiftInfoList(String roomUid) {
|
||||
return api.requestGiftInfos(roomUid)
|
||||
public Single<ServiceResult<GiftPanelInfo>> loadTagsAndGiftInfoList(String roomUid) {
|
||||
return api.requestAllTagsAndGiftInfos(roomUid)
|
||||
.compose(new Transformer<>())
|
||||
.doOnSuccess(response -> {
|
||||
if (response.isSuccess()) {
|
||||
allGiftListInfo = response.getData();
|
||||
giftPanelInfo = response.getData();
|
||||
tabList = giftPanelInfo.tabList;
|
||||
allGiftListInfo = giftPanelInfo.giftTabMap;
|
||||
}
|
||||
})
|
||||
.doOnError(throwable -> {
|
||||
toast(throwable.getMessage());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -188,6 +214,11 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TagsInfo> getTabList() {
|
||||
return tabList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GiftInfo> getGiftInfoList(int giftType) {
|
||||
return getGiftInfosByType(null, giftType);
|
||||
@@ -196,7 +227,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
@Override
|
||||
public List<GiftInfo> getGiftInfosByType(String roomUid, int giftType) {
|
||||
if (allGiftListInfo == null) {
|
||||
requestGiftInfos(roomUid).subscribe();
|
||||
requestTagsAndGiftInfos(roomUid).subscribe();
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<GiftInfo> giftInfos = null;
|
||||
@@ -205,7 +236,10 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
giftInfos = allGiftListInfo.getNormalGift();
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_LUCKY:
|
||||
giftInfos = allGiftListInfo.getLuckyGift();
|
||||
giftInfos = allGiftListInfo.getLuckyBagGift();
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_SUPER_LUCKY:
|
||||
giftInfos = allGiftListInfo.getSuperLuckyGift();
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_VIP:
|
||||
giftInfos = allGiftListInfo.getVipGift();
|
||||
@@ -219,6 +253,9 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
case GiftType.GIFT_TYPE_SINGLE_ROOM:
|
||||
giftInfos = allGiftListInfo.getSinglePopularGift();
|
||||
break;
|
||||
case GiftType.GIFT_TYPE_COUNTRY:
|
||||
giftInfos = allGiftListInfo.getCountryGift();
|
||||
break;
|
||||
}
|
||||
return giftInfos == null ? new ArrayList<>() : giftInfos;
|
||||
}
|
||||
@@ -450,7 +487,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
IMNetEaseManager.get().getChatRoomEventObservable().onNext(new RoomEvent()
|
||||
.setEvent(RoomEvent.GIFT_OUT_OF_DATE)
|
||||
.setMessage(serviceResult.getMessage()));
|
||||
requestGiftInfos(finalRoomUid).subscribe();
|
||||
requestTagsAndGiftInfos(finalRoomUid).subscribe();
|
||||
return Single.error(new GiftOutOfDateException(serviceResult.getMessage()));
|
||||
} else if (serviceResult.getMessage() != null) {
|
||||
SingleToastUtil.showToast(serviceResult.getMessage());
|
||||
@@ -547,7 +584,7 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
giftInfo = findGiftInfoById(allGiftListInfo.getVipGift(), giftId);
|
||||
}
|
||||
if (giftInfo == null) {
|
||||
giftInfo = findGiftInfoById(allGiftListInfo.getLuckyGift(), giftId);
|
||||
giftInfo = findGiftInfoById(allGiftListInfo.getLuckyBagGift(), giftId);
|
||||
}
|
||||
if (giftInfo == null) {
|
||||
giftInfo = findGiftInfoById(allGiftListInfo.getLuckyPoolGift(), giftId);
|
||||
@@ -697,8 +734,16 @@ public class GiftModel extends BaseModel implements IGiftModel {
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@GET("/gift/listV5")
|
||||
Single<ServiceResult<GiftListInfo>> requestGiftInfos(@Query("roomUid") String roomUid);
|
||||
@GET("/gift/getPanel")
|
||||
Single<ServiceResult<GiftPanelInfo>> requestGiftInfos(@Query("roomUid") String roomUid);
|
||||
|
||||
/**
|
||||
* 获取面板标签和礼物列表
|
||||
*
|
||||
* @return -
|
||||
*/
|
||||
@GET("/gift/getPanel")
|
||||
Single<ServiceResult<GiftPanelInfo>> requestAllTagsAndGiftInfos(@Query("roomUid") String roomUid);
|
||||
|
||||
/**
|
||||
* 获取砸金蛋中奖背包里面的东西列表
|
||||
|
@@ -30,5 +30,7 @@ public interface IGiftCore extends IBaseCore {
|
||||
|
||||
void requestGiftInfos();
|
||||
|
||||
void requestAllTagsAndGiftInfos();
|
||||
|
||||
void onReceiveChatRoomMessages(List<ChatRoomMessage> chatRoomMessageList);
|
||||
}
|
||||
|
@@ -2,6 +2,9 @@ package com.chwl.core.gift;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.chwl.core.gift.bean.GiftPanelInfo;
|
||||
import com.chwl.core.gift.bean.TagsInfo;
|
||||
import com.chwl.core.home.bean.TabInfo;
|
||||
import com.netease.nimlib.sdk.chatroom.model.ChatRoomMessage;
|
||||
import com.chwl.core.bean.response.ServiceResult;
|
||||
import com.chwl.core.gift.bean.GiftFreeInfo;
|
||||
@@ -24,7 +27,14 @@ public interface IGiftModel {
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<GiftListInfo>> loadGiftInfoList(String roomUid);
|
||||
// Single<ServiceResult<GiftPanelInfo>> loadGiftInfoList(String roomUid);
|
||||
/**
|
||||
* 加载面板 tags 和普通礼物,不带上房间专属的礼物
|
||||
*
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<GiftPanelInfo>> loadTagsAndGiftInfoList(String roomUid);
|
||||
|
||||
/**
|
||||
* 进入房间后,刷新礼物列表, 保留原来的不带有房间专属礼物的列表
|
||||
@@ -32,7 +42,7 @@ public interface IGiftModel {
|
||||
* @param roomUid
|
||||
* @return
|
||||
*/
|
||||
Single<ServiceResult<GiftListInfo>> refreshGiftList(String roomUid);
|
||||
Single<ServiceResult<GiftPanelInfo>> refreshGiftList(String roomUid);
|
||||
|
||||
/**
|
||||
* 加载背包礼物
|
||||
@@ -48,6 +58,8 @@ public interface IGiftModel {
|
||||
*/
|
||||
List<GiftInfo> getKnapList();
|
||||
|
||||
List<TagsInfo> getTabList();
|
||||
|
||||
/**
|
||||
* 从内存里取出背包礼物列表
|
||||
*
|
||||
|
@@ -11,7 +11,10 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class GiftListInfo implements Serializable {
|
||||
private List<GiftInfo> luckyGift;
|
||||
// private List<GiftInfo> luckyGift; // 拆分为 lucky bag 和 super luck
|
||||
private List<GiftInfo> luckyBagGift;
|
||||
private List<GiftInfo> countryGift;
|
||||
private List<GiftInfo> superLuckyGift;
|
||||
private List<GiftInfo> vipGift;
|
||||
private List<GiftInfo> normalGift;
|
||||
private List<GiftInfo> luckyPoolGift;
|
||||
@@ -19,5 +22,4 @@ public class GiftListInfo implements Serializable {
|
||||
private List<GiftInfo> drawGift;
|
||||
private List<GiftInfo> singlePopularGift;
|
||||
private String giftVersion;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,12 @@
|
||||
package com.chwl.core.gift.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GiftPanelInfo implements Serializable {
|
||||
public List<TagsInfo> tabList;
|
||||
|
||||
public GiftListInfo giftTabMap;
|
||||
// public Map<String, GiftListInfo> giftTabMap;
|
||||
}
|
@@ -26,7 +26,7 @@ public class GiftType {
|
||||
public static final int CARDS = 4;
|
||||
|
||||
/**
|
||||
* 礼物类型 -- 福袋
|
||||
* 礼物类型 -- VIP
|
||||
*/
|
||||
|
||||
public static final int GIFT_TYPE_VIP = 7;
|
||||
@@ -45,4 +45,6 @@ public class GiftType {
|
||||
* 超级幸运礼物
|
||||
*/
|
||||
public static final int GIFT_TYPE_SUPER_LUCKY = 16;
|
||||
|
||||
public static final int GIFT_TYPE_COUNTRY = 17;
|
||||
}
|
||||
|
39
core/src/main/java/com/chwl/core/gift/bean/TagsInfo.java
Normal file
39
core/src/main/java/com/chwl/core/gift/bean/TagsInfo.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.chwl.core.gift.bean;
|
||||
|
||||
import com.chwl.core.bean.I18N;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class TagsInfo implements Serializable {
|
||||
private I18N nameMap;
|
||||
|
||||
public String tagName() {
|
||||
return I18N.getFirstOrDefault(nameMap, "");
|
||||
}
|
||||
|
||||
// 排序
|
||||
private int seq;
|
||||
|
||||
// 对应的礼物分类
|
||||
private String key;
|
||||
|
||||
private GiftType giftType;
|
||||
public int tagGiftType() {
|
||||
if ("normalGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_NORMAL;
|
||||
} else if ("luckyBagGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_LUCKY;
|
||||
} else if ("superLuckyGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_SUPER_LUCKY;
|
||||
} else if ("vipGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_VIP;
|
||||
} else if ("weekStarGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_WEEK_STAR;
|
||||
} else if ("countryGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_COUNTRY;
|
||||
} else if ("singlePopularGift".equals(key)) {
|
||||
return GiftType.GIFT_TYPE_SINGLE_ROOM;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
@@ -32,8 +32,8 @@ COMPILE_SDK_VERSION=34
|
||||
MIN_SDK_VERSION=21
|
||||
TARGET_SDK_VERSION=34
|
||||
|
||||
version_name=1.0.12
|
||||
version_code=16
|
||||
version_name=1.0.13
|
||||
version_code=17
|
||||
|
||||
#systemProp.https.proxyHost=127.0.0.1
|
||||
#systemProp.https.proxyPort=7890
|
||||
|
Reference in New Issue
Block a user