diff options
Diffstat (limited to 'src/com/android/launcher3/popup')
-rw-r--r-- | src/com/android/launcher3/popup/ArrowPopup.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher3/popup/PopupContainerWithArrow.java | 23 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java index bd08aaa0e..90987775b 100644 --- a/src/com/android/launcher3/popup/ArrowPopup.java +++ b/src/com/android/launcher3/popup/ArrowPopup.java @@ -35,7 +35,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewOutlineProvider; -import android.view.accessibility.AccessibilityEvent; import android.view.animation.AccelerateDecelerateInterpolator; import com.android.launcher3.AbstractFloatingView; @@ -52,8 +51,6 @@ import com.android.launcher3.util.Themes; import java.util.ArrayList; import java.util.Collections; -import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; - /** * A container for shortcuts to deep links and notifications associated with an app. */ @@ -370,11 +367,8 @@ public abstract class ArrowPopup extends AbstractFloatingView { openAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { + announceAccessibilityChanges(); mOpenCloseAnimator = null; - sendCustomAccessibilityEvent( - ArrowPopup.this, - AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, - getContext().getString(R.string.action_deep_shortcut)); } }); diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index b522b5513..f276fbfea 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -34,6 +34,7 @@ import android.os.Build; import android.os.Handler; import android.os.Looper; import android.util.AttributeSet; +import android.util.Pair; import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; @@ -213,6 +214,7 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, } } + @TargetApi(Build.VERSION_CODES.P) private void populateAndShow(final BubbleTextView originalIcon, final List<String> shortcutIds, final List<NotificationKeyData> notificationKeys, List<SystemShortcut> systemShortcuts) { mNumNotifications = notificationKeys.size(); @@ -261,14 +263,8 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, reorderAndShow(viewsToFlip); ItemInfo originalItemInfo = (ItemInfo) originalIcon.getTag(); - int numShortcuts = mShortcuts.size() + systemShortcuts.size(); - if (mNumNotifications == 0) { - setContentDescription(getContext().getString(R.string.shortcuts_menu_description, - numShortcuts, originalIcon.getContentDescription().toString())); - } else { - setContentDescription(getContext().getString( - R.string.shortcuts_menu_with_notifications_description, numShortcuts, - mNumNotifications, originalIcon.getContentDescription().toString())); + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + setAccessibilityPaneTitle(getTitleForAccessibility()); } mLauncher.getDragController().addDragListener(this); @@ -284,6 +280,17 @@ public class PopupContainerWithArrow extends ArrowPopup implements DragSource, this, shortcutIds, mShortcuts, notificationKeys)); } + private String getTitleForAccessibility() { + return getContext().getString(mNumNotifications == 0 ? + R.string.action_deep_shortcut : + R.string.shortcuts_menu_with_notifications_description); + } + + @Override + protected Pair<View, String> getAccessibilityTarget() { + return Pair.create(this, ""); + } + @Override protected void getTargetObjectLocation(Rect outPos) { mLauncher.getDragLayer().getDescendantRectRelativeToSelf(mOriginalIcon, outPos); |