aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cgeo/geocaching/cgBase.java4
-rw-r--r--src/cgeo/geocaching/cgSettings.java15
-rw-r--r--src/cgeo/geocaching/cgeoinit.java33
-rw-r--r--src/cgeo/geocaching/files/LocParser.java9
4 files changed, 30 insertions, 31 deletions
diff --git a/src/cgeo/geocaching/cgBase.java b/src/cgeo/geocaching/cgBase.java
index c0e093d..4995919 100644
--- a/src/cgeo/geocaching/cgBase.java
+++ b/src/cgeo/geocaching/cgBase.java
@@ -759,7 +759,7 @@ public class cgBase {
}
// cache direction - image
- if (settings.loadDirectionImg)
+ if (settings.getLoadDirImg())
{
try {
final Matcher matcherDirection = patternDirection.matcher(row);
@@ -948,7 +948,7 @@ public class cgBase {
}
// get direction images
- if (settings.loadDirectionImg)
+ if (settings.getLoadDirImg())
{
for (cgCache oneCache : caches.cacheList) {
if (oneCache.latitude == null && oneCache.longitude == null && oneCache.directionImg != null) {
diff --git a/src/cgeo/geocaching/cgSettings.java b/src/cgeo/geocaching/cgSettings.java
index 6746bf7..b2d2cf5 100644
--- a/src/cgeo/geocaching/cgSettings.java
+++ b/src/cgeo/geocaching/cgSettings.java
@@ -55,6 +55,7 @@ public class cgSettings {
private static final String KEY_USERNAME = "username";
private static final String KEY_COORD_INPUT_FORMAT = "coordinputformat";
private static final String KEY_LOG_OFFLINE = "log_offline";
+ private static final String KEY_LOAD_DIRECTION_IMG = "loaddirectionimg";
private interface PrefRunnable {
void edit(final Editor edit);
@@ -146,7 +147,6 @@ public class cgSettings {
public String webDeviceCode = null;
public boolean trackableAutovisit = false;
public boolean signatureAutoinsert = false;
- public boolean loadDirectionImg = true;
// usable values
public static final String tag = "c:geo";
@@ -595,4 +595,17 @@ public class cgSettings {
return prefs.getBoolean(KEY_LOG_OFFLINE, false);
}
+ void setLoadDirImg(final boolean value) {
+ editSettings(new PrefRunnable() {
+
+ @Override
+ public void edit(Editor edit) {
+ edit.putBoolean(KEY_LOAD_DIRECTION_IMG, value);
+ }
+ });
+ }
+
+ public boolean getLoadDirImg() {
+ return prefs.getBoolean(KEY_LOAD_DIRECTION_IMG, true);
+ }
}
diff --git a/src/cgeo/geocaching/cgeoinit.java b/src/cgeo/geocaching/cgeoinit.java
index ecd97da..46ba767 100644
--- a/src/cgeo/geocaching/cgeoinit.java
+++ b/src/cgeo/geocaching/cgeoinit.java
@@ -317,9 +317,16 @@ public class cgeoinit extends AbstractActivity {
}
captchaButton.setOnClickListener(new cgeoChangeCaptcha());
- CheckBox dirImgButton = (CheckBox) findViewById(R.id.loaddirectionimg);
- dirImgButton.setChecked(prefs.getBoolean("loaddirectionimg", true));
- dirImgButton.setOnClickListener(new cgeoChangeDirImg());
+ final CheckBox dirImgButton = (CheckBox) findViewById(R.id.loaddirectionimg);
+ dirImgButton.setChecked(settings.getLoadDirImg());
+ dirImgButton.setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ settings.setLoadDirImg(!settings.getLoadDirImg());
+ dirImgButton.setChecked(settings.getLoadDirImg());
+ }
+ });
CheckBox useEnglishButton = (CheckBox) findViewById(R.id.useenglish);
if (prefs.getBoolean("useenglish", false) == false) {
@@ -688,26 +695,6 @@ public class cgeoinit extends AbstractActivity {
return;
}
}
-
- private class cgeoChangeDirImg implements View.OnClickListener {
-
- public void onClick(View arg0) {
- SharedPreferences.Editor edit = prefs.edit();
- if (prefs.getBoolean("loaddirectionimg", true)) {
- edit.putBoolean("loaddirectionimg", false);
- settings.loadDirectionImg = false;
- } else {
- edit.putBoolean("loaddirectionimg", true);
- settings.loadDirectionImg = true;
- }
- edit.commit();
-
- CheckBox dirImgButton = (CheckBox) findViewById(R.id.loaddirectionimg);
- dirImgButton.setChecked(prefs.getBoolean("loaddirectionimg", true));
-
- return;
- }
- }
private class cgeoChangeUseEnglish implements View.OnClickListener {
diff --git a/src/cgeo/geocaching/files/LocParser.java b/src/cgeo/geocaching/files/LocParser.java
index e05b5f6..152293c 100644
--- a/src/cgeo/geocaching/files/LocParser.java
+++ b/src/cgeo/geocaching/files/LocParser.java
@@ -6,6 +6,8 @@ import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import android.os.Handler;
+import android.util.Log;
import cgeo.geocaching.cgBase;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgCacheWrap;
@@ -14,9 +16,6 @@ import cgeo.geocaching.cgSearch;
import cgeo.geocaching.cgSettings;
import cgeo.geocaching.cgeoapplication;
-import android.os.Handler;
-import android.util.Log;
-
public final class LocParser extends FileParser {
private static final Pattern patternGeocode = Pattern
.compile("name id=\"([^\"]+)\"");
@@ -132,8 +131,8 @@ public final class LocParser extends FileParser {
}
}
- if (pointCoord.name != null && pointCoord.name.length() > 0) {
- coords.put(pointCoord.name, pointCoord);
+ if (pointCoord.geocode != null && pointCoord.geocode.length() > 0) {
+ coords.put(pointCoord.geocode, pointCoord);
}
}