aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java4
-rw-r--r--main/src/cgeo/geocaching/Geocache.java8
-rw-r--r--main/src/cgeo/geocaching/MainActivity.java13
-rw-r--r--main/src/cgeo/geocaching/SearchResult.java6
-rw-r--r--main/src/cgeo/geocaching/UsefulAppsActivity.java1
-rw-r--r--main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java9
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java1
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCConnector.java6
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCMap.java4
-rw-r--r--main/src/cgeo/geocaching/connector/gc/GCParser.java17
-rw-r--r--main/src/cgeo/geocaching/files/GPXImporter.java2
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleCacheOverlay.java4
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java4
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java4
-rw-r--r--main/src/cgeo/geocaching/ui/CacheListAdapter.java6
-rw-r--r--main/src/cgeo/geocaching/ui/DirectionImage.java4
-rw-r--r--main/src/cgeo/geocaching/ui/ImagesList.java10
17 files changed, 60 insertions, 43 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 851a20c..33a6504 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2162,7 +2162,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
// Fast preview: parse only HTML without loading any images
HtmlImageCounter imageCounter = new HtmlImageCounter();
final UnknownTagsHandler unknownTagsHandler = new UnknownTagsHandler();
- holder.text.setText(Html.fromHtml(logText, imageCounter, unknownTagsHandler));
+ holder.text.setText(Html.fromHtml(logText, imageCounter, unknownTagsHandler), TextView.BufferType.SPANNABLE);
if (imageCounter.getImageCount() > 0) {
// Complete view: parse again with loading images - if necessary ! If there are any images causing problems the user can see at least the preview
LogImageLoader loader = new LogImageLoader(holder);
@@ -2170,7 +2170,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
}
}
else {
- holder.text.setText(logText);
+ holder.text.setText(logText, TextView.BufferType.SPANNABLE);
}
// images
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index c96acc6..ac1c9b1 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -176,7 +176,9 @@ public class Geocache implements ICache, IWaypoint {
}
/**
- * Gather missing information from another cache object.
+ * Gather missing information for new Geocache object from the stored Geocache object.
+ * This is called in the new Geocache parsed from website to set information not yet
+ * parsed.
*
* @param other
* the other version, or null if non-existent
@@ -188,6 +190,8 @@ public class Geocache implements ICache, IWaypoint {
}
updated = System.currentTimeMillis();
+ // if parsed cache is not yet detailed and stored is, the information of
+ // the parsed cache will be overwritten
if (!detailed && (other.detailed || zoomlevel < other.zoomlevel)) {
detailed = other.detailed;
detailedUpdate = other.detailedUpdate;
@@ -207,7 +211,7 @@ public class Geocache implements ICache, IWaypoint {
onWatchlist = other.onWatchlist;
logOffline = other.logOffline;
finalDefined = other.finalDefined;
- // archived is kept from the most recent data
+ archived = other.archived;
}
/*
diff --git a/main/src/cgeo/geocaching/MainActivity.java b/main/src/cgeo/geocaching/MainActivity.java
index b00567d..4393eda 100644
--- a/main/src/cgeo/geocaching/MainActivity.java
+++ b/main/src/cgeo/geocaching/MainActivity.java
@@ -36,6 +36,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
+import android.widget.ImageView;
import android.widget.TextView;
import java.util.ArrayList;
@@ -49,12 +50,12 @@ public class MainActivity extends AbstractActivity {
@InjectView(R.id.user_info) protected TextView userInfoView;
@InjectView(R.id.nav_satellites) protected TextView navSatellites;
@InjectView(R.id.filter_button_title)protected TextView filterTitle;
- @InjectView(R.id.map) protected View findOnMap;
- @InjectView(R.id.search_offline) protected View findByOffline;
- @InjectView(R.id.advanced_button) protected View advanced;
- @InjectView(R.id.any_button) protected View any;
- @InjectView(R.id.filter_button) protected View filter;
- @InjectView(R.id.nearest) protected View nearestView ;
+ @InjectView(R.id.map) protected ImageView findOnMap;
+ @InjectView(R.id.search_offline) protected ImageView findByOffline;
+ @InjectView(R.id.advanced_button) protected ImageView advanced;
+ @InjectView(R.id.any_button) protected ImageView any;
+ @InjectView(R.id.filter_button) protected ImageView filter;
+ @InjectView(R.id.nearest) protected ImageView nearestView;
@InjectView(R.id.nav_type) protected TextView navType ;
@InjectView(R.id.nav_accuracy) protected TextView navAccuracy ;
@InjectView(R.id.nav_location) protected TextView navLocation ;
diff --git a/main/src/cgeo/geocaching/SearchResult.java b/main/src/cgeo/geocaching/SearchResult.java
index b0540f2..4cef95e 100644
--- a/main/src/cgeo/geocaching/SearchResult.java
+++ b/main/src/cgeo/geocaching/SearchResult.java
@@ -114,7 +114,7 @@ public class SearchResult implements Parcelable {
public SearchResult(final Collection<Geocache> caches) {
this();
for (final Geocache cache : caches) {
- addCache(cache);
+ addAndPutInCache(cache);
}
}
@@ -199,7 +199,7 @@ public class SearchResult implements Parcelable {
(excludeMine && (cache.isOwner() || cache.isFound())) ||
(!cacheType.contains(cache));
if (!excludeCache) {
- result.addCache(cache);
+ result.addAndPutInCache(cache);
cachesForVote.add(cache);
}
}
@@ -229,7 +229,7 @@ public class SearchResult implements Parcelable {
}
/** Add the cache geocode to the search and store the cache in the CacheCache */
- public boolean addCache(final Geocache cache) {
+ public boolean addAndPutInCache(final Geocache cache) {
addGeocode(cache.getGeocode());
return cgData.saveCache(cache, EnumSet.of(SaveFlag.SAVE_CACHE));
}
diff --git a/main/src/cgeo/geocaching/UsefulAppsActivity.java b/main/src/cgeo/geocaching/UsefulAppsActivity.java
index dc5ea32..d6e0ec8 100644
--- a/main/src/cgeo/geocaching/UsefulAppsActivity.java
+++ b/main/src/cgeo/geocaching/UsefulAppsActivity.java
@@ -57,6 +57,7 @@ public class UsefulAppsActivity extends AbstractActivity {
private static final HelperApp[] HELPER_APPS = {
new HelperApp(R.string.helper_calendar_title, R.string.helper_calendar_description, R.drawable.cgeo, "cgeo.calendar"),
+ new HelperApp(R.string.helper_pocketquery_title, R.string.helper_pocketquery_description, R.drawable.helper_pocketquery, "org.pquery"),
new HelperApp(R.string.helper_locus_title, R.string.helper_locus_description, R.drawable.helper_locus, "menion.android.locus"),
new HelperApp(R.string.helper_gpsstatus_title, R.string.helper_gpsstatus_description, R.drawable.helper_gpsstatus, "com.eclipsim.gpsstatus2"),
new HelperApp(R.string.helper_bluetoothgps_title, R.string.helper_bluetoothgps_description, R.drawable.helper_bluetoothgps, "googoo.android.btgps"),
diff --git a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
index 8793c1c..e0c304a 100644
--- a/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
+++ b/main/src/cgeo/geocaching/activity/AbstractViewPagerActivity.java
@@ -14,6 +14,7 @@ import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
+import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.HashMap;
@@ -91,12 +92,12 @@ public abstract class AbstractViewPagerActivity<Page extends Enum<Page>> extends
private class ViewPagerAdapter extends PagerAdapter implements TitleProvider {
@Override
- public void destroyItem(View container, int position, Object object) {
+ public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((View) object);
}
@Override
- public void finishUpdate(View container) {
+ public void finishUpdate(ViewGroup container) {
}
@Override
@@ -105,7 +106,7 @@ public abstract class AbstractViewPagerActivity<Page extends Enum<Page>> extends
}
@Override
- public Object instantiateItem(View container, int position) {
+ public Object instantiateItem(ViewGroup container, int position) {
final Page page = pageOrder.get(position);
PageViewCreator creator = viewCreators.get(page);
@@ -146,7 +147,7 @@ public abstract class AbstractViewPagerActivity<Page extends Enum<Page>> extends
}
@Override
- public void startUpdate(View arg0) {
+ public void startUpdate(ViewGroup arg0) {
}
@Override
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 3b26376..a7a8f7e 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -112,7 +112,6 @@ public class cgeocaches extends AbstractListActivity implements FilteredActivity
private static final int MENU_FILTER = 74;
private static final int MENU_DELETE_EVENTS = 75;
private static final int MENU_CLEAR_OFFLINE_LOGS = 76;
- private static final int MENU_EXPORT_FIELDNOTES = 77;
private static final int MSG_DONE = -1;
private static final int MSG_RESTART_GEO_AND_DIR = -2;
diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
index cfbf761..82bd52a 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java
@@ -30,7 +30,11 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode,
private static final String CACHE_URL_SHORT = "http://coord.info/";
// Double slash is used to force open in browser
private static final String CACHE_URL_LONG = "http://www.geocaching.com//seek/cache_details.aspx?wp=";
- private static final Pattern gpxZipFilePattern = Pattern.compile("\\d{7,}(_.+)?\\.zip", Pattern.CASE_INSENSITIVE);
+ /**
+ * Pocket queries downloaded from the website use a numeric prefix. The pocket query creator Android app adds a
+ * verbatim "pocketquery" prefix.
+ */
+ private static final Pattern gpxZipFilePattern = Pattern.compile("((\\d{7,})|(pocketquery))" + "(_.+)?" + "\\.zip", Pattern.CASE_INSENSITIVE);
private GCConnector() {
// singleton
diff --git a/main/src/cgeo/geocaching/connector/gc/GCMap.java b/main/src/cgeo/geocaching/connector/gc/GCMap.java
index 49f61ef..3143a06 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCMap.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCMap.java
@@ -92,7 +92,7 @@ public class GCMap {
JSONObject ownerObj = dataObject.getJSONObject("owner");
cache.setOwnerDisplayName(ownerObj.getString("text"));
- result.addCache(cache);
+ result.addAndPutInCache(cache);
}
} catch (JSONException e) {
@@ -231,7 +231,7 @@ public class GCMap {
exclude = true;
}
if (!exclude) {
- searchResult.addCache(cache);
+ searchResult.addAndPutInCache(cache);
}
}
Log.d("Retrieved " + searchResult.getCount() + " caches for tile " + tile.toString());
diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java
index 3334c42..6d9f4ed 100644
--- a/main/src/cgeo/geocaching/connector/gc/GCParser.java
+++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java
@@ -167,13 +167,15 @@ public abstract class GCParser {
// cache direction - image
if (Settings.getLoadDirImg()) {
final String direction = BaseUtils.getMatch(row, GCConstants.PATTERN_SEARCH_DIRECTION_DISTANCE, false, 1, null, false);
- final String distance = BaseUtils.getMatch(row, GCConstants.PATTERN_SEARCH_DIRECTION_DISTANCE, false, 2, null, false);
if (direction != null) {
cache.setDirectionImg(direction);
}
- if (distance != null) {
- cache.setDistance(DistanceParser.parseDistance(distance, Settings.isUseMetricUnits()));
- }
+ }
+
+ // cache distance - estimated distance for basic members
+ final String distance = BaseUtils.getMatch(row, GCConstants.PATTERN_SEARCH_DIRECTION_DISTANCE, false, 2, null, false);
+ if (distance != null) {
+ cache.setDistance(DistanceParser.parseDistance(distance, Settings.isUseMetricUnits()));
}
// difficulty/terrain
@@ -242,7 +244,7 @@ public abstract class GCParser {
Log.w("GCParser.parseSearch: Failed to parse favorite count");
}
- searchResult.addCache(cache);
+ searchResult.addAndPutInCache(cache);
}
// total caches found
@@ -330,9 +332,11 @@ public abstract class GCParser {
static SearchResult parseCache(final String page, final CancellableHandler handler) {
final SearchResult searchResult = parseCacheFromText(page, handler);
+ // attention: parseCacheFromText already stores implicitely through searchResult.addCache
if (searchResult != null && !searchResult.getGeocodes().isEmpty()) {
final Geocache cache = searchResult.getFirstCacheFromResult(LoadFlags.LOAD_CACHE_OR_DB);
getExtraOnlineInfo(cache, page, handler);
+ // too late: it is already stored through parseCacheFromText
cache.setDetailedUpdatedNow();
if (CancellableHandler.isCancelled(handler)) {
return null;
@@ -726,7 +730,8 @@ public abstract class GCParser {
return searchResult;
}
- searchResult.addCache(cache);
+ cache.setDetailedUpdatedNow();
+ searchResult.addAndPutInCache(cache);
return searchResult;
}
diff --git a/main/src/cgeo/geocaching/files/GPXImporter.java b/main/src/cgeo/geocaching/files/GPXImporter.java
index 69d2dac..87c0ec4 100644
--- a/main/src/cgeo/geocaching/files/GPXImporter.java
+++ b/main/src/cgeo/geocaching/files/GPXImporter.java
@@ -140,7 +140,7 @@ public class GPXImporter {
final SearchResult search = new SearchResult();
for (Geocache cache : caches) {
- search.addCache(cache);
+ search.addAndPutInCache(cache);
}
if (Settings.isStoreOfflineMaps() || Settings.isStoreOfflineWpMaps()) {
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleCacheOverlay.java b/main/src/cgeo/geocaching/maps/google/GoogleCacheOverlay.java
index 4868a30..21d78a0 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleCacheOverlay.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleCacheOverlay.java
@@ -73,12 +73,12 @@ public class GoogleCacheOverlay extends ItemizedOverlay<GoogleCacheOverlayItem>
@Override
public Drawable superBoundCenter(Drawable markerIn) {
- return super.boundCenter(markerIn);
+ return ItemizedOverlay.boundCenter(markerIn);
}
@Override
public Drawable superBoundCenterBottom(Drawable marker) {
- return super.boundCenterBottom(marker);
+ return ItemizedOverlay.boundCenterBottom(marker);
}
@Override
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java
index 0bd2484..9e14e36 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeCacheOverlay.java
@@ -71,12 +71,12 @@ public class MapsforgeCacheOverlay extends ItemizedOverlay<MapsforgeCacheOverlay
@Override
public Drawable superBoundCenter(Drawable markerIn) {
- return super.boundCenter(markerIn);
+ return ItemizedOverlay.boundCenter(markerIn);
}
@Override
public Drawable superBoundCenterBottom(Drawable marker) {
- return super.boundCenterBottom(marker);
+ return ItemizedOverlay.boundCenterBottom(marker);
}
@Override
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java
index 581548f..30355fd 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeCacheOverlay.java
@@ -71,12 +71,12 @@ public class MapsforgeCacheOverlay extends ItemizedOverlay<MapsforgeCacheOverlay
@Override
public Drawable superBoundCenter(Drawable markerIn) {
- return super.boundCenter(markerIn);
+ return ItemizedOverlay.boundCenter(markerIn);
}
@Override
public Drawable superBoundCenterBottom(Drawable marker) {
- return super.boundCenterBottom(marker);
+ return ItemizedOverlay.boundCenterBottom(marker);
}
@Override
diff --git a/main/src/cgeo/geocaching/ui/CacheListAdapter.java b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
index 99ae405..7f4ceaa 100644
--- a/main/src/cgeo/geocaching/ui/CacheListAdapter.java
+++ b/main/src/cgeo/geocaching/ui/CacheListAdapter.java
@@ -18,6 +18,7 @@ import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.Log;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import android.app.Activity;
@@ -443,10 +444,13 @@ public class CacheListAdapter extends ArrayAdapter<Geocache> {
holder.dirImg.setVisibility(View.GONE);
holder.direction.updateAzimuth(azimuth);
holder.direction.updateHeading(cache.getDirection());
- } else {
+ } else if (StringUtils.isNotBlank(cache.getDirectionImg())) {
holder.dirImg.setImageDrawable(DirectionImage.getDrawable(cache.getDirectionImg()));
holder.dirImg.setVisibility(View.VISIBLE);
holder.direction.setVisibility(View.GONE);
+ } else {
+ holder.dirImg.setVisibility(View.GONE);
+ holder.direction.setVisibility(View.GONE);
}
holder.favorite.setText(Integer.toString(cache.getFavoritePoints()));
diff --git a/main/src/cgeo/geocaching/ui/DirectionImage.java b/main/src/cgeo/geocaching/ui/DirectionImage.java
index df7275d..9de360c 100644
--- a/main/src/cgeo/geocaching/ui/DirectionImage.java
+++ b/main/src/cgeo/geocaching/ui/DirectionImage.java
@@ -3,6 +3,8 @@ package cgeo.geocaching.ui;
import cgeo.geocaching.StoredList;
import cgeo.geocaching.network.HtmlImage;
+import org.apache.commons.lang3.StringUtils;
+
import android.graphics.drawable.BitmapDrawable;
public class DirectionImage {
@@ -16,7 +18,7 @@ public class DirectionImage {
* @return a drawable with the arrow pointing into the right direction
*/
public static BitmapDrawable getDrawable(final String directionCode) {
- return htmlImage.getDrawable("http://www.geocaching.com/images/icons/compass/" + directionCode + ".gif");
+ return StringUtils.isNotBlank(directionCode) ? htmlImage.getDrawable("http://www.geocaching.com/images/icons/compass/" + directionCode + ".gif") : null;
}
}
diff --git a/main/src/cgeo/geocaching/ui/ImagesList.java b/main/src/cgeo/geocaching/ui/ImagesList.java
index 218e16e..a0ffe84 100644
--- a/main/src/cgeo/geocaching/ui/ImagesList.java
+++ b/main/src/cgeo/geocaching/ui/ImagesList.java
@@ -39,9 +39,6 @@ import java.util.List;
public class ImagesList {
- private static final int MENU_FILE = 201;
- private static final int MENU_BROWSER = 202;
-
private BitmapDrawable currentDrawable;
private Image currentImage;
@@ -159,10 +156,9 @@ public class ImagesList {
}
public void onCreateContextMenu(ContextMenu menu, View v) {
+ activity.getMenuInflater().inflate(R.menu.images_list_context, menu);
final Resources res = activity.getResources();
menu.setHeaderTitle(res.getString(R.string.cache_image));
- menu.add(0, MENU_FILE, 0, res.getString(R.string.cache_image_open_file));
- menu.add(0, MENU_BROWSER, 0, res.getString(R.string.cache_image_open_browser));
final ImageView view = (ImageView) v;
currentDrawable = (BitmapDrawable) view.getDrawable();
currentImage = images.get(view.getId());
@@ -170,10 +166,10 @@ public class ImagesList {
public boolean onContextItemSelected(MenuItem item) {
switch (item.getItemId()) {
- case MENU_FILE:
+ case R.id.image_open_file:
viewImageInStandardApp(currentDrawable);
return true;
- case MENU_BROWSER:
+ case R.id.image_open_browser:
if (currentImage != null) {
currentImage.openInBrowser(activity);
}