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

This commit is contained in:
TreeHugger Robot
2020-06-12 17:21:21 +00:00
committed by Android (Google) Code Review
2 changed files with 11 additions and 4 deletions

View File

@@ -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} * Used by {@link Control.StatelessBuilder} when there is no known state. Can also be used
* that accepts no type of input, or when there is no known state. * 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 * @return a singleton {@link ControlTemplate} to indicate no specific template is used by
* this {@link Control} * this {@link Control}

View File

@@ -89,6 +89,7 @@ class ControlViewHolder(
return when { return when {
status != Control.STATUS_OK -> StatusBehavior::class status != Control.STATUS_OK -> StatusBehavior::class
deviceType == DeviceTypes.TYPE_CAMERA -> TouchBehavior::class deviceType == DeviceTypes.TYPE_CAMERA -> TouchBehavior::class
template == ControlTemplate.NO_TEMPLATE -> TouchBehavior::class
template is ToggleTemplate -> ToggleBehavior::class template is ToggleTemplate -> ToggleBehavior::class
template is StatelessTemplate -> TouchBehavior::class template is StatelessTemplate -> TouchBehavior::class
template is ToggleRangeTemplate -> ToggleRangeBehavior::class template is ToggleRangeTemplate -> ToggleRangeBehavior::class
@@ -235,7 +236,10 @@ class ControlViewHolder(
controlsController.action(cws.componentName, cws.ci, action) 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( fun bindBehavior(
existingBehavior: Behavior?, existingBehavior: Behavior?,