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

Commit 5b650d07 authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Update expanded view drop target size based on value from shell" into main

parents 8b0469b0 f3224cf8
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -13,8 +13,10 @@
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
<inset xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:inset="@dimen/bubble_expanded_view_drop_target_padding">
    <shape
        android:shape="rectangle">
        <corners android:radius="@dimen/bubble_expanded_view_drop_target_corner_radius" />
        <solid android:color="@color/bubblebar_drop_target_bg_color" />
@@ -22,3 +24,4 @@
            android:width="1dp"
            android:color="?androidprv:attr/materialColorPrimaryContainer" />
    </shape>
</inset>
+2 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@

<!-- TODO(b/330585402): replace 600dp height with calculated value -->
<View xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="@dimen/bubble_expanded_view_drop_target_width"
    android:layout_height="600dp"
    android:layout_width="@dimen/bubble_expanded_view_drop_target_default_width"
    android:layout_height="@dimen/bubble_expanded_view_drop_target_default_height"
    android:layout_margin="@dimen/bubble_expanded_view_drop_target_margin"
    android:background="@drawable/bg_bubble_expanded_view_drop_target"
    android:elevation="@dimen/bubblebar_elevation" />
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -456,8 +456,10 @@

    <!-- Bubble bar drop target -->
    <dimen name="bubblebar_drop_target_corner_radius">36dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_corner_radius">16dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_width">412dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_default_width">412dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_default_height">600dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_corner_radius">28dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_padding">24dp</dimen>
    <dimen name="bubble_expanded_view_drop_target_margin">16dp</dimen>

    <!-- Launcher splash screen -->
+7 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
    private BubbleBarViewController mBubbleBarViewController;
    private BubbleStashController mBubbleStashController;
    private BubbleStashedHandleViewController mBubbleStashedHandleViewController;
    private BubblePinController mBubblePinController;

    // Keep track of bubble bar bounds sent to shell to avoid sending duplicate updates
    private final Rect mLastSentBubbleBarBounds = new Rect();
@@ -169,6 +170,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
        BubbleBarLocation bubbleBarLocation;
        List<RemovedBubble> removedBubbles;
        List<String> bubbleKeysInOrder;
        Point expandedViewDropTargetSize;

        // These need to be loaded in the background
        BubbleBarBubble addedBubble;
@@ -186,6 +188,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
            bubbleBarLocation = update.bubbleBarLocation;
            removedBubbles = update.removedBubbles;
            bubbleKeysInOrder = update.bubbleKeysInOrder;
            expandedViewDropTargetSize = update.expandedViewDropTargetSize;
        }
    }

@@ -216,6 +219,7 @@ public class BubbleBarController extends IBubblesListener.Stub {
        mBubbleBarViewController = bubbleControllers.bubbleBarViewController;
        mBubbleStashController = bubbleControllers.bubbleStashController;
        mBubbleStashedHandleViewController = bubbleControllers.bubbleStashedHandleViewController;
        mBubblePinController = bubbleControllers.bubblePinController;

        bubbleControllers.runAfterInit(() -> {
            mBubbleBarViewController.setHiddenForBubbles(
@@ -419,6 +423,9 @@ public class BubbleBarController extends IBubblesListener.Stub {
                updateBubbleBarLocationInternal(update.bubbleBarLocation);
            }
        }
        if (update.expandedViewDropTargetSize != null) {
            mBubblePinController.setDropTargetSize(update.expandedViewDropTargetSize);
        }
    }

    /** Tells WMShell to show the currently selected bubble. */
+15 −1
Original line number Diff line number Diff line
@@ -37,12 +37,17 @@ class BubblePinController(
    screenSizeProvider: () -> Point
) : BaseBubblePinController(screenSizeProvider) {

    var dropTargetSize: Point? = null

    private lateinit var bubbleBarViewController: BubbleBarViewController
    private lateinit var bubbleStashController: BubbleStashController
    private var exclRectWidth: Float = 0f
    private var exclRectHeight: Float = 0f

    private var dropTargetView: View? = null
    // Fallback width and height in case shell has not sent the size over
    private var dropTargetDefaultWidth: Int = 0
    private var dropTargetDefaultHeight: Int = 0
    private var dropTargetMargin: Int = 0

    fun init(bubbleControllers: BubbleControllers) {
@@ -50,6 +55,14 @@ class BubblePinController(
        bubbleStashController = bubbleControllers.bubbleStashController
        exclRectWidth = context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_width)
        exclRectHeight = context.resources.getDimension(R.dimen.bubblebar_dismiss_zone_height)
        dropTargetDefaultWidth =
            context.resources.getDimensionPixelSize(
                R.dimen.bubble_expanded_view_drop_target_default_width
            )
        dropTargetDefaultHeight =
            context.resources.getDimensionPixelSize(
                R.dimen.bubble_expanded_view_drop_target_default_height
            )
        dropTargetMargin =
            context.resources.getDimensionPixelSize(R.dimen.bubble_expanded_view_drop_target_margin)
    }
@@ -75,7 +88,6 @@ class BubblePinController(
        return LayoutInflater.from(context)
            .inflate(R.layout.bubble_expanded_view_drop_target, container, false)
            .also { view ->
                // TODO(b/330585402): dynamic height for the drop target based on actual height
                dropTargetView = view
                container.addView(view)
            }
@@ -88,6 +100,8 @@ class BubblePinController(
        val bubbleBarBounds = bubbleBarViewController.bubbleBarBounds
        dropTargetView?.updateLayoutParams<FrameLayout.LayoutParams> {
            gravity = BOTTOM or (if (onLeft) LEFT else RIGHT)
            width = dropTargetSize?.x ?: dropTargetDefaultWidth
            height = dropTargetSize?.y ?: dropTargetDefaultHeight
            bottomMargin =
                -bubbleStashController.bubbleBarTranslationY.toInt() +
                    bubbleBarBounds.height() +