summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-11-11 14:52:11 -0800
committerJoe Onorato <joeo@android.com>2009-11-11 14:52:11 -0800
commit52a653f3ffec3fd95987e0e35151cb670a54109a (patch)
tree2dcc41c6b8a837f4b6cf3c0dc8f06a465f027ad9
parenta30ce8e6b25e41f392a41fd4d0d3e0a424a84dad (diff)
downloadandroid_packages_apps_Trebuchet-52a653f3ffec3fd95987e0e35151cb670a54109a.tar.gz
android_packages_apps_Trebuchet-52a653f3ffec3fd95987e0e35151cb670a54109a.tar.bz2
android_packages_apps_Trebuchet-52a653f3ffec3fd95987e0e35151cb670a54109a.zip
Fix 2241848 - 3D apps folder does not send accessibility events
It's now sending them. The beeping and vibrating accessibility things work, but we only have prebuilts for the speech one and it's not saying anything and I can't debug it, so this will have to do.
-rw-r--r--res/values/strings.xml6
-rw-r--r--src/com/android/launcher2/AllAppsView.java57
-rw-r--r--src/com/android/launcher2/HandleView.java2
3 files changed, 63 insertions, 2 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c91e53384..b642ead0f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -88,6 +88,12 @@
<!-- Title of dialog when user is selecting live folder to add to homescreen -->
<string name="title_select_live_folder">Select folder</string>
+ <!-- All applications label for accessibilty (spoken when the button gets focus). -->
+ <string name="all_apps_button_label">All applications</string>
+ <!-- Label for button in all applications label to go back home (to the workspace / desktop)
+ for accessibilty (spoken when the button gets focus). -->
+ <string name="all_apps_home_button_label">Home</string>
+
<!-- Menus items: -->
<skip />
<!-- Verb, menu item used to add an item on the desktop -->
diff --git a/src/com/android/launcher2/AllAppsView.java b/src/com/android/launcher2/AllAppsView.java
index 76fee5b91..a4891dafb 100644
--- a/src/com/android/launcher2/AllAppsView.java
+++ b/src/com/android/launcher2/AllAppsView.java
@@ -46,6 +46,7 @@ import android.view.SurfaceHolder;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.accessibility.AccessibilityEvent;
import java.util.ArrayList;
import java.util.Collections;
@@ -565,6 +566,44 @@ public class AllAppsView extends RSSurfaceView
return true;
}
+ @Override
+ public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
+ if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SELECTED) {
+ if (!isVisible()) {
+ return false;
+ }
+ String text = null;
+ int index;
+ int count = mAllAppsList.size() + 1; // +1 is home
+ int pos = -1;
+ switch (mLastSelection) {
+ case SELECTION_ICONS:
+ index = mRollo.mState.selectedIconIndex;
+ if (index >= 0) {
+ ApplicationInfo info = mAllAppsList.get(index);
+ if (info.title != null) {
+ text = info.title.toString();
+ pos = index;
+ }
+ }
+ break;
+ case SELECTION_HOME:
+ text = getContext().getString(R.string.all_apps_home_button_label);
+ pos = count;
+ break;
+ }
+ if (text != null) {
+ Log.d(TAG, "dispatchPopulateAccessibilityEvent setting text=" + text);
+ event.setEnabled(true);
+ event.getText().add(text);
+ //event.setContentDescription(text);
+ event.setItemCount(count);
+ event.setCurrentItemIndex(pos);
+ }
+ }
+ return false;
+ }
+
public void setDragController(DragController dragger) {
mDragController = dragger;
}
@@ -1286,19 +1325,28 @@ public class AllAppsView extends RSSurfaceView
mLastSelection = SELECTION_ICONS;
}
+ int prev = mState.selectedIconIndex;
mState.selectedIconIndex = index;
+ ApplicationInfo info = mAllAppsList.get(index);
Bitmap selectionBitmap = mSelectionBitmap;
Utilities.drawSelectedAllAppsBitmap(mSelectionCanvas,
selectionBitmap.getWidth(), selectionBitmap.getHeight(),
- pressed == SELECTED_PRESSED,
- mAllAppsList.get(index).iconBitmap);
+ pressed == SELECTED_PRESSED, info.iconBitmap);
mSelectedIcon = Allocation.createFromBitmap(mRS, selectionBitmap,
Element.RGBA_8888(mRS), false);
mSelectedIcon.uploadToTexture(0);
mState.selectedIconTexture = mSelectedIcon.getID();
+
+ if (prev != index) {
+ if (info.title != null && info.title.length() > 0) {
+ Log.d(TAG, "sendAccessibilityEvent SELECTION_ICONS " + info.title);
+ //setContentDescription(info.title);
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
+ }
+ }
}
}
@@ -1310,6 +1358,7 @@ public class AllAppsView extends RSSurfaceView
}
void setHomeSelected(int mode) {
+ final int prev = mLastSelection;
switch (mode) {
case SELECTED_NONE:
mState.homeButtonId = mHomeButtonNormal.getID();
@@ -1317,6 +1366,10 @@ public class AllAppsView extends RSSurfaceView
case SELECTED_FOCUSED:
mLastSelection = SELECTION_HOME;
mState.homeButtonId = mHomeButtonFocused.getID();
+ if (prev != SELECTION_HOME) {
+ Log.d(TAG, "sendAccessibilityEvent SELECTION_HOME");
+ sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SELECTED);
+ }
break;
case SELECTED_PRESSED:
mState.homeButtonId = mHomeButtonPressed.getID();
diff --git a/src/com/android/launcher2/HandleView.java b/src/com/android/launcher2/HandleView.java
index 2bffe4b52..e07334e9f 100644
--- a/src/com/android/launcher2/HandleView.java
+++ b/src/com/android/launcher2/HandleView.java
@@ -45,6 +45,8 @@ public class HandleView extends ImageView {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HandleView, defStyle, 0);
mOrientation = a.getInt(R.styleable.HandleView_direction, ORIENTATION_HORIZONTAL);
a.recycle();
+
+ setContentDescription(context.getString(R.string.all_apps_button_label));
}
@Override