diff --git a/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java b/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java index 038ce633..002b9912 100644 --- a/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java +++ b/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java @@ -76,6 +76,11 @@ public class CalculatorImpl { } private String formatString(String str) { + // if the number contains a decimal, do not try removing the leading zero anymore, nor add group separator + // it would prevent writing values like 1.02 + if (str.contains(".")) + return str; + final double doubleValue = Formatter.stringToDouble(str); return Formatter.doubleToString(doubleValue); } @@ -183,10 +188,7 @@ public class CalculatorImpl { else newValue = "0"; - if (newValue.equals("-0")) - newValue = "0"; - - newValue = newValue.replaceAll(",$", ""); + newValue = formatString(newValue); setValue(newValue); baseValue = Formatter.stringToDouble(newValue); } diff --git a/gradle.properties_sample b/gradle.properties_sample new file mode 100644 index 00000000..933eed44 --- /dev/null +++ b/gradle.properties_sample @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +# Default value: -Xmx10248m -XX:MaxPermSize=256m +# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true +RELEASE_KEY_ALIAS=myalias +RELEASE_KEY_PASSWORD=123456789 +RELEASE_STORE_PASSWORD=987654321