diff options
| author | rsudev <rasch@munin-soft.de> | 2011-08-22 20:14:01 +0200 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2011-08-22 20:14:01 +0200 |
| commit | de195b2f2b6f416d0d34df4e05f9a293bcaffc5e (patch) | |
| tree | deee2bb063fc82ae6a3206c318cf980cbff810f1 /src | |
| parent | 72e3d358dfc7593fb442a8e413882a19623caf4a (diff) | |
| parent | cab37df9f0ba2cda06d7a63ec61892c3084d37a4 (diff) | |
| download | cgeo-de195b2f2b6f416d0d34df4e05f9a293bcaffc5e.zip cgeo-de195b2f2b6f416d0d34df4e05f9a293bcaffc5e.tar.gz cgeo-de195b2f2b6f416d0d34df4e05f9a293bcaffc5e.tar.bz2 | |
Merge branch 'master' of https://github.com/cgeo/c-geo-opensource
Diffstat (limited to 'src')
| -rw-r--r-- | src/cgeo/geocaching/cgBase.java | 57 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgData.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgSettings.java | 15 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgeocoords.java | 66 | ||||
| -rw-r--r-- | src/cgeo/geocaching/cgeoinit.java | 33 | ||||
| -rw-r--r-- | src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java | 2 | ||||
| -rw-r--r-- | src/cgeo/geocaching/files/GPXParser.java | 6 | ||||
| -rw-r--r-- | src/cgeo/geocaching/files/LocParser.java | 9 | ||||
| -rw-r--r-- | src/cgeo/geocaching/mapcommon/cgeomap.java | 14 |
9 files changed, 102 insertions, 102 deletions
diff --git a/src/cgeo/geocaching/cgBase.java b/src/cgeo/geocaching/cgBase.java index f9ee8c2..fc13d7f 100644 --- a/src/cgeo/geocaching/cgBase.java +++ b/src/cgeo/geocaching/cgBase.java @@ -94,7 +94,7 @@ public class cgBase { private final static Pattern patternCountLogs = Pattern.compile("<span id=\"ctl00_ContentBody_lblFindCounts\"><p>(.*)<\\/p><\\/span>", Pattern.CASE_INSENSITIVE); private final static Pattern patternCountLog = Pattern.compile(" src=\"\\/images\\/icons\\/([^\\.]*).gif\" alt=\"[^\"]*\" title=\"[^\"]*\" />([0-9]*)[^0-9]+", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); //private final static Pattern patternLogs = Pattern.compile("<table class=\"LogsTable\">(.*?)</table>\\s*<p", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); - private final static Pattern patternLog = Pattern.compile("<tr><td class.+?<a href=\"/profile/\\?guid=.+?>(.+?)</a>.+?logOwnerStats.+?guid.+?>(\\d+)</a>.+?LogType.+?<img.+?/images/icons/([^\\.]+)\\..+?title=\"(.+?)\".+?LogDate.+?>(.+?)<.+?LogText.+?>(.*?)</p>(.*?)</div></div></div></td></tr>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); + private final static Pattern patternLog = Pattern.compile("<tr><td class.+?<a href=\"/profile/\\?guid=.+?>(.+?)</a>.+?(?:logOwnerStats.+?guid.+?>(\\d+)</a>.+?)?LogType.+?<img.+?/images/icons/([^\\.]+)\\..+?title=\"(.+?)\".+?LogDate.+?>(.+?)<.+?LogText.+?>(.*?)</p>(.*?)</div></div></div></td></tr>", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); private final static Pattern patternLogImgs = Pattern.compile("href=\"(http://img.geocaching.com/cache/log/.+?)\".+?<span>([^<]*)", Pattern.CASE_INSENSITIVE); private final static Pattern patternAttributes = Pattern.compile("<h3 class=\"WidgetHeader\">[^<]*<img[^>]+>\\W*Attributes[^<]*</h3>[^<]*<div class=\"WidgetBody\">(([^<]*<img src=\"[^\"]+\" alt=\"[^\"]+\"[^>]*>)+)[^<]*<p", Pattern.CASE_INSENSITIVE); private final static Pattern patternAttributesInside = Pattern.compile("[^<]*<img src=\"([^\"]+)\" alt=\"([^\"]+)\"[^>]*>", Pattern.CASE_INSENSITIVE); @@ -103,7 +103,7 @@ public class cgBase { private final static Pattern patternInventory = Pattern.compile("<span id=\"ctl00_ContentBody_uxTravelBugList_uxInventoryLabel\">\\W*Inventory[^<]*</span>[^<]*</h3>[^<]*<div class=\"WidgetBody\">([^<]*<ul>(([^<]*<li>[^<]*<a href=\"[^\"]+\"[^>]*>[^<]*<img src=\"[^\"]+\"[^>]*>[^<]*<span>[^<]+<\\/span>[^<]*<\\/a>[^<]*<\\/li>)+)[^<]*<\\/ul>)?", Pattern.CASE_INSENSITIVE); private final static Pattern patternInventoryInside = Pattern.compile("[^<]*<li>[^<]*<a href=\"[a-z0-9\\-\\_\\.\\?\\/\\:\\@]*\\/track\\/details\\.aspx\\?guid=([0-9a-z\\-]+)[^\"]*\"[^>]*>[^<]*<img src=\"[^\"]+\"[^>]*>[^<]*<span>([^<]+)<\\/span>[^<]*<\\/a>[^<]*<\\/li>", Pattern.CASE_INSENSITIVE); private final static Pattern patternOnWatchlist = Pattern.compile("<img\\s*src=\"\\/images\\/stockholm\\/16x16\\/icon_stop_watchlist.gif\"", Pattern.CASE_INSENSITIVE); - + public static HashMap<String, String> cacheTypes = new HashMap<String, String>(); public static HashMap<String, String> cacheTypesInv = new HashMap<String, String>(); public static HashMap<String, String> cacheIDs = new HashMap<String, String>(); @@ -392,17 +392,17 @@ public class cgBase { /** * read all viewstates from page - * + * * @return String[] with all view states */ public static String[] getViewstates(String page) { // Get the number of viewstates. - // If there is only one viewstate, __VIEWSTATEFIELDCOUNT is not present + // If there is only one viewstate, __VIEWSTATEFIELDCOUNT is not present int count = 1; final Matcher matcherViewstateCount = patternViewstateFieldCount.matcher(page); if (matcherViewstateCount.find()) count = Integer.parseInt(matcherViewstateCount.group(1)); - + String[] viewstates = new String[count]; // Get the viewstates @@ -424,10 +424,10 @@ public class cgBase { return viewstates; } - /** + /** * put viewstates into request parameters */ - public void setViewstates(String[] viewstates, HashMap<String, String> params) { + private static void setViewstates(String[] viewstates, HashMap<String, String> params) { if (viewstates == null || viewstates.length == 0) return; params.put("__VIEWSTATE", viewstates[0]); @@ -442,10 +442,10 @@ public class cgBase { * transfers the viewstates variables from a page (response) to parameters * (next request) */ - public void transferViewstates(String page, HashMap<String, String> params) { + public static void transferViewstates(String page, HashMap<String, String> params) { setViewstates(getViewstates(page), params); } - + /** * checks if an Array of Strings is empty or not. Empty means: * - Array is null @@ -458,7 +458,7 @@ public class cgBase { for (String s: a) if (s != null && s.length() > 0) return false; - + return true; } @@ -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) { @@ -1591,7 +1591,7 @@ public class cgBase { try { // final Matcher matcherLogs = patternLogs.matcher(page); -// +// // if (matcherLogs.find()) // { /* @@ -1604,7 +1604,7 @@ public class cgBase { 7- The rest (e.g. log-images, maybe faster) */ final Matcher matcherLog = patternLog.matcher(page);//(matcherLogs.group(1)); - + while (matcherLog.find()) { final cgLog logDone = new cgLog(); @@ -1617,7 +1617,7 @@ public class cgBase { { logDone.type = logTypes.get("icon_note"); } - + try { if (matcherLog.group(5).indexOf(',') > 0) @@ -1641,8 +1641,11 @@ public class cgBase { logDone.author = Html.fromHtml(matcherLog.group(1)).toString(); - logDone.found = Integer.parseInt(matcherLog.group(2)); - + if (null != matcherLog.group(2)) + { + logDone.found = Integer.parseInt(matcherLog.group(2)); + } + logDone.log = matcherLog.group(6); final Matcher matcherImg = patternLogImgs.matcher(matcherLog.group(7)); @@ -1839,7 +1842,7 @@ public class cgBase { return caches; } - private void checkFields(cgCache cache) { + private static void checkFields(cgCache cache) { if (cache.geocode == null || cache.geocode.length() == 0) { Log.w(cgSettings.tag, "geo code not parsed correctly"); } @@ -3602,7 +3605,7 @@ public class cgBase { return trackable; } - public int postLog(cgeoapplication app, String geocode, String cacheid, String[] viewstates, + public int postLog(cgeoapplication app, String geocode, String cacheid, String[] viewstates, int logType, int year, int month, int day, String log, ArrayList<cgTrackableLog> trackables) { if (isEmpty(viewstates)) { Log.e(cgSettings.tag, "cgeoBase.postLog: No viewstate given"); @@ -3764,7 +3767,7 @@ public class cgBase { return 1000; } - public int postLogTrackable(String tbid, String trackingCode, String[] viewstates, + public int postLogTrackable(String tbid, String trackingCode, String[] viewstates, int logType, int year, int month, int day, String log) { if (isEmpty(viewstates)) { Log.e(cgSettings.tag, "cgeoBase.postLogTrackable: No viewstate given"); @@ -4112,7 +4115,7 @@ public class cgBase { if (params != null) { Set<Map.Entry<String, String>> entrySet = params.entrySet(); ArrayList<String> paramsEncoded = new ArrayList<String>(); - + for(Map.Entry<String, String> entry : entrySet) { String key = entry.getKey(); @@ -4376,7 +4379,7 @@ public class cgBase { final Map<String, ?> prefsAll = prefs.getAll(); final Set<? extends Map.Entry<String, ?>> entrySet = prefsAll.entrySet(); - + for(Map.Entry<String, ?> entry : entrySet){ String key = entry.getKey(); if (key.matches("cookie_.+")) { @@ -4391,7 +4394,7 @@ public class cgBase { if (cookies != null) { final Set<Map.Entry<String, String>> entrySet = cookies.entrySet(); final ArrayList<String> cookiesEncoded = new ArrayList<String>(); - + for(Map.Entry<String, String> entry : entrySet){ cookiesEncoded.add(entry.getKey() + "=" + entry.getValue()); } @@ -4411,7 +4414,7 @@ public class cgBase { for(Map.Entry<String, ?> entry : entrySet){ String key = entry.getKey(); if (key.length() > 7 && key.substring(0, 7).equals("cookie_")) { - cookiesEncoded.add(key + "=" + entry.getValue()); + cookiesEncoded.add(key + "=" + entry.getValue()); } } @@ -5317,7 +5320,7 @@ public class cgBase { public String getUserName() { return settings.getUsername(); } - + /** * insert text into the EditText at the current cursor position * @param editText @@ -5329,12 +5332,12 @@ public class cgBase { int selectionEnd = editText.getSelectionEnd(); int start = Math.min(selectionStart, selectionEnd); int end = Math.max(selectionStart, selectionEnd); - + String content = editText.getText().toString(); if (start > 0 && !Character.isWhitespace(content.charAt(start - 1))) { insertText = " " + insertText; } - + editText.getText().replace(start, end, insertText); int newCursor = start + insertText.length(); editText.setSelection(newCursor, newCursor); diff --git a/src/cgeo/geocaching/cgData.java b/src/cgeo/geocaching/cgData.java index 70226d0..ab24864 100644 --- a/src/cgeo/geocaching/cgData.java +++ b/src/cgeo/geocaching/cgData.java @@ -2072,7 +2072,7 @@ public class cgData { return waypoints; } - private cgWaypoint createWaypointFromDatabaseContent(Cursor cursor) { + private static cgWaypoint createWaypointFromDatabaseContent(Cursor cursor) { cgWaypoint waypoint = new cgWaypoint(); waypoint.id = (int) cursor.getInt(cursor.getColumnIndex("_id")); waypoint.geocode = (String) cursor.getString(cursor.getColumnIndex("geocode")); 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/cgeocoords.java b/src/cgeo/geocaching/cgeocoords.java index b4f88ec..c206d44 100644 --- a/src/cgeo/geocaching/cgeocoords.java +++ b/src/cgeo/geocaching/cgeocoords.java @@ -26,18 +26,18 @@ public class cgeocoords extends Dialog { private cgSettings settings = null; private cgGeo geo = null; private Double latitude = 0.0, longitude = 0.0; - + private EditText eLat, eLon; private Button bLat, bLon; private EditText eLatDeg, eLatMin, eLatSec, eLatSub; private EditText eLonDeg, eLonMin, eLonSec, eLonSub; private TextView tLatSep1, tLatSep2, tLatSep3; - private TextView tLonSep1, tLonSep2, tLonSep3; - + private TextView tLonSep1, tLonSep2, tLonSep3; + CoordinateUpdate cuListener; - + coordInputFormatEnum currentFormat; - + public cgeocoords(final AbstractActivity contextIn, cgSettings settingsIn, final cgWaypoint waypoint, final cgGeo geoIn) { super(contextIn); context = contextIn; @@ -65,7 +65,7 @@ public class cgeocoords extends Dialog { } setContentView(R.layout.coords); - + Spinner s = (Spinner) findViewById(R.id.spinnerCoordinateFormats); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(context, @@ -74,9 +74,9 @@ public class cgeocoords extends Dialog { adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); s.setAdapter(adapter); s.setSelection(settings.getCoordInputFormat().ordinal()); - + s.setOnItemSelectedListener(new CoordinateFormatListener()); - + bLat = (Button) findViewById(R.id.ButtonLat); eLat = (EditText) findViewById(R.id.latitude); eLatDeg = (EditText) findViewById(R.id.EditTextLatDeg); @@ -95,7 +95,7 @@ public class cgeocoords extends Dialog { eLonSub = (EditText) findViewById(R.id.EditTextLonSecFrac); tLonSep1 = (TextView) findViewById(R.id.LonSeparator1); tLonSep2 = (TextView) findViewById(R.id.LonSeparator2); - tLonSep3 = (TextView) findViewById(R.id.LonSeparator3); + tLonSep3 = (TextView) findViewById(R.id.LonSeparator3); eLatDeg.addTextChangedListener(new textChangedListener(1)); eLatMin.addTextChangedListener(new textChangedListener(2)); @@ -109,13 +109,13 @@ public class cgeocoords extends Dialog { eLon.addTextChangedListener(new textChangedListener(11)); bLat.setOnClickListener(new buttonClickListener()); bLon.setOnClickListener(new buttonClickListener()); - + Button buttonCurrent = (Button) findViewById(R.id.current); buttonCurrent.setOnClickListener(new CurrentListener()); Button buttonDone = (Button) findViewById(R.id.done); - buttonDone.setOnClickListener(new InputDoneListener()); + buttonDone.setOnClickListener(new InputDoneListener()); } - + private void updateGUI() { Double lat = 0.0; if (latitude != null) { @@ -124,7 +124,7 @@ public class cgeocoords extends Dialog { } else { bLat.setText("N"); } - + lat = Math.abs(latitude); } Double lon = 0.0; @@ -134,7 +134,7 @@ public class cgeocoords extends Dialog { } else { bLon.setText("E"); } - + lon = Math.abs(longitude); } int latDeg = (int) Math.floor(lat); @@ -156,7 +156,7 @@ public class cgeocoords extends Dialog { int lonSecFrac = (int) Math.round((((lon - lonDeg) * 60 - lonMin) * 60 - lonSec) * 1000); switch (currentFormat) { - case Plain: + case Plain: findViewById(R.id.coordTable).setVisibility(View.GONE); eLat.setVisibility(View.VISIBLE); eLon.setVisibility(View.VISIBLE); @@ -164,7 +164,7 @@ public class cgeocoords extends Dialog { eLat.setText(cgBase.formatCoordinate(latitude, "lat", true)); } if (longitude != null) { - eLon.setText(cgBase.formatCoordinate(longitude, "lon", true)); + eLon.setText(cgBase.formatCoordinate(longitude, "lon", true)); } break; case Deg: // DDD.DDDDD° @@ -254,8 +254,8 @@ public class cgeocoords extends Dialog { break; } } - - private String addZeros(int value, int len) { + + private static String addZeros(int value, int len) { String zeros = ""; if (value == 0) { value = 1; @@ -290,7 +290,7 @@ public class cgeocoords extends Dialog { calc(); } } - + private class textChangedListener implements TextWatcher { private int editTextId; @@ -301,21 +301,21 @@ public class cgeocoords extends Dialog { @Override public void afterTextChanged(Editable s) { - + /* * Max lengths, depending on currentFormat - * + * * formatPlain = disabled * DEG MIN SEC SUB * formatDeg 2/3 5 - - * formatMin 2/3 2 3 - * formatSec 2/3 2 2 3 */ - + if (currentFormat == coordInputFormatEnum.Plain) { return; } - + int maxLength = 2; if (editTextId == 5 || editTextId == 4 || editTextId == 8) { maxLength = 3; @@ -326,7 +326,7 @@ public class cgeocoords extends Dialog { if ((editTextId == 3 || editTextId == 7) && currentFormat == coordInputFormatEnum.Min) { maxLength = 3; } - + if (s.length() == maxLength) { switch (editTextId) { case 1: @@ -380,12 +380,12 @@ public class cgeocoords extends Dialog { @Override public void onTextChanged(CharSequence s, int start, int before, int count) {} } - + private void calc() { if (currentFormat == coordInputFormatEnum.Plain) { return; } - + int latDeg = 0, latMin = 0, latSec = 0, latSub = 0; int lonDeg = 0, lonMin = 0, lonSec = 0, lonSub = 0; try { @@ -422,7 +422,7 @@ public class cgeocoords extends Dialog { lonMinFrac /= 10; } latitude = latDeg + latMin/60.0 + latMinFrac/60.0; - longitude = lonDeg + lonMin/60.0 + lonMinFrac/60.0; + longitude = lonDeg + lonMin/60.0 + lonMinFrac/60.0; break; case Sec: Double latSecFrac = latSub * 1.0; @@ -440,14 +440,14 @@ public class cgeocoords extends Dialog { latitude *= (bLat.getText().toString() == "S" ? -1 : 1); longitude *= (bLon.getText().toString() == "W" ? -1 : 1); } - + private class CoordinateFormatListener implements OnItemSelectedListener { @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { currentFormat = coordInputFormatEnum.fromInt(pos); settings.setCoordInputFormat(currentFormat); - updateGUI(); + updateGUI(); } @Override @@ -463,13 +463,13 @@ public class cgeocoords extends Dialog { context.showToast(context.getResources().getString(R.string.err_point_unknown_position)); return; } - + latitude = geo.latitudeNow; longitude = geo.longitudeNow; updateGUI(); } } - + private class InputDoneListener implements View.OnClickListener { @Override @@ -509,11 +509,11 @@ public class cgeocoords extends Dialog { dismiss(); } } - + public void setOnCoordinateUpdate(CoordinateUpdate cu) { cuListener = cu; } - + public interface CoordinateUpdate { public void update(ArrayList<Double> coords); } 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/compatibility/AndroidLevel8Internal.java b/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java index cfc56da..c68f20e 100644 --- a/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java +++ b/src/cgeo/geocaching/compatibility/AndroidLevel8Internal.java @@ -8,7 +8,7 @@ class AndroidLevel8Internal { public AndroidLevel8Internal() { } - public int getRotation(final Activity activity) { + public static int getRotation(final Activity activity) { Display display = activity.getWindowManager().getDefaultDisplay(); return display.getRotation(); } diff --git a/src/cgeo/geocaching/files/GPXParser.java b/src/cgeo/geocaching/files/GPXParser.java index 64c36d3..255bed0 100644 --- a/src/cgeo/geocaching/files/GPXParser.java +++ b/src/cgeo/geocaching/files/GPXParser.java @@ -57,7 +57,7 @@ public abstract class GPXParser extends FileParser { nsGCList.add("http://www.groundspeak.com/cache/1/1"); // PQ 1.1 nsGCList.add("http://www.groundspeak.com/cache/1/0/1"); // PQ 1.0.1 nsGCList.add("http://www.groundspeak.com/cache/1/0"); // PQ 1.0 - + namespace = namespaceIn; version = versionIn; } @@ -546,7 +546,7 @@ public abstract class GPXParser extends FileParser { protected abstract Element getCacheParent(Element waypoint); - protected String validate(String input) { + protected static String validate(String input) { if ("nil".equalsIgnoreCase(input)) { return ""; } @@ -564,7 +564,7 @@ public abstract class GPXParser extends FileParser { } } } - + public static Long parseGPX(cgeoapplication app, File file, int listId, Handler handler) { cgSearch search = new cgSearch(); long searchId = 0l; 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);
}
}
diff --git a/src/cgeo/geocaching/mapcommon/cgeomap.java b/src/cgeo/geocaching/mapcommon/cgeomap.java index 3ed589e..8500e1c 100644 --- a/src/cgeo/geocaching/mapcommon/cgeomap.java +++ b/src/cgeo/geocaching/mapcommon/cgeomap.java @@ -102,7 +102,6 @@ public class cgeomap extends MapBase { private DisplayUsersThread displayUsersThread = null; private LoadDetails loadDetailsThread = null; private volatile long loadThreadRun = 0l; - private volatile long downloadThreadRun = 0l; private volatile long usersThreadRun = 0l; private volatile boolean downloaded = false; // overlays @@ -467,7 +466,7 @@ public class cgeomap extends MapBase { private void addMapViewMenuItems(final Menu menu) { String[] mapViews = res.getStringArray(R.array.map_sources); mapSourceEnum mapSource = settings.mapSource; - + menu.add(1, SUBMENU_VIEW_GOOGLE_MAP, 0, mapViews[0]).setCheckable(true).setChecked(mapSource == mapSourceEnum.googleMap); menu.add(1, SUBMENU_VIEW_GOOGLE_SAT, 0, mapViews[1]).setCheckable(true).setChecked(mapSource == mapSourceEnum.googleSat); menu.add(1, SUBMENU_VIEW_MF_MAPNIK, 0, mapViews[2]).setCheckable(true).setChecked(mapSource == mapSourceEnum.mapsforgeMapnik); @@ -646,7 +645,7 @@ public class cgeomap extends MapBase { if (mapRestartRequired) { // close old mapview activity.finish(); - + // prepare information to restart a similar view Intent mapIntent = new Intent(activity, settings.getMapFactory().getMapClass()); @@ -662,10 +661,10 @@ public class cgeomap extends MapBase { mapState[1] = mapCenter.getLongitudeE6(); mapState[2] = mapView.getMapZoomLevel(); mapIntent.putExtra("mapstate", mapState); - + // start the new map activity.startActivity(mapIntent); - + } return true; @@ -701,7 +700,7 @@ public class cgeomap extends MapBase { prefsEdit.putInt("mapsource", settings.mapSource.ordinal()); prefsEdit.commit(); - + boolean mapRestartRequired = settings.mapSource.isGoogleMapSource()!= settings.mapSourceUsed.isGoogleMapSource(); if (!mapRestartRequired) { @@ -1155,7 +1154,6 @@ public class cgeomap extends MapBase { try { stop = false; working = true; - downloadThreadRun = System.currentTimeMillis(); if (stop) { displayHandler.sendEmptyMessage(0); @@ -1662,7 +1660,7 @@ public class cgeomap extends MapBase { } else { viewport = app.getBounds(searchIdCenter); } - + if (viewport == null) return; Integer cnt = (Integer) viewport.get(0); |
