diff --git a/app/build.gradle b/app/build.gradle index 5d9fc36..ea5d46f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,8 +11,8 @@ android { compileSdkVersion 36 buildToolsVersion '36.0.0' useLibrary 'org.apache.http.legacy' - versionCode 148 - versionName "1.8.7" + versionCode 149 + versionName "1.8.8" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/com/jens/automation2/ActivityManageActionSetSystemSetting.java b/app/src/main/java/com/jens/automation2/ActivityManageActionSetSystemSetting.java index 5c27f90..1c5a357 100644 --- a/app/src/main/java/com/jens/automation2/ActivityManageActionSetSystemSetting.java +++ b/app/src/main/java/com/jens/automation2/ActivityManageActionSetSystemSetting.java @@ -106,7 +106,7 @@ public class ActivityManageActionSetSystemSetting extends Activity selectedDataType.equalsIgnoreCase("Long") ) { - if(Miscellaneous.isNumericDecimal(etSettingValue.getText().toString()) || !Miscellaneous.isNumeric(etSettingValue.getText().toString())) + if(!Miscellaneous.isNumeric(etSettingValue.getText().toString()) || Miscellaneous.isNonDecimalNumber(etSettingValue.getText().toString())) { Toast.makeText(ActivityManageActionSetSystemSetting.this, getResources().getString(R.string.enter_a_number), Toast.LENGTH_LONG).show(); return; diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java index bcb34aa..b7fbdff 100644 --- a/app/src/main/java/com/jens/automation2/Miscellaneous.java +++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java @@ -96,6 +96,7 @@ import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.text.DateFormat; +import java.text.DecimalFormatSymbols; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -1114,28 +1115,34 @@ public class Miscellaneous extends Service } } - // executes a command on the system - private static boolean canExecuteCommand(String command) - { - boolean executedSuccesfully; - try - { - Runtime.getRuntime().exec(command); - executedSuccesfully = true; - } - catch (Exception e) - { - executedSuccesfully = false; - } + // executes a command on the system + private static boolean canExecuteCommand(String command) + { + boolean executedSuccesfully; + try + { + Runtime.getRuntime().exec(command); + executedSuccesfully = true; + } + catch (Exception e) + { + executedSuccesfully = false; + } + + return executedSuccesfully; + } + + public static char getDecimalSeparator() + { + DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.getDefault()); + return symbols.getDecimalSeparator(); // ',' or '.' + } - return executedSuccesfully; - } public static boolean isNumericDecimal(String strNum) { if (strNum == null) - { return false; - } + try { double d = Double.parseDouble(strNum); @@ -1146,6 +1153,14 @@ public class Miscellaneous extends Service } return true; } + + public static boolean isNonDecimalNumber(String number) + { + if (number == null) + return false; + + return !number.contains(String.valueOf(getDecimalSeparator())); + } public static boolean isNumeric(String str) { diff --git a/fastlane/metadata/android/en-US/changelogs/149.txt b/fastlane/metadata/android/en-US/changelogs/149.txt index dd7bd80..342d802 100644 --- a/fastlane/metadata/android/en-US/changelogs/149.txt +++ b/fastlane/metadata/android/en-US/changelogs/149.txt @@ -2,4 +2,5 @@ * Fixed: Crash when opening the application through the running service's notification * Fixed: Crash when starting service and show service icon was deactivated in app settings * Fixed: "Bluetooth connect" permission was not requested for turning Bluetooth on or off. -* Fixed: Another app started/stopped couldn't be added when UI language was Dutch. \ No newline at end of file +* Fixed: Another app started/stopped couldn't be added when UI language was Dutch. +* Fixed: Check for non-decimal number in some input fields \ No newline at end of file