LayoutStringKt

Added in 1.3.0-alpha05

public final class LayoutStringKt


Summary

Public methods

static final @NonNull TypeBuilders.StringLayoutConstraint
@RequiresSchemaVersion(major = 1, minor = 200)
asLayoutConstraint(@NonNull String receiver, int alignment)

Extension for creating a StringLayoutConstraint from a String.

static final @NonNull LayoutString
@RequiresSchemaVersion(major = 1, minor = 200)
asLayoutString(
    @NonNull DynamicBuilders.DynamicString receiver,
    @NonNull String staticValue,
    @NonNull TypeBuilders.StringLayoutConstraint layoutConstraint
)

Extension for creating a LayoutString from a DynamicString

static final @NonNull LayoutString

Extension for creating a LayoutString from a String.

static final @NonNull TypeBuilders.StringLayoutConstraint
@RequiresSchemaVersion(major = 1, minor = 200)
stringLayoutConstraint(@NonNull String longestPattern, int alignment)

Specifies layout constraints for to use for layout measurement in presence of dynamic values.

Public methods

asLayoutConstraint

@RequiresSchemaVersion(major = 1, minor = 200)
public static final @NonNull TypeBuilders.StringLayoutConstraint asLayoutConstraint(@NonNull String receiver, int alignment)

Extension for creating a StringLayoutConstraint from a String. this will be used as longestPattern.

Parameters
int alignment

the alignment of the actual text within the space reserved by longestPattern

@RequiresSchemaVersion(major = 1, minor = 200)
public static final @NonNull LayoutString asLayoutString(
    @NonNull DynamicBuilders.DynamicString receiver,
    @NonNull String staticValue,
    @NonNull TypeBuilders.StringLayoutConstraint layoutConstraint
)

Extension for creating a LayoutString from a DynamicString

Parameters
@NonNull String staticValue

the static value that can be used when the dynamicValue can't be resolved.

@NonNull TypeBuilders.StringLayoutConstraint layoutConstraint

used to correctly measure layout Text element size and align text to ensure that the layout is of a known size during the layout pass regardless of the dynamicValue String.

public static final @NonNull LayoutString getLayoutString(@NonNull String receiver)

Extension for creating a LayoutString from a String.

stringLayoutConstraint

@RequiresSchemaVersion(major = 1, minor = 200)
public static final @NonNull TypeBuilders.StringLayoutConstraint stringLayoutConstraint(@NonNull String longestPattern, int alignment)

Specifies layout constraints for to use for layout measurement in presence of dynamic values.

Parameters
@NonNull String longestPattern

the text string to use as the pattern for the (graphically) longest text that can be laid out. Used to ensure that the layout is of a known size during the layout pass.

int alignment

the alignment of the actual text within the space reserved by longestPattern