|
@@ -3,6 +3,7 @@ package com.kongzue.dialogx.dialogs;
|
|
|
import android.view.View;
|
|
|
|
|
|
import androidx.annotation.ColorInt;
|
|
|
+import androidx.annotation.ColorRes;
|
|
|
|
|
|
import com.kongzue.dialogx.interfaces.OnBackPressedListener;
|
|
|
import com.kongzue.dialogx.interfaces.OnBindView;
|
|
@@ -34,12 +35,24 @@ public class InputDialog extends MessageDialog {
|
|
|
this.okText = okText;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog(int titleResId, int messageResId, int okTextResId) {
|
|
|
+ this.title = getString(titleResId);
|
|
|
+ this.message = getString(messageResId);
|
|
|
+ this.okText = getString(okTextResId);
|
|
|
+ }
|
|
|
+
|
|
|
public static InputDialog show(CharSequence title, CharSequence message, CharSequence okText) {
|
|
|
InputDialog inputDialog = new InputDialog(title, message, okText);
|
|
|
inputDialog.show();
|
|
|
return inputDialog;
|
|
|
}
|
|
|
|
|
|
+ public static InputDialog show(int titleResId, int messageResId, int okTextResId) {
|
|
|
+ InputDialog inputDialog = new InputDialog(titleResId, messageResId, okTextResId);
|
|
|
+ inputDialog.show();
|
|
|
+ return inputDialog;
|
|
|
+ }
|
|
|
+
|
|
|
public InputDialog(CharSequence title, CharSequence message, CharSequence okText, CharSequence cancelText) {
|
|
|
this.title = title;
|
|
|
this.message = message;
|
|
@@ -47,12 +60,25 @@ public class InputDialog extends MessageDialog {
|
|
|
this.cancelText = cancelText;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog(int titleResId, int messageResId, int okTextResId, int cancelTextResId) {
|
|
|
+ this.title = getString(titleResId);
|
|
|
+ this.message = getString(messageResId);
|
|
|
+ this.okText = getString(okTextResId);
|
|
|
+ this.cancelText = getString(cancelTextResId);
|
|
|
+ }
|
|
|
+
|
|
|
public static InputDialog show(CharSequence title, CharSequence message, CharSequence okText, CharSequence cancelText) {
|
|
|
InputDialog inputDialog = new InputDialog(title, message, okText, cancelText);
|
|
|
inputDialog.show();
|
|
|
return inputDialog;
|
|
|
}
|
|
|
|
|
|
+ public static InputDialog show(int titleResId, int messageResId, int okTextResId, int cancelTextResId) {
|
|
|
+ InputDialog inputDialog = new InputDialog(titleResId, messageResId, okTextResId, cancelTextResId);
|
|
|
+ inputDialog.show();
|
|
|
+ return inputDialog;
|
|
|
+ }
|
|
|
+
|
|
|
public InputDialog(CharSequence title, CharSequence message, CharSequence okText, CharSequence cancelText, String inputText) {
|
|
|
this.title = title;
|
|
|
this.message = message;
|
|
@@ -75,12 +101,26 @@ public class InputDialog extends MessageDialog {
|
|
|
this.otherText = otherText;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog(int titleResId, int messageResId, int okTextResId, int cancelTextResId, int otherTextResId) {
|
|
|
+ this.title = getString(titleResId);
|
|
|
+ this.message = getString(messageResId);
|
|
|
+ this.okText = getString(okTextResId);
|
|
|
+ this.cancelText = getString(cancelTextResId);
|
|
|
+ this.otherText = getString(otherTextResId);
|
|
|
+ }
|
|
|
+
|
|
|
public static InputDialog show(CharSequence title, CharSequence message, CharSequence okText, CharSequence cancelText, CharSequence otherText) {
|
|
|
InputDialog inputDialog = new InputDialog(title, message, okText, cancelText, otherText);
|
|
|
inputDialog.show();
|
|
|
return inputDialog;
|
|
|
}
|
|
|
|
|
|
+ public static InputDialog show(int titleResId, int messageResId, int okTextResId, int cancelTextResId, int otherTextResId) {
|
|
|
+ InputDialog inputDialog = new InputDialog(titleResId, messageResId, okTextResId, cancelTextResId, otherTextResId);
|
|
|
+ inputDialog.show();
|
|
|
+ return inputDialog;
|
|
|
+ }
|
|
|
+
|
|
|
public InputDialog(CharSequence title, CharSequence message, CharSequence okText, CharSequence cancelText, CharSequence otherText, String inputText) {
|
|
|
this.title = title;
|
|
|
this.message = message;
|
|
@@ -90,12 +130,27 @@ public class InputDialog extends MessageDialog {
|
|
|
this.inputText = inputText;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog(int titleResId, int messageResId, int okTextResId, int cancelTextResId, int otherTextResId, int inputTextResId) {
|
|
|
+ this.title = getString(titleResId);
|
|
|
+ this.message = getString(messageResId);
|
|
|
+ this.okText = getString(okTextResId);
|
|
|
+ this.cancelText = getString(cancelTextResId);
|
|
|
+ this.otherText = getString(otherTextResId);
|
|
|
+ this.inputText = getString(inputTextResId);
|
|
|
+ }
|
|
|
+
|
|
|
public static InputDialog show(CharSequence title, CharSequence message, CharSequence okText, CharSequence cancelText, CharSequence otherText, String inputText) {
|
|
|
InputDialog inputDialog = new InputDialog(title, message, okText, cancelText, otherText, inputText);
|
|
|
inputDialog.show();
|
|
|
return inputDialog;
|
|
|
}
|
|
|
|
|
|
+ public static InputDialog show(int titleResId, int messageResId, int okTextResId, int cancelTextResId, int otherTextResId, int inputTextResId) {
|
|
|
+ InputDialog inputDialog = new InputDialog(titleResId, messageResId, okTextResId, cancelTextResId, otherTextResId, inputTextResId);
|
|
|
+ inputDialog.show();
|
|
|
+ return inputDialog;
|
|
|
+ }
|
|
|
+
|
|
|
public CharSequence getOkButton() {
|
|
|
return okText;
|
|
|
}
|
|
@@ -106,6 +161,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setOkButton(int okTextResId) {
|
|
|
+ this.okText = getString(okTextResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public InputDialog setOkButton(OnInputDialogButtonClickListener<InputDialog> okButtonClickListener) {
|
|
|
this.okButtonClickListener = okButtonClickListener;
|
|
|
return this;
|
|
@@ -118,6 +179,13 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setOkButton(int okTextResId, OnInputDialogButtonClickListener<InputDialog> okButtonClickListener) {
|
|
|
+ this.okText = getString(okTextResId);
|
|
|
+ this.okButtonClickListener = okButtonClickListener;
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public CharSequence getCancelButton() {
|
|
|
return cancelText;
|
|
|
}
|
|
@@ -128,6 +196,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setCancelButton(int cancelTextResId) {
|
|
|
+ this.cancelText = getString(cancelTextResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public InputDialog setCancelButton(OnInputDialogButtonClickListener<InputDialog> cancelButtonClickListener) {
|
|
|
this.cancelButtonClickListener = cancelButtonClickListener;
|
|
|
return this;
|
|
@@ -140,6 +214,13 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setCancelButton(int cancelTextResId, OnInputDialogButtonClickListener<InputDialog> cancelButtonClickListener) {
|
|
|
+ this.cancelText = getString(cancelTextResId);
|
|
|
+ this.cancelButtonClickListener = cancelButtonClickListener;
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public CharSequence getOtherButton() {
|
|
|
return otherText;
|
|
|
}
|
|
@@ -150,6 +231,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setOtherButton(int otherTextResId) {
|
|
|
+ this.otherText = getString(otherTextResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public InputDialog setOtherButton(OnInputDialogButtonClickListener<InputDialog> otherButtonClickListener) {
|
|
|
this.otherButtonClickListener = otherButtonClickListener;
|
|
|
return this;
|
|
@@ -162,6 +249,13 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setOtherButton(int otherTextResId, OnInputDialogButtonClickListener<InputDialog> otherButtonClickListener) {
|
|
|
+ this.otherText = getString(otherTextResId);
|
|
|
+ this.otherButtonClickListener = otherButtonClickListener;
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public OnInputDialogButtonClickListener<InputDialog> getInputOkButtonClickListener() {
|
|
|
return (OnInputDialogButtonClickListener<InputDialog>) okButtonClickListener;
|
|
|
}
|
|
@@ -199,6 +293,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setTitle(int titleResId) {
|
|
|
+ this.title = getString(titleResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public CharSequence getMessage() {
|
|
|
return message;
|
|
|
}
|
|
@@ -209,6 +309,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setMessage(int messageResId) {
|
|
|
+ this.message = getString(messageResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public String getInputText() {
|
|
|
return inputText;
|
|
|
}
|
|
@@ -219,6 +325,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setInputText(int inputTextResId) {
|
|
|
+ this.inputText = getString(inputTextResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public String getInputHintText() {
|
|
|
return inputHintText;
|
|
|
}
|
|
@@ -229,6 +341,12 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
+ public InputDialog setInputHintText(int inputHintTextResId) {
|
|
|
+ this.inputHintText = getString(inputHintTextResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
+
|
|
|
public TextInfo getTitleTextInfo() {
|
|
|
return titleTextInfo;
|
|
|
}
|
|
@@ -326,7 +444,7 @@ public class InputDialog extends MessageDialog {
|
|
|
return this;
|
|
|
}
|
|
|
|
|
|
- public InputDialog setCustomView(OnBindView<MessageDialog> onBindView){
|
|
|
+ public InputDialog setCustomView(OnBindView<MessageDialog> onBindView) {
|
|
|
this.onBindView = onBindView;
|
|
|
refreshUI();
|
|
|
return this;
|
|
@@ -337,7 +455,7 @@ public class InputDialog extends MessageDialog {
|
|
|
return onBindView.getCustomView();
|
|
|
}
|
|
|
|
|
|
- public InputDialog removeCustomView(){
|
|
|
+ public InputDialog removeCustomView() {
|
|
|
this.onBindView.clean();
|
|
|
refreshUI();
|
|
|
return this;
|
|
@@ -352,4 +470,10 @@ public class InputDialog extends MessageDialog {
|
|
|
refreshUI();
|
|
|
return this;
|
|
|
}
|
|
|
+
|
|
|
+ public InputDialog setBackgroundColorRes(@ColorRes int backgroundColorResId) {
|
|
|
+ this.backgroundColor = getColor(backgroundColorResId);
|
|
|
+ refreshUI();
|
|
|
+ return this;
|
|
|
+ }
|
|
|
}
|