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

Commit d6fb5e21 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Controls UI - Tap for NO_TEMPLATE" into rvc-dev

parents d32c56d2 733d6378
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -214,10 +214,13 @@ public abstract class ControlTemplate {
    }

    /**
     * Get a singleton {@link ControlTemplate} that has no features.
     * Get a singleton {@link ControlTemplate}, which supports no direct user input.
     *
     * This template has no distinctive field, not even an identifier. Used for a {@link Control}
     * that accepts no type of input, or when there is no known state.
     * Used by {@link Control.StatelessBuilder} when there is no known state. Can also be used
     * in {@link Control.StatefulBuilder} for conveying information to a user about the
     * {@link Control} but direct user interaction is not desired. Since this template has no
     * corresponding {@link ControlAction}, any user interaction will launch the
     * {@link Control#getAppIntent()}.
     *
     * @return a singleton {@link ControlTemplate} to indicate no specific template is used by
     *         this {@link Control}
+5 −1
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ class ControlViewHolder(
            return when {
                status != Control.STATUS_OK -> StatusBehavior::class
                deviceType == DeviceTypes.TYPE_CAMERA -> TouchBehavior::class
                template == ControlTemplate.NO_TEMPLATE -> TouchBehavior::class
                template is ToggleTemplate -> ToggleBehavior::class
                template is StatelessTemplate -> TouchBehavior::class
                template is ToggleRangeTemplate -> ToggleRangeBehavior::class
@@ -235,7 +236,10 @@ class ControlViewHolder(
        controlsController.action(cws.componentName, cws.ci, action)
    }

    fun usePanel(): Boolean = deviceType in ControlViewHolder.FORCE_PANEL_DEVICES
    fun usePanel(): Boolean {
        return deviceType in ControlViewHolder.FORCE_PANEL_DEVICES ||
            controlTemplate == ControlTemplate.NO_TEMPLATE
    }

    fun bindBehavior(
        existingBehavior: Behavior?,