@@ -35,6 +35,7 @@ public class FastDialogBuilder {
3535 private TextView tvWarning ;
3636 private ClearableEditText etWarning ;
3737 private ClearableEditText etWarningDecimal ;
38+ private ClearableEditText etWarningNumber ;
3839 private ClearableEditText etUsername ;
3940 private NumberPicker numberPicker ;
4041 private ClearableEditText etPassword ;
@@ -49,6 +50,7 @@ public class FastDialogBuilder {
4950 private RecyclerView rvFolder ;
5051
5152 private boolean isDecimal = false ;
53+ private boolean isNumber = false ;
5254 private boolean fullScreen = true ;
5355 private Type type ;
5456
@@ -126,6 +128,7 @@ private FastDialogBuilder createDialog(Type type){
126128 tvWarning = dialog .findViewById (R .id .warning_dialog_text );
127129 etWarning = dialog .findViewById (R .id .warning_dialog_et );
128130 etWarningDecimal = dialog .findViewById (R .id .warning_dialog_et_decimal );
131+ etWarningNumber = dialog .findViewById (R .id .warning_dialog_et_number );
129132 btCancel = dialog .findViewById (R .id .warning_dialog_cancel_bt );
130133 btOk = dialog .findViewById (R .id .warning_dialog_ok_bt );
131134 btCancel .setOnClickListener (v -> {
@@ -146,6 +149,7 @@ private FastDialogBuilder createDialog(Type type){
146149 tvWarning .setVisibility (View .GONE );
147150 etWarning .setVisibility (View .GONE );
148151 etWarningDecimal .setVisibility (View .GONE );
152+ etWarningNumber .setVisibility (View .GONE );
149153 btCancel .setVisibility (View .GONE );
150154 btOk .setVisibility (View .GONE );
151155 }
@@ -273,6 +277,7 @@ public FastDialogBuilder setHint(String hint){
273277 etWarning .setVisibility (View .VISIBLE );
274278 etWarning .setHint (hint );
275279 etWarningDecimal .setHint (hint );
280+ etWarningNumber .setHint (hint );
276281 return this ;
277282 }
278283 public FastDialogBuilder loginWithEmail (){
@@ -294,8 +299,18 @@ public FastDialogBuilder positiveText(String positive){
294299 }
295300 public FastDialogBuilder decimalEditText (){
296301 etWarning .setVisibility (View .GONE );
302+ etWarningNumber .setVisibility (View .GONE );
297303 etWarningDecimal .setVisibility (View .VISIBLE );
298304 isDecimal = true ;
305+ isNumber = false ;
306+ return this ;
307+ }
308+ public FastDialogBuilder numberEditText (){
309+ etWarning .setVisibility (View .GONE );
310+ etWarningDecimal .setVisibility (View .GONE );
311+ etWarningNumber .setVisibility (View .VISIBLE );
312+ isDecimal = false ;
313+ isNumber = true ;
299314 return this ;
300315 }
301316 void positiveClickListener (PositiveClick click ){
@@ -317,16 +332,20 @@ public FastDialogBuilder cancelable(boolean bool){
317332 public FastDialogBuilder privateEditText (){
318333 etWarning .setTransformationMethod (PasswordTransformationMethod .getInstance ());
319334 etWarningDecimal .setTransformationMethod (PasswordTransformationMethod .getInstance ());
335+ etWarningNumber .setTransformationMethod (PasswordTransformationMethod .getInstance ());
320336 return this ;
321337 }
322338 public FastDialogBuilder setInputText (String str ){
323- if (!isDecimal ){
324- etWarning .setText (str );
325- etWarning .setSelection (etWarning .getText ().length ());
326- }
327- else {
339+ if (isDecimal ){
328340 etWarningDecimal .setText (str );
329341 etWarningDecimal .setSelection (etWarningDecimal .getText ().length ());
342+ }else if (isNumber ){
343+ etWarningNumber .setText (str );
344+ etWarningNumber .setSelection (etWarningNumber .getText ().length ());
345+ }
346+ else {
347+ etWarning .setText (str );
348+ etWarning .setSelection (etWarning .getText ().length ());
330349 }
331350
332351 return this ;
@@ -335,6 +354,7 @@ public FastDialogBuilder setInputText(String str){
335354 public FastDialogBuilder setTextMaxLength (int length ){
336355 etWarning .setFilters (new InputFilter [] { new InputFilter .LengthFilter (length ) });
337356 etWarningDecimal .setFilters (new InputFilter [] { new InputFilter .LengthFilter (length ) });
357+ etWarningNumber .setFilters (new InputFilter [] { new InputFilter .LengthFilter (length ) });
338358 return this ;
339359 }
340360
0 commit comments