Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/widget/EmptyAlertEditText.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/EmptyAlertEditText.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/EmptyAlertEditText.java |
| index 9fe5e1a2494e2550a78b3c4e092dc09208ed478f..f9babe28b976843a29d9bbbe15af0daae8715e92 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/widget/EmptyAlertEditText.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/EmptyAlertEditText.java |
| @@ -63,14 +63,23 @@ public class EmptyAlertEditText extends AppCompatEditText { |
| } |
| /** |
| + *Checks whether the content is empty. Note that this doesn't update an error message. |
|
Ted C
2015/07/21 20:21:08
need a blank space after *
Kibeom Kim (inactive)
2015/08/04 20:54:04
Done.
|
| + * @return Whether the content is empty. |
| + */ |
| + public boolean isValid() { |
|
Ian Wen
2015/07/21 19:59:05
1. isValid() "checks whether the content is empty"
Kibeom Kim (inactive)
2015/08/04 20:54:04
in the new code, we call validate() on every text
|
| + return getTrimmedText().length() > 0; |
| + } |
| + |
| + /** |
| * Checks whether the content is empty. If empty, an alert message will be shown. |
| * @return Whether the content is empty. |
| */ |
| public boolean validate() { |
| - if (getTrimmedText().length() == 0) { |
| + if (isValid()) { |
| + return true; |
| + } else { |
| setError(mAlertMessage); |
| return false; |
| } |
| - return true; |
| } |
| } |