aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgData.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2011-11-12 09:33:46 +0100
committerBananeweizen <bananeweizen@gmx.de>2011-11-12 09:33:46 +0100
commit0a534bda27038f98ba36f31e3f76b2cd8099e4ae (patch)
tree13045b24ba1ccf0b8b5dfd0c551586f15c7cb7d3 /main/src/cgeo/geocaching/cgData.java
parent4176c82bef6227d14f858999df86d774b5f411e3 (diff)
downloadcgeo-0a534bda27038f98ba36f31e3f76b2cd8099e4ae.zip
cgeo-0a534bda27038f98ba36f31e3f76b2cd8099e4ae.tar.gz
cgeo-0a534bda27038f98ba36f31e3f76b2cd8099e4ae.tar.bz2
refactoring of cgImage, cgeoimages activity
* no more public fields, use constructor instead * allow null values for fields * image activity startup moved to activity for better encapsulation of fields
Diffstat (limited to 'main/src/cgeo/geocaching/cgData.java')
-rw-r--r--main/src/cgeo/geocaching/cgData.java27
1 files changed, 9 insertions, 18 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index 2ebb554..6cfeab9 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -1554,9 +1554,9 @@ public class cgData {
values.clear();
values.put("geocode", geocode);
values.put("updated", timeStamp);
- values.put("url", oneSpoiler.url);
- values.put("title", oneSpoiler.title);
- values.put("description", oneSpoiler.description);
+ values.put("url", oneSpoiler.getUrl());
+ values.put("title", oneSpoiler.getTitle());
+ values.put("description", oneSpoiler.getDescription());
databaseRW.insert(dbTableSpoilers, null, values);
}
@@ -1608,8 +1608,8 @@ public class cgData {
for (cgImage img : log.logImages) {
values.clear();
values.put("log_id", log_id);
- values.put("title", img.title);
- values.put("url", img.url);
+ values.put("title", img.getTitle());
+ values.put("url", img.getUrl());
databaseRW.insert(dbTableLogImages, null, values);
}
}
@@ -2263,10 +2263,7 @@ public class cgData {
int indexDescription = cursor.getColumnIndex("description");
do {
- cgImage spoiler = new cgImage();
- spoiler.url = cursor.getString(indexUrl);
- spoiler.title = cursor.getString(indexTitle);
- spoiler.description = cursor.getString(indexDescription);
+ cgImage spoiler = new cgImage(cursor.getString(indexUrl), cursor.getString(indexTitle), cursor.getString(indexDescription));
spoilers.add(spoiler);
} while (cursor.moveToNext());
@@ -2382,18 +2379,12 @@ public class cgData {
logs.add(log);
}
if (!cursor.isNull(indexLogImagesId)) {
- final cgImage log_img = new cgImage();
- log_img.title = cursor.getString(indexTitle);
- if (log_img.title == null) {
- log_img.title = "";
- }
- log_img.url = cursor.getString(indexUrl);
- if (log_img.url == null) {
- log_img.url = "";
- }
+ String title = cursor.getString(indexTitle);
+ String url = cursor.getString(indexUrl);
if (log.logImages == null) {
log.logImages = new ArrayList<cgImage>();
}
+ final cgImage log_img = new cgImage(url, title);
log.logImages.add(log_img);
}
}