diff options
author | lado <herrlado@gmail.com> | 2013-02-12 22:23:12 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2013-02-12 22:23:12 +0100 |
commit | 7cf09896768d7d8b53734b130eb8d8d47e00cb14 (patch) | |
tree | 5ae7f529f83e8447aacd58a8b04cf77ec574030b /vdrmanager/src/de | |
parent | 1ac50e0424d0232f511fac40f063d92ccce7e8f7 (diff) | |
download | vdr-manager-7cf09896768d7d8b53734b130eb8d8d47e00cb14.tar.gz vdr-manager-7cf09896768d7d8b53734b130eb8d8d47e00cb14.tar.bz2 |
DBAccess
Diffstat (limited to 'vdrmanager/src/de')
-rw-r--r-- | vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java index a846596..84cc0d4 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java @@ -9,7 +9,7 @@ import android.content.res.Configuration; import android.text.TextUtils; import de.bjusystems.vdrmanager.R; import de.bjusystems.vdrmanager.StringUtils; -import de.bjusystems.vdrmanager.data.db.OrmDatabaseHelper; +import de.bjusystems.vdrmanager.data.db.DBAccess; /** * Class for all preferences @@ -25,12 +25,6 @@ public class Preferences { private static Vdr current; - private static OrmDatabaseHelper db; - - public static OrmDatabaseHelper getDatabaseHelper() { - return db; - } - public static void setCurrentVdr(Context context, Vdr vdr) { current = vdr; final SharedPreferences sharedPrefs = getSharedPreferences(context); @@ -499,11 +493,11 @@ public class Preferences { thePrefs = null; } - public static void reloadVDR() { + public static void reloadVDR(Context context) { if (current == null) { return; } - db.getVdrDAO().refresh(current); + DBAccess.get(context).getVdrDAO().refresh(current); } public static boolean initVDR(final Context context) { @@ -516,7 +510,7 @@ public class Preferences { Vdr vdr = null; if (id != -1) { - vdr = db.getVdrDAO().queryForId(id); + vdr = DBAccess.get(context).getVdrDAO().queryForId(id); } setCurrentVdr(context, vdr); @@ -525,7 +519,7 @@ public class Preferences { return true; } - List<Vdr> list = db.getVdrDAO().queryForAll(); + List<Vdr> list = DBAccess.get(context).getVdrDAO().queryForAll(); if (list != null && list.isEmpty() == false) { vdr = list.get(0); setCurrentVdr(context, vdr); @@ -552,10 +546,6 @@ public class Preferences { // if (thePrefs != null) { // return; // } - if (db == null) { - db = new OrmDatabaseHelper(context); - } - synchronized (Preferences.class) { // if (thePrefs != null) { // return; @@ -632,7 +622,7 @@ public class Preferences { vdr.setEncoding(getString(context, R.string.vdr_encoding_key, "utf-8")); - if (db.getVdrDAO().create(vdr) != 1) { + if (DBAccess.get(context).getVdrDAO().create(vdr) != 1) { return false; } |