summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/Launcher.java
diff options
context:
space:
mode:
authorSvetoslav Ganov <svetoslavganov@google.com>2011-01-07 14:55:17 -0800
committerSvetoslav Ganov <svetoslavganov@google.com>2011-01-07 14:55:22 -0800
commit815ba2d2eabded5ffee53fba668d63ca9173e6fd (patch)
tree592e2e054e01eb7450f84b215bca2fe7f5613db2 /src/com/android/launcher2/Launcher.java
parent413fe14bff78b8256df97376c707b06d75ac9bd1 (diff)
downloadandroid_packages_apps_Trebuchet-815ba2d2eabded5ffee53fba668d63ca9173e6fd.tar.gz
android_packages_apps_Trebuchet-815ba2d2eabded5ffee53fba668d63ca9173e6fd.tar.bz2
android_packages_apps_Trebuchet-815ba2d2eabded5ffee53fba668d63ca9173e6fd.zip
Added accessibility support for the home/all app togle in Launcher2
bug:3307225 1. Added code to fire accessibility events on transition to all apps and to home and to appropriately populate the generated accessibility event depending on the context in which it is fired. Change-Id: Icd1ceb3b2556b6f416829d58b4ac7df42d61936c
Diffstat (limited to 'src/com/android/launcher2/Launcher.java')
-rw-r--r--src/com/android/launcher2/Launcher.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 83f13aa11..1ec326b2f 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -88,6 +88,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.View.OnLongClickListener;
+import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.Advanceable;
import android.widget.EditText;
@@ -416,6 +417,21 @@ public final class Launcher extends Activity
}
}
+ @Override
+ public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+ super.dispatchPopulateAccessibilityEvent(event);
+
+ // we want to take over text population so it is context dependent
+ event.getText().clear();
+ if (mState == State.ALL_APPS) {
+ event.getText().add(getString(R.string.all_apps_button_label));
+ } else if (mState == State.WORKSPACE) {
+ event.getText().add(getString(R.string.all_apps_home_button_label));
+ }
+
+ return true;
+ }
+
private void checkForLocaleChange() {
if (sLocaleConfiguration == null) {
new AsyncTask<Void, Void, LocaleConfiguration>() {
@@ -2878,8 +2894,10 @@ public final class Launcher extends Activity
// Change the state *after* we've called all the transition code
mState = State.ALL_APPS;
- }
+ // send an accessibility event to announce the context change
+ getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
+ }
void showWorkspace(boolean animated) {
showWorkspace(animated, null);
@@ -2901,6 +2919,9 @@ public final class Launcher extends Activity
// Change the state *after* we've called all the transition code
mState = State.WORKSPACE;
+
+ // send an accessibility event to announce the context change
+ getWindow().getDecorView().sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
}
void enterSpringLoadedDragMode(CellLayout layout) {