Merge "Bubble bar dismiss" into udc-qpr-dev

This commit is contained in:
Ivan Tkachenko
2023-07-31 17:54:17 +00:00
committed by Android (Google) Code Review
5 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<stroke
android:width="2dp"
android:color="@android:color/system_accent1_600" />
<solid android:color="@android:color/system_accent1_600" />
</shape>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:pathData="M19.000000,6.400000l-1.400000,-1.400000 -5.600000,5.600000 -5.600000,-5.600000 -1.400000,1.400000 5.600000,5.600000 -5.600000,5.600000 1.400000,1.400000 5.600000,-5.600000 5.600000,5.600000 1.400000,-1.400000 -5.600000,-5.600000z"
android:fillColor="@android:color/system_neutral1_50"/>
</vector>

View File

@@ -371,6 +371,13 @@
<dimen name="bubblebar_icon_spacing">3dp</dimen>
<dimen name="bubblebar_icon_elevation">1dp</dimen>
<!-- Bubble bar dismiss view -->
<dimen name="bubblebar_dismiss_target_size">96dp</dimen>
<dimen name="bubblebar_dismiss_target_small_size">60dp</dimen>
<dimen name="bubblebar_dismiss_target_icon_size">24dp</dimen>
<dimen name="bubblebar_dismiss_target_bottom_margin">50dp</dimen>
<dimen name="bubblebar_dismiss_floating_gradient_height">548dp</dimen>
<!-- Launcher splash screen -->
<!-- Note: keep this value in sync with the WindowManager/Shell dimens.xml -->
<!-- starting_surface_exit_animation_window_shift_length -->

View File

@@ -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
)
)
}

View File

@@ -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
//