diff --git a/quickstep/res/drawable/bg_bubble_dismiss_circle.xml b/quickstep/res/drawable/bg_bubble_dismiss_circle.xml new file mode 100644 index 0000000000..b793eecdf9 --- /dev/null +++ b/quickstep/res/drawable/bg_bubble_dismiss_circle.xml @@ -0,0 +1,27 @@ + + + + + + + + + \ No newline at end of file diff --git a/quickstep/res/drawable/ic_bubble_dismiss_white.xml b/quickstep/res/drawable/ic_bubble_dismiss_white.xml new file mode 100644 index 0000000000..b15111b821 --- /dev/null +++ b/quickstep/res/drawable/ic_bubble_dismiss_white.xml @@ -0,0 +1,25 @@ + + + + + diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 88f14786dc..3521d442ce 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -371,6 +371,13 @@ 3dp 1dp + + 96dp + 60dp + 24dp + 50dp + 548dp + diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt new file mode 100644 index 0000000000..4b235a97d2 --- /dev/null +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDismissViewExt.kt @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@file:JvmName("BubbleDismissViewUtils") + +package com.android.launcher3.taskbar.bubbles + +import com.android.launcher3.R +import com.android.wm.shell.common.bubbles.DismissView + +/** + * Dismiss view is shared from WMShell. It requires setup with local resources. + * + * Usage: + * - Kotlin `dismissView.setup()` + * - Java `BubbleDismissViewUtils.setup(dismissView)` + */ +fun DismissView.setup() { + setup( + DismissView.Config( + targetSizeResId = R.dimen.bubblebar_dismiss_target_size, + iconSizeResId = R.dimen.bubblebar_dismiss_target_icon_size, + bottomMarginResId = R.dimen.bubblebar_dismiss_target_bottom_margin, + floatingGradientHeightResId = R.dimen.bubblebar_dismiss_floating_gradient_height, + floatingGradientColorResId = android.R.color.system_neutral1_900, + backgroundResId = R.drawable.bg_bubble_dismiss_circle, + iconResId = R.drawable.ic_bubble_dismiss_white + ) + ) +} diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 60784f5854..c9b7d5ecdd 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -661,6 +661,31 @@ public class SystemUiProxy implements ISystemUiProxy { } } + /** + * Tells SysUI to remove the bubble with the provided key. + * @param key the key of the bubble to show. + */ + public void removeBubble(String key) { + if (mBubbles == null) return; + try { + mBubbles.removeBubble(key); + } catch (RemoteException e) { + Log.w(TAG, "Failed call removeBubble"); + } + } + + /** + * Tells SysUI to remove all bubbles. + */ + public void removeAllBubbles() { + if (mBubbles == null) return; + try { + mBubbles.removeAllBubbles(); + } catch (RemoteException e) { + Log.w(TAG, "Failed call removeAllBubbles"); + } + } + /** * Tells SysUI to collapse the bubbles. */ @@ -674,6 +699,21 @@ public class SystemUiProxy implements ISystemUiProxy { } } + /** + * Tells SysUI when the bubble is being dragged. + * Should be called only when the bubble bar is expanded. + * @param bubbleKey the key of the bubble to collapse/expand + * @param isBeingDragged whether the bubble is being dragged + */ + public void onBubbleDrag(@Nullable String bubbleKey, boolean isBeingDragged) { + if (mBubbles == null) return; + try { + mBubbles.onBubbleDrag(bubbleKey, isBeingDragged); + } catch (RemoteException e) { + Log.w(TAG, "Failed call onBubbleDrag"); + } + } + // // Splitscreen //