summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quickstep/src/com/android/quickstep/views/RecentsView.java21
-rw-r--r--res/values/config.xml1
-rw-r--r--res/values/strings.xml8
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java11
-rw-r--r--src/com/android/launcher3/popup/ArrowPopup.java7
-rw-r--r--src/com/android/launcher3/popup/PopupContainerWithArrow.java13
7 files changed, 23 insertions, 41 deletions
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 5ecee6a60..82a5bdc98 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -327,25 +327,12 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
final int childCount = getChildCount();
if (mShowEmptyMessage || childCount == 0) return 0;
- final View lastChild = getChildAt(childCount - 1);
-
- // Current visible coordinate of the end of the oldest task.
- final int carouselCurrentEnd =
- (mIsRtl ? lastChild.getLeft() : lastChild.getRight()) - getScrollX();
-
- // Visible button-facing end of a centered task.
- final int centeredTaskEnd = mIsRtl ?
- getPaddingLeft() + mInsets.left :
- getWidth() - getPaddingRight() - mInsets.right;
-
- // The distance of the carousel travel during which the alpha changes from 0 to 1. This
- // is the motion between the oldest task in its centered position and the oldest task
- // scrolled to the end.
- final int alphaChangeRange = (mIsRtl ? 0 : mMaxScrollX) - getScrollForPage(childCount - 1);
+ final int scrollEnd = mIsRtl ? 0 : mMaxScrollX;
+ final int oldestChildScroll = getScrollForPage(childCount - 1);
return Utilities.boundToRange(
- ((float) (centeredTaskEnd - carouselCurrentEnd)) /
- alphaChangeRange, 0, 1);
+ ((float) (getScrollX() - oldestChildScroll)) /
+ (scrollEnd - oldestChildScroll), 0, 1);
}
private void updateClearAllButtonAlpha() {
diff --git a/res/values/config.xml b/res/values/config.xml
index 9d1bb4110..6158f29b3 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -139,6 +139,7 @@
<item type="id" name="action_move_screen_forwards" />
<item type="id" name="action_resize" />
<item type="id" name="action_deep_shortcuts" />
+ <item type="id" name="action_shortcuts_and_notifications"/>
<item type="id" name="action_dismiss_notification" />
<!-- QSB IDs. DO not change -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4fbd806ab..5dc784493 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -310,11 +310,9 @@
<!-- Accessibility action to show quick actions menu for an icon. [CHAR_LIMIT=30] -->
<string name="action_deep_shortcut">Shortcuts</string>
-
- <!-- Accessibility description for the shortcuts menu shown for an app. -->
- <string name="shortcuts_menu_description"><xliff:g id="number_of_shortcuts" example="3">%1$d</xliff:g> shortcuts for <xliff:g id="app_name" example="Messenger">%2$s</xliff:g></string>
- <!-- Accessibility description when the shortcuts menu has notifications as well as shortcuts. -->
- <string name="shortcuts_menu_with_notifications_description"><xliff:g id="number_of_shortcuts" example="3">%1$d</xliff:g> shortcuts and <xliff:g id="number_of_notifications" example="3">%2$d</xliff:g> notifications for <xliff:g id="app_name" example="Messenger">%3$s</xliff:g></string>
+ <!-- Accessibility description when the shortcuts menu has notifications as well as shortcuts. [CHAR_LIMIT=50] -->
+ <string name="shortcuts_menu_with_notifications_description">Shortcuts and notifications
+ </string>
<!-- Accessibility action to dismiss a notification in the shortcuts menu for an icon. [CHAR_LIMIT=30] -->
<string name="action_dismiss_notification">Dismiss</string>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 9a9e001c3..d8bb90a71 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -2338,7 +2338,8 @@ public class Launcher extends BaseDraggingActivity
}
if (currentFocus.getTag() instanceof ItemInfo
&& DeepShortcutManager.supportsShortcuts((ItemInfo) currentFocus.getTag())) {
- shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.action_deep_shortcut),
+ shortcutInfos.add(new KeyboardShortcutInfo(
+ getString(R.string.shortcuts_menu_with_notifications_description),
KeyEvent.KEYCODE_S, KeyEvent.META_CTRL_ON));
}
if (!shortcutInfos.isEmpty()) {
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index e1cb4b8dc..81a0e1d5d 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -25,8 +25,6 @@ import com.android.launcher3.DropTarget.DragObject;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
-import com.android.launcher3.touch.ItemLongClickListener;
-import com.android.launcher3.widget.LauncherAppWidgetHostView;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherSettings.Favorites;
@@ -37,9 +35,12 @@ import com.android.launcher3.Workspace;
import com.android.launcher3.dragndrop.DragController.DragListener;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.folder.Folder;
+import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.shortcuts.DeepShortcutManager;
+import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.Thunk;
+import com.android.launcher3.widget.LauncherAppWidgetHostView;
import java.util.ArrayList;
@@ -55,6 +56,7 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
protected static final int MOVE_TO_WORKSPACE = R.id.action_move_to_workspace;
protected static final int RESIZE = R.id.action_resize;
public static final int DEEP_SHORTCUTS = R.id.action_deep_shortcuts;
+ public static final int SHORTCUTS_AND_NOTIFICATIONS = R.id.action_shortcuts_and_notifications;
public enum DragType {
ICON,
@@ -92,6 +94,8 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
launcher.getText(R.string.action_resize)));
mActions.put(DEEP_SHORTCUTS, new AccessibilityAction(DEEP_SHORTCUTS,
launcher.getText(R.string.action_deep_shortcut)));
+ mActions.put(SHORTCUTS_AND_NOTIFICATIONS, new AccessibilityAction(DEEP_SHORTCUTS,
+ launcher.getText(R.string.shortcuts_menu_with_notifications_description)));
}
public void addAccessibilityAction(int action, int actionLabel) {
@@ -111,7 +115,8 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
// If the request came from keyboard, do not add custom shortcuts as that is already
// exposed as a direct shortcut
if (!fromKeyboard && DeepShortcutManager.supportsShortcuts(item)) {
- info.addAction(mActions.get(DEEP_SHORTCUTS));
+ info.addAction(mActions.get(NotificationListener.getInstanceIfConnected() != null
+ ? SHORTCUTS_AND_NOTIFICATIONS : DEEP_SHORTCUTS));
}
for (ButtonDropTarget target : mLauncher.getDropTargetBar().getDropTargets()) {
diff --git a/src/com/android/launcher3/popup/ArrowPopup.java b/src/com/android/launcher3/popup/ArrowPopup.java
index bd08aaa0e..5589f1714 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.
*/
@@ -371,10 +368,6 @@ public abstract class ArrowPopup extends AbstractFloatingView {
@Override
public void onAnimationEnd(Animator animation) {
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..763eb6fb6 100644
--- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java
+++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java
@@ -213,6 +213,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 +262,10 @@ 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(getContext().getString(mNumNotifications == 0 ?
+ R.string.action_deep_shortcut :
+ R.string.shortcuts_menu_with_notifications_description));
}
mLauncher.getDragController().addDragListener(this);