diff --git a/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java b/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java index e6550b62d..4363e6dd2 100644 --- a/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/LiveNewWishAdapter.java @@ -1,5 +1,6 @@ package com.yunbao.common.adapter; +import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -11,6 +12,7 @@ import com.yunbao.common.R; import com.yunbao.common.bean.WishModel; import com.yunbao.common.event.LiveNewWishListCloseEvent; import com.yunbao.common.utils.Bus; +import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.views.DayWishItemViewHolder; import com.yunbao.common.views.LunarWishItemViewHolder; import com.yunbao.common.views.SeasonalWishItemViewHolder; @@ -46,8 +48,20 @@ public class LiveNewWishAdapter extends RecyclerView.Adapter { Bus.get().post(new LiveNewWishListCloseEvent().setSeasonalWish(true)); break; } + boolean isAdd = false; + for (int i = 0; i < wishList.size(); i++) { + if (wishList.get(i)!=null){ + if (!TextUtils.isEmpty(wishList.get(i).getLid()) && !TextUtils.isEmpty(model.getLid()) + && TextUtils.equals(wishList.get(i).getLid(), model.getLid())) { + ToastUtil.show(R.string.too_many_gifts); + isAdd = true; + } + } - wishList.add(0, model); + } + if (!isAdd) { + wishList.add(0, model); + } notifyDataSetChanged(); } diff --git a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java index 32197b1d5..d2e73a5c7 100644 --- a/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/LiveNewWishListFragment.java @@ -119,6 +119,7 @@ public class LiveNewWishListFragment extends BaseFragment { } if (wishList2.size() == 0) { Bus.get().post(new PopupViewDismissEvent()); + } else if (wishList2.size() == 1) { new XPopup.Builder(getContext()) .asCustom(new HintCustomPopup(getContext(), @@ -146,20 +147,6 @@ public class LiveNewWishListFragment extends BaseFragment { 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; - } } @Override @@ -185,22 +172,22 @@ public class LiveNewWishListFragment extends BaseFragment { 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; - } + } - + 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; + } } } diff --git a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java index b6d8a88c6..b909dade7 100644 --- a/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java +++ b/common/src/main/java/com/yunbao/common/views/LiveNewWishListPopup.java @@ -167,6 +167,7 @@ public class LiveNewWishListPopup extends BottomPopupView { .setWishlistName(event.getModel().getName()) .setWishlistIcon(event.getModel().getImg()) .setWishlistNum("1") + .setLid(event.getModel().getId()) .setLuid("" + IMLoginManager.get(mContext).getUserInfo().getId()) .setWishlistProgress("0") .setPrice(Integer.parseInt(event.getModel().getPrice())) @@ -334,7 +335,7 @@ public class LiveNewWishListPopup extends BottomPopupView { setWishlistV2(type, gson.toJson(wishList2), new HttpCallback() { @Override public void onSuccess(String data) { - ToastUtil.show(data); + ToastUtil.show("修改成功"); } @Override diff --git a/common/src/main/res/layout/dialog_live_new_wish_list.xml b/common/src/main/res/layout/dialog_live_new_wish_list.xml index 542dd57c5..f044c166a 100644 --- a/common/src/main/res/layout/dialog_live_new_wish_list.xml +++ b/common/src/main/res/layout/dialog_live_new_wish_list.xml @@ -39,7 +39,10 @@ android:layout_width="117dp" android:layout_height="31dp" android:layout_alignParentEnd="true" - android:layout_margin="8dp" + android:layout_marginStart="8dp" + android:layout_marginTop="8dp" + android:layout_marginEnd="8dp" + android:layout_marginBottom="8dp" android:background="@drawable/background_wish_replacement" android:gravity="center" android:text="@string/replacement_wish_day" diff --git a/common/src/main/res/values-en-rUS/string.xml b/common/src/main/res/values-en-rUS/string.xml index c0ec19604..26b8c1dff 100644 --- a/common/src/main/res/values-en-rUS/string.xml +++ b/common/src/main/res/values-en-rUS/string.xml @@ -1311,6 +1311,7 @@ Limited ride And limited avatar frame "At least 2 types of gifts can be set to trigger the wish list special effect gift. " cancel settings + Too many gifts diff --git a/common/src/main/res/values-zh-rHK/strings.xml b/common/src/main/res/values-zh-rHK/strings.xml index 9724141a6..414e46817 100644 --- a/common/src/main/res/values-zh-rHK/strings.xml +++ b/common/src/main/res/values-zh-rHK/strings.xml @@ -1307,4 +1307,5 @@ 最低设置2种类型礼物才能触发心愿单特效礼物。 不再设置 去设置 + 重複添加禮物 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 643b04889..e9de01ea7 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -1306,4 +1306,5 @@ 最低设置2种类型礼物才能触发心愿单特效礼物。 不再设置 去设置 + 重複添加禮物 diff --git a/common/src/main/res/values-zh/strings.xml b/common/src/main/res/values-zh/strings.xml index bf87d8472..8ed844ab7 100644 --- a/common/src/main/res/values-zh/strings.xml +++ b/common/src/main/res/values-zh/strings.xml @@ -1306,6 +1306,7 @@ 最低设置2种类型礼物才能触发心愿单特效礼物。 不再设置 去设置 + 重複添加禮物 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index d6af03ba2..7c77c20d7 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -1312,5 +1312,6 @@ Limited ride And limited avatar frame At least 2 types of gifts can be set to trigger the wish list special effect gift. cancel settings + Too many gifts