心愿单的重置提示
This commit is contained in:
parent
2db89365bb
commit
d1d8054c01
@ -152,17 +152,8 @@ public class LiveNewWishGiftPopup extends BottomPopupView {
|
|||||||
LiveNetManager.get(getContext()).getWishListGiftConf(type, new HttpCallback<WishListGiftConfModel>() {
|
LiveNetManager.get(getContext()).getWishListGiftConf(type, new HttpCallback<WishListGiftConfModel>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(WishListGiftConfModel data) {
|
public void onSuccess(WishListGiftConfModel data) {
|
||||||
List<GiftListModel> giftListModels = new ArrayList<>();
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getGiftList()));
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
giftListModels.addAll(data.getGiftList());
|
|
||||||
ViewList.add(LiveNewWishGiftFragment.newInstance(giftListModels));
|
|
||||||
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getNobleList()));
|
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getNobleList()));
|
||||||
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getGuardList()));
|
ViewList.add(LiveNewWishGiftFragment.newInstance(data.getGuardList()));
|
||||||
LiveNewWishListAdapter liveNewWishListAdapter = new LiveNewWishListAdapter(mContext, ViewList);
|
LiveNewWishListAdapter liveNewWishListAdapter = new LiveNewWishListAdapter(mContext, ViewList);
|
||||||
|
@ -13,21 +13,27 @@ import androidx.fragment.app.FragmentActivity;
|
|||||||
import androidx.viewpager2.widget.ViewPager2;
|
import androidx.viewpager2.widget.ViewPager2;
|
||||||
|
|
||||||
import com.google.android.material.tabs.TabLayout;
|
import com.google.android.material.tabs.TabLayout;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.lxj.xpopup.XPopup;
|
||||||
import com.lxj.xpopup.core.BottomPopupView;
|
import com.lxj.xpopup.core.BottomPopupView;
|
||||||
import com.yunbao.common.R;
|
import com.yunbao.common.R;
|
||||||
import com.yunbao.common.adapter.LiveNewWishListAdapter;
|
import com.yunbao.common.adapter.LiveNewWishListAdapter;
|
||||||
import com.yunbao.common.bean.WishModel;
|
import com.yunbao.common.bean.WishModel;
|
||||||
import com.yunbao.common.event.LiveNewWishListEvent;
|
import com.yunbao.common.event.LiveNewWishListEvent;
|
||||||
import com.yunbao.common.fragment.LiveNewWishListFragment;
|
import com.yunbao.common.fragment.LiveNewWishListFragment;
|
||||||
|
import com.yunbao.common.http.base.HttpCallback;
|
||||||
|
import com.yunbao.common.http.live.LiveNetManager;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.utils.Bus;
|
import com.yunbao.common.utils.Bus;
|
||||||
import com.yunbao.common.utils.DpUtil;
|
import com.yunbao.common.utils.DpUtil;
|
||||||
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新版心愿单
|
* 新版心愿单
|
||||||
@ -157,7 +163,7 @@ public class LiveNewWishListPopup extends BottomPopupView {
|
|||||||
customView.setSelected(true);
|
customView.setSelected(true);
|
||||||
fragmentViewpager.setCurrentItem(tab.getId(), false);
|
fragmentViewpager.setCurrentItem(tab.getId(), false);
|
||||||
type = tab.getId() + 1;
|
type = tab.getId() + 1;
|
||||||
switch (type){
|
switch (type) {
|
||||||
case 1:
|
case 1:
|
||||||
replacementWish.setText(R.string.replacement_wish_day);
|
replacementWish.setText(R.string.replacement_wish_day);
|
||||||
break;
|
break;
|
||||||
@ -184,25 +190,37 @@ public class LiveNewWishListPopup extends BottomPopupView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ViewClicksAntiShake.clicksAntiShake(replacementWish, new ViewClicksAntiShake.ViewClicksCallBack() {
|
ViewClicksAntiShake.clicksAntiShake(replacementWish, () -> new XPopup.Builder(getContext())
|
||||||
@Override
|
.asCustom(new ReplacementHintCustomPopup(getContext(), type, type -> {
|
||||||
public void onViewClicks() {
|
switch (type) {
|
||||||
switch (type){
|
case 1:
|
||||||
case 1:
|
dayWishFragment.clearGiftListModel();
|
||||||
dayWishFragment.clearGiftListModel();
|
break;
|
||||||
break;
|
case 2:
|
||||||
case 2:
|
zhouXinFragment.clearGiftListModel();
|
||||||
zhouXinFragment.clearGiftListModel();
|
break;
|
||||||
break;
|
case 3:
|
||||||
case 3:
|
lunarWishFragment.clearGiftListModel();
|
||||||
lunarWishFragment.clearGiftListModel();
|
break;
|
||||||
break;
|
case 4:
|
||||||
case 4:
|
seasonalWishFragment.clearGiftListModel();
|
||||||
seasonalWishFragment.clearGiftListModel();
|
break;
|
||||||
break;
|
}
|
||||||
}
|
List<WishModel> wishList = new ArrayList<>();
|
||||||
}
|
LiveNetManager.get(getContext()).
|
||||||
});
|
setWishlistV2(type, new Gson().toJson(wishList), new HttpCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onSuccess(String data) {
|
||||||
|
ToastUtil.show(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(String error) {
|
||||||
|
ToastUtil.show(R.string.net_error);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}))
|
||||||
|
.show());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initDate() {
|
private void initDate() {
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
package com.yunbao.common.views;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.lxj.xpopup.core.CenterPopupView;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 心愿单重置、保存提示
|
||||||
|
*/
|
||||||
|
public class ReplacementHintCustomPopup extends CenterPopupView {
|
||||||
|
private int type = 0;
|
||||||
|
private TextView wishTab;
|
||||||
|
private ReplacementHintCallBack callBack;
|
||||||
|
|
||||||
|
public ReplacementHintCustomPopup(@NonNull Context context, int type, ReplacementHintCallBack callBack) {
|
||||||
|
super(context);
|
||||||
|
this.type = type;
|
||||||
|
this.callBack = callBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返回自定义弹窗的布局
|
||||||
|
@Override
|
||||||
|
protected int getImplLayoutId() {
|
||||||
|
return R.layout.replacement_hint_custom_popup;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 执行初始化操作,比如:findView,设置点击,或者任何你弹窗内的业务逻辑
|
||||||
|
@Override
|
||||||
|
protected void onCreate() {
|
||||||
|
super.onCreate();
|
||||||
|
wishTab = findViewById(R.id.wish_tab);
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
wishTab.setText(String.format("【%s】", getContext().getString(R.string.day_wish)));
|
||||||
|
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
wishTab.setText(String.format("【%s】", getContext().getString(R.string.zhou_xin)));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
wishTab.setText(String.format("【%s】", getContext().getString(R.string.lunar_wish)));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
wishTab.setText(String.format("【%s】", getContext().getString(R.string.seasonal_wish)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_cancel), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
if (callBack != null) {
|
||||||
|
callBack.onReplacement(type);
|
||||||
|
}
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.live_open_ok), new ViewClicksAntiShake.ViewClicksCallBack() {
|
||||||
|
@Override
|
||||||
|
public void onViewClicks() {
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface ReplacementHintCallBack {
|
||||||
|
void onReplacement(int type);
|
||||||
|
}
|
||||||
|
}
|
78
common/src/main/res/layout/replacement_hint_custom_popup.xml
Normal file
78
common/src/main/res/layout/replacement_hint_custom_popup.xml
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
android:layout_width="280dp"
|
||||||
|
android:layout_height="194dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
app:cardCornerRadius="18dp"
|
||||||
|
app:cardElevation="18dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="55dp"
|
||||||
|
android:layout_marginTop="30dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/replacement_reset_confirmed"
|
||||||
|
android:textColor="#161616"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/wish_tab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="【周心願】"
|
||||||
|
android:textColor="#8E73F5"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal"
|
||||||
|
android:layout_marginTop="18dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/replacement_reset_confirmed_hint"
|
||||||
|
android:textColor="#999999"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginTop="22dp"
|
||||||
|
android:layout_marginEnd="16dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/live_open_cancel"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:background="@drawable/backgroud_live_open_lfet"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/replacement_reset_confirmed_sure"
|
||||||
|
android:textColor="#FFC621"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/live_open_ok"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="36dp"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:background="@drawable/backgroud_live_open_right"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/replacement_reset_confirmed_cancel"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</FrameLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</androidx.cardview.widget.CardView>
|
@ -1100,6 +1100,10 @@
|
|||||||
<string name="replacement_wish_zhou">重置心願:周</string>
|
<string name="replacement_wish_zhou">重置心願:周</string>
|
||||||
<string name="replacement_wish_lunar">重置心願:月</string>
|
<string name="replacement_wish_lunar">重置心願:月</string>
|
||||||
<string name="replacement_wish_seasonal">重置心願:季</string>
|
<string name="replacement_wish_seasonal">重置心願:季</string>
|
||||||
|
<string name="replacement_reset_confirmed">是否確定重置</string>
|
||||||
|
<string name="replacement_reset_confirmed_hint">重置後將會清空當前心願單列表\n無論心願單是否完成</string>
|
||||||
|
<string name="replacement_reset_confirmed_sure">確定重置</string>
|
||||||
|
<string name="replacement_reset_confirmed_cancel">返回列表</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user