mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-18 02:08:20 +00:00
Update expanded view drop target size based on value from shell
When a bubble drag starts, shell sends the current expanded view size over as part of BubbleBarData. Update the size stored in BubblePinController based on latest value. Update drop target visual to match the spec. It should have 24dp insets compared to expanded view and 28dp corner radius. Bug: 330585402 Test: drag bubble in landscape, check that drop target for expanded view matches with what is shown when expanded view is dragged Test: drag bubble in portrait, check that the drop target for expanded view, matches with what is shown when expanded view is dragged Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Change-Id: Ic11c4c5c675107543ba08f24a4138cda422d24c1
This commit is contained in:
@@ -13,12 +13,15 @@
|
||||
~ 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:shape="rectangle">
|
||||
<corners android:radius="@dimen/bubble_expanded_view_drop_target_corner_radius" />
|
||||
<solid android:color="@color/bubblebar_drop_target_bg_color" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="?androidprv:attr/materialColorPrimaryContainer" />
|
||||
</shape>
|
||||
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" />
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="?androidprv:attr/materialColorPrimaryContainer" />
|
||||
</shape>
|
||||
</inset>
|
||||
|
||||
@@ -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" />
|
||||
@@ -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 -->
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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() +
|
||||
|
||||
Reference in New Issue
Block a user