From bb953131753303546cb11fe54b80821253b97c0c Mon Sep 17 00:00:00 2001 From: Themaister Date: Mon, 31 Dec 2012 12:18:18 +0100 Subject: [PATCH] Add boolean support to Java config file. --- .../src/org/retroarch/browser/ConfigFile.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/android/phoenix/src/org/retroarch/browser/ConfigFile.java b/android/phoenix/src/org/retroarch/browser/ConfigFile.java index b70d5cb817..0499b85d0e 100644 --- a/android/phoenix/src/org/retroarch/browser/ConfigFile.java +++ b/android/phoenix/src/org/retroarch/browser/ConfigFile.java @@ -69,6 +69,10 @@ public class ConfigFile { public void setString(String key, String value) { map.put(key, value); } + + public void setBoolean(String key, boolean value) { + map.put(key, Boolean.toString(value)); + } public void setInt(String key, int value) { map.put(key, Integer.toString(value)); @@ -78,6 +82,10 @@ public class ConfigFile { map.put(key, Double.toString(value)); } + public boolean keyExists(String key) { + return map.containsKey(key); + } + public String getString(String key) { Object ret = map.get(key); if (ret != null) @@ -85,11 +93,7 @@ public class ConfigFile { else return null; } - - public boolean keyExists(String key) { - return map.containsKey(key); - } - + public int getInt(String key) throws NumberFormatException { String str = getString(key); if (str != null) @@ -105,4 +109,9 @@ public class ConfigFile { else throw new NumberFormatException(); } + + public boolean getBoolean(String key) { + String str = getString(key); + return Boolean.parseBoolean(str); + } }