diff options
author | alanv <alanv@google.com> | 2012-10-03 17:10:50 -0700 |
---|---|---|
committer | alanv <alanv@google.com> | 2012-10-03 17:10:50 -0700 |
commit | eef72c39ae83697b1beaa148ec56aced67382fec (patch) | |
tree | 0b41f6f853cca20a66e104bb485c6dcf6b468242 /src | |
parent | a8f3a204d908330e31c29a11d5a83b8ba40a9610 (diff) | |
download | packages_apps_settings-eef72c39ae83697b1beaa148ec56aced67382fec.zip packages_apps_settings-eef72c39ae83697b1beaa148ec56aced67382fec.tar.gz packages_apps_settings-eef72c39ae83697b1beaa148ec56aced67382fec.tar.bz2 |
Announce dynamic content changes in lock confirmation settings.
Also re-orders updateStage() and setText/Selection calls so that text
events don't flush announcements. This does not change functionality.
Bug: 7256500
Change-Id: I8b10d66e9f73c7a630a8c3c5128372e18f26234c
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/settings/ChooseLockPassword.java | 13 | ||||
-rw-r--r-- | src/com/android/settings/ChooseLockPattern.java | 7 | ||||
-rw-r--r-- | src/com/android/settings/ConfirmLockPassword.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/ConfirmLockPattern.java | 5 |
4 files changed, 24 insertions, 3 deletions
diff --git a/src/com/android/settings/ChooseLockPassword.java b/src/com/android/settings/ChooseLockPassword.java index 4657be5..aab4ba6 100644 --- a/src/com/android/settings/ChooseLockPassword.java +++ b/src/com/android/settings/ChooseLockPassword.java @@ -40,6 +40,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; +import android.view.accessibility.AccessibilityEvent; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.TextView; @@ -272,8 +273,15 @@ public class ChooseLockPassword extends PreferenceActivity { } protected void updateStage(Stage stage) { + final Stage previousStage = mUiStage; mUiStage = stage; updateUi(); + + // If the stage changed, announce the header for accessibility. This + // is a no-op when accessibility is disabled. + if (previousStage != stage) { + mHeaderText.announceForAccessibility(mHeaderText.getText()); + } } /** @@ -378,8 +386,8 @@ public class ChooseLockPassword extends PreferenceActivity { errorMsg = validatePassword(pin); if (errorMsg == null) { mFirstPin = pin; - updateStage(Stage.NeedToConfirm); mPasswordEntry.setText(""); + updateStage(Stage.NeedToConfirm); } } else if (mUiStage == Stage.NeedToConfirm) { if (mFirstPin.equals(pin)) { @@ -389,11 +397,11 @@ public class ChooseLockPassword extends PreferenceActivity { mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback); getActivity().finish(); } else { - updateStage(Stage.ConfirmWrong); CharSequence tmp = mPasswordEntry.getText(); if (tmp != null) { Selection.setSelection((Spannable) tmp, 0, tmp.length()); } + updateStage(Stage.ConfirmWrong); } } if (errorMsg != null) { @@ -415,6 +423,7 @@ public class ChooseLockPassword extends PreferenceActivity { private void showError(String msg, final Stage next) { mHeaderText.setText(msg); + mHeaderText.announceForAccessibility(mHeaderText.getText()); Message mesg = mHandler.obtainMessage(MSG_SHOW_ERROR, next); mHandler.removeMessages(MSG_SHOW_ERROR); mHandler.sendMessageDelayed(mesg, ERROR_MESSAGE_TIMEOUT); diff --git a/src/com/android/settings/ChooseLockPattern.java b/src/com/android/settings/ChooseLockPattern.java index 180eee1..295e8ea 100644 --- a/src/com/android/settings/ChooseLockPattern.java +++ b/src/com/android/settings/ChooseLockPattern.java @@ -429,6 +429,7 @@ public class ChooseLockPattern extends PreferenceActivity { * @param stage */ protected void updateStage(Stage stage) { + final Stage previousStage = mUiStage; mUiStage = stage; @@ -493,6 +494,12 @@ public class ChooseLockPattern extends PreferenceActivity { case ChoiceConfirmed: break; } + + // If the stage changed, announce the header for accessibility. This + // is a no-op when accessibility is disabled. + if (previousStage != stage) { + mHeaderText.announceForAccessibility(mHeaderText.getText()); + } } diff --git a/src/com/android/settings/ConfirmLockPassword.java b/src/com/android/settings/ConfirmLockPassword.java index 1229046..96839ba 100644 --- a/src/com/android/settings/ConfirmLockPassword.java +++ b/src/com/android/settings/ConfirmLockPassword.java @@ -35,6 +35,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; import android.view.inputmethod.EditorInfo; import android.widget.Button; import android.widget.TextView; @@ -173,6 +174,7 @@ public class ConfirmLockPassword extends PreferenceActivity { private void showError(int msg) { mHeaderText.setText(msg); + mHeaderText.announceForAccessibility(mHeaderText.getText()); mPasswordEntry.setText(null); mHandler.postDelayed(new Runnable() { public void run() { diff --git a/src/com/android/settings/ConfirmLockPattern.java b/src/com/android/settings/ConfirmLockPattern.java index 2892930..dd375cc 100644 --- a/src/com/android/settings/ConfirmLockPattern.java +++ b/src/com/android/settings/ConfirmLockPattern.java @@ -180,7 +180,6 @@ public class ConfirmLockPattern extends PreferenceActivity { } private void updateStage(Stage stage) { - switch (stage) { case NeedToUnlock: if (mHeaderText != null) { @@ -220,6 +219,10 @@ public class ConfirmLockPattern extends PreferenceActivity { mLockPatternView.setEnabled(false); // appearance of being disabled break; } + + // Always announce the header for accessibility. This is a no-op + // when accessibility is disabled. + mHeaderTextView.announceForAccessibility(mHeaderTextView.getText()); } private Runnable mClearPatternRunnable = new Runnable() { |