修改生成心愿单
This commit is contained in:
parent
d50c56bbb2
commit
19c0c8c6e7
@ -0,0 +1,6 @@
|
||||
package com.yunbao.common.event;
|
||||
|
||||
import com.yunbao.common.bean.BaseModel;
|
||||
|
||||
public class PopupViewDismissEvent extends BaseModel {
|
||||
}
|
@ -17,6 +17,7 @@ import com.yunbao.common.bean.WishListModel;
|
||||
import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.bean.WishModel2;
|
||||
import com.yunbao.common.event.LiveNewWishListCloseEvent;
|
||||
import com.yunbao.common.event.PopupViewDismissEvent;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.Bus;
|
||||
@ -61,7 +62,13 @@ public class LiveNewWishListFragment extends BaseFragment {
|
||||
.show();
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(tvDone, () -> saveWish());
|
||||
ViewClicksAntiShake.clicksAntiShake(tvDone, new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||
@Override
|
||||
public void onViewClicks() {
|
||||
saveWish();
|
||||
Bus.get().post(new PopupViewDismissEvent());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,40 +107,46 @@ public class LiveNewWishListFragment extends BaseFragment {
|
||||
|
||||
public void saveWish() {
|
||||
List<WishModel> wishList = liveNewWishAdapter.getWishList();
|
||||
wishList.remove(wishList.size() - 1);
|
||||
List<WishModel2> wishList2 = new ArrayList<>();
|
||||
Gson gson = new Gson();
|
||||
for (WishModel model : wishList) {
|
||||
WishModel2 model2 = gson.fromJson(gson.toJson(model), WishModel2.class);
|
||||
wishList2.add(model2);
|
||||
if (model!=null){
|
||||
WishModel2 model2 = gson.fromJson(gson.toJson(model), WishModel2.class);
|
||||
wishList2.add(model2);
|
||||
}
|
||||
|
||||
}
|
||||
if (wishList2.size() == 0) {
|
||||
Bus.get().post(new PopupViewDismissEvent());
|
||||
} else {
|
||||
LiveNetManager.get(getContext()).
|
||||
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
}
|
||||
});
|
||||
switch (type) {
|
||||
case 1:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setDayWish(false));
|
||||
break;
|
||||
case 2:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setZhouXin(false));
|
||||
break;
|
||||
case 3:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setLunarWish(false));
|
||||
break;
|
||||
case 4:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setSeasonalWish(false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LiveNetManager.get(getContext()).
|
||||
setWishlistV2(type, gson.toJson(wishList2), new HttpCallback<String>() {
|
||||
@Override
|
||||
public void onSuccess(String data) {
|
||||
ToastUtil.show(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(R.string.net_error);
|
||||
}
|
||||
});
|
||||
switch (type) {
|
||||
case 1:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setDayWish(false));
|
||||
break;
|
||||
case 2:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setZhouXin(false));
|
||||
break;
|
||||
case 3:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setLunarWish(false));
|
||||
break;
|
||||
case 4:
|
||||
Bus.get().post(new LiveNewWishListCloseEvent().setSeasonalWish(false));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ import com.yunbao.common.bean.WishModel;
|
||||
import com.yunbao.common.bean.WishModel2;
|
||||
import com.yunbao.common.event.LiveNewWishListCloseEvent;
|
||||
import com.yunbao.common.event.LiveNewWishListEvent;
|
||||
import com.yunbao.common.event.PopupViewDismissEvent;
|
||||
import com.yunbao.common.fragment.LiveNewWishListFragment;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
@ -146,6 +147,11 @@ public class LiveNewWishListPopup extends BottomPopupView {
|
||||
super.onDismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onPopupViewDismissEvent(PopupViewDismissEvent event) {
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onLiveNewWishListCloseEvent(LiveNewWishListCloseEvent event) {
|
||||
dayWish = event.isDayWish();
|
||||
|
Loading…
Reference in New Issue
Block a user