Change maxLines and ellipsis argument from nullable to non-null
There is no merge concept in Paragraphs, so just set the reasonable
default value for these arguments.
Bug: 139319934
Test: TreeHuger
Change-Id: I46dac259bcd950ec5c66ecd79c4acac2675b68ba
diff --git a/ui/ui-framework/api/0.1.0-dev04.txt b/ui/ui-framework/api/0.1.0-dev04.txt
index a2b3818..a99794c 100644
--- a/ui/ui-framework/api/0.1.0-dev04.txt
+++ b/ui/ui-framework/api/0.1.0-dev04.txt
@@ -121,9 +121,9 @@
public final class TextKt {
ctor public TextKt();
method public static void CurrentTextStyleProvider(androidx.ui.text.TextStyle value, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
- method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
- method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
+ method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
+ method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
+ method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
method public static androidx.compose.Effect<androidx.ui.text.TextStyle> currentTextStyle();
method public static androidx.ui.core.HorizontalAlignmentLine getFirstBaseline();
method public static androidx.ui.core.HorizontalAlignmentLine getLastBaseline();
diff --git a/ui/ui-framework/api/current.txt b/ui/ui-framework/api/current.txt
index a2b3818..a99794c 100644
--- a/ui/ui-framework/api/current.txt
+++ b/ui/ui-framework/api/current.txt
@@ -121,9 +121,9 @@
public final class TextKt {
ctor public TextKt();
method public static void CurrentTextStyleProvider(androidx.ui.text.TextStyle value, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
- method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
- method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
+ method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
+ method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
+ method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
method public static androidx.compose.Effect<androidx.ui.text.TextStyle> currentTextStyle();
method public static androidx.ui.core.HorizontalAlignmentLine getFirstBaseline();
method public static androidx.ui.core.HorizontalAlignmentLine getLastBaseline();
diff --git a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev04.txt b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev04.txt
index a2b3818..a99794c 100644
--- a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev04.txt
+++ b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev04.txt
@@ -121,9 +121,9 @@
public final class TextKt {
ctor public TextKt();
method public static void CurrentTextStyleProvider(androidx.ui.text.TextStyle value, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
- method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
- method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
+ method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
+ method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
+ method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
method public static androidx.compose.Effect<androidx.ui.text.TextStyle> currentTextStyle();
method public static androidx.ui.core.HorizontalAlignmentLine getFirstBaseline();
method public static androidx.ui.core.HorizontalAlignmentLine getLastBaseline();
diff --git a/ui/ui-framework/api/public_plus_experimental_current.txt b/ui/ui-framework/api/public_plus_experimental_current.txt
index a2b3818..a99794c 100644
--- a/ui/ui-framework/api/public_plus_experimental_current.txt
+++ b/ui/ui-framework/api/public_plus_experimental_current.txt
@@ -121,9 +121,9 @@
public final class TextKt {
ctor public TextKt();
method public static void CurrentTextStyleProvider(androidx.ui.text.TextStyle value, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
- method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
- method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
+ method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
+ method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
+ method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
method public static androidx.compose.Effect<androidx.ui.text.TextStyle> currentTextStyle();
method public static androidx.ui.core.HorizontalAlignmentLine getFirstBaseline();
method public static androidx.ui.core.HorizontalAlignmentLine getLastBaseline();
diff --git a/ui/ui-framework/api/restricted_0.1.0-dev04.txt b/ui/ui-framework/api/restricted_0.1.0-dev04.txt
index a2b3818..a99794c 100644
--- a/ui/ui-framework/api/restricted_0.1.0-dev04.txt
+++ b/ui/ui-framework/api/restricted_0.1.0-dev04.txt
@@ -121,9 +121,9 @@
public final class TextKt {
ctor public TextKt();
method public static void CurrentTextStyleProvider(androidx.ui.text.TextStyle value, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
- method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
- method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
+ method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
+ method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
+ method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
method public static androidx.compose.Effect<androidx.ui.text.TextStyle> currentTextStyle();
method public static androidx.ui.core.HorizontalAlignmentLine getFirstBaseline();
method public static androidx.ui.core.HorizontalAlignmentLine getLastBaseline();
diff --git a/ui/ui-framework/api/restricted_current.txt b/ui/ui-framework/api/restricted_current.txt
index a2b3818..a99794c 100644
--- a/ui/ui-framework/api/restricted_current.txt
+++ b/ui/ui-framework/api/restricted_current.txt
@@ -121,9 +121,9 @@
public final class TextKt {
ctor public TextKt();
method public static void CurrentTextStyleProvider(androidx.ui.text.TextStyle value, kotlin.jvm.functions.Function0<kotlin.Unit> children);
- method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
- method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
- method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, Integer? maxLines = androidx.ui.core.TextKt.DefaultMaxLines);
+ method public static void Text(androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647, kotlin.jvm.functions.Function1<? super androidx.ui.core.TextSpanScope,kotlin.Unit> child);
+ method public static void Text(String text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
+ method public static void Text(androidx.ui.text.AnnotatedString text, androidx.ui.core.Modifier modifier = Modifier.None, androidx.ui.text.TextStyle? style = null, androidx.ui.text.ParagraphStyle? paragraphStyle = null, boolean softWrap = true, androidx.ui.text.style.TextOverflow overflow = androidx.ui.core.TextKt.DefaultOverflow, int maxLines = 2147483647);
method public static androidx.compose.Effect<androidx.ui.text.TextStyle> currentTextStyle();
method public static androidx.ui.core.HorizontalAlignmentLine getFirstBaseline();
method public static androidx.ui.core.HorizontalAlignmentLine getLastBaseline();
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
index f26ab94..4feb78a 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Text.kt
@@ -43,8 +43,8 @@
import androidx.ui.text.toAnnotatedString
private const val DefaultSoftWrap: Boolean = true
+private const val DefaultMaxLines = Int.MAX_VALUE
private val DefaultOverflow: TextOverflow = TextOverflow.Clip
-private val DefaultMaxLines: Int? = null
/** The default selection color if none is specified. */
internal val DefaultSelectionColor = Color(0x6633B5E5)
@@ -74,7 +74,7 @@
paragraphStyle: ParagraphStyle? = null,
softWrap: Boolean = DefaultSoftWrap,
overflow: TextOverflow = DefaultOverflow,
- maxLines: Int? = DefaultMaxLines,
+ maxLines: Int = DefaultMaxLines,
child: @Composable TextSpanScope.() -> Unit
) {
val rootTextSpan = +memo { TextSpan() }
@@ -117,7 +117,7 @@
paragraphStyle: ParagraphStyle? = null,
softWrap: Boolean = DefaultSoftWrap,
overflow: TextOverflow = DefaultOverflow,
- maxLines: Int? = DefaultMaxLines
+ maxLines: Int = DefaultMaxLines
) {
Text(
text = AnnotatedString(text),
@@ -155,11 +155,9 @@
paragraphStyle: ParagraphStyle? = null,
softWrap: Boolean = DefaultSoftWrap,
overflow: TextOverflow = DefaultOverflow,
- maxLines: Int? = DefaultMaxLines
+ maxLines: Int = DefaultMaxLines
) {
- maxLines?.let {
- require(it > 0) { "maxLines should be greater than 0" }
- }
+ require(maxLines > 0) { "maxLines should be greater than 0" }
// States
// The selection range for this Composable, used by selection
val selectionRange = +state<TextRange?> { null }
diff --git a/ui/ui-text/api/0.1.0-dev04.txt b/ui/ui-text/api/0.1.0-dev04.txt
index 6ae0cb5..cc3c2fd 100644
--- a/ui/ui-text/api/0.1.0-dev04.txt
+++ b/ui/ui-text/api/0.1.0-dev04.txt
@@ -285,8 +285,8 @@
}
public final class MultiParagraph {
- ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints);
- ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints);
+ ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
method public androidx.ui.text.style.TextDirection getBidiRunDirection(int offset);
method public androidx.ui.engine.geometry.Rect getBoundingBox(int offset);
method public androidx.ui.engine.geometry.Rect getCursorRect(int offset);
@@ -304,7 +304,7 @@
method public float getLineRight(int lineIndex);
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
- method public Integer? getMaxLines();
+ method public int getMaxLines();
method public float getMinIntrinsicWidth();
method public int getOffsetForPosition(androidx.ui.core.PxPosition position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
@@ -390,8 +390,8 @@
public final class ParagraphKt {
ctor public ParagraphKt();
- method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
- method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints);
+ method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints);
}
public final class ParagraphStyle {
diff --git a/ui/ui-text/api/current.txt b/ui/ui-text/api/current.txt
index 6ae0cb5..cc3c2fd 100644
--- a/ui/ui-text/api/current.txt
+++ b/ui/ui-text/api/current.txt
@@ -285,8 +285,8 @@
}
public final class MultiParagraph {
- ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints);
- ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints);
+ ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
method public androidx.ui.text.style.TextDirection getBidiRunDirection(int offset);
method public androidx.ui.engine.geometry.Rect getBoundingBox(int offset);
method public androidx.ui.engine.geometry.Rect getCursorRect(int offset);
@@ -304,7 +304,7 @@
method public float getLineRight(int lineIndex);
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
- method public Integer? getMaxLines();
+ method public int getMaxLines();
method public float getMinIntrinsicWidth();
method public int getOffsetForPosition(androidx.ui.core.PxPosition position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
@@ -390,8 +390,8 @@
public final class ParagraphKt {
ctor public ParagraphKt();
- method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
- method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints);
+ method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints);
}
public final class ParagraphStyle {
diff --git a/ui/ui-text/api/public_plus_experimental_0.1.0-dev04.txt b/ui/ui-text/api/public_plus_experimental_0.1.0-dev04.txt
index 6ae0cb5..cc3c2fd 100644
--- a/ui/ui-text/api/public_plus_experimental_0.1.0-dev04.txt
+++ b/ui/ui-text/api/public_plus_experimental_0.1.0-dev04.txt
@@ -285,8 +285,8 @@
}
public final class MultiParagraph {
- ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints);
- ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints);
+ ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
method public androidx.ui.text.style.TextDirection getBidiRunDirection(int offset);
method public androidx.ui.engine.geometry.Rect getBoundingBox(int offset);
method public androidx.ui.engine.geometry.Rect getCursorRect(int offset);
@@ -304,7 +304,7 @@
method public float getLineRight(int lineIndex);
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
- method public Integer? getMaxLines();
+ method public int getMaxLines();
method public float getMinIntrinsicWidth();
method public int getOffsetForPosition(androidx.ui.core.PxPosition position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
@@ -390,8 +390,8 @@
public final class ParagraphKt {
ctor public ParagraphKt();
- method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
- method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints);
+ method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints);
}
public final class ParagraphStyle {
diff --git a/ui/ui-text/api/public_plus_experimental_current.txt b/ui/ui-text/api/public_plus_experimental_current.txt
index 6ae0cb5..cc3c2fd 100644
--- a/ui/ui-text/api/public_plus_experimental_current.txt
+++ b/ui/ui-text/api/public_plus_experimental_current.txt
@@ -285,8 +285,8 @@
}
public final class MultiParagraph {
- ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints);
- ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints);
+ ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
method public androidx.ui.text.style.TextDirection getBidiRunDirection(int offset);
method public androidx.ui.engine.geometry.Rect getBoundingBox(int offset);
method public androidx.ui.engine.geometry.Rect getCursorRect(int offset);
@@ -304,7 +304,7 @@
method public float getLineRight(int lineIndex);
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
- method public Integer? getMaxLines();
+ method public int getMaxLines();
method public float getMinIntrinsicWidth();
method public int getOffsetForPosition(androidx.ui.core.PxPosition position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
@@ -390,8 +390,8 @@
public final class ParagraphKt {
ctor public ParagraphKt();
- method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
- method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints);
+ method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints);
}
public final class ParagraphStyle {
diff --git a/ui/ui-text/api/restricted_0.1.0-dev04.txt b/ui/ui-text/api/restricted_0.1.0-dev04.txt
index ea4d2ab..17a559b 100644
--- a/ui/ui-text/api/restricted_0.1.0-dev04.txt
+++ b/ui/ui-text/api/restricted_0.1.0-dev04.txt
@@ -287,8 +287,8 @@
}
public final class MultiParagraph {
- ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints);
- ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints);
+ ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
method public androidx.ui.text.style.TextDirection getBidiRunDirection(int offset);
method public androidx.ui.engine.geometry.Rect getBoundingBox(int offset);
method public androidx.ui.engine.geometry.Rect getCursorRect(int offset);
@@ -306,7 +306,7 @@
method public float getLineRight(int lineIndex);
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
- method public Integer? getMaxLines();
+ method public int getMaxLines();
method public float getMinIntrinsicWidth();
method public int getOffsetForPosition(androidx.ui.core.PxPosition position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
@@ -392,8 +392,8 @@
public final class ParagraphKt {
ctor public ParagraphKt();
- method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
- method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints);
+ method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints);
}
public final class ParagraphStyle {
diff --git a/ui/ui-text/api/restricted_current.txt b/ui/ui-text/api/restricted_current.txt
index ea4d2ab..17a559b 100644
--- a/ui/ui-text/api/restricted_current.txt
+++ b/ui/ui-text/api/restricted_current.txt
@@ -287,8 +287,8 @@
}
public final class MultiParagraph {
- ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints);
- ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, Integer? maxLines, Boolean? ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ ctor public MultiParagraph(androidx.ui.text.MultiParagraphIntrinsics intrinsics, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints);
+ ctor public MultiParagraph(androidx.ui.text.AnnotatedString annotatedString, androidx.ui.text.TextStyle textStyle, androidx.ui.text.ParagraphStyle paragraphStyle, int maxLines, boolean ellipsis, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
method public androidx.ui.text.style.TextDirection getBidiRunDirection(int offset);
method public androidx.ui.engine.geometry.Rect getBoundingBox(int offset);
method public androidx.ui.engine.geometry.Rect getCursorRect(int offset);
@@ -306,7 +306,7 @@
method public float getLineRight(int lineIndex);
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
- method public Integer? getMaxLines();
+ method public int getMaxLines();
method public float getMinIntrinsicWidth();
method public int getOffsetForPosition(androidx.ui.core.PxPosition position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
@@ -392,8 +392,8 @@
public final class ParagraphKt {
ctor public ParagraphKt();
- method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
- method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, Integer? maxLines = null, Boolean? ellipsis = null, androidx.ui.text.ParagraphConstraints constraints);
+ method public static androidx.ui.text.Paragraph Paragraph(String text, androidx.ui.text.TextStyle style, androidx.ui.text.ParagraphStyle paragraphStyle, java.util.List<androidx.ui.text.AnnotatedString.Item<androidx.ui.text.SpanStyle>> spanStyles, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints, androidx.ui.core.Density density, androidx.ui.text.font.Font.ResourceLoader resourceLoader);
+ method public static androidx.ui.text.Paragraph Paragraph(androidx.ui.text.ParagraphIntrinsics paragraphIntrinsics, int maxLines = 2147483647, boolean ellipsis = false, androidx.ui.text.ParagraphConstraints constraints);
}
public final class ParagraphStyle {
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
index f2cc10b..c752feeb 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/MultiParagraphIntegrationTest.kt
@@ -1255,7 +1255,7 @@
text: String,
fontSize: TextUnit = TextUnit.Inherit,
paragraphStyle: ParagraphStyle = ParagraphStyle(),
- maxLines: Int? = null,
+ maxLines: Int = Int.MAX_VALUE,
width: Float = Float.MAX_VALUE
): MultiParagraph {
return MultiParagraph(
@@ -1279,7 +1279,7 @@
text: AnnotatedString,
fontSize: TextUnit = TextUnit.Inherit,
paragraphStyle: ParagraphStyle = ParagraphStyle(),
- maxLines: Int? = null,
+ maxLines: Int = Int.MAX_VALUE,
width: Float = Float.MAX_VALUE
): MultiParagraph {
return MultiParagraph(
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
index 786341b..972da82 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/ParagraphIntegrationTest.kt
@@ -3174,7 +3174,7 @@
textIndent: TextIndent? = null,
textAlign: TextAlign? = null,
fontSize: TextUnit = TextUnit.Inherit,
- maxLines: Int? = null,
+ maxLines: Int = Int.MAX_VALUE,
lineHeight: TextUnit = TextUnit.Inherit,
spanStyles: List<AnnotatedString.Item<SpanStyle>> = listOf(),
fontFamily: FontFamily = fontFamilyMeasureFont,
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
index cf1bf64..845d771 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/platform/AndroidParagraphTest.kt
@@ -1187,8 +1187,8 @@
textIndent: TextIndent? = null,
textAlign: TextAlign? = null,
textDirectionAlgorithm: TextDirectionAlgorithm? = TextDirectionAlgorithm.ContentOrLtr,
- ellipsis: Boolean? = null,
- maxLines: Int? = null,
+ ellipsis: Boolean = false,
+ maxLines: Int = Int.MAX_VALUE,
constraints: ParagraphConstraints,
textStyle: TextStyle? = null,
typefaceAdapter: TypefaceAdapter = TypefaceAdapter()
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/MultiParagraph.kt b/ui/ui-text/src/main/java/androidx/ui/text/MultiParagraph.kt
index 19c1da8..69e3d99 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/MultiParagraph.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/MultiParagraph.kt
@@ -38,8 +38,8 @@
*/
class MultiParagraph(
val intrinsics: MultiParagraphIntrinsics,
- val maxLines: Int? = null,
- ellipsis: Boolean? = null,
+ val maxLines: Int = DefaultMaxLines,
+ ellipsis: Boolean = false,
constraints: ParagraphConstraints
) {
@@ -62,8 +62,8 @@
annotatedString: AnnotatedString,
textStyle: TextStyle,
paragraphStyle: ParagraphStyle,
- maxLines: Int? = null,
- ellipsis: Boolean? = null,
+ maxLines: Int = Int.MAX_VALUE,
+ ellipsis: Boolean = false,
constraints: ParagraphConstraints,
density: Density,
resourceLoader: Font.ResourceLoader
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/Paragraph.kt b/ui/ui-text/src/main/java/androidx/ui/text/Paragraph.kt
index 43c9183..de38a6a 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/Paragraph.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/Paragraph.kt
@@ -26,6 +26,8 @@
import androidx.ui.text.platform.TypefaceAdapter
import androidx.ui.text.style.TextDirection
+internal const val DefaultMaxLines = Int.MAX_VALUE
+
/**
* A paragraph of text that is laid out.
*
@@ -221,8 +223,8 @@
style: TextStyle,
paragraphStyle: ParagraphStyle,
spanStyles: List<AnnotatedString.Item<SpanStyle>>,
- maxLines: Int? = null,
- ellipsis: Boolean? = null,
+ maxLines: Int = DefaultMaxLines,
+ ellipsis: Boolean = false,
constraints: ParagraphConstraints,
density: Density,
resourceLoader: Font.ResourceLoader
@@ -253,8 +255,8 @@
*/
/* actual */ fun Paragraph(
paragraphIntrinsics: ParagraphIntrinsics,
- maxLines: Int? = null,
- ellipsis: Boolean? = null,
+ maxLines: Int = DefaultMaxLines,
+ ellipsis: Boolean = false,
constraints: ParagraphConstraints
): Paragraph {
return AndroidParagraph(
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt
index 81cb0aa..7bcfd28 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/TextDelegate.kt
@@ -106,7 +106,7 @@
val text: AnnotatedString,
style: TextStyle? = null,
paragraphStyle: ParagraphStyle? = null,
- val maxLines: Int? = null,
+ val maxLines: Int = Int.MAX_VALUE,
val softWrap: Boolean = true,
val overflow: TextOverflow = TextOverflow.Clip,
val density: Density,
@@ -227,7 +227,7 @@
val lastBaseline: IntPx get() = assumeLayout { it.multiParagraph.lastBaseline.toIntPx() }
init {
- assert(maxLines == null || maxLines > 0)
+ assert(maxLines > 0)
}
fun layoutIntrinsics() {
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
index 9c6254f..9c6d3c8 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/platform/AndroidParagraph.kt
@@ -26,7 +26,6 @@
import androidx.text.LayoutCompat.DEFAULT_ALIGNMENT
import androidx.text.LayoutCompat.DEFAULT_JUSTIFICATION_MODE
import androidx.text.LayoutCompat.DEFAULT_LINESPACING_MULTIPLIER
-import androidx.text.LayoutCompat.DEFAULT_MAX_LINES
import androidx.text.LayoutCompat.JUSTIFICATION_MODE_INTER_WORD
import androidx.text.TextLayout
import androidx.text.selection.WordBoundary
@@ -51,8 +50,8 @@
*/
internal class AndroidParagraph constructor(
val paragraphIntrinsics: AndroidParagraphIntrinsics,
- val maxLines: Int?,
- val ellipsis: Boolean?,
+ val maxLines: Int,
+ val ellipsis: Boolean,
val constraints: ParagraphConstraints
) : Paragraph {
@@ -61,8 +60,8 @@
style: TextStyle,
paragraphStyle: ParagraphStyle,
spanStyles: List<AnnotatedString.Item<SpanStyle>>,
- maxLines: Int?,
- ellipsis: Boolean?,
+ maxLines: Int,
+ ellipsis: Boolean,
constraints: ParagraphConstraints,
typefaceAdapter: TypefaceAdapter,
density: Density
@@ -85,21 +84,18 @@
override val width: Float
init {
- maxLines?.let {
- require(it >= 1) { "maxLines should be greater than 0" }
- }
+ require(maxLines >= 1) { "maxLines should be greater than 0" }
val paragraphStyle = paragraphIntrinsics.paragraphStyle
val alignment = toLayoutAlign(paragraphStyle.textAlign)
- val maxLines = maxLines ?: DEFAULT_MAX_LINES
val justificationMode = when (paragraphStyle.textAlign) {
TextAlign.Justify -> JUSTIFICATION_MODE_INTER_WORD
else -> DEFAULT_JUSTIFICATION_MODE
}
- val ellipsize = if (ellipsis == true) {
+ val ellipsize = if (ellipsis) {
TextUtils.TruncateAt.END
} else {
null
@@ -124,10 +120,7 @@
override val height: Float
get() = layout.let {
val lineCount = it.lineCount
- if (maxLines != null &&
- maxLines >= 0 &&
- maxLines < lineCount
- ) {
+ if (maxLines < lineCount) {
it.getLineBottom(maxLines - 1)
} else {
it.height.toFloat()
@@ -144,7 +137,7 @@
get() = layout.getLineBaseline(0)
override val lastBaseline: Float
- get() = if (maxLines != null && maxLines in 0 until lineCount) {
+ get() = if (maxLines < lineCount) {
layout.getLineBaseline(maxLines - 1)
} else {
layout.getLineBaseline(lineCount - 1)
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt
index 4a8153d..23b0dc2 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextDelegateTest.kt
@@ -42,7 +42,7 @@
layoutDirection = LayoutDirection.Ltr
)
- assertThat(textDelegate.maxLines).isNull()
+ assertThat(textDelegate.maxLines).isEqualTo(Int.MAX_VALUE)
assertThat(textDelegate.overflow).isEqualTo(TextOverflow.Clip)
}