This repository was archived by the owner on Jun 3, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
android/sdk/src/main/java/com/taobao/weex/ui/component Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change 27
27
import android .text .TextPaint ;
28
28
import android .text .TextUtils ;
29
29
import android .text .TextWatcher ;
30
+ import android .text .method .DigitsKeyListener ;
30
31
import android .text .method .PasswordTransformationMethod ;
31
32
import android .util .Log ;
32
33
import android .util .TypedValue ;
@@ -655,6 +656,8 @@ public void setMaxlength(int maxLength) {
655
656
}
656
657
657
658
private int getInputType (String type ) {
659
+ String digits = "1234567890" ;
660
+ String digitsWithDot = "12234567890." ;
658
661
int inputType ;
659
662
switch (type ) {
660
663
case Constants .Value .TEXT :
@@ -676,6 +679,7 @@ private int getInputType(String type) {
676
679
break ;
677
680
case Constants .Value .TEL :
678
681
inputType = InputType .TYPE_CLASS_PHONE ;
682
+ getHostView ().setKeyListener (DigitsKeyListener .getInstance (digits ));
679
683
break ;
680
684
case Constants .Value .TIME :
681
685
inputType = InputType .TYPE_NULL ;
@@ -686,6 +690,7 @@ private int getInputType(String type) {
686
690
break ;
687
691
case Constants .Value .NUMBER :
688
692
inputType = InputType .TYPE_CLASS_NUMBER ;
693
+ getHostView ().setKeyListener (DigitsKeyListener .getInstance (digitsWithDot ));
689
694
break ;
690
695
default :
691
696
inputType = InputType .TYPE_CLASS_TEXT ;
You can’t perform that action at this time.
0 commit comments