aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo
diff options
context:
space:
mode:
authorSammysHP <sven@sammyshp.de>2012-01-03 14:38:31 +0100
committerSammysHP <sven@sammyshp.de>2012-01-03 14:38:31 +0100
commitf1217089bd35e227b2e0cf792e05676c2caec5dc (patch)
tree70c8addcee5a6b0f20951de5f673cbd967af6bb2 /main/src/cgeo
parent28744d3028aa73e8fa85f4ae3eace87f61946dc0 (diff)
downloadcgeo-f1217089bd35e227b2e0cf792e05676c2caec5dc.zip
cgeo-f1217089bd35e227b2e0cf792e05676c2caec5dc.tar.gz
cgeo-f1217089bd35e227b2e0cf792e05676c2caec5dc.tar.bz2
New: Autofill trackable code
Closes #926
Diffstat (limited to 'main/src/cgeo')
-rw-r--r--main/src/cgeo/geocaching/cgBase.java9
-rw-r--r--main/src/cgeo/geocaching/cgTrackable.java9
-rw-r--r--main/src/cgeo/geocaching/cgeotouch.java4
-rw-r--r--main/src/cgeo/geocaching/cgeotrackable.java1
4 files changed, 21 insertions, 2 deletions
diff --git a/main/src/cgeo/geocaching/cgBase.java b/main/src/cgeo/geocaching/cgBase.java
index 92ca634..9097e75 100644
--- a/main/src/cgeo/geocaching/cgBase.java
+++ b/main/src/cgeo/geocaching/cgBase.java
@@ -1439,7 +1439,7 @@ public class cgBase {
* if not null, the application to use to save the trackable
* @return the parsed trackable, or null if none could be parsed
*/
- public static cgTrackable parseTrackable(final String page, final cgeoapplication app) {
+ public static cgTrackable parseTrackable(final String page, final cgeoapplication app, final String possibleTrackingcode) {
if (StringUtils.isBlank(page)) {
Log.e(Settings.tag, "cgeoBase.parseTrackable: No page given");
return null;
@@ -1594,6 +1594,11 @@ public class cgBase {
Log.w(Settings.tag, "cgeoBase.parseCache: Failed to parse cache logs");
}
+ // trackingcode
+ if (!StringUtils.equalsIgnoreCase(trackable.getGeocode(), possibleTrackingcode)) {
+ trackable.setTrackingcode(possibleTrackingcode);
+ }
+
if (app != null) {
app.saveTrackable(trackable);
}
@@ -1974,7 +1979,7 @@ public class cgBase {
return trackable;
}
- trackable = parseTrackable(page, cgeoapplication.getInstance());
+ trackable = parseTrackable(page, cgeoapplication.getInstance(), geocode);
if (trackable == null) {
Log.e(Settings.tag, "cgeoBase.searchTrackable: No trackable parsed");
return null;
diff --git a/main/src/cgeo/geocaching/cgTrackable.java b/main/src/cgeo/geocaching/cgTrackable.java
index 95446d0..b5fc215 100644
--- a/main/src/cgeo/geocaching/cgTrackable.java
+++ b/main/src/cgeo/geocaching/cgTrackable.java
@@ -34,6 +34,7 @@ public class cgTrackable implements ILogable {
private String details = null;
private String image = null;
private List<cgLog> logs = new ArrayList<cgLog>();
+ private String trackingcode = null;
public String getUrl() {
if (StringUtils.startsWithIgnoreCase(geocode, "GK")) {
@@ -213,4 +214,12 @@ public class cgTrackable implements ILogable {
}
return true;
}
+
+ public String getTrackingcode() {
+ return trackingcode;
+ }
+
+ public void setTrackingcode(String trackingcode) {
+ this.trackingcode = trackingcode;
+ }
}
diff --git a/main/src/cgeo/geocaching/cgeotouch.java b/main/src/cgeo/geocaching/cgeotouch.java
index 7c56cba..d705743 100644
--- a/main/src/cgeo/geocaching/cgeotouch.java
+++ b/main/src/cgeo/geocaching/cgeotouch.java
@@ -112,6 +112,10 @@ public class cgeotouch extends AbstractActivity implements DateDialog.DateDialog
if (extras != null) {
geocode = extras.getString("geocode");
guid = extras.getString("guid");
+
+ if (StringUtils.isNotBlank(extras.getString("trackingcode"))) {
+ ((EditText) findViewById(R.id.tracking)).setText(extras.getString("trackingcode"));
+ }
}
trackable = app.getTrackableByGeocode("logging trackable");
diff --git a/main/src/cgeo/geocaching/cgeotrackable.java b/main/src/cgeo/geocaching/cgeotrackable.java
index d6f5b83..f0630d3 100644
--- a/main/src/cgeo/geocaching/cgeotrackable.java
+++ b/main/src/cgeo/geocaching/cgeotrackable.java
@@ -497,6 +497,7 @@ public class cgeotrackable extends AbstractActivity {
Intent logTouchIntent = new Intent(this, cgeotouch.class);
logTouchIntent.putExtra("geocode", trackable.getGeocode().toUpperCase());
logTouchIntent.putExtra("guid", trackable.getGuid());
+ logTouchIntent.putExtra("trackingcode", trackable.getTrackingcode());
startActivity(logTouchIntent);
}