From 9f2dabf2559824e4916fe31089b38ab4300b6db2 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Tue, 25 Feb 2020 14:17:35 -0500 Subject: [PATCH] Add docs to Controls API Test: build Bug: 150154816 Change-Id: Ie1f77620f8302032845ae1f66459b2990513bb86 --- .../android/service/controls/Control.java | 75 ++++++++++++++++++- .../android/service/controls/DeviceTypes.java | 3 + .../controls/actions/BooleanAction.java | 14 ++-- .../controls/actions/CommandAction.java | 20 +++++ .../controls/actions/ControlAction.java | 18 ++++- .../service/controls/actions/ModeAction.java | 24 ++++++ .../controls/templates/ControlTemplate.java | 15 ++++ .../controls/templates/RangeTemplate.java | 3 +- .../controls/templates/StatelessTemplate.java | 16 +++- .../templates/TemperatureControlTemplate.java | 24 ++++++ .../templates/ToggleRangeTemplate.java | 24 ++++++ 11 files changed, 225 insertions(+), 11 deletions(-) diff --git a/core/java/android/service/controls/Control.java b/core/java/android/service/controls/Control.java index 2d1d0ede62ca5..0cffe7180923a 100644 --- a/core/java/android/service/controls/Control.java +++ b/core/java/android/service/controls/Control.java @@ -394,6 +394,11 @@ public final class Control implements Parcelable { return this; } + /** + * @param deviceType the device type for the {@link Control}. Setting an invalid value not + * in {@link DeviceTypes} will set it to {@link DeviceTypes#TYPE_UNKNOWN}. + * @return {@code this} + */ @NonNull public StatelessBuilder setDeviceType(@DeviceTypes.DeviceType int deviceType) { if (!DeviceTypes.validDeviceType(deviceType)) { @@ -416,6 +421,10 @@ public final class Control implements Parcelable { return this; } + /** + * @param subtitle the user facing subtitle for the {@link Control} + * @return {@code this} + */ @NonNull public StatelessBuilder setSubtitle(@NonNull CharSequence subtitle) { Preconditions.checkNotNull(subtitle); @@ -423,12 +432,22 @@ public final class Control implements Parcelable { return this; } + /** + * @param structure the user facing name of the structure for the {@link Control}. + * {@code null} indicates that it's not associated with any structure. + * @return {@code this} + */ @NonNull public StatelessBuilder setStructure(@Nullable CharSequence structure) { mStructure = structure; return this; } + /** + * @param zone the user facing name of the zone for the {@link Control}. {@code null} + * indicates that it's not associated with any zone. + * @return {@code this} + */ @NonNull public StatelessBuilder setZone(@Nullable CharSequence zone) { mZone = zone; @@ -446,12 +465,20 @@ public final class Control implements Parcelable { return this; } + /** + * @param customIcon an {@link Icon} to override the one determined by the device type. + * @return {@code this} + */ @NonNull public StatelessBuilder setCustomIcon(@Nullable Icon customIcon) { mCustomIcon = customIcon; return this; } + /** + * @param customColor a list of colors to override the ones determined by the device type. + * @return {@code this} + */ @NonNull public StatelessBuilder setCustomColor(@Nullable ColorStateList customColor) { mCustomColor = customColor; @@ -459,7 +486,7 @@ public final class Control implements Parcelable { } /** - * Build a {@link Control} + * Build a stateless {@link Control} * @return a valid {@link Control} */ @NonNull @@ -482,7 +509,7 @@ public final class Control implements Parcelable { /** * Builder class for {@link Control}. * - * This class facilitates the creation of {@link Control}. + * This class facilitates the creation of {@link Control} with an associated state. * It provides the following defaults for non-optional parameters: *