Add an example in `CarText.Builder#addVariant(CharSequence)` javadoc
Bug: 187990777
Relnote: N/A
Test: N/A
Change-Id: I148c7bdf6ef1e5ebbdb6f21f6d243414924aa87f
diff --git a/car/app/app/src/main/java/androidx/car/app/model/CarText.java b/car/app/app/src/main/java/androidx/car/app/model/CarText.java
index c43702f..b31813b 100644
--- a/car/app/app/src/main/java/androidx/car/app/model/CarText.java
+++ b/car/app/app/src/main/java/androidx/car/app/model/CarText.java
@@ -190,6 +190,7 @@
mTextVariants = Collections.emptyList();
mSpansForVariants = Collections.emptyList();
}
+
CarText(Builder builder) {
mText = builder.mText.toString();
mSpans = getSpans(builder.mText);
@@ -358,6 +359,11 @@
* {@link #Builder} does not fit in the screen, the host will display the
* first variant that fits in the screen.
*
+ * <p>For instance, if the variant order is ["long string", "shorter", "short"], and the
+ * screen can fit 7 characters, "shorter" will be chosen. However, if the order is
+ * ["short", "shorter", "long string"], "short" will be chosen, because "short" fits
+ * within the 7 character limit.
+ *
* @throws NullPointerException if the text is {@code null}
*/
@RequiresCarApi(2)