1:完成家族中续签请求接口和弹框展示的文案

This commit is contained in:
2025-11-28 16:53:27 +08:00
parent 995d7c1e90
commit 2b750c5f06
7 changed files with 172 additions and 28 deletions

View File

@@ -40,7 +40,7 @@ class MyFamilyBean {
var mic_cycle: String = "" //麦圈
var nobility_image: String = "" //贵族
var nickname_color: String = "" //贵族颜色
var free_renewal: String = "" //免费续签次数
var free_renewal: Int = 0 //免费续签次数
var today_earnings: String = "" //今日收礼收益
var yesterday_earnings: String = "" //昨日收礼收益
var is_online: Int = 0 //是否在线 1在线 0离线

View File

@@ -9,6 +9,7 @@ import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.text.SpannableString;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
@@ -26,6 +27,7 @@ public class ConfirmDialog extends Dialog {
private String title;
private String message;
private SpannableString spannableMessage;
private String positiveButtonText;
private String negativeButtonText;
private View.OnClickListener positiveButtonClickListener;
@@ -50,6 +52,23 @@ public class ConfirmDialog extends Dialog {
this.isCountdownEnabled = isCountdownEnabled;
this.countdownSeconds = countdownSeconds;
}
// 新增构造函数支持SpannableString
public ConfirmDialog(Context context, String title, SpannableString spannableMessage,
String positiveButtonText, String negativeButtonText,
View.OnClickListener positiveButtonClickListener,
View.OnClickListener negativeButtonClickListener,
boolean isCountdownEnabled, int countdownSeconds) {
super(context);
this.title = title;
this.spannableMessage = spannableMessage;
this.positiveButtonText = positiveButtonText;
this.negativeButtonText = negativeButtonText;
this.positiveButtonClickListener = positiveButtonClickListener;
this.negativeButtonClickListener = negativeButtonClickListener;
this.isCountdownEnabled = isCountdownEnabled;
this.countdownSeconds = countdownSeconds;
}
private void init() {
Window window = getWindow();
@@ -76,7 +95,12 @@ public class ConfirmDialog extends Dialog {
// 设置文本
tvTitle.setText(title);
tvMessage.setText(message);
// 根据是否有spannableMessage来设置不同的文本
if (spannableMessage != null) {
tvMessage.setText(spannableMessage);
} else {
tvMessage.setText(message);
}
btnPositive.setText(positiveButtonText);
btnNegative.setText(negativeButtonText);

View File

@@ -884,4 +884,12 @@ public interface ApiServer {
@GET(Constants.GET_SKILL_LIST)
Call<BaseModel<List<String>>> skillList();
@FormUrlEncoded
@POST(Constants.POST_FREE_RE_SIGN)
Call<BaseModel<String>> freeReSign(@Field("user_id") String user_id);
@FormUrlEncoded
@POST(Constants.POST_RE_SIGN)
Call<BaseModel<String>> reSign(@Field("user_id") String user_id);
}

View File

@@ -4738,5 +4738,35 @@ public class RetrofitClient {
});
}
public void freeReSign(int type, String userId,BaseObserver<String> observer) {
if (type==1) {
sApiServer.freeReSign(userId).enqueue(new Callback<BaseModel<String>>() {
@Override
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
onNextRetu(response, observer);
}
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
LogUtils.e("freeReSign", t.fillInStackTrace());
}
});
}else {
sApiServer.reSign(userId).enqueue(new Callback<BaseModel<String>>() {
@Override
public void onResponse(Call<BaseModel<String>> call, Response<BaseModel<String>> response) {
onNextRetu(response, observer);
}
@Override
public void onFailure(Call<BaseModel<String>> call, Throwable t) {
LogUtils.e("reSign", t.fillInStackTrace());
}
});
}
}
}

View File

@@ -431,6 +431,8 @@ public class Constants {
public static final String POST_FRIEND_LIST_MORE = "/api/User/get_friend_list_more";//挚友列表查看更多
public static final String POST_SEND_LOG = "api/Report/android_log_report";//上传log信息
public static final String GET_SKILL_LIST = "/api/Sign/skill_list";//才艺列表
public static final String POST_FREE_RE_SIGN = "/api/Sign/free_re_sign";//免费续约
public static final String POST_RE_SIGN = "/api/Sign/re_sign";//续签(花金币)