diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2011-09-12 15:31:46 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-12 15:31:46 -0700 |
commit | 2ab804e681d2c008c36c6cfa0c44afb10da81f54 (patch) | |
tree | 6ac74b99ff3dc83816177f8aafdc368e9416c2f3 | |
parent | 3fe9b9c948235ae9ec69d0d61c58df4b73e4ea7d (diff) | |
parent | 65081e68944e51983dea5589e86d9d11de8e70af (diff) | |
download | packages_apps_Settings-2ab804e681d2c008c36c6cfa0c44afb10da81f54.zip packages_apps_Settings-2ab804e681d2c008c36c6cfa0c44afb10da81f54.tar.gz packages_apps_Settings-2ab804e681d2c008c36c6cfa0c44afb10da81f54.tar.bz2 |
Merge "Fixed tutorial to read instructions after hover events."
-rw-r--r-- | src/com/android/settings/AccessibilityTutorialActivity.java | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/com/android/settings/AccessibilityTutorialActivity.java b/src/com/android/settings/AccessibilityTutorialActivity.java index 5039970..206aa94 100644 --- a/src/com/android/settings/AccessibilityTutorialActivity.java +++ b/src/com/android/settings/AccessibilityTutorialActivity.java @@ -522,6 +522,9 @@ public class AccessibilityTutorialActivity extends Activity { /** Whether this module is currently focused. */ private boolean mIsVisible; + /** Handler for sending accessibility events after the current UI action. */ + private InstructionHandler mHandler = new InstructionHandler(); + /** * Constructs a new tutorial module for the given context and controller * with the specified layout. @@ -585,8 +588,11 @@ public class AccessibilityTutorialActivity extends Activity { return; } - final String text = getContext().getString(resId, formatArgs); + final String text = mContext.getString(resId, formatArgs); + mHandler.addInstruction(text); + } + private void addInstructionSync(CharSequence text) { mInstructions.setVisibility(View.VISIBLE); mInstructions.setText(text); mInstructions.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); @@ -661,6 +667,24 @@ public class AccessibilityTutorialActivity extends Activity { protected void setFinishVisible(boolean visible) { mFinish.setVisibility(visible ? VISIBLE : GONE); } + + private class InstructionHandler extends Handler { + private static final int ADD_INSTRUCTION = 1; + + @Override + public void handleMessage(Message msg) { + switch (msg.what) { + case ADD_INSTRUCTION: + final String text = (String) msg.obj; + addInstructionSync(text); + break; + } + } + + public void addInstruction(String text) { + obtainMessage(ADD_INSTRUCTION, text).sendToTarget(); + } + } } /** |