6.7.0用户端更新:修复包裹礼物送礼数量不同步问题
This commit is contained in:
parent
2cf10cc35a
commit
bb49472817
@ -11,6 +11,7 @@ import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.event.LiveGiftItemEvent;
|
||||
import com.yunbao.live.event.LiveParcelItemRefreshEvent;
|
||||
import com.yunbao.live.views.LiveParcelItemViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -56,9 +57,11 @@ public class LiveParcelItemAdapter extends RecyclerView.Adapter {
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void refreshWrapListAfterSend(LiveGiftBean model) {
|
||||
public void refreshWrapListAfterSend(LiveParcelItemRefreshEvent refreshEvent) {
|
||||
LiveGiftBean liveGiftBean = refreshEvent.getLiveGiftModel();
|
||||
int sendCount = refreshEvent.getSendCount();//赠送礼物数量
|
||||
for (int i = 0; i < giftJson.size(); i++) {
|
||||
if (giftJson.get(i).getId() == model.getId()) {
|
||||
if (giftJson.get(i).getId() == liveGiftBean.getId()) {
|
||||
|
||||
|
||||
String giftNum = giftJson.get(i).getGiftNum();
|
||||
@ -70,10 +73,11 @@ public class LiveParcelItemAdapter extends RecyclerView.Adapter {
|
||||
number = 0;
|
||||
}
|
||||
if (number == 1) {
|
||||
|
||||
//如果礼物只剩一个,直接移除礼物
|
||||
giftJson.remove(i);
|
||||
} else {
|
||||
giftJson.get(i).setGiftNum(String.valueOf(number - 1));
|
||||
//设置送礼后的礼物数量
|
||||
giftJson.get(i).setGiftNum(String.valueOf(number - sendCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -699,7 +699,8 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
}
|
||||
isGetNewWrap = true;
|
||||
if (isWrap) {
|
||||
Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel));
|
||||
//刷新包裹中的礼物数量
|
||||
Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel).setSendCount(Integer.parseInt(mCount)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1375,9 +1376,10 @@ public class LiveGiftPopup extends AbsDialogFragment {
|
||||
// //刷新包裹列表wrap_gift_num -1:表示数量没有变化
|
||||
// mObjGiftSendback = obj;
|
||||
isGetNewWrap = true;
|
||||
|
||||
//是包裹里的礼物
|
||||
if (isWrap) {
|
||||
Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel));
|
||||
//刷新包裹中礼物的数量
|
||||
Bus.get().post(new LiveParcelItemRefreshEvent().setLiveGiftModel(liveGiftModel).setSendCount(Integer.parseInt(mCount)));
|
||||
}
|
||||
}
|
||||
} else if (code == 1007 && mGiftBean.getType() != 0) {
|
||||
|
@ -6,6 +6,17 @@ import com.yunbao.common.bean.LiveGiftBean;
|
||||
public class LiveParcelItemRefreshEvent extends BaseModel {
|
||||
private LiveGiftBean liveGiftModel;
|
||||
|
||||
private int sendCount;
|
||||
|
||||
public int getSendCount() {
|
||||
return sendCount;
|
||||
}
|
||||
|
||||
public LiveParcelItemRefreshEvent setSendCount(int sendCount) {
|
||||
this.sendCount = sendCount;
|
||||
return this;
|
||||
}
|
||||
|
||||
public LiveGiftBean getLiveGiftModel() {
|
||||
return liveGiftModel;
|
||||
}
|
||||
|
@ -77,6 +77,6 @@ public class LiveParcelItemFragment extends BaseFragment {
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveParcelItemRefreshEvent(LiveParcelItemRefreshEvent event) {
|
||||
frameGiftAdapter.refreshWrapListAfterSend(event.getLiveGiftModel());
|
||||
frameGiftAdapter.refreshWrapListAfterSend(event);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user