Number check fixed
This commit is contained in:
+2
-2
@@ -11,8 +11,8 @@ android {
|
|||||||
compileSdkVersion 36
|
compileSdkVersion 36
|
||||||
buildToolsVersion '36.0.0'
|
buildToolsVersion '36.0.0'
|
||||||
useLibrary 'org.apache.http.legacy'
|
useLibrary 'org.apache.http.legacy'
|
||||||
versionCode 148
|
versionCode 149
|
||||||
versionName "1.8.7"
|
versionName "1.8.8"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ public class ActivityManageActionSetSystemSetting extends Activity
|
|||||||
selectedDataType.equalsIgnoreCase("Long")
|
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();
|
Toast.makeText(ActivityManageActionSetSystemSetting.this, getResources().getString(R.string.enter_a_number), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ import java.security.SecureRandom;
|
|||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@@ -1114,28 +1115,34 @@ public class Miscellaneous extends Service
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// executes a command on the system
|
// executes a command on the system
|
||||||
private static boolean canExecuteCommand(String command)
|
private static boolean canExecuteCommand(String command)
|
||||||
{
|
{
|
||||||
boolean executedSuccesfully;
|
boolean executedSuccesfully;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Runtime.getRuntime().exec(command);
|
Runtime.getRuntime().exec(command);
|
||||||
executedSuccesfully = true;
|
executedSuccesfully = true;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
executedSuccesfully = false;
|
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)
|
public static boolean isNumericDecimal(String strNum)
|
||||||
{
|
{
|
||||||
if (strNum == null)
|
if (strNum == null)
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
double d = Double.parseDouble(strNum);
|
double d = Double.parseDouble(strNum);
|
||||||
@@ -1146,6 +1153,14 @@ public class Miscellaneous extends Service
|
|||||||
}
|
}
|
||||||
return true;
|
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)
|
public static boolean isNumeric(String str)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,4 +2,5 @@
|
|||||||
* Fixed: Crash when opening the application through the running service's notification
|
* 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: 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: "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.
|
* Fixed: Another app started/stopped couldn't be added when UI language was Dutch.
|
||||||
|
* Fixed: Check for non-decimal number in some input fields
|
||||||
Reference in New Issue
Block a user