Changelog¶
All notable changes to this project will be documented in this document.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
Unreleased¶
Changed¶
- Upgrade to Kotlin
1.6.10
. - Upgrade to Startup
1.1.0
.
2.0.2 - 2021-06-27¶
Changed¶
- Upgrade to Kotlin
1.5.20
.
2.0.1 - 2021-05-04¶
Changed¶
- Upgrade to Kotlin
1.5.0
.
2.0.0 - 2020-12-31¶
Added¶
Distance.format()
andLength.format()
that do not require specifyingandroid.content.Context
. This a part of a large overhaul of this library. SeeChanged
section for more information.Distance.Epsilon
constant that represents smallest possible change in ofDistance
.LengthUnits.bounds
property to the public API. It holds min and max distances that only that unit can represent as a natural count of self.Length.withFittingUnit(units, fitter)
that selects the best unit for a length using supplied units and fitting algorithm. A complementaryUnitFitter
interface is added along withInRangeUnitFitter
andLogDistanceUnitFitter
implementations.- New SI units – centimeters, decimeters, decameters and hectometers.
Length.roundDown()
to get a length with whole unit count rounded towards 0.Measure
class to model a distance normalized to a unit.io.mehow.ruler:android-ruler-startup
artifact to initialize Ruler automatically with Android formatting rules.
Changed¶
- Complete redesign of the formatting part of this library. Formatting is now a part of the JVM
io.mehow.ruler:ruler
artifacts. It allows to plug different formatting contexts such as the one from Android.io.mehow.ruler:ruler-android
artifact is now much smaller and provides only default implementations that can be enabled at runtime. As a part of this redesign most of formatting classes are moved toio.mehow.ruler.format
package. For more details check the API documentation. - Added one nanometer to
Distance.Min
. This change was made in order to makeDistance.abs()
operation safe. - Distance and length formatting use better mechanisms. Instead of custom parsing it relies on
java.text
orandroid.icu
packages. Length.measure
is now ofMeasure
type.ImperialLengthFormatter
rounds smallest unit part instead of dropping the fraction.
Removed¶
- Duplicated Android resources. Formatting relies now on a single pattern and translated units.
- Android resource for formatting negative imperial lengths. It is now handled automatically by generic formatting mechanism.
Ruler.removeConverter()
in favour ofLength.removeConverterFactory()
.Length.withAutoUnit()
in favour ofLength.withFittingUnit()
with default arguments.FlooredLengthFormatter
and floored formatting mechanism. Formatting with a custom fractional precision should be used instead.
Fixed¶
LengthUnit
returning false-negative when negative distance was checked if it is contained in a unit.
1.0.0 - 2020-12-28¶
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 onLength.withAutoUnit()
and unit coercion.LengthFormatter.Factory
interface. Use it to install custom formatters inRuler
.LengthConverter.Factory
interface. Use it to install custom converters inRuler
.Distance.abs()
andLength.abs()
methods.Ruler
implements nowLengthConverter
andLengthFormatter
.
Changed¶
Distance
andLength
throw nowArithmeticException
in case of failures due to overflows or math operations.Distance.exactTotalMeters
property name tometers
.LengthUnit
is no longer an interface. It is now a sealed class with two implementations –SiLengthUnit
andImperialLengthUnit
.LengthUnit
is no longerIterable
. It exposes nowunits
property.- Custom
LengthFormatter
s must be now installed usingLengthFormatter.Factory
interface andRuler.addFormatterFactory()
method. LengthFormatter
to a functional interface.LengthFormatter
can no longer returnnull
.Length
no longer changes units automatically based onLocale
during formatting.- Order of arguments in
LengthFormatter.format()
method. ImperialLengthFormatter
substitutesImperialDistanceFormatter
. It offers a more unified API without bloated configurability.- Custom
LengthConverter
s must be now installed usingLengthConverter.Factory
interface andRuler.addConverterFactory()
method. LengthConverter
to a functional interface.LengthConverter
can no longer returnnull
.- Upgrade to Kotlin
1.4.21
.
Removed¶
- Explicit Java support with
@Jvm*
annotations. Distance.metersPart
andDistance.nanosPart
properties.Distance.create(meters, nanometers)
method.Distance.format()
andDistance.formatFloored()
overloads that acceptLengthUnit
.Ruler.flooredFormatters
property. Flooring is now available solely viaFlooredLengthFormatter
.
Fixed¶
- Wrong lower meter bound of
Miles
unit. - Wrong name of an argument in
Length.div()
methods. - Imperial formatting not handling negative distances.
0.6.0 - 2020-11-11¶
Added¶
meterRatio
property toLengthUnit
interface.contains
function toLengthUnit
interface. This allows to usein
sugar syntax.
Changed¶
io.mehow.ruler:android
toio.mehow.ruler:ruler-android
artifact.- Changelog format follows now Keep a Changelog format. Format is applied retroactively to this file.
Length.measureLength
property tomeasure
.Distance.min
,Distance.zero
andDistance.max
respectively toDistance.Min
,Distance.Zero
andDistance.Max
. They are now available as fields from Java.ImperialDistanceFormatter.basic
andImperialDistanceFormatter.full
toImperialDistanceFormatter.Basic
andImperialDistanceFormatter.Full
respectively.- Upgrade to Kotlin
1.4.10
.
Removed¶
toDistance()
methods fromLengthUnit
interface.-Xjvm-default=enable
compiler argument is no longer required.toMeasuredLength()
function fromLengthUnit
interface.appliesRangeTo()
function fromLengthUnit
interface.
0.5.3 - 2020-06-14¶
Changed¶
- Upgrade to Kotlin
1.3.72
.
Fixed¶
- Long to double conversion when computing distances.
0.5.2 - 2020-04-15¶
Added¶
- Arabic language support.
Fixed¶
- Fix a bug with no inches displayed for 0 length.
0.5.1 - 2020-03-01¶
Removed¶
- Remove
totalMeters
property fromDistance
that approximates it.
Fixed¶
- Fix wrong unit displayed for feet.
0.5.0 - 2020-02-29¶
Added¶
- Support for floored formatting of any length units.
- Allow to set globally if UK should use imperial or SI units.
0.4.1 - 2020-02-07¶
Added¶
- Support for negative distances.
- Support for floored SI unit lengths formatting. It displays only whole parts of a unit.
0.4.0 - 2020-02-05¶
Added¶
Ruler
class as a central point for distance and length formatting.- Imperial unit formatter. It allows to display measurements in a imperial-friendly format. For example
105ft 12in
.
0.3.2 2020-02-03¶
Fixed¶
- Fix issue with high precision Float and Double multiplication.
0.3.1 - 2020-02-03¶
Fixed¶
- Make library JDK 7 compatible.
0.3.0 - 2020-02-03¶
Added¶
- Add
Distance
(oldLength
) formatter for Android. - Add basic math operators like multiplication and division.
- Add Double factories to
Distance
(oldLength
).
Changed¶
- Swap names of
Distance
andLength
classes. - Use Long as an underlying
Distance
primitive. It is more suitable for application that have UI interaction and distance of ~975 light years seems sufficient for most day-to-day applications.
0.2.0 - 2020-02-03¶
Changed¶
DistanceUnitCoercer
changed toDistanceConverter
.Distance
constructor is no longer public.length
inDistance
is no longer public.meters
andnanometers
properties renamed respectively tometersPart
andnanometersParts
inLength
class.
0.1.0 - 2020-02-02¶
- Initial release.