NotificationCompat.ProgressStyle.Segment


public final class NotificationCompat.ProgressStyle.Segment


A segment of the progress bar, which defines its length and color. Segments allow for creating progress bars with multiple colors or sections to represent different stages or categories of progress. For example, Traffic conditions along a navigation journey.

Summary

Public constructors

Segment(@IntRange(from = 1) int length)

Create a segment with a non-zero length.

Public methods

@ColorInt int

Returns the color of this Segment.

int

Gets the id of this Segment.

@IntRange(from = 1) int

The length of this Segment within the progress bar.

@NonNull NotificationCompat.ProgressStyle.Segment
setColor(@ColorInt int color)

Optional color of this Segment

@NonNull NotificationCompat.ProgressStyle.Segment
setId(int id)

Optional ID used to uniquely identify the element across updates.

Public constructors

Segment

public Segment(@IntRange(from = 1) int length)

Create a segment with a non-zero length.

Parameters
@IntRange(from = 1) int length

See getLength

Public methods

getColor

public @ColorInt int getColor()

Returns the color of this Segment.

See also
setColor
COLOR_DEFAULT

for the default visual behavior when it is not set.

getId

public int getId()

Gets the id of this Segment.

See also
setId

getLength

public @IntRange(from = 1) int getLength()

The length of this Segment within the progress bar. This value has no units, it is just relative to the length of other segments, and the value provided to setProgress.

setColor

public @NonNull NotificationCompat.ProgressStyle.Segment setColor(@ColorInt int color)

Optional color of this Segment

setId

public @NonNull NotificationCompat.ProgressStyle.Segment setId(int id)

Optional ID used to uniquely identify the element across updates. The default is 0.