You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/12/26 07:12:51 UTC

incubator-weex git commit: [WEEX-167] Input Changed not fired when same with default value set close #937

Repository: incubator-weex
Updated Branches:
  refs/heads/master a45d51b12 -> 7cd272842


[WEEX-167] Input Changed not fired when same with default value set
close #937


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7cd27284
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7cd27284
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7cd27284

Branch: refs/heads/master
Commit: 7cd2728422861ecd2492611a8a801810bb07f1cc
Parents: a45d51b
Author: jianbai.gbj <ji...@alibaba-inc.com>
Authored: Fri Dec 8 19:17:37 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Dec 26 15:12:13 2017 +0800

----------------------------------------------------------------------
 .../weex/ui/component/AbstractEditComponent.java      | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7cd27284/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java
----------------------------------------------------------------------
diff --git a/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java b/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java
index 941ede5..c502c6c 100644
--- a/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java
+++ b/android/sdk/src/main/java/com/taobao/weex/ui/component/AbstractEditComponent.java
@@ -204,6 +204,7 @@ public abstract class AbstractEditComponent extends WXComponent<WXEditText> {
       });
     } else if (type.equals(Constants.Event.INPUT)) {
       text.addTextChangedListener(new TextWatcher() {
+        boolean  hasChangeForDefaultValue = false;
         @Override
         public void beforeTextChanged(CharSequence s, int start, int count, int after) {
 
@@ -222,11 +223,14 @@ public abstract class AbstractEditComponent extends WXComponent<WXEditText> {
 
           mBeforeText = s.toString();
 
-          if (getDomObject() != null && getDomObject().getAttrs() != null) {
-            Object val = getDomObject().getAttrs().get(Constants.Name.VALUE);
-            String valString = WXUtils.getString(val, null);
-            if (mBeforeText != null && mBeforeText.equals(valString)) {
-              return;
+          if(!hasChangeForDefaultValue){
+            if (getDomObject() != null && getDomObject().getAttrs() != null) {
+              Object val = getDomObject().getAttrs().get(Constants.Name.VALUE);
+              String valString = WXUtils.getString(val, null);
+              if (mBeforeText != null && mBeforeText.equals(valString)) {
+                hasChangeForDefaultValue = true;
+                return;
+              }
             }
           }