diff --git a/core/i18n/src/main/res/values/units.xml b/core/i18n/src/main/res/values/units.xml
index d80ac70c8..9281e8609 100644
--- a/core/i18n/src/main/res/values/units.xml
+++ b/core/i18n/src/main/res/values/units.xml
@@ -43,6 +43,16 @@
- millimeter
- millimeters
+ nm
+
+ - nanometer
+ - nanometers
+
+ pm
+
+ - picometer
+ - picometers
+
in
- inch
@@ -68,6 +78,11 @@
- nautical mile
- nautical miles
+ lP
+
+ - Planck
+ - Planck
+
m²
@@ -145,6 +160,11 @@
- year
- years
+ tP
+
+ - Planck time
+ - Planck time
+
B
@@ -278,6 +298,11 @@
- short ton
- short tons
+ mP
+
+ - Planck mass
+ - Planck mass
+
°C
@@ -294,4 +319,9 @@
- kelvin
- kelvins
-
\ No newline at end of file
+ TP
+
+ - Planck temperature
+ - Planck temperature
+
+
diff --git a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/LengthConverter.kt b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/LengthConverter.kt
index d25a8cea7..18e28398d 100644
--- a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/LengthConverter.kt
+++ b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/LengthConverter.kt
@@ -33,6 +33,16 @@ internal class LengthConverter(context: Context) : SimpleFactorConverter() {
context.getString(R.string.unit_millimeter_symbol),
R.plurals.unit_millimeter
),
+ MeasureUnitWithFactor(
+ 1000_000.0,
+ context.getString(R.string.unit_nanometer_symbol),
+ R.plurals.unit_nanometer
+ ),
+ MeasureUnitWithFactor(
+ 1_000_000_000.0,
+ context.getString(R.string.unit_picometer_symbol),
+ R.plurals.unit_picometer
+ ),
MeasureUnitWithFactor(
100 / 2.54,
context.getString(R.string.unit_inch_symbol),
@@ -57,6 +67,11 @@ internal class LengthConverter(context: Context) : SimpleFactorConverter() {
1 / 1852.0,
context.getString(R.string.unit_nautic_mile_symbol),
R.plurals.unit_nautic_mile
+ ),
+ MeasureUnitWithFactor(
+ 1.616255e-35,
+ context.getString(R.string.unit_planck_distance_symbol),
+ R.plurals.unit_planck_distance
)
)
diff --git a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/MassConverter.kt b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/MassConverter.kt
index 8b73fbbf1..1f82ff439 100644
--- a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/MassConverter.kt
+++ b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/MassConverter.kt
@@ -47,6 +47,11 @@ internal class MassConverter(context: Context): SimpleFactorConverter() {
1000.0 / (453.59237 * 2000.0),
context.getString(R.string.unit_short_ton_symbol),
R.plurals.unit_short_ton
+ ),
+ MeasureUnitWithFactor(
+ 2.176434e-8,
+ context.getString(R.string.unit_planck_mass_symbol),
+ R.plurals.unit_planck_mass
)
)
diff --git a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TemperatureConverter.kt b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TemperatureConverter.kt
index 3712a0b59..85cce177b 100644
--- a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TemperatureConverter.kt
+++ b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TemperatureConverter.kt
@@ -23,6 +23,11 @@ internal class TemperatureConverter(context: Context) : Converter {
R.plurals.unit_kelvin,
TemperatureUnit.Kelvin
),
+ TemperatureMeasureUnit(
+ context.getString(R.string.unit_planck_temperature_symbol),
+ R.plurals.unit_planck_temperature,
+ TemperatureUnit.Planck
+ )
)
override suspend fun isValidUnit(symbol: String): Boolean {
@@ -91,13 +96,32 @@ internal class TemperatureConverter(context: Context) : Converter {
if (from === TemperatureUnit.DegreeFahrenheit && to == TemperatureUnit.DegreeCelsius) {
return (value - 32.0) * (5.0 / 9.0)
}
-
if (from === TemperatureUnit.Kelvin && to == TemperatureUnit.DegreeFahrenheit) {
return (value - 273.15) * (9.0 / 5.0) + 32.0
}
if (from === TemperatureUnit.DegreeFahrenheit && to == TemperatureUnit.Kelvin) {
return (value - 32.0) * (5.0 / 9.0) + 273.15
}
+ if (from === TemperatureUnit.Kelvin && to == TemperatureUnit.Planck) {
+ return value * 1.416833e32
+ }
+ if (from === TemperatureUnit.Planck && to == TemperatureUnit.Kelvin) {
+ return value / 1.416833e32
+ }
+ if (from === TemperatureUnit.DegreeCelsius && to == TemperatureUnit.Planck) {
+ return (value - 273.15) * 1.416833e32
+ }
+ if (from === TemperatureUnit.Planck && to == TemperatureUnit.DegreeCelsius) {
+ return value / 1.416833e32 + 273.15
+ }
+ if (from === TemperatureUnit.DegreeFahrenheit && to == TemperatureUnit.Planck) {
+ return ((value - 32.0) * (5.0 / 9.0) + 273.15) * 1.416833e32
+ }
+ if (from === TemperatureUnit.Planck && to == TemperatureUnit.DegreeFahrenheit) {
+ return ((value / 1.416833e32) - 273.15) * (9.0 / 5.0) + 32.0
+ }
+
+
throw IllegalArgumentException()
}
@@ -120,4 +144,5 @@ enum class TemperatureUnit {
DegreeCelsius,
DegreeFahrenheit,
Kelvin,
+ Planck,
}
\ No newline at end of file
diff --git a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TimeConverter.kt b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TimeConverter.kt
index 2485d3d3e..d763f4a4e 100644
--- a/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TimeConverter.kt
+++ b/data/unitconverter/src/main/java/de/mm20/launcher2/unitconverter/converters/TimeConverter.kt
@@ -37,6 +37,11 @@ internal class TimeConverter(context: Context) : SimpleFactorConverter() {
1.0 / (60 * 60 * 24 * 365),
context.getString(R.string.unit_year_symbol),
R.plurals.unit_year
+ ),
+ MeasureUnitWithFactor(
+ 5.391247e-44,
+ context.getString(R.string.unit_planck_time_symbol),
+ R.plurals.unit_planck_time
)
)