EnergyLevel.Builder

public static final class EnergyLevel.Builder
extends Object

java.lang.Object
   ↳ androidx.car.app.hardware.info.EnergyLevel.Builder


A builder of EnergyLevel.

Summary

Public constructors

Builder()

Public methods

EnergyLevel build()

Constructs the EnergyLevel defined by this builder.

EnergyLevel.Builder setBatteryPercent(CarValue<Float> batteryPercent)

Sets the remaining batter percentage.

EnergyLevel.Builder setDistanceDisplayUnit(CarValue<Integer> distanceDisplayUnit)

Sets the distance display unit.

EnergyLevel.Builder setEnergyIsLow(CarValue<Boolean> energyIsLow)

Sets if the remaining energy is low.

EnergyLevel.Builder setFuelPercent(CarValue<Float> fuelPercent)

Sets the remaining fuel percentage.

EnergyLevel.Builder setRangeRemainingMeters(CarValue<Float> rangeRemainingMeters)

Sets the range of the remaining fuel in meters.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public EnergyLevel build ()

Constructs the EnergyLevel defined by this builder.

Returns
EnergyLevel

setBatteryPercent

public EnergyLevel.Builder setBatteryPercent (CarValue<Float> batteryPercent)

Sets the remaining batter percentage.

Parameters
batteryPercent CarValue

Returns
EnergyLevel.Builder

setDistanceDisplayUnit

public EnergyLevel.Builder setDistanceDisplayUnit (CarValue<Integer> distanceDisplayUnit)

Sets the distance display unit.

Valid values are in CarUnit.

Parameters
distanceDisplayUnit CarValue

Returns
EnergyLevel.Builder

Throws
NullPointerException if distanceDisplayUnit is null

setEnergyIsLow

public EnergyLevel.Builder setEnergyIsLow (CarValue<Boolean> energyIsLow)

Sets if the remaining energy is low.

Parameters
energyIsLow CarValue

Returns
EnergyLevel.Builder

Throws
NullPointerException if energyIsLow is null

setFuelPercent

public EnergyLevel.Builder setFuelPercent (CarValue<Float> fuelPercent)

Sets the remaining fuel percentage.

Parameters
fuelPercent CarValue

Returns
EnergyLevel.Builder

Throws
NullPointerException if fuelPercent is null

setRangeRemainingMeters

public EnergyLevel.Builder setRangeRemainingMeters (CarValue<Float> rangeRemainingMeters)

Sets the range of the remaining fuel in meters.

Parameters
rangeRemainingMeters CarValue

Returns
EnergyLevel.Builder

Throws
NullPointerException if rangeRemaining is null