From 82479f4854050b94db95d0d32e056f298b63d1a0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Jan 2016 20:04:47 +0100 Subject: [PATCH 1/3] add a sample file to see how are the constants in gradle.properties set --- gradle.properties_sample | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gradle.properties_sample 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 From c90c123971522c925df1576e2deb48d729150a1e Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Jan 2016 22:59:56 +0100 Subject: [PATCH 2/3] allow writing zeroes as decimal values --- .../calculator/simplemobiletools/com/CalculatorImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java b/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java index 038ce633..cefb2185 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); } From 12a07c0fcc8315a030a2701ff4da2fa39555adfc Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Jan 2016 23:03:19 +0100 Subject: [PATCH 3/3] keep the numbers properly formatted at clearing digits --- .../calculator/simplemobiletools/com/CalculatorImpl.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java b/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java index cefb2185..002b9912 100644 --- a/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java +++ b/app/src/main/java/calculator/simplemobiletools/com/CalculatorImpl.java @@ -188,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); }