diff options
3 files changed, 27 insertions, 3 deletions
diff --git a/packages/Keyguard/res/values/strings.xml b/packages/Keyguard/res/values/strings.xml index ba6685a..89e7240 100644 --- a/packages/Keyguard/res/values/strings.xml +++ b/packages/Keyguard/res/values/strings.xml @@ -157,6 +157,12 @@ <!-- Accessibility description for when the bouncer prompt is dismissed. [CHAR LIMIT=NONE] --> <string name="keyguard_accessibility_hide_bouncer">Launch canceled</string> + <!-- Accessibility description announced when user drags widget over the delete drop target [CHAR LIMIT=NONE] --> + <string name="keyguard_accessibility_delete_widget_start">Drop <xliff:g id="widget_index">%1$s</xliff:g> to delete.</string> + + <!-- Accessibility description announced when user drags widget away from delete drop target [CHAR LIMIT=NONE] --> + <string name="keyguard_accessibility_delete_widget_end"><xliff:g id="widget_index">%1$s</xliff:g> will not be deleted.</string> + <!-- Password keyboard strings. Used by LockScreen and Settings --><skip /> <!-- Label for "switch to symbols" key. Must be short to fit on key! --> <string name="password_keyboard_label_symbol_key">\?123</string> diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java index 81f6221..c0586d5 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardWidgetFrame.java @@ -147,6 +147,10 @@ public class KeyguardWidgetFrame extends FrameLayout { if (ENABLE_HOVER_OVER_DELETE_DROP_TARGET_OVERLAY) { if (mIsHoveringOverDeleteDropTarget != isHovering) { mIsHoveringOverDeleteDropTarget = isHovering; + int resId = isHovering ? R.string.keyguard_accessibility_delete_widget_start + : R.string.keyguard_accessibility_delete_widget_end; + String text = getContext().getResources().getString(resId, getContentDescription()); + announceForAccessibility(text); invalidate(); } } @@ -326,7 +330,7 @@ public class KeyguardWidgetFrame extends FrameLayout { /** * Depending on whether the security is up, the widget size needs to change - * + * * @param height The height of the widget, -1 for full height */ private void setWidgetHeight(int height) { diff --git a/packages/Keyguard/src/com/android/keyguard/PagedView.java b/packages/Keyguard/src/com/android/keyguard/PagedView.java index b6279d0..666227c 100644 --- a/packages/Keyguard/src/com/android/keyguard/PagedView.java +++ b/packages/Keyguard/src/com/android/keyguard/PagedView.java @@ -125,6 +125,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc private int[] mChildOffsets; private int[] mChildRelativeOffsets; private int[] mChildOffsetsWithLayoutScale; + private String mDeleteString; // Accessibility announcement when widget is deleted protected final static int TOUCH_STATE_REST = 0; protected final static int TOUCH_STATE_SCROLLING = 1; @@ -1118,6 +1119,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc // i.e. fall through to the next case (don't break) // (We sometimes miss ACTION_DOWN events in Workspace because it ignores all events // while it's small- this was causing a crash before we checked for INVALID_POINTER) + + break; } case MotionEvent.ACTION_DOWN: { @@ -2194,8 +2197,13 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc protected void onEndReordering() { if (AccessibilityManager.getInstance(mContext).isEnabled()) { - announceForAccessibility(mContext.getString( - R.string.keyguard_accessibility_widget_reorder_end)); + if (mDeleteString != null) { + announceForAccessibility(mDeleteString); + mDeleteString = null; + } else { + announceForAccessibility(mContext.getString( + R.string.keyguard_accessibility_widget_reorder_end)); + } } mIsReordering = false; @@ -2507,6 +2515,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc AnimatorUpdateListener updateCb = new FlingAlongVectorAnimatorUpdateListener(dragView, vel, from, startTime, FLING_TO_DELETE_FRICTION); + mDeleteString = getContext().getResources() + .getString(R.string.keyguard_accessibility_widget_deleted, + mDragView.getContentDescription()); final Runnable onAnimationEndRunnable = createPostDeleteAnimationRunnable(dragView); // Create and start the animation @@ -2562,6 +2573,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc ObjectAnimator.ofFloat(dragView, "alpha", toAlpha)); animations.add(alphaAnim); + mDeleteString = getContext().getResources() + .getString(R.string.keyguard_accessibility_widget_deleted, + mDragView.getContentDescription()); final Runnable onAnimationEndRunnable = createPostDeleteAnimationRunnable(dragView); AnimatorSet anim = new AnimatorSet(); |