aboutsummaryrefslogtreecommitdiffstats
path: root/packages/CMSettingsProvider/src
diff options
context:
space:
mode:
authorLuis Vidal <lvidal@cyngn.com>2016-05-06 16:34:50 -0700
committerLuis Vidal <lvidal@cyngn.com>2016-05-06 17:49:03 -0700
commit186ae8353d02166eb893552b029758600772e8f7 (patch)
treea9c82063bde2d805e8a79f1953225f041fee1248 /packages/CMSettingsProvider/src
parente4886a668f6fc7f04fa2c9e6de28c5e2e9f17d59 (diff)
downloadvendor_cmsdk-186ae8353d02166eb893552b029758600772e8f7.zip
vendor_cmsdk-186ae8353d02166eb893552b029758600772e8f7.tar.gz
vendor_cmsdk-186ae8353d02166eb893552b029758600772e8f7.tar.bz2
Set a default temperature unit
Bump the DB version and set a default temperature unit in global settings Change-Id: I14f80e1b3fa3ae4a47769c02b5ebd6a905a53e46 TICKET: CYNGNOS-2751
Diffstat (limited to 'packages/CMSettingsProvider/src')
-rw-r--r--packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java
index 34fa4cb..faf99d3 100644
--- a/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java
+++ b/packages/CMSettingsProvider/src/org/cyanogenmod/cmsettings/CMDatabaseHelper.java
@@ -46,7 +46,7 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
private static final boolean LOCAL_LOGV = false;
private static final String DATABASE_NAME = "cmsettings.db";
- private static final int DATABASE_VERSION = 4;
+ private static final int DATABASE_VERSION = 5;
public static class CMTableNames {
public static final String TABLE_SYSTEM = "system";
@@ -201,6 +201,22 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
upgradeVersion = 4;
}
+ if (upgradeVersion < 5) {
+ db.beginTransaction();
+ SQLiteStatement stmt = null;
+ try {
+ stmt = db.compileStatement("INSERT INTO global(name,value)"
+ + " VALUES(?,?);");
+ loadIntegerSetting(stmt, CMSettings.Global.WEATHER_TEMPERATURE_UNIT,
+ R.integer.def_temperature_unit);
+ db.setTransactionSuccessful();
+ } finally {
+ if (stmt != null) stmt.close();
+ db.endTransaction();
+ }
+ upgradeVersion = 5;
+ }
+
// *** Remember to update DATABASE_VERSION above!
if (upgradeVersion < newVersion) {
@@ -342,6 +358,9 @@ public class CMDatabaseHelper extends SQLiteOpenHelper{
loadStringSetting(stmt,
CMSettings.Global.POWER_NOTIFICATIONS_RINGTONE,
R.string.def_power_notifications_ringtone);
+
+ loadIntegerSetting(stmt, CMSettings.Global.WEATHER_TEMPERATURE_UNIT,
+ R.integer.def_temperature_unit);
} finally {
if (stmt != null) stmt.close();
}