Skip to content

Commit

Permalink
Merge pull request #34 from Yet-Zio/v1.0.6
Browse files Browse the repository at this point in the history
v1.0.6
  • Loading branch information
Yet-Zio committed Feb 1, 2023
2 parents df1b622 + 0a9bddc commit 35cd679
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

android {
tasks.whenTaskAdded {task ->
tasks.whenTaskAdded { task ->
if(task.name.contains("ArtProfile")) {
task.enabled = false
}
Expand All @@ -15,8 +15,8 @@ android {
applicationId "yetzio.yetcalc"
minSdk 21
targetSdk 33
versionCode 6
versionName "1.0.5"
versionCode 7
versionName "1.0.6"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -49,7 +49,7 @@ dependencies {

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'

implementation("org.mariuszgromada.math:MathParser.org-mXparser:5.1.0")
Expand All @@ -60,7 +60,7 @@ dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'

implementation 'com.google.android.material:material:1.7.0'
implementation 'com.google.android.material:material:1.8.0'
implementation 'io.github.muddz:styleabletoast:2.4.0'

implementation 'androidx.preference:preference:1.2.0'
Expand Down
38 changes: 24 additions & 14 deletions app/src/main/java/yetzio/yetcalc/component/UnitConv.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class UnitConv{
17 -> GigaToMetre(value)
18 -> TeraToMetre(value)
19 -> PetaToMetre(value)
20 -> FlgToMetre(value)
else -> {
value
}
Expand All @@ -68,6 +69,7 @@ class UnitConv{
17 -> MetreToGiga(temp)
18 -> MetreToTera(temp)
19 -> MetreToPeta(temp)
20 -> MetreToFlg(temp)
else -> {
temp
}
Expand Down Expand Up @@ -154,6 +156,10 @@ class UnitConv{
return peta * BigDecimal("1000000000000000").toDouble()
}

fun FlgToMetre(flg: Double): Double{
return flg * BigDecimal("201.168").toDouble()
}

// Order 2 - Meter to others
fun MetreToFemto(metre: Double): Double{
return metre * BigDecimal("1000000000000000").toDouble()
Expand Down Expand Up @@ -231,6 +237,10 @@ class UnitConv{
return metre / BigDecimal("1000000000000000").toDouble()
}

fun MetreToFlg(metre: Double): Double{
return metre / BigDecimal("201.168").toDouble()
}

}
}

Expand Down Expand Up @@ -352,7 +362,7 @@ class UnitConv{
}

fun CupUKToCubicMetre(cup: Double): Double{
return cup * BigDecimal("0.0002841306").toDouble()
return cup / BigDecimal("3519.5079728").toDouble()
}

fun PintsUSToCubicMetre(pint: Double): Double{
Expand Down Expand Up @@ -412,27 +422,27 @@ class UnitConv{
}

fun TeaspoonsUSToCubicMetre(teaspoon: Double): Double{
return teaspoon / BigDecimal("202900").toDouble()
return BigDecimal.valueOf(teaspoon / 202884.1361596).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun TeaspoonsUKToCubicMetre(teaspoon: Double): Double{
return teaspoon / BigDecimal("281560").toDouble()
return BigDecimal.valueOf(teaspoon / 168936.3827175).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun TablespoonsUSToCubicMetre(tablespoon: Double): Double{
return tablespoon / BigDecimal("67630").toDouble()
return BigDecimal.valueOf(tablespoon / 67628.045398).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun TablespoonsUKToCubicMetre(tablespoon: Double): Double{
return tablespoon * BigDecimal("0.0000177582").toDouble()
return BigDecimal.valueOf(tablespoon / 56312.1275646).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun FluidOuncesUSToCubicMetre(fluidounce: Double): Double{
return fluidounce * BigDecimal("0.0000295735").toDouble()
return BigDecimal.valueOf(fluidounce / 33814.0227018).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun FluidOuncesUKToCubicMetre(fluidounce: Double): Double{
return fluidounce * BigDecimal("0.0000284131").toDouble()
return BigDecimal.valueOf(fluidounce / 35195.0797279).setScale(3, RoundingMode.HALF_UP).toDouble()
}

// Order 2 - Cubic metre to others
Expand Down Expand Up @@ -466,7 +476,7 @@ class UnitConv{
}

fun CubicMetreToCupUK(cmetre: Double): Double{
return cmetre / BigDecimal("0.0002841306").toDouble()
return cmetre * BigDecimal("3519.5079728").toDouble()
}

fun CubicMetreToPintsUS(cmetre: Double): Double{
Expand Down Expand Up @@ -526,27 +536,27 @@ class UnitConv{
}

fun CubicMetreToTeaspoonsUS(cmetre: Double): Double{
return cmetre / BigDecimal("202900").toDouble()
return BigDecimal.valueOf(cmetre * 202884.1361596).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToTeaspoonsUK(cmetre: Double): Double{
return cmetre / BigDecimal("281560").toDouble()
return BigDecimal.valueOf(cmetre * 168936.3827175).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToTablespoonsUS(cmetre: Double): Double{
return cmetre / BigDecimal("67630").toDouble()
return BigDecimal.valueOf(cmetre * 67628.045398).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToTablespoonsUK(cmetre: Double): Double{
return cmetre * BigDecimal("0.0000177582").toDouble()
return BigDecimal.valueOf(cmetre * 56312.1275646).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToFluidOuncesUS(cmetre: Double): Double{
return cmetre * BigDecimal("0.0000295735").toDouble()
return BigDecimal.valueOf(cmetre * 33814.0227018).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToFluidOuncesUK(cmetre: Double): Double{
return cmetre * BigDecimal("0.0000284131").toDouble()
return BigDecimal.valueOf(cmetre * 35195.0797279).setScale(3, RoundingMode.HALF_UP).toDouble()
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="author_name">Yet Zio</string>
<string name="app_name">yetCalc</string>
<string name="VERSION_NUM">1.0.5</string>
<string name="VERSION_NUM">1.0.6</string>
<string name="app_descrp">Yet another calculator by Yet Zio</string>
<string name="ghbtext">View on GitHub</string>
<string name="app_details">Free and open source software\nLicensed under the BSD-3-Clause license.</string>
Expand Down Expand Up @@ -632,6 +632,7 @@
<item>Gigametres</item>
<item>Terametre</item>
<item>Petametres</item>
<item>Furlongs</item>
</string-array>

<string-array name="volumelist">
Expand Down
7 changes: 7 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bug Fixes

- Fixed inaccurate results in volume section of unit converter over Cups(US), Cups(UK), Teaspoons, Tablespoons, Fluid Ounces, etc. Other units might have similar issues as well.

Enhancements

- Added furlongs to length section in Unit Converter

0 comments on commit 35cd679

Please sign in to comment.