diff --git a/core/base/src/main/res/values/strings.xml b/core/base/src/main/res/values/strings.xml
index f459056f..8f2d9572 100644
--- a/core/base/src/main/res/values/strings.xml
+++ b/core/base/src/main/res/values/strings.xml
@@ -1161,6 +1161,45 @@
Gallon/second (Imperial)
gal/s
+
+ Candela/square meter
+ cd/m^2
+ Candela/square centimeter
+ cd/cm^2
+ Candela/square foot
+ cd/ft^2
+ Candela/square inch
+ cd/in^2
+ Kilocandela/square meter
+ kcd
+ Stilb
+ sb
+ Lumen/square meter/steradian
+ lm/m^2/sr
+ Lumen/square centimeter/steradian
+ lm/cm^2/sr
+ Lumen/square foot/steradian
+ lm/ft^2/sr
+ Watt/square centimeter/steradian
+ W/cm^2/sr
+ Nit
+ nt
+ Millinit
+ mnt
+ Lambert
+ L
+ Millilambert
+ mL
+ Foot-lambert
+ fL
+ Apostilb
+ asb
+ Blondel
+ blondel
+ Bril
+ bril
+ Skot
+ sk
Length
@@ -1185,6 +1224,7 @@
Force
Torque
Flow
+ Luminance
Convert from
diff --git a/data/model/src/main/java/com/sadellie/unitto/data/model/UnitGroup.kt b/data/model/src/main/java/com/sadellie/unitto/data/model/UnitGroup.kt
index 4fe452a9..2bb22212 100644
--- a/data/model/src/main/java/com/sadellie/unitto/data/model/UnitGroup.kt
+++ b/data/model/src/main/java/com/sadellie/unitto/data/model/UnitGroup.kt
@@ -53,4 +53,5 @@ enum class UnitGroup(
FORCE(res = R.string.force),
TORQUE(res = R.string.torque),
FLOW_RATE(res = R.string.flow_rate),
+ LUMINANCE(res = R.string.luminance),
}
diff --git a/data/units/src/main/java/com/sadellie/unitto/data/units/AllUnitsRepository.kt b/data/units/src/main/java/com/sadellie/unitto/data/units/AllUnitsRepository.kt
index 0af1420b..38db7531 100644
--- a/data/units/src/main/java/com/sadellie/unitto/data/units/AllUnitsRepository.kt
+++ b/data/units/src/main/java/com/sadellie/unitto/data/units/AllUnitsRepository.kt
@@ -36,6 +36,7 @@ import com.sadellie.unitto.data.units.collections.flowRateCollection
import com.sadellie.unitto.data.units.collections.fluxCollection
import com.sadellie.unitto.data.units.collections.forceCollection
import com.sadellie.unitto.data.units.collections.lengthCollection
+import com.sadellie.unitto.data.units.collections.luminanceCollection
import com.sadellie.unitto.data.units.collections.massCollection
import com.sadellie.unitto.data.units.collections.numberBaseCollection
import com.sadellie.unitto.data.units.collections.powerCollection
diff --git a/data/units/src/main/java/com/sadellie/unitto/data/units/MyUnitIDS.kt b/data/units/src/main/java/com/sadellie/unitto/data/units/MyUnitIDS.kt
index 0b3e5f39..686b4149 100644
--- a/data/units/src/main/java/com/sadellie/unitto/data/units/MyUnitIDS.kt
+++ b/data/units/src/main/java/com/sadellie/unitto/data/units/MyUnitIDS.kt
@@ -616,4 +616,25 @@ object MyUnitIDS {
const val gallons_per_hour_imperial = "gallons_per_hour_imperial"
const val gallons_per_minute_imperial = "gallons_per_minute_imperial"
const val gallons_per_second_imperial = "gallons_per_second_imperial"
+
+ // LUMINANCE
+ const val candela_per_square_meter = "candela_per_square_meter"
+ const val candela_per_square_centimeter = "candela_per_square_centimeter"
+ const val candela_per_square_foot = "candela_per_square_foot"
+ const val candela_per_square_inch = "candela_per_square_inch"
+ const val kilocandela_per_square_meter = "kilocandela_per_square_meter"
+ const val stilb = "stilb"
+ const val lumen_per_square_meter_per_steradian = "lumen_per_square_meter_per_steradian"
+ const val lumen_per_square_centimeter_per_steradian = "lumen_per_square_centimeter_per_steradian"
+ const val lumen_per_square_foot_per_steradian = "lumen_per_square_foot_per_steradian"
+ const val watt_per_square_centimeter_per_steradian = "watt_per_square_centimeter_per_steradian"
+ const val nit = "nit"
+ const val millinit = "millinit"
+ const val lambert = "lambert"
+ const val millilambert = "millilambert"
+ const val foot_lambert = "foot_lambert"
+ const val apostilb = "apostilb"
+ const val blondel = "blondel"
+ const val bril = "bril"
+ const val skot = "skot"
}
diff --git a/data/units/src/main/java/com/sadellie/unitto/data/units/collections/Luminance.kt b/data/units/src/main/java/com/sadellie/unitto/data/units/collections/Luminance.kt
new file mode 100644
index 00000000..d7b88328
--- /dev/null
+++ b/data/units/src/main/java/com/sadellie/unitto/data/units/collections/Luminance.kt
@@ -0,0 +1,50 @@
+/*
+ * Unitto is a unit converter for Android
+ * Copyright (c) 2023 Elshan Agaev
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.sadellie.unitto.data.units.collections
+
+import com.sadellie.unitto.data.model.AbstractUnit
+import com.sadellie.unitto.data.model.DefaultUnit
+import com.sadellie.unitto.data.model.UnitGroup
+import com.sadellie.unitto.data.units.MyUnitIDS
+import com.sadellie.unitto.data.units.R
+import java.math.BigDecimal
+
+val luminanceCollection: List by lazy {
+ listOf(
+ DefaultUnit(MyUnitIDS.candela_per_square_meter, BigDecimal.valueOf(31415926.5359), UnitGroup.LUMINANCE, R.string.candela_per_square_meter, R.string.candela_per_square_meter_short),
+ DefaultUnit(MyUnitIDS.candela_per_square_centimeter, BigDecimal.valueOf(314159265359), UnitGroup.LUMINANCE, R.string.candela_per_square_centimeter, R.string.candela_per_square_centimeter_short),
+ DefaultUnit(MyUnitIDS.candela_per_square_foot, BigDecimal.valueOf(338158218.89), UnitGroup.LUMINANCE, R.string.candela_per_square_foot, R.string.candela_per_square_foot_short),
+ DefaultUnit(MyUnitIDS.candela_per_square_inch, BigDecimal.valueOf(48694783520), UnitGroup.LUMINANCE, R.string.candela_per_square_inch, R.string.candela_per_square_inch_short),
+ DefaultUnit(MyUnitIDS.kilocandela_per_square_meter, BigDecimal.valueOf(31415926535.9), UnitGroup.LUMINANCE, R.string.kilocandela_per_square_meter, R.string.kilocandela_per_square_meter_short),
+ DefaultUnit(MyUnitIDS.stilb, BigDecimal.valueOf(314159265359), UnitGroup.LUMINANCE, R.string.stilb, R.string.stilb_short),
+ DefaultUnit(MyUnitIDS.lumen_per_square_meter_per_steradian, BigDecimal.valueOf(31415926.5359), UnitGroup.LUMINANCE, R.string.lumen_per_square_meter_per_steradian, R.string.lumen_per_square_meter_per_steradian_short),
+ DefaultUnit(MyUnitIDS.lumen_per_square_centimeter_per_steradian, BigDecimal.valueOf(314159265359), UnitGroup.LUMINANCE, R.string.lumen_per_square_centimeter_per_steradian, R.string.lumen_per_square_centimeter_per_steradian_short),
+ DefaultUnit(MyUnitIDS.lumen_per_square_foot_per_steradian, BigDecimal.valueOf(338158218.89), UnitGroup.LUMINANCE, R.string.lumen_per_square_foot_per_steradian, R.string.lumen_per_square_foot_per_steradian_short),
+ DefaultUnit(MyUnitIDS.watt_per_square_centimeter_per_steradian, BigDecimal.valueOf(214570778240185), UnitGroup.LUMINANCE, R.string.watt_per_square_centimeter_per_steradian, R.string.watt_per_square_centimeter_per_steradian_short),
+ DefaultUnit(MyUnitIDS.nit, BigDecimal.valueOf(31415926.5359), UnitGroup.LUMINANCE, R.string.nit, R.string.nit_short),
+ DefaultUnit(MyUnitIDS.millinit, BigDecimal.valueOf(31415.9265359), UnitGroup.LUMINANCE, R.string.millinit, R.string.millinit_short),
+ DefaultUnit(MyUnitIDS.lambert, BigDecimal.valueOf(100000000000), UnitGroup.LUMINANCE, R.string.lambert, R.string.lambert_short),
+ DefaultUnit(MyUnitIDS.millilambert, BigDecimal.valueOf(100000000), UnitGroup.LUMINANCE, R.string.millilambert, R.string.millilambert_short),
+ DefaultUnit(MyUnitIDS.foot_lambert, BigDecimal.valueOf(107639104.167), UnitGroup.LUMINANCE, R.string.foot_lambert, R.string.foot_lambert_short),
+ DefaultUnit(MyUnitIDS.apostilb, BigDecimal.valueOf(10000000), UnitGroup.LUMINANCE, R.string.apostilb, R.string.apostilb_short),
+ DefaultUnit(MyUnitIDS.blondel, BigDecimal.valueOf(10000000), UnitGroup.LUMINANCE, R.string.blondel, R.string.blondel_short),
+ DefaultUnit(MyUnitIDS.skot, BigDecimal.valueOf(10000), UnitGroup.LUMINANCE, R.string.skot, R.string.skot_short),
+ DefaultUnit(MyUnitIDS.bril, BigDecimal.valueOf(1), UnitGroup.LUMINANCE, R.string.bril, R.string.bril_short),
+ )
+}
diff --git a/data/units/src/test/java/com/sadellie/unitto/data/units/AllUnitsTest.kt b/data/units/src/test/java/com/sadellie/unitto/data/units/AllUnitsTest.kt
index f2f048a1..c1a58709 100644
--- a/data/units/src/test/java/com/sadellie/unitto/data/units/AllUnitsTest.kt
+++ b/data/units/src/test/java/com/sadellie/unitto/data/units/AllUnitsTest.kt
@@ -485,6 +485,29 @@ class AllUnitsTest {
gallons_per_second_imperial.checkWith(cubic_meter_per_minute, "312", "85.1028")
}
+ @Test
+ fun testLuminance() = testWithUnits {
+ candela_per_square_meter.checkWith(lumen_per_square_foot_per_steradian, "6723", "624.58714")
+ candela_per_square_centimeter.checkWith(candela_per_square_inch, "6723", "43374.1068")
+ candela_per_square_foot.checkWith(apostilb, "6723", "227343.77056")
+ candela_per_square_inch.checkWith(lumen_per_square_centimeter_per_steradian, "6723", "1042.06708")
+ kilocandela_per_square_meter.checkWith(lambert, "6723", "2112.09274")
+ stilb.checkWith(blondel, "6723", "211209274.10086")
+ lumen_per_square_meter_per_steradian.checkWith(lumen_per_square_centimeter_per_steradian, "6723", "0.6723")
+ lumen_per_square_centimeter_per_steradian.checkWith(millilambert, "6723", "21120927.41009")
+ lumen_per_square_foot_per_steradian.checkWith(skot, "6723", "227343770.55975")
+ watt_per_square_centimeter_per_steradian.checkWith(stilb, "6723", "4591809")
+ nit.checkWith(candela_per_square_foot, "6723", "624.58714")
+ millinit.checkWith(lumen_per_square_foot_per_steradian, "6723", "0.62459")
+ lambert.checkWith(foot_lambert, "6723", "6245871.37921")
+ millilambert.checkWith(apostilb, "6723", "67230")
+ foot_lambert.checkWith(watt_per_square_centimeter_per_steradian, "6723", "0.00337")
+ apostilb.checkWith(kilocandela_per_square_meter, "6723", "2.14")
+ blondel.checkWith(candela_per_square_centimeter, "6723", "0.214")
+ bril.checkWith(skot, "6723", "0.6723")
+ skot.checkWith(lumen_per_square_meter_per_steradian, "6723", "2.14")
+ }
+
private fun String.checkWith(checkingId: String, value: String, expected: String) {
val unitFrom = allUnitsRepository.getById(this)
val unitTo = allUnitsRepository.getById(checkingId)