Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +40 −7 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class BubbleBarViewController { private TaskbarInsetsController mTaskbarInsetsController; private View.OnClickListener mBubbleClickListener; private View.OnClickListener mBubbleBarClickListener; private BubbleView.Controller mBubbleViewController; // These are exposed to {@link BubbleStashController} to animate for stashing/un-stashing private final MultiValueAlpha mBubbleBarAlpha; Loading Loading @@ -153,6 +154,31 @@ public class BubbleBarViewController { mBubbleBarController.updateBubbleBarLocation(location); } }); mBubbleViewController = new BubbleView.Controller() { @Override public BubbleBarLocation getBubbleBarLocation() { return BubbleBarViewController.this.getBubbleBarLocation(); } @Override public void dismiss(BubbleView bubble) { if (bubble.getBubble() != null) { notifySysUiBubbleDismissed(bubble.getBubble()); } onBubbleDismissed(bubble); } @Override public void collapse() { collapseBubbleBar(); } @Override public void updateBubbleBarLocation(BubbleBarLocation location) { mBubbleBarController.updateBubbleBarLocation(location); } }; } private void onBubbleClicked(BubbleView bubbleView) { Loading @@ -165,8 +191,7 @@ public class BubbleBarViewController { final String currentlySelected = mBubbleBarController.getSelectedBubbleKey(); if (mBarView.isExpanded() && Objects.equals(bubble.getKey(), currentlySelected)) { // Tapping the currently selected bubble while expanded collapses the view. setExpanded(false); mBubbleStashController.stashBubbleBar(); collapseBubbleBar(); } else { mBubbleBarController.showAndSelectBubble(bubble); } Loading Loading @@ -196,6 +221,11 @@ public class BubbleBarViewController { } } private void collapseBubbleBar() { setExpanded(false); mBubbleStashController.stashBubbleBar(); } /** Notifies that the stash state is changing. */ public void onStashStateChanging() { if (isAnimatingNewBubble()) { Loading Loading @@ -440,6 +470,7 @@ public class BubbleBarViewController { public void removeBubble(BubbleBarBubble b) { if (b != null) { mBarView.removeBubble(b.getView()); b.getView().setController(null); } else { Log.w(TAG, "removeBubble, bubble was null!"); } Loading @@ -450,6 +481,8 @@ public class BubbleBarViewController { BubbleBarBubble removedBubble, boolean isExpanding, boolean suppressAnimation) { mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), removedBubble.getView()); addedBubble.getView().setOnClickListener(mBubbleClickListener); addedBubble.getView().setController(mBubbleViewController); removedBubble.getView().setController(null); mBubbleDragController.setupBubbleView(addedBubble.getView()); if (!suppressAnimation) { animateBubbleNotification(addedBubble, isExpanding, /* isUpdate= */ false); Loading @@ -464,6 +497,7 @@ public class BubbleBarViewController { mBarView.addBubble(b.getView()); b.getView().setOnClickListener(mBubbleClickListener); mBubbleDragController.setupBubbleView(b.getView()); b.getView().setController(mBubbleViewController); if (b instanceof BubbleBarOverflow) { return; Loading Loading @@ -580,8 +614,8 @@ public class BubbleBarViewController { mSystemUiProxy.stopBubbleDrag(location, mBarView.getRestingTopPositionOnScreen()); } /** Notifies {@link BubbleBarView} that the dragged bubble was dismissed. */ public void onBubbleDragDismissed(BubbleView bubble) { /** Handle given bubble being dismissed */ public void onBubbleDismissed(BubbleView bubble) { mBubbleBarController.onBubbleDismissed(bubble); mBarView.removeBubble(bubble); } Loading Loading @@ -624,10 +658,9 @@ public class BubbleBarViewController { } /** * Called when given bubble was dismissed. Notifies SystemUI * @param bubble dismissed bubble item * Notify SystemUI that the given bubble has been dismissed. */ public void onDismissBubble(@NonNull BubbleBarItem bubble) { public void notifySysUiBubbleDismissed(@NonNull BubbleBarItem bubble) { mSystemUiProxy.dragBubbleToDismiss(bubble.getKey(), mTimeSource.currentTimeMillis()); } Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java +1 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ public class BubbleDismissController { if (mMagnetizedObject.getUnderlyingObject() instanceof BubbleView) { BubbleView bubbleView = (BubbleView) mMagnetizedObject.getUnderlyingObject(); if (bubbleView.getBubble() != null) { mBubbleBarViewController.onDismissBubble(bubbleView.getBubble()); mBubbleBarViewController.notifySysUiBubbleDismissed(bubbleView.getBubble()); } } else if (mMagnetizedObject.getUnderlyingObject() instanceof BubbleBarView) { mBubbleBarViewController.onDismissAllBubbles(); Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ public class BubbleDragController { @Override protected void onDragDismiss() { mBubblePinController.onDragEnd(); mBubbleBarViewController.onBubbleDragDismissed(bubbleView); mBubbleBarViewController.onBubbleDismissed(bubbleView); mBubbleBarViewController.onBubbleDragEnd(); } Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java +73 −0 Original line number Diff line number Diff line Loading @@ -23,11 +23,13 @@ import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Path; import android.graphics.Rect; import android.os.Bundle; import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewOutlineProvider; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ImageView; import androidx.constraintlayout.widget.ConstraintLayout; Loading @@ -36,6 +38,7 @@ import com.android.launcher3.R; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconNormalizer; import com.android.wm.shell.animation.Interpolators; import com.android.wm.shell.common.bubbles.BubbleBarLocation; import com.android.wm.shell.common.bubbles.BubbleInfo; // TODO: (b/276978250) This is will be similar to WMShell's BadgedImageView, it'd be nice to share. Loading Loading @@ -73,6 +76,9 @@ public class BubbleView extends ConstraintLayout { private BubbleBarItem mBubble; @Nullable private Controller mController; public BubbleView(Context context) { this(context, null); } Loading Loading @@ -180,6 +186,58 @@ public class BubbleView extends ConstraintLayout { mDotRenderer.draw(canvas, mDrawParams); } @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); info.addAction(AccessibilityNodeInfo.ACTION_COLLAPSE); if (mBubble instanceof BubbleBarBubble) { info.addAction(AccessibilityNodeInfo.ACTION_DISMISS); } if (mController != null) { if (mController.getBubbleBarLocation().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, Bundle arguments) { if (super.performAccessibilityActionInternal(action, arguments)) { return true; } if (action == AccessibilityNodeInfo.ACTION_COLLAPSE) { if (mController != null) { mController.collapse(); } return true; } if (action == AccessibilityNodeInfo.ACTION_DISMISS) { if (mController != null) { mController.dismiss(this); } return true; } if (action == R.id.action_move_left) { if (mController != null) { mController.updateBubbleBarLocation(BubbleBarLocation.LEFT); } } if (action == R.id.action_move_right) { if (mController != null) { mController.updateBubbleBarLocation(BubbleBarLocation.RIGHT); } } return false; } void setController(@Nullable Controller controller) { mController = controller; } /** Sets the bubble being rendered in this view. */ public void setBubble(BubbleBarBubble bubble) { mBubble = bubble; Loading Loading @@ -337,4 +395,19 @@ public class BubbleView extends ConstraintLayout { String toString = mBubble != null ? mBubble.getKey() : "null"; return "BubbleView{" + toString + "}"; } /** Interface for BubbleView to communicate with its controller */ public interface Controller { /** Get current bubble bar {@link BubbleBarLocation} */ BubbleBarLocation getBubbleBarLocation(); /** This bubble should be dismissed */ void dismiss(BubbleView bubble); /** Collapse the bubble bar */ void collapse(); /** Request bubble bar location to be updated to the given location */ void updateBubbleBarLocation(BubbleBarLocation location); } } Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +40 −7 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ public class BubbleBarViewController { private TaskbarInsetsController mTaskbarInsetsController; private View.OnClickListener mBubbleClickListener; private View.OnClickListener mBubbleBarClickListener; private BubbleView.Controller mBubbleViewController; // These are exposed to {@link BubbleStashController} to animate for stashing/un-stashing private final MultiValueAlpha mBubbleBarAlpha; Loading Loading @@ -153,6 +154,31 @@ public class BubbleBarViewController { mBubbleBarController.updateBubbleBarLocation(location); } }); mBubbleViewController = new BubbleView.Controller() { @Override public BubbleBarLocation getBubbleBarLocation() { return BubbleBarViewController.this.getBubbleBarLocation(); } @Override public void dismiss(BubbleView bubble) { if (bubble.getBubble() != null) { notifySysUiBubbleDismissed(bubble.getBubble()); } onBubbleDismissed(bubble); } @Override public void collapse() { collapseBubbleBar(); } @Override public void updateBubbleBarLocation(BubbleBarLocation location) { mBubbleBarController.updateBubbleBarLocation(location); } }; } private void onBubbleClicked(BubbleView bubbleView) { Loading @@ -165,8 +191,7 @@ public class BubbleBarViewController { final String currentlySelected = mBubbleBarController.getSelectedBubbleKey(); if (mBarView.isExpanded() && Objects.equals(bubble.getKey(), currentlySelected)) { // Tapping the currently selected bubble while expanded collapses the view. setExpanded(false); mBubbleStashController.stashBubbleBar(); collapseBubbleBar(); } else { mBubbleBarController.showAndSelectBubble(bubble); } Loading Loading @@ -196,6 +221,11 @@ public class BubbleBarViewController { } } private void collapseBubbleBar() { setExpanded(false); mBubbleStashController.stashBubbleBar(); } /** Notifies that the stash state is changing. */ public void onStashStateChanging() { if (isAnimatingNewBubble()) { Loading Loading @@ -440,6 +470,7 @@ public class BubbleBarViewController { public void removeBubble(BubbleBarBubble b) { if (b != null) { mBarView.removeBubble(b.getView()); b.getView().setController(null); } else { Log.w(TAG, "removeBubble, bubble was null!"); } Loading @@ -450,6 +481,8 @@ public class BubbleBarViewController { BubbleBarBubble removedBubble, boolean isExpanding, boolean suppressAnimation) { mBarView.addBubbleAndRemoveBubble(addedBubble.getView(), removedBubble.getView()); addedBubble.getView().setOnClickListener(mBubbleClickListener); addedBubble.getView().setController(mBubbleViewController); removedBubble.getView().setController(null); mBubbleDragController.setupBubbleView(addedBubble.getView()); if (!suppressAnimation) { animateBubbleNotification(addedBubble, isExpanding, /* isUpdate= */ false); Loading @@ -464,6 +497,7 @@ public class BubbleBarViewController { mBarView.addBubble(b.getView()); b.getView().setOnClickListener(mBubbleClickListener); mBubbleDragController.setupBubbleView(b.getView()); b.getView().setController(mBubbleViewController); if (b instanceof BubbleBarOverflow) { return; Loading Loading @@ -580,8 +614,8 @@ public class BubbleBarViewController { mSystemUiProxy.stopBubbleDrag(location, mBarView.getRestingTopPositionOnScreen()); } /** Notifies {@link BubbleBarView} that the dragged bubble was dismissed. */ public void onBubbleDragDismissed(BubbleView bubble) { /** Handle given bubble being dismissed */ public void onBubbleDismissed(BubbleView bubble) { mBubbleBarController.onBubbleDismissed(bubble); mBarView.removeBubble(bubble); } Loading Loading @@ -624,10 +658,9 @@ public class BubbleBarViewController { } /** * Called when given bubble was dismissed. Notifies SystemUI * @param bubble dismissed bubble item * Notify SystemUI that the given bubble has been dismissed. */ public void onDismissBubble(@NonNull BubbleBarItem bubble) { public void notifySysUiBubbleDismissed(@NonNull BubbleBarItem bubble) { mSystemUiProxy.dragBubbleToDismiss(bubble.getKey(), mTimeSource.currentTimeMillis()); } Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissController.java +1 −1 Original line number Diff line number Diff line Loading @@ -143,7 +143,7 @@ public class BubbleDismissController { if (mMagnetizedObject.getUnderlyingObject() instanceof BubbleView) { BubbleView bubbleView = (BubbleView) mMagnetizedObject.getUnderlyingObject(); if (bubbleView.getBubble() != null) { mBubbleBarViewController.onDismissBubble(bubbleView.getBubble()); mBubbleBarViewController.notifySysUiBubbleDismissed(bubbleView.getBubble()); } } else if (mMagnetizedObject.getUnderlyingObject() instanceof BubbleBarView) { mBubbleBarViewController.onDismissAllBubbles(); Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ public class BubbleDragController { @Override protected void onDragDismiss() { mBubblePinController.onDragEnd(); mBubbleBarViewController.onBubbleDragDismissed(bubbleView); mBubbleBarViewController.onBubbleDismissed(bubbleView); mBubbleBarViewController.onBubbleDragEnd(); } Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleView.java +73 −0 Original line number Diff line number Diff line Loading @@ -23,11 +23,13 @@ import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Path; import android.graphics.Rect; import android.os.Bundle; import android.text.TextUtils; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewOutlineProvider; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ImageView; import androidx.constraintlayout.widget.ConstraintLayout; Loading @@ -36,6 +38,7 @@ import com.android.launcher3.R; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconNormalizer; import com.android.wm.shell.animation.Interpolators; import com.android.wm.shell.common.bubbles.BubbleBarLocation; import com.android.wm.shell.common.bubbles.BubbleInfo; // TODO: (b/276978250) This is will be similar to WMShell's BadgedImageView, it'd be nice to share. Loading Loading @@ -73,6 +76,9 @@ public class BubbleView extends ConstraintLayout { private BubbleBarItem mBubble; @Nullable private Controller mController; public BubbleView(Context context) { this(context, null); } Loading Loading @@ -180,6 +186,58 @@ public class BubbleView extends ConstraintLayout { mDotRenderer.draw(canvas, mDrawParams); } @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); info.addAction(AccessibilityNodeInfo.ACTION_COLLAPSE); if (mBubble instanceof BubbleBarBubble) { info.addAction(AccessibilityNodeInfo.ACTION_DISMISS); } if (mController != null) { if (mController.getBubbleBarLocation().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, Bundle arguments) { if (super.performAccessibilityActionInternal(action, arguments)) { return true; } if (action == AccessibilityNodeInfo.ACTION_COLLAPSE) { if (mController != null) { mController.collapse(); } return true; } if (action == AccessibilityNodeInfo.ACTION_DISMISS) { if (mController != null) { mController.dismiss(this); } return true; } if (action == R.id.action_move_left) { if (mController != null) { mController.updateBubbleBarLocation(BubbleBarLocation.LEFT); } } if (action == R.id.action_move_right) { if (mController != null) { mController.updateBubbleBarLocation(BubbleBarLocation.RIGHT); } } return false; } void setController(@Nullable Controller controller) { mController = controller; } /** Sets the bubble being rendered in this view. */ public void setBubble(BubbleBarBubble bubble) { mBubble = bubble; Loading Loading @@ -337,4 +395,19 @@ public class BubbleView extends ConstraintLayout { String toString = mBubble != null ? mBubble.getKey() : "null"; return "BubbleView{" + toString + "}"; } /** Interface for BubbleView to communicate with its controller */ public interface Controller { /** Get current bubble bar {@link BubbleBarLocation} */ BubbleBarLocation getBubbleBarLocation(); /** This bubble should be dismissed */ void dismiss(BubbleView bubble); /** Collapse the bubble bar */ void collapse(); /** Request bubble bar location to be updated to the given location */ void updateBubbleBarLocation(BubbleBarLocation location); } }