Skip to content

1.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 27 Dec 23:16
· 210 commits to trunk since this release

Added

  • AutoLengthFormatter class. Use it to format lengths using resources defined in the library based on a unit.
  • FlooredLengthFormatter class. Use it to floor a length unit quantities and format them using resources defined in the library.
  • AutoFitLengthConverter class. Use it to convert lengths to different lengths a best fitting units based on Length.withAutoUnit() and unit coercion.
  • LengthFormatter.Factory interface. Use it to install custom formatters in Ruler.
  • LengthConverter.Factory interface. Use it to install custom converters in Ruler.
  • Distance.abs() and Length.abs() methods.
  • Ruler implements now LengthConverter and LengthFormatter.

Changed

  • Distance and Length throw now ArithmeticException in case of failures due to overflows or math operations.
  • Distance.exactTotalMeters property name to meters.
  • LengthUnit is no longer an interface. It is now a sealed class with two implementations – SiLengthUnit and ImperialLengthUnit.
  • LengthUnit is no longer Iterable. It exposes now units property.
  • Custom LengthFormatters must be now installed using LengthFormatter.Factory interface and Ruler.addFormatterFactory() method.
  • LengthFormatter to a functional interface.
  • LengthFormatter can no longer return null.
  • Length no longer changes units automatically based on Locale during formatting.
  • Order of arguments in LengthFormatter.format() method.
  • ImperialLengthFormatter substitutes ImperialDistanceFormatter. It offers a more unified API without bloated configurability.
  • Custom LengthConverters must be now installed using LengthConverter.Factory interface and Ruler.addConverterFactory() method.
  • LengthConverter to a functional interface.
  • LengthConverter can no longer return null.
  • Upgrade to Kotlin 1.4.21.

Removed

  • Explicit Java support with @Jvm* annotations.
  • Distance.metersPart and Distance.nanosPart properties.
  • Distance.create(meters, nanometers) method.
  • Distance.format() and Distance.formatFloored() overloads that accept LengthUnit.
  • Ruler.flooredFormatters property. Flooring is now available solely via FlooredLengthFormatter.

Fixed

  • Wrong lower meter bound of Miles unit.
  • Wrong name of an argument in Length.div() methods.
  • Imperial formatting not handling negative distances.