From 29e277d1053deada7c9edcdc84d94672cb720254 Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Thu, 30 Apr 2020 13:57:26 -0400 Subject: Controls UI - Detail panel redlines Adjust to latest spec. Add flag in intent to inform calling activity that it will be shown in a bottomsheet. Bug: 154698537 Test: manual, long press on controls Change-Id: Ic081d670b146232b038d433b33b71f1b9a1a96c1 --- packages/SystemUI/res/layout/controls_detail_dialog.xml | 7 ++----- packages/SystemUI/res/values/dimens.xml | 3 +-- .../src/com/android/systemui/controls/ui/DetailDialog.kt | 14 +++++++++++++- 3 files changed, 16 insertions(+), 8 deletions(-) (limited to 'packages/SystemUI') diff --git a/packages/SystemUI/res/layout/controls_detail_dialog.xml b/packages/SystemUI/res/layout/controls_detail_dialog.xml index d1ce10e5745f..d61122fd47dd 100644 --- a/packages/SystemUI/res/layout/controls_detail_dialog.xml +++ b/packages/SystemUI/res/layout/controls_detail_dialog.xml @@ -26,7 +26,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" - android:layout_marginBottom="10dp"> + android:layout_marginBottom="4dp"> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 48648e547a84..f9c7c6bd7c1e 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1268,10 +1268,9 @@ 40% - 25dp - 12dp 100dp 17sp + @*android:dimen/config_bottomDialogCornerRadius 48dp diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt index 65ed9678c63e..236fa2d29aca 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt @@ -28,6 +28,7 @@ import android.view.WindowInsets.Type import android.view.WindowManager import android.widget.ImageView +import com.android.internal.policy.ScreenDecorationsUtils import com.android.systemui.R /** @@ -41,8 +42,12 @@ class DetailDialog( ) : Dialog(cvh.context, R.style.Theme_SystemUI_Dialog_Control_DetailPanel) { companion object { - private const val ALPHA = (0.8f * 255).toInt() private const val PANEL_TOP_OFFSET = "systemui.controls_panel_top_offset" + /* + * Indicate to the activity that it is being rendered in a bottomsheet, and they + * should optimize the layout for a smaller space. + */ + private const val EXTRA_USE_PANEL = "controls.DISPLAY_IN_PANEL" } var activityView = ActivityView(context, null, 0, false) @@ -50,6 +55,7 @@ class DetailDialog( val stateCallback: ActivityView.StateCallback = object : ActivityView.StateCallback() { override fun onActivityViewReady(view: ActivityView) { val launchIntent = Intent(intent) + launchIntent.putExtra(EXTRA_USE_PANEL, true) // Apply flags to make behaviour match documentLaunchMode=always. launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) @@ -112,6 +118,12 @@ class DetailDialog( setOnClickListener { dismiss() } (getParent() as View).setOnClickListener { dismiss() } } + + if (ScreenDecorationsUtils.supportsRoundedCornersOnWindows(context.getResources())) { + val cornerRadius = context.resources + .getDimensionPixelSize(R.dimen.controls_activity_view_corner_radius) + activityView.setCornerRadius(cornerRadius.toFloat()) + } } override fun show() { -- cgit v1.2.3-59-g8ed1b