Refactoring and javadoc changes for protolayout library.
BUG: 285570489
Change-Id: If7c2638eee833e66857f6d99c8f971b078da39de
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ActionBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ActionBuilders.java
index 5276a5e..16268c91 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ActionBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ActionBuilders.java
@@ -167,6 +167,7 @@
ActionProto.AndroidStringExtra.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-973795259);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -181,6 +182,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public AndroidStringExtra build() {
@@ -258,6 +260,7 @@
ActionProto.AndroidIntExtra.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1199435881);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -272,6 +275,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public AndroidIntExtra build() {
@@ -349,6 +353,7 @@
ActionProto.AndroidLongExtra.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-906933303);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -363,6 +368,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public AndroidLongExtra build() {
@@ -440,6 +446,7 @@
ActionProto.AndroidDoubleExtra.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1104636989);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -454,6 +461,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public AndroidDoubleExtra build() {
@@ -532,6 +540,7 @@
ActionProto.AndroidBooleanExtra.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1244694745);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -547,6 +556,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public AndroidBooleanExtra build() {
@@ -706,6 +716,7 @@
ActionProto.AndroidActivity.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1799520061);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -831,6 +842,7 @@
ActionProto.LaunchAction.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(2004803940);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -846,6 +858,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public LaunchAction build() {
@@ -930,6 +943,7 @@
ActionProto.LoadAction.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(674205536);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -947,6 +961,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public LoadAction build() {
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java
index ba17358f..6b55c675 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ColorBuilders.java
@@ -132,15 +132,21 @@
private final Fingerprint mFingerprint = new Fingerprint(-1955659823);
/**
- * @deprecated Use {@link #Builder(int)} instead.
+ * Creates an instance of {@link Builder} from the given static value. {@link
+ * #setDynamicValue(DynamicColor)} can be used to provide a dynamic value.
+ */
+ public Builder(@ColorInt int staticValue) {
+ setArgb(staticValue);
+ }
+
+ /**
+ * Creates an instance of {@link Builder}.
+ *
+ * @deprecated use {@link #Builder(int)}
*/
@Deprecated
public Builder() {}
- public Builder(@ColorInt int argb) {
- setArgb(argb);
- }
-
/**
* Sets the static color value, in ARGB format. If a dynamic value is also set and the
* renderer supports dynamic values for the corresponding field, this static value will
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DeviceParametersBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DeviceParametersBuilders.java
index 2837ebf39..e25c2cc 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DeviceParametersBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DeviceParametersBuilders.java
@@ -242,6 +242,7 @@
private final DeviceParametersProto.DeviceParameters.Builder mImpl =
DeviceParametersProto.DeviceParameters.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -406,6 +407,7 @@
private final DeviceParametersProto.Capabilities.Builder mImpl =
DeviceParametersProto.Capabilities.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java
index f55d632..926d920 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/DimensionBuilders.java
@@ -41,19 +41,31 @@
private static final ExpandedDimensionProp EXPAND = new ExpandedDimensionProp.Builder().build();
private static final WrappedDimensionProp WRAP = new WrappedDimensionProp.Builder().build();
- /** Shortcut for building a {@link DpProp} using a measurement in DP. */
+ /**
+ * Shortcut for building a {@link DpProp} using a measurement in DP.
+ *
+ * @since 1.0
+ */
@NonNull
public static DpProp dp(@Dimension(unit = DP) float valueDp) {
return new DpProp.Builder(valueDp).build();
}
- /** Shortcut for building a {@link SpProp} using a measurement in SP. */
+ /**
+ * Shortcut for building a {@link SpProp} using a measurement in SP.
+ *
+ * @since 1.0
+ */
@NonNull
public static SpProp sp(@Dimension(unit = SP) float valueSp) {
return new SpProp.Builder().setValue(valueSp).build();
}
- /** Shortcut for building a {@link EmProp} using a measurement in EM. */
+ /**
+ * Shortcut for building a {@link EmProp} using a measurement in EM.
+ *
+ * @since 1.0
+ */
@NonNull
public static EmProp em(int valueEm) {
return new EmProp.Builder().setValue(valueEm).build();
@@ -211,28 +223,29 @@
/** Builder for {@link DpProp}. */
public static final class Builder
implements ContainerDimension.Builder,
- ImageDimension.Builder,
- SpacerDimension.Builder,
- ExtensionDimension.Builder {
+ ImageDimension.Builder,
+ SpacerDimension.Builder,
+ ExtensionDimension.Builder {
private final DimensionProto.DpProp.Builder mImpl = DimensionProto.DpProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(756413087);
/**
- * @deprecated Use {@link #Builder(float)} instead.
- */
- @Deprecated
- public Builder() {}
-
- /**
- * Creates a instance of {@link Builder}.
- *
- * @param staticValue the static value, in dp.
+ * Creates an instance of {@link Builder} from the given static value. {@link
+ * #setDynamicValue(DynamicFloat)} can be used to provide a dynamic value.
*/
public Builder(@Dimension(unit = DP) float staticValue) {
setValue(staticValue);
}
/**
+ * Creates an instance of {@link Builder}.
+ *
+ * @deprecated use {@link #Builder(float)}
+ */
+ @Deprecated
+ public Builder() {}
+
+ /**
* Sets the static value, in dp. If a dynamic value is also set and the renderer
* supports dynamic values for the corresponding field, this static value will be
* ignored. If the static value is not specified, zero will be used instead.
@@ -240,9 +253,9 @@
* @since 1.0
*/
@NonNull
- public Builder setValue(@Dimension(unit = DP) float staticValue) {
- mImpl.setValue(staticValue);
- mFingerprint.recordPropertyUpdate(1, Float.floatToIntBits(staticValue));
+ public Builder setValue(@Dimension(unit = DP) float value) {
+ mImpl.setValue(value);
+ mFingerprint.recordPropertyUpdate(1, Float.floatToIntBits(value));
return this;
}
@@ -537,6 +550,7 @@
private final DimensionProto.SpProp.Builder mImpl = DimensionProto.SpProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(631793260);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -620,6 +634,7 @@
private final DimensionProto.EmProp.Builder mImpl = DimensionProto.EmProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-659639046);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -729,21 +744,22 @@
private final Fingerprint mFingerprint = new Fingerprint(-1927567665);
/**
- * @deprecated Use {@link #Builder(float)} instead.
- */
- @Deprecated
- public Builder() {}
-
- /**
- * Creates a instance of {@link Builder}.
- *
- * @param staticValue the static value, in degrees.
+ * Creates an instance of {@link Builder} from the given static value. {@link
+ * #setDynamicValue(DynamicFloat)} can be used to provide a dynamic value.
*/
public Builder(float staticValue) {
setValue(staticValue);
}
/**
+ * Creates an instance of {@link Builder}.
+ *
+ * @deprecated use {@link #Builder(float)}
+ */
+ @Deprecated
+ public Builder() {}
+
+ /**
* Sets the static value, in degrees. If a dynamic value is also set and the renderer
* supports dynamic values for the corresponding field, this static value will be
* ignored. If the static value is not specified, zero will be used instead.
@@ -751,9 +767,9 @@
* @since 1.0
*/
@NonNull
- public Builder setValue(float staticValue) {
- mImpl.setValue(staticValue);
- mFingerprint.recordPropertyUpdate(1, Float.floatToIntBits(staticValue));
+ public Builder setValue(float value) {
+ mImpl.setValue(value);
+ mFingerprint.recordPropertyUpdate(1, Float.floatToIntBits(value));
return this;
}
@@ -968,7 +984,6 @@
.build();
}
- /* */
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@NonNull
@@ -989,6 +1004,7 @@
DimensionProto.ExpandedDimensionProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-997720604);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1015,6 +1031,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public ExpandedDimensionProp build() {
@@ -1102,6 +1119,7 @@
DimensionProto.WrappedDimensionProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1118918114);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1117,13 +1135,13 @@
throw new IllegalArgumentException(
"setMinimumSize doesn't support dynamic values.");
}
-
mImpl.setMinimumSize(minimumSize.toProto());
mFingerprint.recordPropertyUpdate(
1, checkNotNull(minimumSize.getFingerprint()).aggregateValueAsInt());
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public WrappedDimensionProp build() {
@@ -1228,6 +1246,7 @@
DimensionProto.ProportionalDimensionProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1725027476);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1254,6 +1273,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public ProportionalDimensionProp build() {
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java
index 1cf6bce..386be49 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/LayoutElementBuilders.java
@@ -68,7 +68,10 @@
import java.util.Collections;
import java.util.List;
-/** Builders for composable layout elements that can be combined together to create renderable UI */
+/**
+ * Builders for composable layout elements that can be combined together to create renderable UI
+ * layouts.
+ */
public final class LayoutElementBuilders {
private LayoutElementBuilders() {}
@@ -147,6 +150,8 @@
/**
* Renderer dependent Font variant. If not supported, will behave similar to {@link
* #FONT_VARIANT_UNDEFINED}.
+ *
+ * @since 1.2
*/
@ProtoLayoutExperimental
@RestrictTo(RestrictTo.Scope.LIBRARY)
@@ -395,6 +400,7 @@
LayoutElementProto.FontWeightProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1485961687);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -483,6 +489,7 @@
LayoutElementProto.FontVariantProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-295272526);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -572,6 +579,7 @@
LayoutElementProto.SpanVerticalAlignmentProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1822193880);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -641,6 +649,9 @@
/**
* Gets the text color. If not defined, defaults to white.
*
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
* @since 1.0
*/
@Nullable
@@ -784,6 +795,7 @@
LayoutElementProto.FontStyle.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-374492482);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -848,6 +860,8 @@
/**
* Sets whether the text should be rendered in a italic typeface. If not specified,
* defaults to "false".
+ *
+ * @since 1.0
*/
@SuppressLint("MissingGetterMatchingBuilder")
@NonNull
@@ -870,6 +884,8 @@
/**
* Sets whether the text should be rendered with an underline. If not specified,
* defaults to "false".
+ *
+ * @since 1.0
*/
@SuppressLint("MissingGetterMatchingBuilder")
@NonNull
@@ -1055,6 +1071,7 @@
LayoutElementProto.TextOverflowProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1542057565);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1144,6 +1161,7 @@
LayoutElementProto.MarqueeParameters.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1405971293);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1234,6 +1252,7 @@
LayoutElementProto.AndroidTextStyle.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(408674745);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1275,6 +1294,9 @@
/**
* Gets the text to render.
*
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
* @since 1.0
*/
@Nullable
@@ -1287,21 +1309,6 @@
}
/**
- * Gets the bounding constraints for the layout affected by the dynamic value from {@link
- * #getText()}.
- *
- * @since 1.2
- */
- @Nullable
- public StringLayoutConstraint getLayoutConstraintsForDynamicText() {
- if (mImpl.hasText()) {
- return StringLayoutConstraint.fromProto(mImpl.getText());
- } else {
- return null;
- }
- }
-
- /**
* Gets the style of font to use (size, bold etc). If not specified, defaults to the
* platform's default body font.
*
@@ -1425,6 +1432,21 @@
return mImpl.getMarqueeParameters().getIterations();
}
+ /**
+ * Gets the bounding constraints for the layout affected by the dynamic value from {@link
+ * #getText()}.
+ *
+ * @since 1.2
+ */
+ @Nullable
+ public StringLayoutConstraint getLayoutConstraintsForDynamicText() {
+ if (mImpl.hasText()) {
+ return StringLayoutConstraint.fromProto(mImpl.getText());
+ } else {
+ return null;
+ }
+ }
+
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@Nullable
@@ -1489,6 +1511,7 @@
LayoutElementProto.Text.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(814133697);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1513,33 +1536,6 @@
}
/**
- * Sets the bounding constraints for the layout affected by the dynamic value from
- * {@link #setText(StringProp)}}.
- *
- * @since 1.2
- */
- @NonNull
- public Builder setLayoutConstraintsForDynamicText(
- @NonNull StringLayoutConstraint stringLayoutConstraint) {
- mImpl.mergeText(stringLayoutConstraint.toProto());
- mFingerprint.recordPropertyUpdate(
- 1,
- checkNotNull(stringLayoutConstraint.getFingerprint())
- .aggregateValueAsInt());
- return this;
- }
-
- /**
- * Sets the static text to render.
- *
- * @since 1.0
- */
- @NonNull
- public Builder setText(@NonNull String text) {
- return setText(new StringProp.Builder(text).build());
- }
-
- /**
* Sets the style of font to use (size, bold etc). If not specified, defaults to the
* platform's default body font.
*
@@ -1579,6 +1575,7 @@
4, checkNotNull(maxLines.getFingerprint()).aggregateValueAsInt());
return this;
}
+
/**
* Sets the maximum number of lines that can be represented by the {@link Text} element.
* If not defined, the {@link Text} element will be treated as a single-line element.
@@ -1698,6 +1695,33 @@
return this;
}
+ /**
+ * Sets the bounding constraints for the layout affected by the dynamic value from
+ * {@link #setText(StringProp)}}.
+ *
+ * @since 1.2
+ */
+ @NonNull
+ public Builder setLayoutConstraintsForDynamicText(
+ @NonNull StringLayoutConstraint stringLayoutConstraint) {
+ mImpl.mergeText(stringLayoutConstraint.toProto());
+ mFingerprint.recordPropertyUpdate(
+ 1,
+ checkNotNull(stringLayoutConstraint.getFingerprint())
+ .aggregateValueAsInt());
+ return this;
+ }
+
+ /**
+ * Sets the static text to render.
+ *
+ * @since 1.0
+ */
+ @NonNull
+ public Builder setText(@NonNull String text) {
+ return setText(new StringProp.Builder(text).build());
+ }
+
@Override
@NonNull
public Text build() {
@@ -1778,6 +1802,7 @@
LayoutElementProto.ContentScaleModeProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1200564005);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1822,6 +1847,9 @@
* <p>Note that only Android image resources can be tinted; Inline images will not be
* tinted, and this property will have no effect.
*
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
* @since 1.0
*/
@Nullable
@@ -1872,6 +1900,7 @@
LayoutElementProto.ColorFilter.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1912021459);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2066,6 +2095,7 @@
LayoutElementProto.Image.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-48009959);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2204,6 +2234,9 @@
* {@link Arc}, this must be specified as an angular dimension, otherwise a linear dimension
* must be used. If not defined, defaults to 0.
*
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
* @since 1.0
*/
@Nullable
@@ -2216,6 +2249,37 @@
}
/**
+ * Gets the height of this spacer. If not defined, defaults to 0.
+ *
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
+ * @since 1.0
+ */
+ @Nullable
+ public SpacerDimension getHeight() {
+ if (mImpl.hasHeight()) {
+ return DimensionBuilders.spacerDimensionFromProto(mImpl.getHeight());
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Gets {@link androidx.wear.protolayout.ModifiersBuilders.Modifiers} for this element.
+ *
+ * @since 1.0
+ */
+ @Nullable
+ public Modifiers getModifiers() {
+ if (mImpl.hasModifiers()) {
+ return Modifiers.fromProto(mImpl.getModifiers());
+ } else {
+ return null;
+ }
+ }
+
+ /**
* Gets the bounding constraints for the layout affected by the dynamic value from {@link
* #getWidth()}.
*
@@ -2231,20 +2295,6 @@
}
/**
- * Gets the height of this spacer. If not defined, defaults to 0.
- *
- * @since 1.0
- */
- @Nullable
- public SpacerDimension getHeight() {
- if (mImpl.hasHeight()) {
- return DimensionBuilders.spacerDimensionFromProto(mImpl.getHeight());
- } else {
- return null;
- }
- }
-
- /**
* Gets the bounding constraints for the layout affected by the dynamic value from {@link
* #getHeight()}.
*
@@ -2259,21 +2309,6 @@
}
}
- /**
- * Gets {@link androidx.wear.protolayout.ModifiersBuilders.Modifiers} for this element.
- * Intended for testing purposes only.
- *
- * @since 1.0
- */
- @Nullable
- public Modifiers getModifiers() {
- if (mImpl.hasModifiers()) {
- return Modifiers.fromProto(mImpl.getModifiers());
- } else {
- return null;
- }
- }
-
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@Nullable
@@ -2327,6 +2362,7 @@
LayoutElementProto.Spacer.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-156449821);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2616,6 +2652,7 @@
LayoutElementProto.Box.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-2113485818);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2727,6 +2764,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public Box build() {
@@ -2866,6 +2904,7 @@
LayoutElementProto.SpanText.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(266451531);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2878,14 +2917,14 @@
@NonNull
public Builder setText(@NonNull StringProp text) {
if (text.getDynamicValue() != null) {
- throw new IllegalArgumentException(
- "SpanText.Builder.setText doesn't support dynamic values.");
+ throw new IllegalArgumentException("setText doesn't support dynamic values.");
}
mImpl.setText(text.toProto());
mFingerprint.recordPropertyUpdate(
1, checkNotNull(text.getFingerprint()).aggregateValueAsInt());
return this;
}
+
/**
* Sets the text to render.
*
@@ -2944,6 +2983,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public SpanText build() {
@@ -3095,6 +3135,7 @@
LayoutElementProto.SpanImage.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(920832637);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -3116,6 +3157,7 @@
1, checkNotNull(resourceId.getFingerprint()).aggregateValueAsInt());
return this;
}
+
/**
* Sets the resource_id of the image to render. This must exist in the supplied resource
* bundle.
@@ -3441,6 +3483,7 @@
LayoutElementProto.Spannable.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1111684471);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -3483,6 +3526,7 @@
3, checkNotNull(maxLines.getFingerprint()).aggregateValueAsInt());
return this;
}
+
/**
* Sets the maximum number of lines that can be represented by the {@link Spannable}
* element. If not defined, the {@link Spannable} element will be treated as a
@@ -3748,6 +3792,7 @@
LayoutElementProto.Column.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1676323158);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -3835,6 +3880,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public Column build() {
@@ -3852,6 +3898,8 @@
* <p>If specified, vertical_alignment can be used to control the gravity inside the container,
* affecting the vertical placement of children whose width are smaller than the resulting row
* height.
+ *
+ * @since 1.0
*/
public static final class Row implements LayoutElement {
private final LayoutElementProto.Row mImpl;
@@ -3992,6 +4040,7 @@
LayoutElementProto.Row.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1279502255);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -4028,13 +4077,8 @@
*/
@NonNull
public Builder setVerticalAlignment(@VerticalAlignment int verticalAlignment) {
- mImpl.setVerticalAlignment(
- AlignmentProto.VerticalAlignmentProp.newBuilder()
- .setValue(
- AlignmentProto.VerticalAlignment.forNumber(
- verticalAlignment)));
- mFingerprint.recordPropertyUpdate(2, verticalAlignment);
- return this;
+ return setVerticalAlignment(
+ new VerticalAlignmentProp.Builder().setValue(verticalAlignment).build());
}
/**
@@ -4078,6 +4122,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public Row build() {
@@ -4125,6 +4170,9 @@
* sweep anti-clockwise (i.e. -90 degrees is equivalent to 270 degrees), and values >360
* will be be placed at X mod 360 degrees.
*
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
* @since 1.0
*/
@Nullable
@@ -4239,6 +4287,7 @@
LayoutElementProto.Arc.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-257261663);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -4343,6 +4392,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public Arc build() {
@@ -4461,6 +4511,7 @@
LayoutElementProto.ArcText.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-132896327);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -4514,6 +4565,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public ArcText build() {
@@ -4539,6 +4591,9 @@
/**
* Gets the length of this line, in degrees. If not defined, defaults to 0.
*
+ * <p>While this field is statically accessible from 1.0, it's only bindable since version
+ * 1.2 and renderers supporting version 1.2 will use the dynamic value (if set).
+ *
* @since 1.0
*/
@Nullable
@@ -4551,23 +4606,7 @@
}
/**
- * Gets the bounding constraints for the layout affected by the dynamic value from {@link
- * #getLength()}.
- *
- * @since 1.2
- */
- @Nullable
- public AngularLayoutConstraint getLayoutConstraintsForDynamicLength() {
- if (mImpl.hasLength()) {
- return AngularLayoutConstraint.fromProto(mImpl.getLength());
- } else {
- return null;
- }
- }
-
- /**
- * Gets the thickness of this line. If not defined, defaults to 0. Intended for testing
- * purposes only.
+ * Gets the thickness of this line. If not defined, defaults to 0.
*
* @since 1.0
*/
@@ -4642,6 +4681,21 @@
}
}
+ /**
+ * Gets the bounding constraints for the layout affected by the dynamic value from {@link
+ * #getLength()}.
+ *
+ * @since 1.2
+ */
+ @Nullable
+ public AngularLayoutConstraint getLayoutConstraintsForDynamicLength() {
+ if (mImpl.hasLength()) {
+ return AngularLayoutConstraint.fromProto(mImpl.getLength());
+ } else {
+ return null;
+ }
+ }
+
@Override
@RestrictTo(Scope.LIBRARY_GROUP)
@Nullable
@@ -4701,6 +4755,7 @@
LayoutElementProto.ArcLine.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(846148011);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -4906,6 +4961,7 @@
LayoutElementProto.StrokeCapProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-956183418);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -5037,6 +5093,7 @@
LayoutElementProto.ArcSpacer.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1076667423);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -5089,6 +5146,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public ArcSpacer build() {
@@ -5195,6 +5253,7 @@
LayoutElementProto.ArcAdapter.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-176086106);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -5241,6 +5300,7 @@
return setRotateContents(new BoolProp.Builder().setValue(rotateContents).build());
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public ArcAdapter build() {
@@ -5379,6 +5439,7 @@
LayoutElementProto.ExtensionLayoutElement.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(661980356);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -5433,6 +5494,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public ExtensionLayoutElement build() {
@@ -5570,7 +5632,7 @@
public static final class Layout {
private final LayoutElementProto.Layout mImpl;
- private Layout(LayoutElementProto.Layout impl) {
+ Layout(LayoutElementProto.Layout impl) {
this.mImpl = impl;
}
@@ -5638,6 +5700,7 @@
private final LayoutElementProto.Layout.Builder mImpl =
LayoutElementProto.Layout.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/** Sets the root element in the layout. */
@@ -5847,7 +5910,6 @@
* ARC_ANCHOR_END:
* -180 0 180
* Hello World!
- *
* }</pre>
*
* @since 1.0
@@ -6005,6 +6067,7 @@
AlignmentProto.HorizontalAlignmentProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1412659592);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -6093,6 +6156,7 @@
AlignmentProto.VerticalAlignmentProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1488177384);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -6180,6 +6244,7 @@
AlignmentProto.TextAlignmentProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1800500598);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -6267,6 +6332,7 @@
AlignmentProto.ArcAnchorTypeProp.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-496387006);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java
index 6ca34bb..b9e02a9 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ModifiersBuilders.java
@@ -436,6 +436,7 @@
ModifiersProto.Clickable.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(812136104);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -630,6 +631,7 @@
ModifiersProto.Semantics.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1679805809);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -841,6 +843,7 @@
ModifiersProto.Padding.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(375605427);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -923,8 +926,6 @@
* side of the container if the device is using an RTL locale). If false, start/end will
* always map to left/right, accordingly.
*
- * <p>Note that this field only supports static values.
- *
* @since 1.0
*/
@NonNull
@@ -1051,6 +1052,7 @@
private final ModifiersProto.Border.Builder mImpl = ModifiersProto.Border.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(157094687);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1161,6 +1163,7 @@
private final ModifiersProto.Corner.Builder mImpl = ModifiersProto.Corner.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-532589910);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1276,6 +1279,7 @@
ModifiersProto.Background.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1234051555);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1383,6 +1387,7 @@
ModifiersProto.ElementMetadata.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1401175352);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1586,6 +1591,7 @@
ModifiersProto.Modifiers.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1165106749);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1786,6 +1792,7 @@
ModifiersProto.AnimatedVisibility.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1372451979);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -1907,6 +1914,7 @@
ModifiersProto.EnterTransition.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1732205279);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2030,6 +2038,7 @@
ModifiersProto.FadeInTransition.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1430024488);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2172,6 +2181,7 @@
ModifiersProto.SlideInTransition.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-991346238);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2314,6 +2324,7 @@
ModifiersProto.ExitTransition.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-99296494);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2439,6 +2450,7 @@
ModifiersProto.FadeOutTransition.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-545572295);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2581,6 +2593,7 @@
ModifiersProto.SlideOutTransition.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(3732844);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2752,6 +2765,7 @@
ModifiersProto.SlideParentBound.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-516388675);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2767,6 +2781,7 @@
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public SlideParentBound build() {
@@ -2864,6 +2879,7 @@
ModifiersProto.ArcModifiers.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(1342182166);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -2972,6 +2988,7 @@
ModifiersProto.SpanModifiers.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-815102194);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ResourceBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ResourceBuilders.java
index b354f38..59485f7 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ResourceBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/ResourceBuilders.java
@@ -153,6 +153,7 @@
private final ResourceProto.AndroidImageResourceByResId.Builder mImpl =
ResourceProto.AndroidImageResourceByResId.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -268,6 +269,7 @@
private final ResourceProto.InlineImageResource.Builder mImpl =
ResourceProto.InlineImageResource.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -409,6 +411,7 @@
private final ResourceProto.AndroidAnimatedImageResourceByResId.Builder mImpl =
ResourceProto.AndroidAnimatedImageResourceByResId.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -542,6 +545,7 @@
private final ResourceProto.AndroidSeekableAnimatedImageResourceByResId.Builder mImpl =
ResourceProto.AndroidSeekableAnimatedImageResourceByResId.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -704,6 +708,7 @@
private final ResourceProto.ImageResource.Builder mImpl =
ResourceProto.ImageResource.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -843,6 +848,7 @@
private final ResourceProto.Resources.Builder mImpl =
ResourceProto.Resources.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/StateBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/StateBuilders.java
index 31ddd4b..8734394 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/StateBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/StateBuilders.java
@@ -143,6 +143,7 @@
private final StateProto.State.Builder mImpl = StateProto.State.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-688813584);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TimelineBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TimelineBuilders.java
index b837b70..0e94955 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TimelineBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TimelineBuilders.java
@@ -94,6 +94,7 @@
private final TimelineProto.TimeInterval.Builder mImpl =
TimelineProto.TimeInterval.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -202,6 +203,7 @@
private final TimelineProto.TimelineEntry.Builder mImpl =
TimelineProto.TimelineEntry.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -309,6 +311,7 @@
private final TimelineProto.Timeline.Builder mImpl =
TimelineProto.Timeline.newBuilder();
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TriggerBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TriggerBuilders.java
index a2c635a..244533b 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TriggerBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TriggerBuilders.java
@@ -31,7 +31,7 @@
public final class TriggerBuilders {
private TriggerBuilders() {}
- /** Creates a {@link Trigger} that fires immediately when the layout is loaded / reloaded.. */
+ /** Creates a {@link Trigger} that fires immediately when the layout is loaded / reloaded. */
@NonNull
public static Trigger createOnLoadTrigger() {
return new OnLoadTrigger.Builder().build();
@@ -106,8 +106,10 @@
TriggerProto.OnLoadTrigger.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1262805599);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public OnLoadTrigger build() {
@@ -193,6 +195,7 @@
TriggerProto.OnConditionMetTrigger.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(756642641);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -201,13 +204,14 @@
* @since 1.2
*/
@NonNull
- public Builder setCondition(@NonNull DynamicBool dynamicBool) {
- mImpl.setCondition(dynamicBool.toDynamicBoolProto());
+ public Builder setCondition(@NonNull DynamicBool condition) {
+ mImpl.setCondition(condition.toDynamicBoolProto());
mFingerprint.recordPropertyUpdate(
- 1, checkNotNull(dynamicBool.getFingerprint()).aggregateValueAsInt());
+ 1, checkNotNull(condition.getFingerprint()).aggregateValueAsInt());
return this;
}
+ /** Builds an instance from accumulated values. */
@Override
@NonNull
public OnConditionMetTrigger build() {
diff --git a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TypeBuilders.java b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TypeBuilders.java
index ae8a854..5368308 100644
--- a/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TypeBuilders.java
+++ b/wear/protolayout/protolayout/src/main/java/androidx/wear/protolayout/TypeBuilders.java
@@ -26,6 +26,7 @@
import androidx.annotation.RestrictTo.Scope;
import androidx.wear.protolayout.expression.DynamicBuilders;
import androidx.wear.protolayout.expression.DynamicBuilders.DynamicFloat;
+import androidx.wear.protolayout.expression.DynamicBuilders.DynamicString;
import androidx.wear.protolayout.expression.Fingerprint;
import androidx.wear.protolayout.proto.AlignmentProto;
import androidx.wear.protolayout.proto.TypesProto;
@@ -199,6 +200,7 @@
private final TypesProto.Int32Prop.Builder mImpl = TypesProto.Int32Prop.newBuilder();
private final Fingerprint mFingerprint = new Fingerprint(-1360212989);
+ /** Creates an instance of {@link Builder}. */
public Builder() {}
/**
@@ -236,7 +238,9 @@
}
/**
- * Gets the static value.
+ * Gets the static value. If a dynamic value is also set and the renderer supports dynamic
+ * values for the corresponding field, this static value will be ignored. If the static
+ * value is not specified, {@code null} will be used instead.
*
* @since 1.0
*/
@@ -246,12 +250,14 @@
}
/**
- * Gets the dynamic value.
+ * Gets the dynamic value. Note that when setting this value, the static value is still
+ * required to be set to support older renderers that only read the static value. If {@code
+ * dynamicValue} has an invalid result, the provided static value will be used instead.
*
* @since 1.2
*/
@Nullable
- public DynamicBuilders.DynamicString getDynamicValue() {
+ public DynamicString getDynamicValue() {
if (mImpl.hasDynamicValue()) {
return DynamicBuilders.dynamicStringFromProto(mImpl.getDynamicValue());
} else {
@@ -303,6 +309,14 @@
private final Fingerprint mFingerprint = new Fingerprint(327834307);
/**
+ * Creates an instance of {@link Builder} from the given static value. {@link
+ * #setDynamicValue(DynamicString)} can be used to provide a dynamic value.
+ */
+ public Builder(@NonNull String staticValue) {
+ setValue(staticValue);
+ }
+
+ /**
* Creates an instance of {@link Builder}.
*
* @deprecated use {@link #Builder(String)}
@@ -311,15 +325,6 @@
public Builder() {}
/**
- * Creates an instance of {@link Builder}.
- *
- * @param staticValue the static value.
- */
- public Builder(@NonNull String staticValue) {
- setValue(staticValue);
- }
-
- /**
* Sets the static value. If a dynamic value is also set and the renderer supports
* dynamic values for the corresponding field, this static value will be ignored. If the
* static value is not specified, {@code null} will be used instead.
@@ -342,7 +347,7 @@
* @since 1.2
*/
@NonNull
- public Builder setDynamicValue(@NonNull DynamicBuilders.DynamicString dynamicValue) {
+ public Builder setDynamicValue(@NonNull DynamicString dynamicValue) {
mImpl.setDynamicValue(dynamicValue.toDynamicStringProto());
mFingerprint.recordPropertyUpdate(
2, checkNotNull(dynamicValue.getFingerprint()).aggregateValueAsInt());
@@ -353,9 +358,8 @@
* Builds an instance from accumulated values.
*
* @throws IllegalStateException if a dynamic value is set using {@link
- * #setDynamicValue(DynamicBuilders.DynamicString)} but neither {@link
- * #Builder(String)} nor {@link #setValue(String)} is used to provide a static
- * value.
+ * #setDynamicValue(DynamicString)} but neither {@link #Builder(String)} nor {@link
+ * #setValue(String)} is used to provide a static value.
*/
@NonNull
public StringProp build() {
@@ -382,7 +386,9 @@
}
/**
- * Gets the value.
+ * Gets the static value. If a dynamic value is also set and the renderer supports dynamic
+ * values for the corresponding field, this static value will be ignored. If the static
+ * value is not specified, zero will be used instead.
*
* @since 1.0
*/
@@ -391,7 +397,9 @@
}
/**
- * Gets the dynamic value.
+ * Gets the dynamic value. Note that when setting this value, the static value is still
+ * required to be set to support older renderers that only read the static value. If {@code
+ * dynamicValue} has an invalid result, the provided static value will be used instead.
*
* @since 1.2
*/
@@ -448,6 +456,14 @@
private final Fingerprint mFingerprint = new Fingerprint(-641088370);
/**
+ * Creates an instance of {@link Builder} from the given static value. {@link
+ * #setDynamicValue(DynamicFloat)} can be used to provide a dynamic value.
+ */
+ public Builder(float staticValue) {
+ setValue(staticValue);
+ }
+
+ /**
* Creates an instance of {@link Builder}.
*
* @deprecated use {@link #Builder(float)}
@@ -456,15 +472,6 @@
public Builder() {}
/**
- * Creates an instance of {@link Builder}.
- *
- * @param staticValue the static value.
- */
- public Builder(float staticValue) {
- setValue(staticValue);
- }
-
- /**
* Sets the static value. If a dynamic value is also set and the renderer supports
* dynamic values for the corresponding field, this static value will be ignored. If the
* static value is not specified, zero will be used instead.