Status.Builder


public final class Status.Builder


Helper to Build OngoingActivityStatus instances. Templates can be specified, to specify how to render the parts and any surrounding text/format. If no template is specified, a default template that concatenates all parts separated by space is used.

Summary

Public constructors

Public methods

@NonNull Status.Builder

Add a part to be inserted in the placeholders.

@NonNull Status.Builder

Add a template to use for this status.

@NonNull Status

Build an OngoingActivityStatus with the given parameters.

Public constructors

Builder

Added in 1.0.0
public Builder()

Public methods

addPart

Added in 1.0.0
public @NonNull Status.Builder addPart(@NonNull String name, @NonNull Status.Part part)

Add a part to be inserted in the placeholders.

Parameters
@NonNull String name

the name of this part. In the template, use this name surrounded by '#' to reference it, e.g. here "track" and in the template "#track#"

@NonNull Status.Part part

The part that will be rendered in the specified position/s in the template.

Returns
@NonNull Status.Builder

this builder, to chain calls.

addTemplate

Added in 1.0.0
public @NonNull Status.Builder addTemplate(@NonNull CharSequence template)

Add a template to use for this status. Placeholders can be defined with #name# To produce a '#', use '##' in the template. If multiple templates are specified, the first one (in the order they where added by calling this method) that has all required fields is used. If no template is specified, a default template that concatenates all parts separated by space is used.

Parameters
@NonNull CharSequence template

the template to be added

Returns
@NonNull Status.Builder

this builder, to chain calls.

build

Added in 1.0.0
public @NonNull Status build()

Build an OngoingActivityStatus with the given parameters.

Returns
@NonNull Status

the built OngoingActivityStatus