1.首页充值
This commit is contained in:
@@ -29,7 +29,7 @@ isBuildModule=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.2.8
|
||||
APP_VERSION_CODE=182
|
||||
APP_VERSION_CODE=183
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
|
||||
@@ -15,6 +15,7 @@ public class FirstChargeGiftBean {
|
||||
private List<GiftBag> gift_bag;
|
||||
@Data
|
||||
public static class GiftBag {
|
||||
private String gift_bag_id;
|
||||
private String name;
|
||||
private String title1;
|
||||
private String title2;
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.adapter.HeavenGiftAdapter;
|
||||
import com.xscm.moduleutil.bean.BaseListData;
|
||||
import com.xscm.moduleutil.bean.FirstChargeGiftBean;
|
||||
import com.xscm.moduleutil.bean.HeavenGiftBean;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.color.ThemeableDrawableUtils;
|
||||
@@ -42,12 +43,21 @@ public class HeavenGiftDialog extends BaseDialog<DialogHeavenGiftBinding> {
|
||||
public HeavenGiftDialog(@NonNull Context context) {
|
||||
super(context,R.style.BaseDialogStyleH);
|
||||
}
|
||||
|
||||
HeavenGiftBean heavenGiftBea;
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.dialog_heaven_gift;
|
||||
}
|
||||
private OnFirstChargeListener listener;
|
||||
public interface OnFirstChargeListener {
|
||||
void onFirstChargeConfirmed(HeavenGiftBean giftBean, int type);
|
||||
void onFirstChargeCancelled();
|
||||
}
|
||||
|
||||
// 设置监听器的方法
|
||||
public void setOnFirstChargeListener(OnFirstChargeListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
@Override
|
||||
public void initView() {
|
||||
setCancelable(false);
|
||||
@@ -74,6 +84,15 @@ public class HeavenGiftDialog extends BaseDialog<DialogHeavenGiftBinding> {
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvInvite.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
mBinding.tvInvite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.onFirstChargeConfirmed(heavenGiftBea,2);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,6 +107,7 @@ public class HeavenGiftDialog extends BaseDialog<DialogHeavenGiftBinding> {
|
||||
@Override
|
||||
public void onNext(HeavenGiftBean heavenGiftBean) {
|
||||
if (heavenGiftBean != null){
|
||||
heavenGiftBea=heavenGiftBean;
|
||||
mBinding.tvTitle.setText(heavenGiftBean.getCounter());
|
||||
// 示例:假设从 HeavenGiftBean 中获取倒计时时间(单位:秒)
|
||||
// long countdownTime =Integer.parseInt(heavenGiftBean.getEffective_time()) * 1000L; // 转换为毫秒
|
||||
|
||||
@@ -3,11 +3,18 @@ package com.xscm.moduleutil.dialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Paint;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.blankj.utilcode.util.ScreenUtils;
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.xscm.moduleutil.R;
|
||||
@@ -24,9 +31,11 @@ import com.xscm.moduleutil.widget.dialog.BaseDialog;
|
||||
import com.zhpan.bannerview.indicator.DrawableIndicator;
|
||||
import com.zhpan.indicator.base.IIndicator;
|
||||
import com.zhpan.indicator.enums.IndicatorSlideMode;
|
||||
|
||||
import io.reactivex.disposables.Disposable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -38,7 +47,7 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
|
||||
HeavenGiftAdapter heavenGiftAdapter;
|
||||
FirstChargeGiftBean firstChargeGiftBean;
|
||||
private int type;
|
||||
private int type;
|
||||
|
||||
public NewPeopleDialog(@NonNull Context context) {
|
||||
super(context, R.style.BaseDialogStyleH);
|
||||
@@ -71,7 +80,7 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
mBinding.rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup radioGroup, int i) {
|
||||
if (firstChargeGiftBean== null || firstChargeGiftBean.getGift_bag().size() == 0){
|
||||
if (firstChargeGiftBean == null || firstChargeGiftBean.getGift_bag().size() == 0) {
|
||||
ToastUtils.showShort("暂无礼包");
|
||||
return;
|
||||
}
|
||||
@@ -86,7 +95,7 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
list.addAll(firstChargeGiftBean.getGift_bag().get(0).getGift_list());
|
||||
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||
}
|
||||
type=1;
|
||||
type = 1;
|
||||
} else if (i == R.id.btn_1) {
|
||||
List<RoonGiftModel> list = new ArrayList<>();
|
||||
if (firstChargeGiftBean.getGift_bag().size() > 2) {
|
||||
@@ -97,11 +106,11 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
list.addAll(firstChargeGiftBean.getGift_bag().get(1).getGift_list());
|
||||
mBinding.bannerViewPager.create(baseListData(list, 4));
|
||||
}
|
||||
type=2;
|
||||
type = 2;
|
||||
} else if (i == R.id.btn_2) {
|
||||
List<RoonGiftModel> list = new ArrayList<>();
|
||||
if (firstChargeGiftBean.getGift_bag().size() > 3) {
|
||||
if (firstChargeGiftBean.getGift_bag().get(2)!=null) {
|
||||
if (firstChargeGiftBean.getGift_bag().get(2) != null) {
|
||||
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(2).getTitle1());
|
||||
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(2).getTitle2());
|
||||
mBinding.tvTitle2.setPaintFlags(Paint.STRIKE_THRU_TEXT_FLAG);
|
||||
@@ -111,7 +120,7 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
type = 3;
|
||||
}
|
||||
}
|
||||
}else if (i == R.id.btn_3){
|
||||
} else if (i == R.id.btn_3) {
|
||||
List<RoonGiftModel> list = new ArrayList<>();
|
||||
if (firstChargeGiftBean.getGift_bag().size() >= 4) {
|
||||
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(3).getTitle1());
|
||||
@@ -126,30 +135,41 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
|
||||
}
|
||||
});
|
||||
mBinding.rg.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
mBinding.tvInvite.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// RechargeDialogFragment.show(roomId, getSupportFragmentManager());
|
||||
if (listener != null) {
|
||||
listener.onFirstChargeConfirmed(firstChargeGiftBean,type);
|
||||
listener.onFirstChargeConfirmed(firstChargeGiftBean, type);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvInvite.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
}
|
||||
|
||||
public interface OnFirstChargeListener {
|
||||
void onFirstChargeConfirmed(FirstChargeGiftBean giftBean,int type);
|
||||
void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type);
|
||||
|
||||
void onFirstChargeCancelled();
|
||||
}
|
||||
|
||||
private OnFirstChargeListener listener;
|
||||
|
||||
// 设置监听器的方法
|
||||
public void setOnFirstChargeListener(OnFirstChargeListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
RetrofitClient.getInstance().getNewChargeGift(new BaseObserver<FirstChargeGiftBean>() {
|
||||
@@ -194,8 +214,8 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
this.firstChargeGiftBean = firstChargeGiftBean;
|
||||
mBinding.rg.check(R.id.btn_0);
|
||||
if (firstChargeGiftBean.getGift_bag() != null && firstChargeGiftBean.getGift_bag().size() > 0) {
|
||||
if (firstChargeGiftBean.getGift_bag().size() >=0) {
|
||||
type=1;
|
||||
if (firstChargeGiftBean.getGift_bag().size() >= 0) {
|
||||
type = 1;
|
||||
List<RoonGiftModel> list = new ArrayList<>();
|
||||
mBinding.tvTitle1.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle1());
|
||||
mBinding.tvTitle2.setText(firstChargeGiftBean.getGift_bag().get(0).getTitle2());
|
||||
@@ -207,6 +227,8 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
mBinding.btn1.setText(firstChargeGiftBean.getGift_bag().get(1).getName());
|
||||
mBinding.btn2.setText(firstChargeGiftBean.getGift_bag().get(2).getName());
|
||||
mBinding.btn3.setText(firstChargeGiftBean.getGift_bag().get(3).getName());
|
||||
|
||||
initGiftBagButtonStatus(firstChargeGiftBean);
|
||||
} else if (firstChargeGiftBean.getGift_bag().size() == 2) {
|
||||
// mBinding.rg.check(R.id.btn_0);
|
||||
// mBinding.btn1.setVisibility(View.VISIBLE);
|
||||
@@ -220,4 +242,127 @@ public class NewPeopleDialog extends BaseDialog<DialogNewPeopleBinding> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean isstatus = true;
|
||||
|
||||
private void initGiftBagButtonStatus(FirstChargeGiftBean firstChargeGiftBean) {
|
||||
// 1. 准备按钮列表:顺序与gift_bag中的元素顺序一一对应
|
||||
List<RadioButton> buttonList = Arrays.asList(
|
||||
mBinding.btn0,
|
||||
mBinding.btn1,
|
||||
mBinding.btn2
|
||||
// 未来加按钮:mBinding.btn3, mBinding.btn4...
|
||||
);
|
||||
|
||||
// 2. 空安全检查:先判断核心对象/列表非空
|
||||
if (firstChargeGiftBean != null && firstChargeGiftBean.getGift_bag() != null) {
|
||||
List<FirstChargeGiftBean.GiftBag> giftBagList = firstChargeGiftBean.getGift_bag();
|
||||
|
||||
// 3. 循环处理每个按钮
|
||||
for (int i = 0; i < buttonList.size(); i++) {
|
||||
RadioButton currentBtn = buttonList.get(i);
|
||||
// 4. 索引防护:若gift_bag列表长度不足,默认按status=0处理
|
||||
int status = (i < giftBagList.size()) ? giftBagList.get(i).getStatus() : 0;
|
||||
// 检查是否有status=0的情况,如果有则将isStatus设为false
|
||||
if (status == 0) {
|
||||
isstatus = false;
|
||||
}
|
||||
setButtonStatus(currentBtn, status, i); // 增加索引参数
|
||||
}
|
||||
updateRechargeTextViewStatus(isstatus, 0);
|
||||
|
||||
|
||||
} else {
|
||||
// 5. 兜底逻辑:数据为空时,所有按钮按status=0处理
|
||||
for (int i = 0; i < buttonList.size(); i++) {
|
||||
setButtonStatus(buttonList.get(i), 0, i);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 工具方法:统一设置单个按钮的状态
|
||||
*
|
||||
* @param button 要设置的RadioButton
|
||||
* @param status 状态值
|
||||
* @param index 按钮索引,用于标识不同按钮
|
||||
*/
|
||||
private void setButtonStatus(RadioButton button, int status, int index) {
|
||||
if (button == null) return;
|
||||
|
||||
// 移除之前的点击监听器,避免重复设置
|
||||
button.setOnClickListener(null);
|
||||
|
||||
if (status == 1) {
|
||||
// 可用状态
|
||||
button.setEnabled(true);
|
||||
// button.setChecked(true);
|
||||
|
||||
// 恢复充值按钮状态
|
||||
updateRechargeTextViewStatus(true, index);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
updateRechargeTextViewStatus(true, index);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
// status=0和其他状态:特殊处理
|
||||
button.setEnabled(true); // 保持可点击以响应交互
|
||||
// button.setChecked(false);
|
||||
// 设置特殊背景(根据需求修改为你的资源)
|
||||
button.setBackground(getResources().getDrawable(R.drawable.bf_e9));
|
||||
button.setTextColor(getResources().getColor(R.color.colorBlack65));
|
||||
updateRechargeTextViewStatus(false, index);
|
||||
// 添加点击事件
|
||||
button.setOnClickListener(v -> {
|
||||
// 点击时再次确认是status=0状态才处理
|
||||
button.setBackground(getResources().getDrawable(R.drawable.banner_indicator_focus));
|
||||
// 更新充值按钮状态为不可点击
|
||||
updateRechargeTextViewStatus(false, index);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查是否至少有一个元素达标(status == 1)
|
||||
*/
|
||||
public static boolean hasAnyQualified(List<FirstChargeGiftBean.GiftBag> giftBagList) {
|
||||
// 空列表处理 + 任意匹配检查
|
||||
return giftBagList != null && !giftBagList.isEmpty()
|
||||
&& giftBagList.stream()
|
||||
.anyMatch(gift -> gift.getStatus() == 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新充值TextView的状态
|
||||
*
|
||||
* @param enabled 是否可点击
|
||||
* @param index 关联的按钮索引
|
||||
*/
|
||||
private void updateRechargeTextViewStatus(boolean enabled, int index) {
|
||||
TextView rechargeTv = mBinding.tvInvite; // 假设充值按钮的id是tvRecharge
|
||||
if (rechargeTv == null) return;
|
||||
|
||||
// 设置是否可点击
|
||||
rechargeTv.setEnabled(enabled);
|
||||
|
||||
// 根据状态和索引设置不同背景
|
||||
if (enabled) {
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getPrimaryColorInt(), 53);
|
||||
mBinding.tvInvite.setTextColor(ColorManager.getInstance().getButtonColorInt());
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
// 不可点击状态的背景
|
||||
ThemeableDrawableUtils.setThemeableRoundedBackground(mBinding.tvInvite, ColorManager.getInstance().getButtonColorInt(), 53);
|
||||
mBinding.tvInvite.setTextColor(getResources().getColor(R.color.colorBlack65));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,12 +46,16 @@ public class RechargeDialogFragment extends BaseMvpDialogFragment<RechargeDialog
|
||||
private BindType.AllData selectedItem;
|
||||
private PayMethodAdapter bindTypeAdapter;
|
||||
private String roomId;
|
||||
private String gift_bag_id="0";//默认0 类型id 传 gift_bag_id
|
||||
private String type_params="0"; //默认0 类型参数 1首充 2天降好礼 3新人好礼
|
||||
|
||||
public static RechargeDialogFragment show(String id, String type, FragmentManager fragmentManager) {
|
||||
public static RechargeDialogFragment show(String id, String type, FragmentManager fragmentManager,String gift_bag_id,String type_params) {
|
||||
RechargeDialogFragment dialogFragment = new RechargeDialogFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString("roomId", id); //// 可选:传递参数
|
||||
args.putString("type", type);
|
||||
args.putString("gift_bag_id", gift_bag_id);
|
||||
args.putString("type_params", type_params);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.show(fragmentManager, "RoomOnlineDialogFragment");
|
||||
return dialogFragment;
|
||||
@@ -67,8 +71,11 @@ public class RechargeDialogFragment extends BaseMvpDialogFragment<RechargeDialog
|
||||
super.onAttach(context);
|
||||
roomId = getArguments().getString("roomId");
|
||||
type = getArguments().getString("type");
|
||||
gift_bag_id = getArguments().getString("gift_bag_id");
|
||||
type_params = getArguments().getString("type_params");
|
||||
if(type!=null){
|
||||
money=type;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +111,7 @@ public class RechargeDialogFragment extends BaseMvpDialogFragment<RechargeDialog
|
||||
ToastUtils.showShort("请选择支付方式");
|
||||
return;
|
||||
}
|
||||
MvpPre.appPay(SpUtil.getUserId() + "", money, coin, selectedItem.getType());
|
||||
MvpPre.appPay(SpUtil.getUserId() + "", money, coin, selectedItem.getType(),gift_bag_id,type_params);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -445,7 +445,7 @@ public class GiftLotteryDialog extends BaseMvpDialogFragment<GiftLotteryPresente
|
||||
}
|
||||
} else if (id == R.id.exchange_layout) {
|
||||
// ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager(),"0","0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -317,7 +317,7 @@ public class TourClubDialogFragment extends BaseMvpDialogFragment<GiftLotteryPre
|
||||
xlhRecordDialog.show(getChildFragmentManager(), "XlhRecordDialog");
|
||||
} else if (id == R.id.exchange_layout) {//钻石兑换
|
||||
// ARouter.getInstance().build(ARouteConstants.CURRENCY).navigation();
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager(),"0","0");
|
||||
}else if (id==R.id.v_checkbox){
|
||||
mBinding.vCheckbox.setSelected(!mBinding.vCheckbox.isSelected());
|
||||
vCheckbox=mBinding.vCheckbox.isSelected();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.xscm.moduleutil.http;
|
||||
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.UserBean;
|
||||
import com.xscm.moduleutil.utils.Sha1Util;
|
||||
@@ -43,7 +45,7 @@ public class AccessTokenInterceptor implements Interceptor {
|
||||
|
||||
String token = getTokenSafely();
|
||||
mHeaderMap.put("token", token != null ? token : "");
|
||||
|
||||
Log.e(TAG, "intercept: "+token);
|
||||
long timestamp = System.currentTimeMillis() / 1000;
|
||||
mHeaderMap.put("timestamp", String.valueOf(timestamp));
|
||||
mHeaderMap.put("sign", Sha1Util.shaEncode(timestamp));
|
||||
|
||||
@@ -492,7 +492,14 @@ public interface ApiServer {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_APPLY_Pay)
|
||||
Call<BaseModel<AppPay>> appPay(@Field("user_id") String user_id, @Field("money") String money, @Field("coin") String coin, @Field("type") String type);
|
||||
Call<BaseModel<AppPay>> appPay
|
||||
(@Field("user_id") String user_id,
|
||||
@Field("money") String money,
|
||||
@Field("coin") String coin,
|
||||
@Field("type") String type,
|
||||
@Field("type_params") String type_params,
|
||||
@Field("type_id") String type_id
|
||||
);
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(Constants.POST_APPLY_LIST)
|
||||
|
||||
@@ -2058,8 +2058,8 @@ public class RetrofitClient {
|
||||
// });
|
||||
}
|
||||
|
||||
public void appPay(String user_id, String money, String coin, String type, BaseObserver<AppPay> observer) {
|
||||
sApiServer.appPay(user_id, money, coin, type).enqueue(new Callback<BaseModel<AppPay>>() {
|
||||
public void appPay(String user_id, String money, String coin, String type,String type_params,String type_id, BaseObserver<AppPay> observer) {
|
||||
sApiServer.appPay(user_id, money, coin, type,type_params,type_id).enqueue(new Callback<BaseModel<AppPay>>() {
|
||||
@Override
|
||||
public void onResponse(Call<BaseModel<AppPay>> call, Response<BaseModel<AppPay>> response) {
|
||||
if (response.code() == 200) {
|
||||
|
||||
@@ -21,7 +21,8 @@ public class RechargeDialogContacts {
|
||||
public interface IRechargePre extends IPresenter {
|
||||
void recharge();//可选充值金额列表
|
||||
void bindType(String userId);
|
||||
void appPay(String user_id,String money,String coin,String type);
|
||||
|
||||
void appPay(String user_id,String money,String coin,String type,String type_params,String type_id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ public class RechargeDialogPresenter extends BasePresenter<RechargeDialogContact
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appPay(String user_id, String money, String coin, String type) {
|
||||
api.appPay(user_id, money, coin, type, new BaseObserver<AppPay>() {
|
||||
public void appPay(String user_id, String money, String coin, String type, String type_params, String type_id) {
|
||||
api.appPay(user_id, money, coin, type,type_params,type_id, new BaseObserver<AppPay>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
@@ -61,4 +61,6 @@ public class RechargeDialogPresenter extends BasePresenter<RechargeDialogContact
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class RewardGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPr
|
||||
}else if (view1.getId()== com.xscm.moduleutil.R.id.tv_reward_num){
|
||||
RewardDialogFragment.show(circle_id,getChildFragmentManager());
|
||||
}else if (view1.getId()== R.id.cz){
|
||||
RechargeDialogFragment.show("",null, getActivity().getSupportFragmentManager());
|
||||
RechargeDialogFragment.show("",null, getActivity().getSupportFragmentManager(),"0","0");
|
||||
}else if (view1.getId()== R.id.tv_give){
|
||||
for (int i=0;i<mGiftNumList.size();i++) {
|
||||
if (mBinding.tvGiveCoinNum.getText().toString().equals(mGiftNumList.get(i).getText())) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
android:id="@+id/rl_t"
|
||||
android:layout_width="@dimen/dp_276"
|
||||
android:layout_height="@dimen/dp_350"
|
||||
android:background="@mipmap/firsh_bj"
|
||||
android:background="@mipmap/frb_bg"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
@@ -855,6 +855,24 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
private void heavenGiftDialog(){
|
||||
HeavenGiftDialog heavenGiftDialog = new HeavenGiftDialog(this);
|
||||
heavenGiftDialog.show();
|
||||
heavenGiftDialog.setOnFirstChargeListener(new HeavenGiftDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(HeavenGiftBean giftBean, int type) {
|
||||
String giftId="";
|
||||
String money="";
|
||||
if (giftBean.getGift_list().size()!=0) {
|
||||
giftId = giftBean.getGift_bag_id()+"";
|
||||
money = giftBean.getMoney();
|
||||
}
|
||||
|
||||
RechargeDialogFragment.show(null, money, getSupportFragmentManager(),giftId,type+"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFirstChargeCancelled() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: 2025/10/12 新人好礼
|
||||
@@ -871,23 +889,36 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
newPeopleDialog.setOnFirstChargeListener(new NewPeopleDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
|
||||
String s = null;
|
||||
if (type == 1) {
|
||||
s = giftBean.getGift_bag().get(0).getMoney();
|
||||
// 初始化默认值
|
||||
String money = "";
|
||||
String giftBagId = "";
|
||||
List<FirstChargeGiftBean.GiftBag> giftBags = giftBean != null ? giftBean.getGift_bag() : null;
|
||||
|
||||
} else if (type == 2) {
|
||||
s = giftBean.getGift_bag().get(1).getMoney();
|
||||
} else if (type == 3) {
|
||||
s = giftBean.getGift_bag().get(2).getMoney();
|
||||
}else if (type==4){
|
||||
s = giftBean.getGift_bag().get(3).getMoney();
|
||||
}
|
||||
if (s == null) {
|
||||
// 校验数据有效性
|
||||
if (giftBags == null || giftBags.isEmpty()) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
RechargeDialogFragment.show(null, s, getSupportFragmentManager());
|
||||
// 计算索引(type从1开始对应索引0)
|
||||
int index = type - 1;
|
||||
|
||||
// 索引安全校验 + 数据获取
|
||||
if (index >= 0 && index < giftBags.size()) {
|
||||
FirstChargeGiftBean.GiftBag currentGift = giftBags.get(index);
|
||||
money = currentGift.getMoney();
|
||||
giftBagId = currentGift.getGift_bag_id();
|
||||
}
|
||||
|
||||
// 最终数据校验
|
||||
if (money == null) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示对话框
|
||||
RechargeDialogFragment.show(null, money, getSupportFragmentManager(), giftBagId, "3");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -914,21 +945,18 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
||||
firstChargeDialog.setOnFirstChargeListener(new FirstChargeDialog.OnFirstChargeListener() {
|
||||
@Override
|
||||
public void onFirstChargeConfirmed(FirstChargeGiftBean giftBean, int type) {
|
||||
String s = null;
|
||||
if (type == 1) {
|
||||
String s = "";
|
||||
String gift_bag_id= "";
|
||||
if (giftBean.getGift_bag().size()!=0) {
|
||||
gift_bag_id = giftBean.getGift_bag().get(0).getGift_bag_id();
|
||||
s = giftBean.getGift_bag().get(0).getMoney();
|
||||
|
||||
} else if (type == 2) {
|
||||
s = giftBean.getGift_bag().get(1).getMoney();
|
||||
} else if (type == 3) {
|
||||
s = giftBean.getGift_bag().get(2).getMoney();
|
||||
}
|
||||
if (s == null) {
|
||||
ToastUtils.showShort("暂无礼物");
|
||||
return;
|
||||
}
|
||||
|
||||
RechargeDialogFragment.show(null, s, getSupportFragmentManager());
|
||||
RechargeDialogFragment.show(null, s, getSupportFragmentManager(),gift_bag_id,"1");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -971,7 +971,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
val fragment = RechargeDialogFragment.show(
|
||||
roomId, null,
|
||||
supportFragmentManager
|
||||
supportFragmentManager,"",""
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
@@ -1008,7 +1008,7 @@ class RoomActivity : BaseMvpActivity<RoomPresenter?, ActivityRoomBinding?>(),
|
||||
ThreadUtils.runOnUiThreadDelayed({
|
||||
val fragment = RechargeDialogFragment.show(
|
||||
roomId, null,
|
||||
supportFragmentManager
|
||||
supportFragmentManager,"",""
|
||||
)
|
||||
if (fragment != null) {
|
||||
addActiveDialogFragment(fragment) // 添加到管理列表
|
||||
|
||||
@@ -391,7 +391,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
giveGift(giftNumber);
|
||||
}
|
||||
} else if (view1.getId() == R.id.cz) {
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager(),"","");
|
||||
} else if (view1.getId() == R.id.tv_all_wheat) {//全麦
|
||||
if (all) {
|
||||
gifyuseradapter.allElection(false);
|
||||
|
||||
@@ -121,7 +121,7 @@ public class RechargeActivity extends BaseMvpActivity<RechargePresenter, Activit
|
||||
|
||||
|
||||
LogUtils.d(TAG,"onClick,=--3------"+money);
|
||||
MvpPre.appPay(SpUtil.getUserId() + "", money, coin, selectedItem.getType());
|
||||
MvpPre.appPay(SpUtil.getUserId() + "", money, coin, selectedItem.getType(),"","");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class RechargeConactos {
|
||||
|
||||
void wallet();
|
||||
|
||||
void appPay(String user_id,String money,String coin,String type);
|
||||
void appPay(String user_id,String money,String coin,String type,String type_params,String type_id);
|
||||
|
||||
void bindType(String userId);
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public class RechargePresenter extends BasePresenter<RechargeConactos.View> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appPay(String user_id, String money, String coin, String type) {
|
||||
api.appPay(user_id, money, coin, type, new BaseObserver<AppPay>() {
|
||||
public void appPay(String user_id, String money, String coin, String type, String type_params, String type_id) {
|
||||
api.appPay(user_id, money, coin, type,type_params,type_id, new BaseObserver<AppPay>() {
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
addDisposable(d);
|
||||
@@ -65,6 +65,8 @@ public class RechargePresenter extends BasePresenter<RechargeConactos.View> impl
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void bindType(String userId) {
|
||||
api.bindType(userId, new BaseObserver<BindType>() {
|
||||
|
||||
Reference in New Issue
Block a user