aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java4
-rw-r--r--main/src/cgeo/geocaching/enumerations/CacheAttribute.java2
-rw-r--r--main/src/cgeo/geocaching/export/GpxExport.java16
-rw-r--r--tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java13
4 files changed, 27 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index de754b9..dfd8dde 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -1157,7 +1157,7 @@ public class CacheDetailActivity extends AbstractActivity {
}
/**
- * lazy-creates the layout holding the icons of the chaches attributes
+ * lazy-creates the layout holding the icons of the caches attributes
* and makes it visible
*/
private void showAttributeIcons(LinearLayout attribBox, int parentWidth) {
@@ -1175,7 +1175,7 @@ public class CacheDetailActivity extends AbstractActivity {
}
/**
- * lazy-creates the layout holding the discriptions of the chaches attributes
+ * lazy-creates the layout holding the descriptions of the caches attributes
* and makes it visible
*/
private void showAttributeDescriptions(LinearLayout attribBox) {
diff --git a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
index d3c0aa7..3dbfce5 100644
--- a/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
+++ b/main/src/cgeo/geocaching/enumerations/CacheAttribute.java
@@ -75,7 +75,7 @@ public enum CacheAttribute {
TOURIST_OK(63, "touristok"),
TREECLIMBING(64, "treeclimbing"),
FRONTYARD(65, "frontyard"),
- TEAMWORK(66, "teamwork_yes");
+ TEAMWORK(66, "teamwork");
public static final String INTERNAL_PRE = "attribute_";
public static final String INTERNAL_YES = "_yes";
diff --git a/main/src/cgeo/geocaching/export/GpxExport.java b/main/src/cgeo/geocaching/export/GpxExport.java
index 44a4f8d..ac4c336 100644
--- a/main/src/cgeo/geocaching/export/GpxExport.java
+++ b/main/src/cgeo/geocaching/export/GpxExport.java
@@ -49,7 +49,7 @@ public class GpxExport extends AbstractExport {
private File exportFile;
/**
- * Instantiates and configurates the task for exporting field notes.
+ * Instantiates and configures the task for exporting field notes.
*
* @param caches
* The {@link List} of {@link cgCache} to be exported
@@ -71,6 +71,12 @@ public class GpxExport extends AbstractExport {
@Override
protected Boolean doInBackground(Void... params) {
+ // quick check for being able to write the GPX file
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ return false;
+ }
+
+ // FIXME: complete export is created in memory. That should be some file stream instead.
final StringBuilder gpx = new StringBuilder();
gpx.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
@@ -145,9 +151,9 @@ public class GpxExport extends AbstractExport {
gpx.append(attr.id);
gpx.append("\" inc=\"");
if (enabled) {
- gpx.append("1");
+ gpx.append('1');
} else {
- gpx.append("0");
+ gpx.append('0');
}
gpx.append("\">");
gpx.append(StringEscapeUtils.escapeXml(attr.getL10n(enabled)));
@@ -246,7 +252,7 @@ public class GpxExport extends AbstractExport {
exportLocation.mkdirs();
SimpleDateFormat fileNameDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
- exportFile = new File(exportLocation + "/" + fileNameDateFormat.format(new Date()) + ".gpx");
+ exportFile = new File(exportLocation.toString() + '/' + fileNameDateFormat.format(new Date()) + ".gpx");
OutputStream os = null;
Writer fw = null;
@@ -279,7 +285,7 @@ public class GpxExport extends AbstractExport {
if (null != activity) {
progress.dismiss();
if (result) {
- ActivityMixin.showToast(activity, getName() + " " + getString(R.string.export_exportedto) + ": " + exportFile.toString());
+ ActivityMixin.showToast(activity, getName() + ' ' + getString(R.string.export_exportedto) + ": " + exportFile.toString());
} else {
ActivityMixin.showToast(activity, getString(R.string.export_failed));
}
diff --git a/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java
new file mode 100644
index 0000000..a15bd17
--- /dev/null
+++ b/tests/src/cgeo/geocaching/enumerations/CacheAttributeTest.java
@@ -0,0 +1,13 @@
+package cgeo.geocaching.enumerations;
+
+import android.test.AndroidTestCase;
+
+public class CacheAttributeTest extends AndroidTestCase {
+
+ public static void testTrimAttributeName() {
+ for (CacheAttribute attribute : CacheAttribute.values()) {
+ final String rawName = attribute.gcRawName;
+ assertTrue("bad attribute name " + rawName, CacheAttribute.trimAttributeName(rawName).equals(rawName));
+ }
+ }
+}