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
This commit is contained in:
Matt Pietal
2020-04-30 13:57:26 -04:00
parent 7334f95129
commit 29e277d105
3 changed files with 16 additions and 8 deletions

View File

@@ -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">
<ImageView
android:id="@+id/control_detail_close"
android:contentDescription="@string/accessibility_desc_close"
@@ -55,10 +55,7 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingTop="@dimen/controls_activity_view_top_padding"
android:paddingLeft="@dimen/controls_activity_view_side_padding"
android:paddingRight="@dimen/controls_activity_view_side_padding"
android:background="@drawable/rounded_bg_top"
android:background="@android:color/black"
android:orientation="vertical" />
</LinearLayout>

View File

@@ -1268,10 +1268,9 @@
<fraction name="controls_dimmed_alpha">40%</fraction>
<!-- Home Controls activity view detail panel-->
<dimen name="controls_activity_view_top_padding">25dp</dimen>
<dimen name="controls_activity_view_side_padding">12dp</dimen>
<dimen name="controls_activity_view_top_offset">100dp</dimen>
<dimen name="controls_activity_view_text_size">17sp</dimen>
<dimen name="controls_activity_view_corner_radius">@*android:dimen/config_bottomDialogCornerRadius</dimen>
<!-- Home Controls management screens -->
<dimen name="controls_management_top_padding">48dp</dimen>

View File

@@ -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() {