Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18373d2a authored by Ivan Tkachenko's avatar Ivan Tkachenko
Browse files

Bubble bar dismiss

* Added WMShell related proxy methods.
* Added DismissView dimensions and drawable resources.
* Added DismissView extension file to set it up with dimen and drawable resource ids.

Bug: 271466616
Test: manual, TBD
Flag: WM_BUBBLE_BAR
Change-Id: Iddac977a9c8a63facee45e9dd2eb234bb18d030b
parent 163633a9
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+25 −0
Original line number Diff line number Diff line
<?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>
+7 −0
Original line number Diff line number Diff line
@@ -369,6 +369,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 -->
+42 −0
Original line number Diff line number Diff line
/*
 * 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
        )
    )
}
+40 −0
Original line number Diff line number Diff line
@@ -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
    //