aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-04-04 11:39:23 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-04-04 11:39:23 +0200
commita9f868a5e74e2c540d0b71d69560b780c7e16a06 (patch)
tree57c981de266a05b709a8cfcdc120995e50ac2b33 /OpenPGP-Keychain/src/main/java/org/sufficientlysecure
parenta1e13f789364a6346a1eac85adefa3660c683a63 (diff)
downloadopen-keychain-a9f868a5e74e2c540d0b71d69560b780c7e16a06.tar.gz
open-keychain-a9f868a5e74e2c540d0b71d69560b780c7e16a06.tar.bz2
open-keychain-a9f868a5e74e2c540d0b71d69560b780c7e16a06.zip
db-overhaul: different hack for type info (api level problem inside)
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java24
1 files changed, 6 insertions, 18 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java
index a81368988..6a12184fe 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java
@@ -69,26 +69,14 @@ public class ProviderHelper {
HashMap<String, Object> result = new HashMap<String, Object>(proj.length);
if (cursor != null && cursor.moveToFirst()) {
- // this is a HACK because we don't have Cursor.getType (which is api level 11)
- CursorWindow cursorWindow;
- if(cursor instanceof CursorWrapper) {
- cursorWindow = ((SQLiteCursor) ((CursorWrapper) cursor).getWrappedCursor()).getWindow();
- } else {
- cursorWindow = ((SQLiteCursor) cursor).getWindow();
- }
-
int pos = 0;
for(String p : proj) {
- if (cursorWindow.isNull(0, pos)) {
- result.put(p, cursor.isNull(pos));
- } else if (cursorWindow.isLong(0, pos)) {
- result.put(p, cursor.getLong(pos));
- } else if (cursorWindow.isFloat(0, pos)) {
- result.put(p, cursor.getFloat(pos));
- } else if (cursorWindow.isString(0, pos)) {
- result.put(p, cursor.getString(pos));
- } else if (cursorWindow.isBlob(0, pos)) {
- result.put(p, cursor.getBlob(pos));
+ switch(cursor.getType(pos)) {
+ case Cursor.FIELD_TYPE_NULL: result.put(p, cursor.isNull(pos)); break;
+ case Cursor.FIELD_TYPE_INTEGER: result.put(p, cursor.getLong(pos)); break;
+ case Cursor.FIELD_TYPE_FLOAT: result.put(p, cursor.getFloat(pos)); break;
+ case Cursor.FIELD_TYPE_STRING: result.put(p, cursor.getString(pos)); break;
+ case Cursor.FIELD_TYPE_BLOB: result.put(p, cursor.getBlob(pos)); break;
}
pos += 1;
}