Skip to content

Commit

Permalink
Merge pull request #53 from Yet-Zio/v1.0.8
Browse files Browse the repository at this point in the history
v1.0.8
  • Loading branch information
Yet-Zio committed Apr 9, 2023
2 parents 32d6011 + c1335be commit 21946eb
Show file tree
Hide file tree
Showing 14 changed files with 86 additions and 35 deletions.
21 changes: 11 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ android {
applicationId "yetzio.yetcalc"
minSdk 21
targetSdk 33
versionCode 8
versionName "1.0.7"
versionCode 9
versionName "1.0.8"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand All @@ -39,6 +39,7 @@ android {
buildFeatures {
viewBinding true
}
namespace 'yetzio.yetcalc'
}

apply plugin: 'kotlin-kapt'
Expand All @@ -47,18 +48,18 @@ dependencies {

coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.0")

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
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")

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'

implementation 'com.google.android.material:material:1.8.0'
implementation 'io.github.muddz:styleabletoast:2.4.0'
Expand All @@ -71,6 +72,6 @@ dependencies {
implementation 'com.airbnb.android:paris:2.0.0'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
5 changes: 2 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="yetzio.yetcalc">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -20,7 +19,7 @@
<activity
android:name=".views.AboutActivity"
android:exported="false"
android:theme="@style/AboutDark"/>
android:theme="@style/AboutDark" />
<activity
android:name=".views.SettingsActivity"
android:exported="false"
Expand Down
48 changes: 36 additions & 12 deletions app/src/main/java/yetzio/yetcalc/component/UnitConv.kt
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ class UnitConv{
companion object{
var from = 0
var to = 0
var microQt = false

fun convert(from: Int, to: Int, value: Double): Double{
this.from = from
Expand All @@ -261,6 +262,11 @@ class UnitConv{
}

private fun convHandler(value: Double): Double{
if(from == 0)
microQt = true
else
microQt = false

var temp = when(from){
0 -> MicroLToCubicMetre(value)
1 -> DropToCubicMetre(value)
Expand Down Expand Up @@ -422,27 +428,27 @@ class UnitConv{
}

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

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

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

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

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

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

// Order 2 - Cubic metre to others
Expand Down Expand Up @@ -536,27 +542,45 @@ class UnitConv{
}

fun CubicMetreToTeaspoonsUS(cmetre: Double): Double{
return BigDecimal.valueOf(cmetre * 202884.1361596).setScale(3, RoundingMode.HALF_UP).toDouble()
return if (microQt)
BigDecimal.valueOf(cmetre * 202884.1361596).setScale(10, RoundingMode.HALF_UP).toDouble()
else
BigDecimal.valueOf(cmetre * 202884.1361596).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToTeaspoonsUK(cmetre: Double): Double{
return BigDecimal.valueOf(cmetre * 168936.3827175).setScale(3, RoundingMode.HALF_UP).toDouble()
return if(microQt)
BigDecimal.valueOf(cmetre * 168936.3827175).setScale(10, RoundingMode.HALF_UP).toDouble()
else
BigDecimal.valueOf(cmetre * 168936.3827175).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToTablespoonsUS(cmetre: Double): Double{
return BigDecimal.valueOf(cmetre * 67628.045398).setScale(3, RoundingMode.HALF_UP).toDouble()
return if(microQt)
BigDecimal.valueOf(cmetre * 67628.045398).setScale(10, RoundingMode.HALF_UP).toDouble()
else
BigDecimal.valueOf(cmetre * 67628.045398).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToTablespoonsUK(cmetre: Double): Double{
return BigDecimal.valueOf(cmetre * 56312.1275646).setScale(3, RoundingMode.HALF_UP).toDouble()
return if(microQt)
BigDecimal.valueOf(cmetre * 56312.1275646).setScale(10, RoundingMode.HALF_UP).toDouble()
else
BigDecimal.valueOf(cmetre * 56312.1275646).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToFluidOuncesUS(cmetre: Double): Double{
return BigDecimal.valueOf(cmetre * 33814.0227018).setScale(3, RoundingMode.HALF_UP).toDouble()
return if(microQt)
BigDecimal.valueOf(cmetre * 33814.0227018).setScale(10, RoundingMode.HALF_UP).toDouble()
else
BigDecimal.valueOf(cmetre * 33814.0227018).setScale(3, RoundingMode.HALF_UP).toDouble()
}

fun CubicMetreToFluidOuncesUK(cmetre: Double): Double{
return BigDecimal.valueOf(cmetre * 35195.0797279).setScale(3, RoundingMode.HALF_UP).toDouble()
return if(microQt)
BigDecimal.valueOf(cmetre * 35195.0797279).setScale(10, RoundingMode.HALF_UP).toDouble()
else
BigDecimal.valueOf(cmetre * 35195.0797279).setScale(3, RoundingMode.HALF_UP).toDouble()
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/yetzio/yetcalc/utils/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ import android.os.Build
import android.os.VibrationEffect
import android.os.Vibrator
import android.os.VibratorManager
import android.view.MenuItem
import android.widget.Button
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.text.parseAsHtml
import androidx.preference.PreferenceManager
import com.afollestad.materialdialogs.MaterialDialog
import io.github.muddz.styleabletoast.StyleableToast
import yetzio.yetcalc.R
import yetzio.yetcalc.model.SpinnerItem
import java.util.*
import kotlin.collections.ArrayList

fun showThemeDialog(ctx: Activity){
val pref = ctx.getSharedPreferences("CalcPrefs", Context.MODE_PRIVATE)
Expand Down
21 changes: 21 additions & 0 deletions app/src/main/java/yetzio/yetcalc/views/ProgramCalcActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class ProgramCalcActivity : AppCompatActivity(), View.OnClickListener {
private lateinit var toolbar: Toolbar

private lateinit var opsList: ArrayList<String>
private var booleanOpsList = arrayListOf("AND", "OR", "NAND", "NOR", "XOR", "Lsh", "Rsh") // NOT is unary, so not required

override fun onCreate(savedInstanceState: Bundle?) {
initPrefs()
Expand Down Expand Up @@ -713,6 +714,26 @@ class ProgramCalcActivity : AppCompatActivity(), View.OnClickListener {
mViewModel.opPresent = true
break
}

if(i in booleanOpsList){
val inc = when (i) {
"OR" -> {
1
}
"NAND" -> {
3
}
else -> {
2
}
}

if(tvExp.text.toString().contains(i) && tvExp.text.toString().trim().indexOf(i) + inc == tvExp.text.toString().trim().lastIndex){
mViewModel.opPresent = true
break
}
}

}

if(!mViewModel.opPresent){
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@
</LinearLayout>

<LinearLayout
android:id="@+id/githubLyt"
app:layout_constraintBottom_toTopOf="@id/appBottomText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:layout_marginBottom="10sp">
android:layout_marginBottom="20sp">

<ImageView
android:id="@+id/githubIV"
Expand All @@ -86,6 +87,7 @@
android:textColor="@color/greyish"
android:gravity="center"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="25sp"/>
android:layout_marginBottom="25sp"
android:fontFamily="serif"/>

</androidx.constraintlayout.widget.ConstraintLayout>
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.7</string>
<string name="VERSION_NUM">1.0.8</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 @@ -895,5 +895,6 @@
<string name="attachment_summary_on">Automatically download attachments for incoming emails
</string>
<string name="attachment_summary_off">Only download attachments when manually requested</string>
<string name="open_source_licenses">Open Source Licenses</string>

</resources>
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.21' apply false
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

task clean(type: Delete) {
Expand Down
7 changes: 7 additions & 0 deletions fastlane/metadata/android/en-US/changelogs/9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bug Fixes

- Fixed an issue that caused any boolean operator to disappear from history string in programmer mode.

- Fixed a scaling issue when converting to or from Tablespoons(US/UK), Teaspoons(US/UK), etc on volume section of converter mode.

- Fixed an issue that prevented the app from showing the app icon on devices that do not support the adaptive and legacy icons generated by Android Studio.

0 comments on commit 21946eb

Please sign in to comment.