OSDN Git Service

DirectReply: Send button was wrongly actionable on empty field
authorAdrian Roos <roosa@google.com>
Fri, 29 Apr 2016 17:45:38 +0000 (10:45 -0700)
committerAdrian Roos <roosa@google.com>
Fri, 29 Apr 2016 17:50:25 +0000 (10:50 -0700)
Change-Id: I672d897d42ef340e84d9dc938e6edf26e2b8d9c3
Fixes: 28420826

packages/SystemUI/src/com/android/systemui/statusbar/policy/RemoteInputView.java

index f3033cd..a855aed 100644 (file)
@@ -91,8 +91,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
         mEditText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
             @Override
             public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
-
-                // Check if this was the result of hitting the enter key
                 final boolean isSoftImeEvent = event == null
                         && (actionId == EditorInfo.IME_ACTION_DONE
                         || actionId == EditorInfo.IME_ACTION_NEXT
@@ -102,7 +100,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
                         && event.getAction() == KeyEvent.ACTION_DOWN;
 
                 if (isSoftImeEvent || isKeyboardEnterKey) {
-                    sendRemoteInput();
+                    if (mEditText.length() > 0) {
+                        sendRemoteInput();
+                    }
+                    // Consume action to prevent IME from closing.
                     return true;
                 }
                 return false;