1:完成家族中续签请求接口和弹框展示的文案
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user