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

Commit fa7f85b5 authored by Mady Mellor's avatar Mady Mellor
Browse files

Introduce BubbleBarExpandedView

* Adds the new BubbleBarExpandedView & basic HandleView classes for
  rendering a bubble's expanded view when bubbles are in the bubble
  bar.

* The HandleView class will eventually render the manage menu
  but this is not implemented yet.

* Adds BubbleBarExpandedView to BubbleViewProvider & Bubble, this will
  be a nullable view that is only inflated when the bubble bar is
  active. The inflation / creation of this view is done in a separate
  CL.

Test: treehugger / manual with other CLs
Bug: 253318833
Change-Id: Iee05e39fc7c06f5210c0adccbe69ba6991e722df
parent 6ffe1437
Loading
Loading
Loading
Loading
+24 −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.
  -->
<com.android.wm.shell.bubbles.bar.BubbleBarExpandedView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:orientation="vertical"
    android:id="@+id/bubble_bar_expanded_view">

</com.android.wm.shell.bubbles.bar.BubbleBarExpandedView>
+2 −0
Original line number Diff line number Diff line
@@ -228,6 +228,8 @@
    <dimen name="bubble_user_education_stack_padding">16dp</dimen>
    <!-- Size of the bubble bar (height), should match transient_taskbar_size in Launcher. -->
    <dimen name="bubblebar_size">72dp</dimen>
    <!-- The size of the drag handle / menu shown along with a bubble bar expanded view. -->
    <dimen name="bubblebar_expanded_view_menu_size">16dp</dimen>

    <!-- Bottom and end margin for compat buttons. -->
    <dimen name="compat_button_margin">24dp</dimen>
+28 −2
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.InstanceId;
import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView;
import com.android.wm.shell.common.bubbles.BubbleInfo;

import java.io.PrintWriter;
@@ -87,8 +88,18 @@ public class Bubble implements BubbleViewProvider {
    private String mAppName;
    private ShortcutInfo mShortcutInfo;
    private String mMetadataShortcutId;

    /**
     * If {@link BubbleController#isShowingAsBubbleBar()} is true, the only view that will be
     * populated will be {@link #mBubbleBarExpandedView}. If it is false, {@link #mIconView}
     * and {@link #mExpandedView} will be populated.
     */
    @Nullable
    private BadgedImageView mIconView;
    @Nullable
    private BubbleExpandedView mExpandedView;
    @Nullable
    private BubbleBarExpandedView mBubbleBarExpandedView;

    private BubbleViewInfoTask mInflationTask;
    private boolean mInflateSynchronously;
@@ -327,12 +338,18 @@ public class Bubble implements BubbleViewProvider {
        return mIconView;
    }

    @Override
    @Nullable
    @Override
    public BubbleExpandedView getExpandedView() {
        return mExpandedView;
    }

    @Nullable
    @Override
    public BubbleBarExpandedView getBubbleBarExpandedView() {
        return mBubbleBarExpandedView;
    }

    @Nullable
    public String getTitle() {
        return mTitle;
@@ -364,6 +381,9 @@ public class Bubble implements BubbleViewProvider {
            mExpandedView.cleanUpExpandedState();
            mExpandedView = null;
        }
        if (mBubbleBarExpandedView != null) {
            mBubbleBarExpandedView.cleanUpExpandedState();
        }
        if (mIntent != null) {
            mIntent.unregisterCancelListener(mIntentCancelListener);
        }
@@ -445,7 +465,7 @@ public class Bubble implements BubbleViewProvider {
    }

    boolean isInflated() {
        return mIconView != null && mExpandedView != null;
        return (mIconView != null && mExpandedView != null) || mBubbleBarExpandedView != null;
    }

    void stopInflation() {
@@ -478,6 +498,9 @@ public class Bubble implements BubbleViewProvider {
        if (mExpandedView != null) {
            mExpandedView.update(this /* bubble */);
        }
        if (mBubbleBarExpandedView != null) {
            mBubbleBarExpandedView.update(this /* bubble */);
        }
        if (mIconView != null) {
            mIconView.setRenderedBubble(this /* bubble */);
        }
@@ -607,6 +630,9 @@ public class Bubble implements BubbleViewProvider {
     */
    @Override
    public int getTaskId() {
        if (mBubbleBarExpandedView != null) {
            return mBubbleBarExpandedView.getTaskId();
        }
        return mExpandedView != null ? mExpandedView.getTaskId() : mTaskId;
    }

+5 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.util.TypedValue
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.android.wm.shell.R
import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView

class BubbleOverflow(
    private val context: Context,
@@ -136,6 +137,10 @@ class BubbleOverflow(
        return expandedView
    }

    override fun getBubbleBarExpandedView(): BubbleBarExpandedView? {
        return null
    }

    override fun getDotColor(): Int {
        return dotColor
    }
+24 −2
Original line number Diff line number Diff line
@@ -22,18 +22,40 @@ import android.view.View;

import androidx.annotation.Nullable;

import com.android.wm.shell.bubbles.bar.BubbleBarExpandedView;

/**
 * Interface to represent actual Bubbles and UI elements that act like bubbles, like BubbleOverflow.
 */
public interface BubbleViewProvider {
    @Nullable BubbleExpandedView getExpandedView();

    /**
     * Returns the icon view used for a bubble (the click target when collapsed). This is populated
     * when bubbles are floating, i.e. when {@link BubbleController#isShowingAsBubbleBar()} is
     * false.
     */
    @Nullable
    View getIconView();

    /**
     * Returns the expanded view used for a bubble. This is populated when bubbles are floating,
     * i.e. when {@link BubbleController#isShowingAsBubbleBar()} is false.
     */
    @Nullable
    BubbleExpandedView getExpandedView();

    /**
     * Returns the expanded view used for a bubble being show in the bubble bar. This is populated
     * when {@link BubbleController#isShowingAsBubbleBar()} is true.
     */
    @Nullable
    BubbleBarExpandedView getBubbleBarExpandedView();

    /**
     * Sets whether the contents of the bubble's TaskView should be visible.
     */
    void setTaskViewVisibility(boolean visible);

    @Nullable View getIconView();

    String getKey();

Loading