diff options
author | Bananeweizen <Bananeweizen@gmx.de> | 2012-03-23 23:38:31 -0700 |
---|---|---|
committer | Bananeweizen <Bananeweizen@gmx.de> | 2012-03-23 23:38:31 -0700 |
commit | f8ab632089847e2c4c34a162925e1c762be1bf6b (patch) | |
tree | 0d561d71ef49fad6da9a2ea99448494039705feb /main | |
parent | 2b5a1a7482178ec4773443cb1b0b2a174779a7da (diff) | |
parent | 9c028c81ed9c89adbb9ea24a58aa1952f9ead6c8 (diff) | |
download | cgeo-f8ab632089847e2c4c34a162925e1c762be1bf6b.zip cgeo-f8ab632089847e2c4c34a162925e1c762be1bf6b.tar.gz cgeo-f8ab632089847e2c4c34a162925e1c762be1bf6b.tar.bz2 |
Merge pull request #1288 from jenda69/master
Modifications for exporting caches to Locus (#1282)
Diffstat (limited to 'main')
-rw-r--r-- | main/res/values-cs/strings.xml | 1 | ||||
-rw-r--r-- | main/res/values/strings.xml | 1 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/apps/AbstractLocusApp.java | 10 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java | 3 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java | 11 |
6 files changed, 22 insertions, 6 deletions
diff --git a/main/res/values-cs/strings.xml b/main/res/values-cs/strings.xml index 8759093..0c744f6 100644 --- a/main/res/values-cs/strings.xml +++ b/main/res/values-cs/strings.xml @@ -206,6 +206,7 @@ <string name="caches_refresh_selected">aktualizovat vybrané</string> <string name="caches_refresh_all">aktualizovat vše</string> <string name="caches_map_locus">Locus</string> + <string name="caches_map_locus_export">Exportovat do Locusu</string> <string name="caches_recaptcha_title">reCAPTCHA</string> <string name="caches_recaptcha_explanation">Opište text z obrázků. Je to důležité pro stažení souřadnic keší.</string> <string name="caches_recaptcha_hint">Text z obrázku</string> diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index d401bae..5606309 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -298,6 +298,7 @@ <string name="caches_move_selected">Move selected</string> <string name="caches_move_all">Move all</string> <string name="caches_map_locus">Locus</string> + <string name="caches_map_locus_export">Export to Locus</string> <string name="caches_recaptcha_title">reCAPTCHA</string> <string name="caches_recaptcha_explanation">Please, write text from image. It\'s important to download coordinates of caches. It\'s optional and can be switched off in Settings.</string> <string name="caches_recaptcha_hint">Text from image</string> diff --git a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java index 46105cd..1ccf8dc 100644 --- a/main/src/cgeo/geocaching/apps/AbstractLocusApp.java +++ b/main/src/cgeo/geocaching/apps/AbstractLocusApp.java @@ -37,6 +37,10 @@ public abstract class AbstractLocusApp extends AbstractApp { super(getString(R.string.caches_map_locus), INTENT); } + protected AbstractLocusApp(final String text, final String intent) { + super(text, intent); + } + @Override public boolean isInstalled(Context context) { return LocusUtils.isLocusAvailable(context); @@ -52,7 +56,7 @@ public abstract class AbstractLocusApp extends AbstractApp { * @param activity * @author koem */ - protected static boolean showInLocus(final List<? extends Object> objectsToShow, final boolean withCacheWaypoints, + protected static boolean showInLocus(final List<? extends Object> objectsToShow, final boolean withCacheWaypoints, final boolean export, final Activity activity) { if (objectsToShow == null || objectsToShow.isEmpty()) { return false; @@ -78,13 +82,13 @@ public abstract class AbstractLocusApp extends AbstractApp { } if (pd.getPoints().size() <= 1000) { - DisplayData.sendData(activity, pd, false); + DisplayData.sendData(activity, pd, export); } else { final ArrayList<PointsData> data = new ArrayList<PointsData>(); data.add(pd); DisplayData.sendDataCursor(activity, data, "content://" + LocusDataStorageProvider.class.getCanonicalName().toLowerCase(), - false); + export); } return true; diff --git a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java index 260d933..c867373 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java @@ -34,7 +34,7 @@ class LocusApp extends AbstractLocusApp implements NavigationApp { points.add(waypoint); } - return showInLocus(points, true, activity); + return showInLocus(points, true, false, activity); } } diff --git a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java index fd19353..2d73885 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cachelist/CacheListAppFactory.java @@ -27,7 +27,8 @@ public final class CacheListAppFactory extends AbstractAppFactory { if (ArrayUtils.isEmpty(apps)) { apps = new CacheListApp[] { new InternalCacheListMap(), - new LocusCacheListApp() }; + new LocusCacheListApp(false), + new LocusCacheListApp(true) }; } return apps; } diff --git a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java index 0c5455c..1b50861 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java +++ b/main/src/cgeo/geocaching/apps/cachelist/LocusCacheListApp.java @@ -1,5 +1,6 @@ package cgeo.geocaching.apps.cachelist; +import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; @@ -8,11 +9,19 @@ import cgeo.geocaching.apps.AbstractLocusApp; import org.apache.commons.collections.CollectionUtils; import android.app.Activity; +import android.content.Intent; import java.util.List; class LocusCacheListApp extends AbstractLocusApp implements CacheListApp { + private boolean export; + + public LocusCacheListApp(boolean export) { + super(getString(export ? R.string.caches_map_locus_export : R.string.caches_map_locus), Intent.ACTION_VIEW); + this.export = export; + } + /** * show caches in Locus * @@ -25,7 +34,7 @@ class LocusCacheListApp extends AbstractLocusApp implements CacheListApp { return false; } - showInLocus(cacheList, false, activity); + showInLocus(cacheList, false, export, activity); return true; } |