From a3798b01c03911efcd7f7b28f78cebc35871c528 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期二, 06 八月 2024 18:37:07 +0800
Subject: [PATCH] 2024年08月06日18:37:05
---
app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java | 53 +++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 39 insertions(+), 14 deletions(-)
diff --git a/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java b/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java
index f260d96..8219c57 100644
--- a/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java
+++ b/app/src/main/java/com/hdl/photovoltaic/widget/DelayedConfirmationCancelDialog.java
@@ -11,12 +11,13 @@
import androidx.annotation.NonNull;
import com.hdl.photovoltaic.R;
+import com.hdl.photovoltaic.base.BaseDialog;
import com.hdl.photovoltaic.databinding.DialogConfirmCancelBinding;
/**
* 寤舵椂纭妗�
*/
-public class DelayedConfirmationCancelDialog extends Dialog {
+public class DelayedConfirmationCancelDialog extends BaseDialog {
public DelayedConfirmationCancelDialog(@NonNull Context context) {
super(context, R.style.Custom_Dialog);
this.mContext = context;
@@ -24,8 +25,8 @@
CountDownTimer timer;
private final Context mContext;
- private ConfirmationCancelDialog.onNoOnclickListener noOnclickListener;//鍙栨秷鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒
- private ConfirmationCancelDialog.onYesOnclickListener yesOnclickListener;//纭畾鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒
+ private onNoOnclickListener noOnclickListener;//鍙栨秷鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒
+ private onYesOnclickListener yesOnclickListener;//纭畾鎸夐挳琚偣鍑讳簡鐨勭洃鍚櫒
private DialogConfirmCancelBinding viewBinding;
private String titleStr, contentStr, yesStr, noStr;
@@ -52,7 +53,7 @@
*
* @param title 鍐呭
*/
- public void setTitle(String title) {
+ public void setTitleContent(String title) {
if (TextUtils.isEmpty(title)) {
return;
}
@@ -61,6 +62,19 @@
viewBinding.loadingConfirmationTitleTv.setText(titleStr);
}
+ }
+
+ /**
+ * 闅愯棌鑷畾涔�"鏍囬"缁勪欢
+ *
+ * @param isHideTitle true 闅愯棌
+ */
+ public void isHideTitle(boolean isHideTitle) {
+ if (isHideTitle) {
+ if (viewBinding != null) {
+ viewBinding.loadingConfirmationTitleTv.setVisibility(View.GONE);
+ }
+ }
}
/**
@@ -183,6 +197,17 @@
timer = new CountDownTimer(seconds * 1000, 1000) { // 璁剧疆鍊掕鏃朵负3绉掞紙鍗曚綅锛氭绉掞級
public void onTick(long millisUntilFinished) {
int secondsRemaining = (int) (millisUntilFinished / 1000);
+ if (secondsRemaining == 0) {
+ viewBinding.dialogConfirmTv.setText(mContext.getString(R.string.loading_affirm));
+ viewBinding.dialogConfirmTv.setTextColor(Color.parseColor("#38C494"));
+ viewBinding.dialogConfirmLy.setEnabled(true);
+ viewBinding.dialogConfirmTv.setEnabled(true);
+ if (timer != null) {
+ timer.cancel();
+ timer = null;
+ }
+ return;
+ }
String timeLeft = "(" + secondsRemaining + ")";
String text = mContext.getString(R.string.loading_affirm) + timeLeft;
viewBinding.dialogConfirmTv.setText(text);
@@ -192,14 +217,14 @@
}
public void onFinish() {
- viewBinding.dialogConfirmTv.setText(mContext.getString(R.string.loading_affirm));
- viewBinding.dialogConfirmTv.setTextColor(Color.parseColor("#38C494"));
- viewBinding.dialogConfirmLy.setEnabled(true);
- viewBinding.dialogConfirmTv.setEnabled(true);
- if (timer != null) {
- timer.cancel();
- timer = null;
- }
+// viewBinding.dialogConfirmTv.setText(mContext.getString(R.string.loading_affirm));
+// viewBinding.dialogConfirmTv.setTextColor(Color.parseColor("#38C494"));
+// viewBinding.dialogConfirmLy.setEnabled(true);
+// viewBinding.dialogConfirmTv.setEnabled(true);
+// if (timer != null) {
+// timer.cancel();
+// timer = null;
+// }
}
};
@@ -212,7 +237,7 @@
*
* @param onNoOnclickListener -
*/
- public void setNoOnclickListener(ConfirmationCancelDialog.onNoOnclickListener onNoOnclickListener) {
+ public void setNoOnclickListener(onNoOnclickListener onNoOnclickListener) {
if (onNoOnclickListener != null) {
this.noOnclickListener = onNoOnclickListener;
}
@@ -223,7 +248,7 @@
*
* @param yesOnclickListener -
*/
- public void setYesOnclickListener(ConfirmationCancelDialog.onYesOnclickListener yesOnclickListener) {
+ public void setYesOnclickListener(onYesOnclickListener yesOnclickListener) {
if (yesOnclickListener != null) {
this.yesOnclickListener = yesOnclickListener;
}
--
Gitblit v1.8.0