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

Commit 70f2c2a1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Controls UI - Detail panel" into rvc-dev am: 87cf6848

Change-Id: I98060c91d844bb0953f7811e884c079366587ee6
parents 86d91754 87cf6848
Loading
Loading
Loading
Loading
+5 −31
Original line number Original line Diff line number Diff line
@@ -50,41 +50,15 @@
        android:padding="12dp" />
        android:padding="12dp" />
  </LinearLayout>
  </LinearLayout>


  <LinearLayout
  <FrameLayout
      android:id="@+id/controls_activity_view"
      android:layout_width="match_parent"
      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:paddingTop="@dimen/controls_activity_view_top_padding"
      android:paddingLeft="@dimen/controls_activity_view_side_padding"
      android:paddingLeft="@dimen/controls_activity_view_side_padding"
      android:paddingRight="@dimen/controls_activity_view_side_padding"
      android:paddingRight="@dimen/controls_activity_view_side_padding"
      android:background="@drawable/rounded_bg_top"
      android:background="@drawable/rounded_bg_top"
      android:orientation="vertical">
      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>
</LinearLayout>
</LinearLayout>
+1 −1
Original line number Original line Diff line number Diff line
@@ -1260,7 +1260,7 @@
    <!-- Home Controls activity view detail panel-->
    <!-- Home Controls activity view detail panel-->
    <dimen name="controls_activity_view_top_padding">25dp</dimen>
    <dimen name="controls_activity_view_top_padding">25dp</dimen>
    <dimen name="controls_activity_view_side_padding">12dp</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>
    <dimen name="controls_activity_view_text_size">17sp</dimen>


    <!-- Home Controls management screens -->
    <!-- Home Controls management screens -->
+0 −5
Original line number Original line Diff line number Diff line
@@ -731,11 +731,6 @@
        <item name="android:textSize">@dimen/control_text_size</item>
        <item name="android:textSize">@dimen/control_text_size</item>
        <item name="android:textColor">@color/control_secondary_text</item>
        <item name="android:textColor">@color/control_secondary_text</item>
    </style>
    </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">
    <style name="Control.ListPopupWindow" parent="@*android:style/Widget.DeviceDefault.ListPopupWindow">
        <item name="android:overlapAnchor">true</item>
        <item name="android:overlapAnchor">true</item>


+4 −16
Original line number Original line Diff line number Diff line
@@ -17,14 +17,11 @@
package com.android.systemui.controls.ui
package com.android.systemui.controls.ui


import android.app.Dialog
import android.app.Dialog
import android.app.PendingIntent
import android.content.Intent
import android.content.Intent
import android.service.controls.Control
import android.service.controls.Control
import android.service.controls.actions.BooleanAction
import android.service.controls.actions.BooleanAction
import android.service.controls.actions.CommandAction
import android.service.controls.actions.CommandAction
import android.util.Log
import android.view.HapticFeedbackConstants
import android.view.HapticFeedbackConstants
import com.android.systemui.R
import com.android.systemui.controls.controller.ControlsController
import com.android.systemui.controls.controller.ControlsController


object ControlActionCoordinator {
object ControlActionCoordinator {
@@ -51,23 +48,14 @@ object ControlActionCoordinator {
    }
    }


    /**
    /**
     * Allow apps to specify whether they would like to appear in a detail panel or within
     * All long presses will be shown in a 3/4 height bottomsheet panel, in order for the user to
     * the full activity by setting the {@link Control#EXTRA_USE_PANEL} flag. In order for
     * retain context with their favorited controls in the power menu.
     * activities to determine how they are being launched, they should inspect the
     * {@link Control#EXTRA_USE_PANEL} flag for a value of true.
     */
     */
    fun longPress(cvh: ControlViewHolder) {
    fun longPress(cvh: ControlViewHolder) {
        // Long press snould only be called when there is valid control state, otherwise ignore
        // Long press snould only be called when there is valid control state, otherwise ignore
        cvh.cws.control?.let {
        cvh.cws.control?.let {
            try {
                it.getAppIntent().send()
            cvh.layout.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
            cvh.layout.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS)
                cvh.context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
            showDialog(cvh, it.getAppIntent().getIntent())
            } catch (e: PendingIntent.CanceledException) {
                Log.e(ControlsUiController.TAG, "Error sending pending intent", e)
                cvh.setTransientStatus(
                    cvh.context.resources.getString(R.string.controls_error_failed))
            }
        }
        }
    }
    }


+2 −4
Original line number Original line Diff line number Diff line
@@ -52,8 +52,7 @@ class ControlViewHolder(
    val layout: ViewGroup,
    val layout: ViewGroup,
    val controlsController: ControlsController,
    val controlsController: ControlsController,
    val uiExecutor: DelayableExecutor,
    val uiExecutor: DelayableExecutor,
    val bgExecutor: DelayableExecutor,
    val bgExecutor: DelayableExecutor
    val usePanels: Boolean
) {
) {


    companion object {
    companion object {
@@ -159,8 +158,7 @@ class ControlViewHolder(
        controlsController.action(cws.componentName, cws.ci, action)
        controlsController.action(cws.componentName, cws.ci, action)
    }
    }


    fun usePanel(): Boolean =
    fun usePanel(): Boolean = deviceType in ControlViewHolder.FORCE_PANEL_DEVICES
        usePanels && deviceType in ControlViewHolder.FORCE_PANEL_DEVICES


    private fun findBehavior(
    private fun findBehavior(
        status: Int,
        status: Int,
Loading