Notification.ProgressStyle.Segment


public static final class Notification.ProgressStyle.Segment
extends Object

java.lang.Object
   ↳ android.app.Notification.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(int length)

Create a segment with a non-zero length.

Public methods

boolean equals(Object o)

Needed for ERROR(Notification.Style.areNotificationsVisiblyDifferent/android.app.Notification.Style#areNotificationsVisiblyDifferent Notification.Style.areNotificationsVisiblyDifferent)

int getColor()

Returns the color of this Segment.

int getId()

Gets the id of this Segment.

int getLength()

The length of this Segment within the progress bar.

int hashCode()

Returns a hash code value for the object.

Notification.ProgressStyle.Segment setColor(int color)

Optional color of this Segment

Notification.ProgressStyle.Segment setId(int id)

Optional ID used to uniquely identify the element across updates.

Inherited methods

Public constructors

Segment

public Segment (int length)

Create a segment with a non-zero length.

Parameters
length int: See getLength()

Public methods

equals

public boolean equals (Object o)

Needed for ERROR(Notification.Style.areNotificationsVisiblyDifferent/android.app.Notification.Style#areNotificationsVisiblyDifferent Notification.Style.areNotificationsVisiblyDifferent)

Parameters
o Object: the reference object with which to compare.

Returns
boolean true if this object is the same as the obj argument; false otherwise.

getColor

public int getColor ()

Returns the color of this Segment.

Returns
int

See also:

getId

public int getId ()

Gets the id of this Segment.

Returns
int

See also:

getLength

public 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 ProgressStyle.setProgress.

Returns
int

hashCode

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

Returns
int a hash code value for this object.

setColor

public Notification.ProgressStyle.Segment setColor (int color)

Optional color of this Segment

Parameters
color int

Returns
Notification.ProgressStyle.Segment This value cannot be null.

setId

public Notification.ProgressStyle.Segment setId (int id)

Optional ID used to uniquely identify the element across updates.

Parameters
id int

Returns
Notification.ProgressStyle.Segment This value cannot be null.