fix:修复赠送背包TAB的解锁礼物后,未更新顶部提示面板数量问题

This commit is contained in:
Max
2024-02-02 18:04:12 +08:00
parent 2c4fb0e056
commit bed3184df9

View File

@@ -228,6 +228,9 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
private BaseQuickAdapter<GiftPrivilegeInfo, BaseViewHolder> baseQuickAdapter;
// 需要重新加载背包礼物
private boolean needReloadKnapGift;
public GiftDialog(Context context, int giftId) {
this(context, 0, true, false, true, giftId);
}
@@ -465,6 +468,8 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
//福袋礼物有定时更新逻辑,每次点击都需要刷新福袋礼物信息
if (integer == GiftIndicator.TYPE_INTEREST) {
reloadData(false);
} else if (integer == GiftIndicator.TYPE_KNAP && needReloadKnapGift) {
reloadData(false);
}
});
@@ -1669,11 +1674,20 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
// 更新解锁礼物数据状态
private void updateUnlockGiftDataState(int giftId, int number) {
//(趣味、背包)都有可能有解锁礼物
ArrayList<GiftInfo> list = new ArrayList<GiftInfo>();
List<GiftInfo> panelGiftList = GiftModel.get().getGiftInfoList(GiftType.GIFT_TYPE_UNLOCK);
if (panelGiftList == null) {
List<GiftInfo> knapList = GiftModel.get().getKnapList();
if (panelGiftList != null) {
list.addAll(panelGiftList);
}
if (knapList != null) {
list.addAll(knapList);
}
if (list.isEmpty()) {
return;
}
for (GiftInfo item : panelGiftList) {
for (GiftInfo item : list) {
if (item.getGiftType() != GiftType.GIFT_TYPE_UNLOCK) {
continue;
}
@@ -1739,6 +1753,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
.requestKnapGiftInfos()
.subscribe((listServiceResult, throwable) -> {
if (throwable == null) {
needReloadKnapGift = false;
if (currentType == giftIndicator.getCurrrentType()) {
updateGiftView(giftIndicator.getCurrrentType());
}
@@ -1836,9 +1851,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene
@Subscribe(threadMode = ThreadMode.MAIN)
public void onRecieveGiftKnapMsg(UpdateKnapEvent event) {
//刷新背包礼物
compositeDisposable.add(GiftModel.get().requestKnapGiftInfos()
.compose(RxHelper.handleSchedulers())
.subscribe());
needReloadKnapGift = true;
if (giftIndicator.getCurrrentType() != GiftIndicator.TYPE_KNAP) {
return;
}