diff options
author | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-22 15:19:14 -0700 |
---|---|---|
committer | Svetoslav Ganov <svetoslavganov@google.com> | 2012-05-22 16:17:53 -0700 |
commit | 55d225d50e68b3ea629c45a53d6744b52e335134 (patch) | |
tree | fccd9ea6327a2c36434b3326eea225c5f143c832 /src/com | |
parent | a4ac83cc3b285780328a052a2d42646c1abf3d13 (diff) | |
download | packages_apps_trebuchet-55d225d50e68b3ea629c45a53d6744b52e335134.zip packages_apps_trebuchet-55d225d50e68b3ea629c45a53d6744b52e335134.tar.gz packages_apps_trebuchet-55d225d50e68b3ea629c45a53d6744b52e335134.tar.bz2 |
Cling allows touch explore and accessibility focus search behind it.
1. Touch exploration is performed through hover events and
the cling has to consume them to prevent touch exploring
content behind it to achieve modal window like behavior.
2. Since the cling should behave as a modal window, the
accessibility focus search should not returning items
behind the cling, so the focus search should use the
cling as its root.
bug:6538549
Change-Id: I8545b6ae3ac85a363cc371e1a608d55b9abd5de8
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/Cling.java | 33 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 1 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/com/android/launcher2/Cling.java b/src/com/android/launcher2/Cling.java index d61b988..5cde0b4 100644 --- a/src/com/android/launcher2/Cling.java +++ b/src/com/android/launcher2/Cling.java @@ -28,6 +28,10 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.DisplayMetrics; +import android.view.FocusFinder; +import android.view.MotionEvent; +import android.view.View; +import android.view.accessibility.AccessibilityManager; import android.widget.FrameLayout; import com.android.launcher.R; @@ -130,6 +134,35 @@ public class Cling extends FrameLayout { } @Override + public View findViewToTakeAccessibilityFocusFromHover(View child, View descendant) { + if (descendant.includeForAccessibility()) { + return descendant; + } + return null; + } + + @Override + public View focusSearch(int direction) { + return this.focusSearch(null, direction); + } + + @Override + public View focusSearch(View focused, int direction) { + return FocusFinder.getInstance().findNextFocus(this, focused, direction); + } + + @Override + public boolean onHoverEvent(MotionEvent event) { + return (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) + || mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) + || mDrawIdentifier.equals(WORKSPACE_LARGE) + || mDrawIdentifier.equals(ALLAPPS_PORTRAIT) + || mDrawIdentifier.equals(ALLAPPS_LANDSCAPE) + || mDrawIdentifier.equals(ALLAPPS_LARGE) + || mDrawIdentifier.equals(WORKSPACE_CUSTOM)); + } + + @Override public boolean onTouchEvent(android.view.MotionEvent event) { if (mDrawIdentifier.equals(WORKSPACE_PORTRAIT) || mDrawIdentifier.equals(WORKSPACE_LANDSCAPE) || diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index e6c25cb..87ca4c7 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -3466,6 +3466,7 @@ public final class Launcher extends Activity cling.init(this, positionData); cling.setVisibility(View.VISIBLE); cling.setLayerType(View.LAYER_TYPE_HARDWARE, null); + cling.requestAccessibilityFocus(); if (animate) { cling.buildLayer(); cling.setAlpha(0f); |