diff --git a/app/build.gradle b/app/build.gradle index 42b49a8..b297a20 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,6 +11,6 @@ android { minSdkVersion 21 targetSdkVersion 21 versionCode 2 - versionName "2.1.1" + versionName "2.1.3" } } \ No newline at end of file diff --git a/app/src/main/java/com/airlim/garagetrois/Client_Functions.java b/app/src/main/java/com/airlim/garagetrois/Client_Functions.java index 7f0a7a3..f96a568 100644 --- a/app/src/main/java/com/airlim/garagetrois/Client_Functions.java +++ b/app/src/main/java/com/airlim/garagetrois/Client_Functions.java @@ -38,6 +38,8 @@ import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static junit.framework.Assert.assertEquals; @@ -55,11 +57,16 @@ public static int getPrefInt(String key, Context context) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); String sleepytime = preferences.getString(key, "11.0"); - Log.v("preference", sleepytime); - //return Integer.parseInt(String.valueOf(Double.longBitsToDouble(preferences.getLong(key, Double.doubleToLongBits(11.0))))); - if (sleepytime != null) { - sleepytime = sleepytime.split("\\.", 2)[0]; - sleepytime = sleepytime.replace(".", ""); + + if(sleepytime.contains(".")){ + String[] numbers = sleepytime.split("\\."); + Log.v("preference", numbers[0]); + Log.v("preference", numbers[1].substring(0,1)); + sleepytime = numbers[0] + numbers[1].substring(0,1); + Log.v("preference", sleepytime); + } + else { + sleepytime = sleepytime + "0"; } return Integer.parseInt(sleepytime);