Merge "Adding accessibility scroll support to PagedView." into jb-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a2e7f8a848
@@ -279,6 +279,11 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
|
|||||||
mWidgetPreviewIconPaddedDimension =
|
mWidgetPreviewIconPaddedDimension =
|
||||||
(int) (mAppIconSize * (1 + (2 * sWidgetPreviewIconPaddingPercentage)));
|
(int) (mAppIconSize * (1 + (2 * sWidgetPreviewIconPaddingPercentage)));
|
||||||
mFadeInAdjacentScreens = false;
|
mFadeInAdjacentScreens = false;
|
||||||
|
|
||||||
|
// Unless otherwise specified this view is important for accessibility.
|
||||||
|
if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
|
||||||
|
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import android.content.Context;
|
|||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -1854,7 +1855,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
@Override
|
@Override
|
||||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||||
super.onInitializeAccessibilityNodeInfo(info);
|
super.onInitializeAccessibilityNodeInfo(info);
|
||||||
info.setScrollable(true);
|
info.setScrollable(getPageCount() > 1);
|
||||||
|
if (getCurrentPage() < getPageCount() - 1) {
|
||||||
|
info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_FORWARD);
|
||||||
|
}
|
||||||
|
if (getCurrentPage() > 0) {
|
||||||
|
info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1868,6 +1875,28 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean performAccessibilityAction(int action, Bundle arguments) {
|
||||||
|
if (super.performAccessibilityAction(action, arguments)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
switch (action) {
|
||||||
|
case AccessibilityNodeInfo.ACTION_SCROLL_FORWARD: {
|
||||||
|
if (getCurrentPage() < getPageCount() - 1) {
|
||||||
|
scrollRight();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
case AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD: {
|
||||||
|
if (getCurrentPage() > 0) {
|
||||||
|
scrollLeft();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected String getCurrentPageDescription() {
|
protected String getCurrentPageDescription() {
|
||||||
return String.format(getContext().getString(R.string.default_scroll_format),
|
return String.format(getContext().getString(R.string.default_scroll_format),
|
||||||
getNextPage() + 1, getChildCount());
|
getNextPage() + 1, getChildCount());
|
||||||
|
|||||||
@@ -342,6 +342,11 @@ public class Workspace extends SmoothPagedView
|
|||||||
|
|
||||||
// Disable multitouch across the workspace/all apps/customize tray
|
// Disable multitouch across the workspace/all apps/customize tray
|
||||||
setMotionEventSplittingEnabled(true);
|
setMotionEventSplittingEnabled(true);
|
||||||
|
|
||||||
|
// Unless otherwise specified this view is important for accessibility.
|
||||||
|
if (getImportantForAccessibility() == View.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
|
||||||
|
setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each
|
// estimate the size of a widget with spans hSpan, vSpan. return MAX_VALUE for each
|
||||||
|
|||||||
Reference in New Issue
Block a user