diff --git a/quickstep/res/values/ids.xml b/quickstep/res/values/ids.xml new file mode 100644 index 0000000000..3091d9e930 --- /dev/null +++ b/quickstep/res/values/ids.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml index 340d25b0f9..98a27839d2 100644 --- a/quickstep/res/values/strings.xml +++ b/quickstep/res/values/strings.xml @@ -342,4 +342,10 @@ %1$s from %2$s %1$s and %2$d more + + Move left + + Move right + + Dismiss all diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java index 4794dfd8db..9df0576cd5 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java @@ -30,6 +30,7 @@ import android.annotation.SuppressLint; import android.content.Context; import android.graphics.PointF; import android.graphics.Rect; +import android.os.Bundle; import android.util.AttributeSet; import android.util.FloatProperty; import android.util.LayoutDirection; @@ -38,6 +39,7 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.FrameLayout; import androidx.dynamicanimation.animation.SpringForce; @@ -367,6 +369,47 @@ public class BubbleBarView extends FrameLayout { } } + @Override + public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfoInternal(info); + // Always show only expand action as the menu is only for collapsed bubble bar + info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND); + info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.action_dismiss_all, + getResources().getString(R.string.bubble_bar_action_dismiss_all))); + if (mBubbleBarLocation.isOnLeft(isLayoutRtl())) { + info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.action_move_right, + getResources().getString(R.string.bubble_bar_action_move_right))); + } else { + info.addAction(new AccessibilityNodeInfo.AccessibilityAction(R.id.action_move_left, + getResources().getString(R.string.bubble_bar_action_move_left))); + } + } + + @Override + public boolean performAccessibilityActionInternal(int action, + @androidx.annotation.Nullable Bundle arguments) { + if (super.performAccessibilityActionInternal(action, arguments)) { + return true; + } + if (action == AccessibilityNodeInfo.ACTION_EXPAND) { + mController.expandBubbleBar(); + return true; + } + if (action == R.id.action_dismiss_all) { + mController.dismissBubbleBar(); + return true; + } + if (action == R.id.action_move_left) { + mController.updateBubbleBarLocation(BubbleBarLocation.LEFT); + return true; + } + if (action == R.id.action_move_right) { + mController.updateBubbleBarLocation(BubbleBarLocation.RIGHT); + return true; + } + return false; + } + @SuppressLint("RtlHardcoded") private void onBubbleBarLocationChanged() { final boolean onLeft = mBubbleBarLocation.isOnLeft(isLayoutRtl()); @@ -1382,5 +1425,14 @@ public class BubbleBarView extends FrameLayout { /** Notifies the controller that the bubble bar was touched while it was animating. */ void onBubbleBarTouchedWhileAnimating(); + + /** Requests the controller to expand bubble bar */ + void expandBubbleBar(); + + /** Requests the controller to dismiss the bubble bar */ + void dismissBubbleBar(); + + /** Requests the controller to update bubble bar location to the given value */ + void updateBubbleBarLocation(BubbleBarLocation location); } } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 2311d42e16..74a673b066 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -117,7 +117,7 @@ public class BubbleBarViewController { dp -> onBubbleBarConfigurationChanged(/* animate= */ true)); mBubbleBarScale.updateValue(1f); mBubbleClickListener = v -> onBubbleClicked((BubbleView) v); - mBubbleBarClickListener = v -> onBubbleBarClicked(); + mBubbleBarClickListener = v -> expandBubbleBar(); mBubbleDragController.setupBubbleBarView(mBarView); mBarView.setOnClickListener(mBubbleBarClickListener); mBarView.addOnLayoutChangeListener( @@ -137,6 +137,21 @@ public class BubbleBarViewController { public void onBubbleBarTouchedWhileAnimating() { BubbleBarViewController.this.onBubbleBarTouchedWhileAnimating(); } + + @Override + public void expandBubbleBar() { + BubbleBarViewController.this.expandBubbleBar(); + } + + @Override + public void dismissBubbleBar() { + onDismissAllBubbles(); + } + + @Override + public void updateBubbleBarLocation(BubbleBarLocation location) { + mBubbleBarController.updateBubbleBarLocation(location); + } }); } @@ -162,7 +177,7 @@ public class BubbleBarViewController { mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY()); } - private void onBubbleBarClicked() { + private void expandBubbleBar() { if (mShouldShowEducation) { mShouldShowEducation = false; // Get the bubble bar bounds on screen @@ -609,17 +624,17 @@ public class BubbleBarViewController { } /** - * Called when bubble was dragged into the dismiss target. Notifies System + * Called when given bubble was dismissed. Notifies SystemUI * @param bubble dismissed bubble item */ - public void onDismissBubbleWhileDragging(@NonNull BubbleBarItem bubble) { + public void onDismissBubble(@NonNull BubbleBarItem bubble) { mSystemUiProxy.dragBubbleToDismiss(bubble.getKey(), mTimeSource.currentTimeMillis()); } /** - * Called when bubble stack was dragged into the dismiss target + * Called when bubble stack was dismissed */ - public void onDismissAllBubblesWhileDragging() { + public void onDismissAllBubbles() { mSystemUiProxy.removeAllBubbles(); } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java index a6096e229c..6a63da890e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java @@ -143,10 +143,10 @@ public class BubbleDismissController { if (mMagnetizedObject.getUnderlyingObject() instanceof BubbleView) { BubbleView bubbleView = (BubbleView) mMagnetizedObject.getUnderlyingObject(); if (bubbleView.getBubble() != null) { - mBubbleBarViewController.onDismissBubbleWhileDragging(bubbleView.getBubble()); + mBubbleBarViewController.onDismissBubble(bubbleView.getBubble()); } } else if (mMagnetizedObject.getUnderlyingObject() instanceof BubbleBarView) { - mBubbleBarViewController.onDismissAllBubblesWhileDragging(); + mBubbleBarViewController.onDismissAllBubbles(); } }