diff options
7 files changed, 21 insertions, 79 deletions
diff --git a/packages/SystemUI/res/layout/controls_detail_dialog.xml b/packages/SystemUI/res/layout/controls_detail_dialog.xml index 34b603f4bc3d..d1ce10e5745f 100644 --- a/packages/SystemUI/res/layout/controls_detail_dialog.xml +++ b/packages/SystemUI/res/layout/controls_detail_dialog.xml @@ -50,41 +50,15 @@ android:padding="12dp" /> </LinearLayout> - <LinearLayout + <FrameLayout + android:id="@+id/controls_activity_view" android:layout_width="match_parent" - android:layout_height="wrap_content" + 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:orientation="vertical"> - <TextView - android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.ControlDialog" - android:clickable="false" - android:focusable="false" - android:maxLines="1" - android:ellipsize="end" /> - <TextView - android:id="@+id/subtitle" - android:layout_marginTop="6dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="@style/TextAppearance.ControlDialog" - android:clickable="false" - android:focusable="false" - android:maxLines="1" - android:ellipsize="end" /> - - <FrameLayout - android:id="@+id/controls_activity_view" - android:layout_width="match_parent" - android:layout_height="0dp" - android:layout_marginTop="10dp" - android:layout_weight="1" /> - - </LinearLayout> + android:orientation="vertical" /> </LinearLayout> diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 179f8b8ea9f4..98527ef9ba97 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -1262,7 +1262,7 @@ <!-- 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">200dp</dimen> + <dimen name="controls_activity_view_top_offset">100dp</dimen> <dimen name="controls_activity_view_text_size">17sp</dimen> <!-- Home Controls management screens --> diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml index 4ed819e4925b..26ae79081491 100644 --- a/packages/SystemUI/res/values/styles.xml +++ b/packages/SystemUI/res/values/styles.xml @@ -731,11 +731,6 @@ <item name="android:textSize">@dimen/control_text_size</item> <item name="android:textColor">@color/control_secondary_text</item> </style> - <style name="TextAppearance.ControlDialog"> - <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item> - <item name="android:textSize">@dimen/controls_activity_view_text_size</item> - <item name="android:textColor">@color/control_primary_text</item> - </style> <style name="Control.ListPopupWindow" parent="@*android:style/Widget.DeviceDefault.ListPopupWindow"> <item name="android:overlapAnchor">true</item> diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt index b3c6cab2adff..0af29bec04b3 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt @@ -17,14 +17,11 @@ package com.android.systemui.controls.ui import android.app.Dialog -import android.app.PendingIntent import android.content.Intent import android.service.controls.Control import android.service.controls.actions.BooleanAction import android.service.controls.actions.CommandAction -import android.util.Log import android.view.HapticFeedbackConstants -import com.android.systemui.R import com.android.systemui.controls.controller.ControlsController object ControlActionCoordinator { @@ -51,23 +48,14 @@ object ControlActionCoordinator { } /** - * Allow apps to specify whether they would like to appear in a detail panel or within - * the full activity by setting the {@link Control#EXTRA_USE_PANEL} flag. In order for - * activities to determine how they are being launched, they should inspect the - * {@link Control#EXTRA_USE_PANEL} flag for a value of true. + * All long presses will be shown in a 3/4 height bottomsheet panel, in order for the user to + * retain context with their favorited controls in the power menu. */ fun longPress(cvh: ControlViewHolder) { // Long press snould only be called when there is valid control state, otherwise ignore cvh.cws.control?.let { - try { - it.getAppIntent().send() - cvh.layout.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) - cvh.context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) - } catch (e: PendingIntent.CanceledException) { - Log.e(ControlsUiController.TAG, "Error sending pending intent", e) - cvh.setTransientStatus( - cvh.context.resources.getString(R.string.controls_error_failed)) - } + cvh.layout.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS) + showDialog(cvh, it.getAppIntent().getIntent()) } } diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt index 61a323d0b9a8..c677b8cd05d5 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt @@ -52,8 +52,7 @@ class ControlViewHolder( val layout: ViewGroup, val controlsController: ControlsController, val uiExecutor: DelayableExecutor, - val bgExecutor: DelayableExecutor, - val usePanels: Boolean + val bgExecutor: DelayableExecutor ) { companion object { @@ -159,8 +158,7 @@ class ControlViewHolder( controlsController.action(cws.componentName, cws.ci, action) } - fun usePanel(): Boolean = - usePanels && deviceType in ControlViewHolder.FORCE_PANEL_DEVICES + fun usePanel(): Boolean = deviceType in ControlViewHolder.FORCE_PANEL_DEVICES private fun findBehavior( status: Int, diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt index cfd8df059567..bf0f1c85249c 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt @@ -30,7 +30,6 @@ import android.content.res.Configuration import android.graphics.drawable.Drawable import android.graphics.drawable.LayerDrawable import android.os.Process -import android.provider.Settings import android.service.controls.Control import android.service.controls.actions.ControlAction import android.util.Log @@ -84,7 +83,6 @@ class ControlsUiControllerImpl @Inject constructor ( private const val PREF_COMPONENT = "controls_component" private const val PREF_STRUCTURE = "controls_structure" - private const val USE_PANELS = "systemui.controls_use_panel" private const val FADE_IN_MILLIS = 200L private val EMPTY_COMPONENT = ComponentName("", "") @@ -441,9 +439,6 @@ class ControlsUiControllerImpl @Inject constructor ( val maxColumns = findMaxColumns() - // use flag only temporarily for testing - val usePanels = Settings.Secure.getInt(context.contentResolver, USE_PANELS, 0) == 1 - val listView = parent.requireViewById(R.id.global_actions_controls_list) as ViewGroup var lastRow: ViewGroup = createRow(inflater, listView) selectedStructure.controls.forEach { @@ -457,8 +452,7 @@ class ControlsUiControllerImpl @Inject constructor ( baseLayout, controlsController.get(), uiExecutor, - bgExecutor, - usePanels + bgExecutor ) val key = ControlKey(selectedStructure.componentName, it.controlId) cvh.bindData(controlsById.getValue(key)) 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 15c41a2005a6..65ed9678c63e 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/DetailDialog.kt @@ -24,9 +24,9 @@ import android.provider.Settings import android.view.View import android.view.ViewGroup import android.view.WindowInsets +import android.view.WindowInsets.Type import android.view.WindowManager import android.widget.ImageView -import android.widget.TextView import com.android.systemui.R @@ -45,7 +45,7 @@ class DetailDialog( private const val PANEL_TOP_OFFSET = "systemui.controls_panel_top_offset" } - lateinit var activityView: ActivityView + var activityView = ActivityView(context, null, 0, false) val stateCallback: ActivityView.StateCallback = object : ActivityView.StateCallback() { override fun onActivityViewReady(view: ActivityView) { @@ -67,10 +67,8 @@ class DetailDialog( init { window.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY) - setContentView(R.layout.controls_detail_dialog) - activityView = ActivityView(context, null, 0, false) requireViewById<ViewGroup>(R.id.controls_activity_view).apply { addView(activityView) } @@ -79,14 +77,6 @@ class DetailDialog( setOnClickListener { _: View -> dismiss() } } - requireViewById<TextView>(R.id.title).apply { - setText(cvh.title.text) - } - - requireViewById<TextView>(R.id.subtitle).apply { - setText(cvh.subtitle.text) - } - requireViewById<ImageView>(R.id.control_detail_open_in_app).apply { setOnClickListener { v: View -> dismiss() @@ -97,15 +87,15 @@ class DetailDialog( // consume all insets to achieve slide under effect window.getDecorView().setOnApplyWindowInsetsListener { - v: View, insets: WindowInsets -> + _: View, insets: WindowInsets -> activityView.apply { val l = getPaddingLeft() val t = getPaddingTop() val r = getPaddingRight() - setPadding(l, t, r, insets.getSystemWindowInsets().bottom) + setPadding(l, t, r, insets.getInsets(Type.systemBars()).bottom) } - insets.consumeSystemWindowInsets() + WindowInsets.CONSUMED } requireViewById<ViewGroup>(R.id.control_detail_root).apply { @@ -118,6 +108,9 @@ class DetailDialog( val lp = getLayoutParams() as ViewGroup.MarginLayoutParams lp.topMargin = offsetInPx setLayoutParams(lp) + + setOnClickListener { dismiss() } + (getParent() as View).setOnClickListener { dismiss() } } } |