diff options
author | Jim Miller <jaggies@google.com> | 2011-04-18 18:16:09 -0700 |
---|---|---|
committer | Jim Miller <jaggies@google.com> | 2011-04-18 18:18:13 -0700 |
commit | 29c9073595e7ab25a4528d14873bb88627a48135 (patch) | |
tree | 8b390abe8cbddd1eb9094e90525b2e09a293a669 /src/com/android/settings/ConfirmLockPassword.java | |
parent | 7c2fa094ccca6e29f36b1a2004257f2675c007b0 (diff) | |
download | packages_apps_Settings-29c9073595e7ab25a4528d14873bb88627a48135.tar.gz packages_apps_Settings-29c9073595e7ab25a4528d14873bb88627a48135.tar.bz2 packages_apps_Settings-29c9073595e7ab25a4528d14873bb88627a48135.zip |
Fix 3402408: Manage "continue" button in ConfirmPassword screen
This disables the "continue" button until the user has entered at
least one character.
Change-Id: I3192e1789ba89031ac4cc90f388b32b7af19a445
Diffstat (limited to 'src/com/android/settings/ConfirmLockPassword.java')
-rw-r--r-- | src/com/android/settings/ConfirmLockPassword.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java index 7b7b1038d..ffda3d3dd 100644 --- a/src/com/android/settings/ConfirmLockPassword.java +++ b/src/com/android/settings/ConfirmLockPassword.java @@ -27,13 +27,16 @@ import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceActivity; +import android.text.Editable; import android.text.InputType; +import android.text.TextWatcher; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; +import android.widget.Button; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; @@ -58,7 +61,7 @@ public class ConfirmLockPassword extends PreferenceActivity { } public static class ConfirmLockPasswordFragment extends Fragment implements OnClickListener, - OnEditorActionListener { + OnEditorActionListener, TextWatcher { private static final long ERROR_MESSAGE_TIMEOUT = 3000; private TextView mPasswordEntry; private LockPatternUtils mLockPatternUtils; @@ -66,6 +69,7 @@ public class ConfirmLockPassword extends PreferenceActivity { private Handler mHandler = new Handler(); private PasswordEntryKeyboardHelper mKeyboardHelper; private PasswordEntryKeyboardView mKeyboardView; + private Button mContinueButton; // required constructor for fragments @@ -87,9 +91,14 @@ public class ConfirmLockPassword extends PreferenceActivity { // Disable IME on our window since we provide our own keyboard view.findViewById(R.id.cancel_button).setOnClickListener(this); - view.findViewById(R.id.next_button).setOnClickListener(this); + mContinueButton = (Button) view.findViewById(R.id.next_button); + mContinueButton.setOnClickListener(this); + mContinueButton.setEnabled(false); // disable until the user enters at least one char + mPasswordEntry = (TextView) view.findViewById(R.id.password_entry); mPasswordEntry.setOnEditorActionListener(this); + mPasswordEntry.addTextChangedListener(this); + mKeyboardView = (PasswordEntryKeyboardView) view.findViewById(R.id.keyboard); mHeaderText = (TextView) view.findViewById(R.id.headerText); final boolean isAlpha = DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC == storedQuality @@ -172,6 +181,7 @@ public class ConfirmLockPassword extends PreferenceActivity { }, ERROR_MESSAGE_TIMEOUT); } + // {@link OnEditorActionListener} methods. public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // Check if this was the result of hitting the enter or "done" key if (actionId == EditorInfo.IME_NULL @@ -182,5 +192,16 @@ public class ConfirmLockPassword extends PreferenceActivity { } return false; } + + // {@link TextWatcher} methods. + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + } + + public void onTextChanged(CharSequence s, int start, int before, int count) { + } + + public void afterTextChanged(Editable s) { + mContinueButton.setEnabled(mPasswordEntry.getText().length() > 0); + } } } |