aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-08-26 14:01:50 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-08-26 14:01:50 +0200
commite989666a734d4f36a20f70ed6b83339c2b0b4b54 (patch)
treed46d90af64a81da53824a949e05cc4be5c3cfbd1 /main/src/cgeo
parent36d9c61be952cbfc6d62016bf1c6538b5db13f3d (diff)
downloadcgeo-e989666a734d4f36a20f70ed6b83339c2b0b4b54.zip
cgeo-e989666a734d4f36a20f70ed6b83339c2b0b4b54.tar.gz
cgeo-e989666a734d4f36a20f70ed6b83339c2b0b4b54.tar.bz2
fix #1893: remove go4cache
Diffstat (limited to 'main/src/cgeo')
-rw-r--r--main/src/cgeo/geocaching/AbstractPopupActivity.java2
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java5
-rw-r--r--main/src/cgeo/geocaching/EditWaypointActivity.java6
-rw-r--r--main/src/cgeo/geocaching/GeoDataProvider.java3
-rw-r--r--main/src/cgeo/geocaching/LogTrackableActivity.java6
-rw-r--r--main/src/cgeo/geocaching/SearchActivity.java3
-rw-r--r--main/src/cgeo/geocaching/Settings.java16
-rw-r--r--main/src/cgeo/geocaching/SettingsActivity.java21
-rw-r--r--main/src/cgeo/geocaching/VisitCacheActivity.java5
-rw-r--r--main/src/cgeo/geocaching/cgeo.java2
-rw-r--r--main/src/cgeo/geocaching/cgeoapplication.java20
-rw-r--r--main/src/cgeo/geocaching/cgeocaches.java2
-rw-r--r--main/src/cgeo/geocaching/cgeonavigate.java12
-rw-r--r--main/src/cgeo/geocaching/go4cache/Go4Cache.java173
-rw-r--r--main/src/cgeo/geocaching/go4cache/Go4CacheUser.java106
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java150
-rw-r--r--main/src/cgeo/geocaching/maps/OtherCachersOverlay.java144
-rw-r--r--main/src/cgeo/geocaching/maps/OtherCachersOverlayItem.java36
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapItemFactory.java9
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapView.java8
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlay.java117
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlayItem.java32
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapItemFactory.java5
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java3
-rw-r--r--main/src/cgeo/geocaching/maps/interfaces/OtherCachersOverlayItemImpl.java12
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapItemFactory.java9
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java8
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlay.java120
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java32
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java10
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java8
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlay.java120
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlayItem.java32
-rw-r--r--main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java4
34 files changed, 3 insertions, 1238 deletions
diff --git a/main/src/cgeo/geocaching/AbstractPopupActivity.java b/main/src/cgeo/geocaching/AbstractPopupActivity.java
index a119949..d765bdc 100644
--- a/main/src/cgeo/geocaching/AbstractPopupActivity.java
+++ b/main/src/cgeo/geocaching/AbstractPopupActivity.java
@@ -109,8 +109,6 @@ public abstract class AbstractPopupActivity extends AbstractActivity {
}
protected void init() {
- app.setAction(geocode);
-
cache = app.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB);
if (cache == null) {
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index ed75d7a..5a11677 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -283,11 +283,6 @@ public class CacheDetailActivity extends AbstractActivity {
return;
}
- // Go4Cache
- if (StringUtils.isNotBlank(geocode)) {
- app.setAction(geocode);
- }
-
final LoadCacheHandler loadCacheHandler = new LoadCacheHandler();
try {
diff --git a/main/src/cgeo/geocaching/EditWaypointActivity.java b/main/src/cgeo/geocaching/EditWaypointActivity.java
index d32be66..ef2a2cc 100644
--- a/main/src/cgeo/geocaching/EditWaypointActivity.java
+++ b/main/src/cgeo/geocaching/EditWaypointActivity.java
@@ -66,8 +66,6 @@ public class EditWaypointActivity extends AbstractActivity {
lookup = waypoint.getLookup();
own = waypoint.isUserDefined();
- app.setAction(geocode);
-
if (waypoint.getCoords() != null) {
((Button) findViewById(R.id.buttonLatitude)).setText(waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE));
((Button) findViewById(R.id.buttonLongitude)).setText(waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE));
@@ -126,10 +124,6 @@ public class EditWaypointActivity extends AbstractActivity {
setTitle(res.getString(R.string.waypoint_edit_title));
}
- if (geocode != null) {
- app.setAction(geocode);
- }
-
Button buttonLat = (Button) findViewById(R.id.buttonLatitude);
buttonLat.setOnClickListener(new coordDialogListener());
Button buttonLon = (Button) findViewById(R.id.buttonLongitude);
diff --git a/main/src/cgeo/geocaching/GeoDataProvider.java b/main/src/cgeo/geocaching/GeoDataProvider.java
index 1b9a0f5..f615630 100644
--- a/main/src/cgeo/geocaching/GeoDataProvider.java
+++ b/main/src/cgeo/geocaching/GeoDataProvider.java
@@ -2,7 +2,6 @@ package cgeo.geocaching;
import cgeo.geocaching.enumerations.LocationProviderType;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.go4cache.Go4Cache;
import cgeo.geocaching.utils.Log;
import cgeo.geocaching.utils.MemorySubject;
@@ -335,8 +334,6 @@ class GeoDataProvider extends MemorySubject<IGeoData> {
final int visible = gpsLocation.isRecent() ? satellitesVisible : 0;
final IGeoData current = new GeoData(locationData.location, gpsEnabled, visible, satellitesFixed);
notifyObservers(current);
-
- Go4Cache.signalCoordinates(current.getCoords());
}
}
diff --git a/main/src/cgeo/geocaching/LogTrackableActivity.java b/main/src/cgeo/geocaching/LogTrackableActivity.java
index 578bd62..bcbc4d4 100644
--- a/main/src/cgeo/geocaching/LogTrackableActivity.java
+++ b/main/src/cgeo/geocaching/LogTrackableActivity.java
@@ -140,8 +140,6 @@ public class LogTrackableActivity extends AbstractActivity implements DateDialog
setTitle(res.getString(R.string.trackable_touch) + ": " + trackable.getGeocode().toUpperCase());
}
- app.setAction("logging trackable");
-
if (guid == null) {
showToast(res.getString(R.string.err_tb_forgot_saw));
@@ -232,10 +230,6 @@ public class LogTrackableActivity extends AbstractActivity implements DateDialog
}
public void init() {
- if (geocode != null) {
- app.setAction("logging trackable");
- }
-
final Button typeButton = (Button) findViewById(R.id.type);
registerForContextMenu(typeButton);
typeButton.setText(typeSelected.getL10n());
diff --git a/main/src/cgeo/geocaching/SearchActivity.java b/main/src/cgeo/geocaching/SearchActivity.java
index 638e509..3221479 100644
--- a/main/src/cgeo/geocaching/SearchActivity.java
+++ b/main/src/cgeo/geocaching/SearchActivity.java
@@ -44,9 +44,6 @@ public class SearchActivity extends AbstractActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // init
- app.setAction(null);
-
// search query
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
diff --git a/main/src/cgeo/geocaching/Settings.java b/main/src/cgeo/geocaching/Settings.java
index ee201e2..9e5a8a4 100644
--- a/main/src/cgeo/geocaching/Settings.java
+++ b/main/src/cgeo/geocaching/Settings.java
@@ -36,7 +36,6 @@ public final class Settings {
private static final String KEY_HELP_SHOWN = "helper";
private static final String KEY_ANYLONGITUDE = "anylongitude";
private static final String KEY_ANYLATITUDE = "anylatitude";
- private static final String KEY_PUBLICLOC = "publicloc";
private static final String KEY_USE_OFFLINEMAPS = "offlinemaps";
private static final String KEY_USE_OFFLINEWPMAPS = "offlinewpmaps";
private static final String KEY_WEB_DEVICE_CODE = "webDeviceCode";
@@ -150,7 +149,6 @@ public final class Settings {
e.putBoolean(KEY_HELP_SHOWN, old.getInt(KEY_HELP_SHOWN, 0) != 0);
e.putFloat(KEY_ANYLONGITUDE, old.getFloat(KEY_ANYLONGITUDE, 0));
e.putFloat(KEY_ANYLATITUDE, old.getFloat(KEY_ANYLATITUDE, 0));
- e.putBoolean(KEY_PUBLICLOC, 0 != old.getInt(KEY_PUBLICLOC, 0));
e.putBoolean(KEY_USE_OFFLINEMAPS, 0 != old.getInt(KEY_USE_OFFLINEMAPS, 1));
e.putBoolean(KEY_USE_OFFLINEWPMAPS, 0 != old.getInt(KEY_USE_OFFLINEWPMAPS, 0));
e.putString(KEY_WEB_DEVICE_CODE, old.getString(KEY_WEB_DEVICE_CODE, null));
@@ -721,20 +719,6 @@ public final class Settings {
});
}
- public static boolean isPublicLoc() {
- return sharedPrefs.getBoolean(KEY_PUBLICLOC, false);
- }
-
- public static void setPublicLoc(final boolean publicLocation) {
- editSharedSettings(new PrefRunnable() {
-
- @Override
- public void edit(Editor edit) {
- edit.putBoolean(KEY_PUBLICLOC, publicLocation);
- }
- });
- }
-
public static boolean isTrackableAutoVisit() {
return sharedPrefs.getBoolean(KEY_AUTO_VISIT_TRACKABLES, false);
}
diff --git a/main/src/cgeo/geocaching/SettingsActivity.java b/main/src/cgeo/geocaching/SettingsActivity.java
index 8d802bf..1f747b2 100644
--- a/main/src/cgeo/geocaching/SettingsActivity.java
+++ b/main/src/cgeo/geocaching/SettingsActivity.java
@@ -249,27 +249,6 @@ public class SettingsActivity extends AbstractActivity {
((EditText) findViewById(R.id.passvote)).setText(gcvoteLogin.right);
}
- // go4cache settings
- TextView go4cache = (TextView) findViewById(R.id.about_go4cache);
- go4cache.setClickable(true);
- go4cache.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View arg0) {
- startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://go4cache.com/")));
- }
- });
-
- final CheckBox publicButton = (CheckBox) findViewById(R.id.publicloc);
- publicButton.setChecked(Settings.isPublicLoc());
- publicButton.setOnClickListener(new View.OnClickListener() {
-
- @Override
- public void onClick(View v) {
- Settings.setPublicLoc(publicButton.isChecked());
- }
- });
-
// Twitter settings
Button authorizeTwitter = (Button) findViewById(R.id.authorize_twitter);
authorizeTwitter.setOnClickListener(new View.OnClickListener() {
diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java
index e5410e7..fd552f5 100644
--- a/main/src/cgeo/geocaching/VisitCacheActivity.java
+++ b/main/src/cgeo/geocaching/VisitCacheActivity.java
@@ -267,8 +267,6 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
setTitle(res.getString(R.string.log_new_log) + ": " + cache.getGeocode().toUpperCase());
}
- app.setAction(geocode);
-
init();
}
@@ -466,9 +464,6 @@ public class VisitCacheActivity extends AbstractActivity implements DateDialog.D
}
public void init() {
- if (geocode != null) {
- app.setAction(geocode);
- }
postButton = (Button) findViewById(R.id.post);
tweetBox = (LinearLayout) findViewById(R.id.tweet_box);
tweetCheck = (CheckBox) findViewById(R.id.tweet);
diff --git a/main/src/cgeo/geocaching/cgeo.java b/main/src/cgeo/geocaching/cgeo.java
index 5bf728f..c80ec6f 100644
--- a/main/src/cgeo/geocaching/cgeo.java
+++ b/main/src/cgeo/geocaching/cgeo.java
@@ -248,8 +248,6 @@ public class cgeo extends AbstractActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- app.setAction(null);
-
setContentView(R.layout.main);
setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL); // type to search
diff --git a/main/src/cgeo/geocaching/cgeoapplication.java b/main/src/cgeo/geocaching/cgeoapplication.java
index 137fe30..9c63555 100644
--- a/main/src/cgeo/geocaching/cgeoapplication.java
+++ b/main/src/cgeo/geocaching/cgeoapplication.java
@@ -36,7 +36,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class cgeoapplication extends Application {
final private cgData storage = new cgData();
- private String action = null;
private volatile GeoDataProvider geo;
private volatile DirectionProvider dir;
public boolean firstRun = true; // c:geo is just launched
@@ -368,25 +367,6 @@ public class cgeoapplication extends Application {
return storage.loadWaypoint(id);
}
- /**
- * set the current action to be reported to Go4Cache (if enabled in settings)<br>
- * this might be either
- * <ul>
- * <li>geocode</li>
- * <li>name of a cache</li>
- * <li>action like twittering</li>
- * </ul>
- *
- * @param action
- */
- public void setAction(String action) {
- this.action = action;
- }
-
- public String getAction() {
- return StringUtils.defaultString(action);
- }
-
/** {@link cgData#saveLogOffline(String, Date, LogType, String)} */
public boolean saveLogOffline(String geocode, Date date, LogType logtype, String log) {
return storage.saveLogOffline(geocode, date, logtype, log);
diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java
index 50a0d72..654927a 100644
--- a/main/src/cgeo/geocaching/cgeocaches.java
+++ b/main/src/cgeo/geocaching/cgeocaches.java
@@ -431,8 +431,6 @@ public class cgeocaches extends AbstractListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- app.setAction(action);
-
setTheme();
setContentView(R.layout.caches);
diff --git a/main/src/cgeo/geocaching/cgeonavigate.java b/main/src/cgeo/geocaching/cgeonavigate.java
index 53470b3..c308356 100644
--- a/main/src/cgeo/geocaching/cgeonavigate.java
+++ b/main/src/cgeo/geocaching/cgeonavigate.java
@@ -84,8 +84,6 @@ public class cgeonavigate extends AbstractActivity {
return;
}
- setGo4CacheAction();
-
// set header
setTitle();
setDestCoords();
@@ -99,8 +97,6 @@ public class cgeonavigate extends AbstractActivity {
public void onResume() {
super.onResume();
- setGo4CacheAction();
-
// sensor & geolocation manager
geoDirHandler.startGeoAndDir();
@@ -110,14 +106,6 @@ public class cgeonavigate extends AbstractActivity {
}
}
- private void setGo4CacheAction() {
- if (StringUtils.isNotBlank(geocode)) {
- app.setAction(geocode);
- } else if (StringUtils.isNotBlank(name)) {
- app.setAction(name);
- }
- }
-
@Override
public void onPause() {
geoDirHandler.stopGeoAndDir();
diff --git a/main/src/cgeo/geocaching/go4cache/Go4Cache.java b/main/src/cgeo/geocaching/go4cache/Go4Cache.java
deleted file mode 100644
index 131faa4..0000000
--- a/main/src/cgeo/geocaching/go4cache/Go4Cache.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package cgeo.geocaching.go4cache;
-
-import cgeo.geocaching.Settings;
-import cgeo.geocaching.cgeoapplication;
-import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.geopoint.GeopointFormatter.Format;
-import cgeo.geocaching.geopoint.Viewport;
-import cgeo.geocaching.network.Network;
-import cgeo.geocaching.network.Parameters;
-import cgeo.geocaching.utils.CryptUtils;
-import cgeo.geocaching.utils.Log;
-import cgeo.geocaching.utils.Version;
-
-import org.apache.commons.lang3.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ArrayBlockingQueue;
-
-/**
- *
- * Thread to send location information to go4cache.com. The singleton will be created
- * only if, at any time, the user opts in to send this information. Then the same thread
- * will take care of sending updated positions when available.
- *
- */
-
-public final class Go4Cache extends Thread {
-
- private static class InstanceHolder { // initialization on demand holder
- private static final Go4Cache INSTANCE = new Go4Cache();
- }
-
- private final static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // 2010-07-25 14:44:01
- final private ArrayBlockingQueue<Geopoint> queue = new ArrayBlockingQueue<Geopoint>(1);
-
- public static Go4Cache getInstance() { // no need to be synchronized
- return InstanceHolder.INSTANCE;
- }
-
- private Go4Cache() { // private singleton constructor
- super("Go4Cache");
- setPriority(Thread.MIN_PRIORITY);
- start();
- }
-
- /**
- * Send the coordinates to go4cache.com if the user opted in to do so.
- *
- * @param coords
- * the current coordinates
- */
- public static void signalCoordinates(final Geopoint coords) {
- if (Settings.isPublicLoc()) {
- getInstance().queue.offer(coords);
- }
- }
-
- @Override
- public void run() {
- Log.d("Go4Cache task started");
- Geopoint latestCoords = null;
- String latestAction = null;
-
- try {
- for (;;) {
- final Geopoint currentCoords = queue.take();
- final String currentAction = cgeoapplication.getInstance().getAction();
-
- // If we are too close and we haven't changed our current action, no need
- // to update our situation.
- if (null != latestCoords && latestCoords.distanceTo(currentCoords) < 0.75 && StringUtils.equals(latestAction, currentAction)) {
- continue;
- }
-
- final String username = Settings.getUsername();
- if (StringUtils.isBlank(username)) {
- continue;
- }
-
- final String latStr = currentCoords.format(Format.LAT_DECDEGREE_RAW);
- final String lonStr = currentCoords.format(Format.LON_DECDEGREE_RAW);
- final Parameters params = new Parameters(
- "u", username,
- "lt", latStr,
- "ln", lonStr,
- "a", currentAction,
- "s", (CryptUtils.sha1(username + "|" + latStr + "|" + lonStr + "|" + currentAction + "|" + CryptUtils.md5("carnero: developing your dreams"))).toLowerCase(),
- "v", Version.getVersionName(cgeoapplication.getInstance()));
-
- Network.postRequest("http://api.go4cache.com/", params);
-
- // Update our coordinates even if the request was not successful, as not to hammer the server
- // with invalid requests for every new GPS position.
- latestCoords = currentCoords;
- latestAction = currentAction;
- }
- } catch (InterruptedException e) {
- Log.e("Go4Cache.run: interrupted", e);
- }
- }
-
- /**
- * Return an immutable list of users present in the given viewport.
- *
- * @param username
- * the current username
- * @param viewport
- * the current viewport
- * @return the list of users present in the viewport
- */
- public static List<Go4CacheUser> getGeocachersInViewport(final String username, final Viewport viewport) {
- final List<Go4CacheUser> users = new ArrayList<Go4CacheUser>();
-
- if (null == username) {
- return users;
- }
-
- final Parameters params = new Parameters(
- "u", username,
- "ltm", viewport.bottomLeft.format(Format.LAT_DECDEGREE_RAW),
- "ltx", viewport.topRight.format(Format.LAT_DECDEGREE_RAW),
- "lnm", viewport.bottomLeft.format(Format.LON_DECDEGREE_RAW),
- "lnx", viewport.topRight.format(Format.LON_DECDEGREE_RAW));
-
- final String data = Network.getResponseData(Network.postRequest("http://api.go4cache.com/get.php", params));
-
- if (StringUtils.isBlank(data)) {
- Log.e("Go4Cache.getGeocachersInViewport: No data from server");
- return null;
- }
-
- try {
- final JSONArray usersData = new JSONObject(data).getJSONArray("users");
- final int count = usersData.length();
- for (int i = 0; i < count; i++) {
- final JSONObject oneUser = usersData.getJSONObject(i);
- users.add(parseUser(oneUser));
- }
- } catch (Exception e) {
- Log.e("cgBase.getGeocachersInViewport: " + e.toString());
- }
-
- return Collections.unmodifiableList(users);
- }
-
- /**
- * Parse user information from go4cache.com.
- *
- * @param user
- * a JSON object
- * @return a cgCache user filled with information
- * @throws JSONException
- * if JSON could not be parsed correctly
- * @throws ParseException
- * if the date could not be parsed as expected
- */
- private static Go4CacheUser parseUser(final JSONObject user) throws JSONException, ParseException {
- final Date date = dateFormat.parse(user.getString("located"));
- final String username = user.getString("user");
- final Geopoint coords = new Geopoint(user.getDouble("latitude"), user.getDouble("longitude"));
- final String action = user.getString("action");
- final String client = user.getString("client");
- return new Go4CacheUser(username, coords, date, action, client);
- }
-}
diff --git a/main/src/cgeo/geocaching/go4cache/Go4CacheUser.java b/main/src/cgeo/geocaching/go4cache/Go4CacheUser.java
deleted file mode 100644
index 08fd02e..0000000
--- a/main/src/cgeo/geocaching/go4cache/Go4CacheUser.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package cgeo.geocaching.go4cache;
-
-import cgeo.geocaching.R;
-import cgeo.geocaching.cgeoapplication;
-import cgeo.geocaching.geopoint.Geopoint;
-
-import android.content.res.Resources;
-
-import java.util.Date;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Go4CacheUser {
- private static final Pattern patternGeocode = Pattern.compile("^(GC[A-Z0-9]+)(\\: ?(.+))?$", Pattern.CASE_INSENSITIVE);
-
- private final Date date;
- private final String username;
- private final Geopoint coords;
- private final String action;
- private final String client;
-
- private String actionForDisplay;
- private String geocode;
- private Resources res;
-
- public Go4CacheUser(final String username, final Geopoint coords, final Date date, final String action, final String client) {
- this.username = username;
- this.coords = coords;
- this.date = new Date(date.getTime());
- this.action = action;
- this.client = client;
- }
-
- public Date getDate() {
- return date;
- }
-
- public String getUsername() {
- return username;
- }
-
- public Geopoint getCoords() {
- return coords;
- }
-
- public int getIconId() {
- if (client == null) {
- return -1;
- }
- if (client.equalsIgnoreCase("c:geo")) {
- return R.drawable.client_cgeo;
- }
- if (client.equalsIgnoreCase("preCaching")) {
- return R.drawable.client_precaching;
- }
- if (client.equalsIgnoreCase("Handy Geocaching")) {
- return R.drawable.client_handygeocaching;
- }
- return -1;
- }
-
- private void getGeocodeAndAction() {
- final Matcher matcherGeocode = patternGeocode.matcher(action.trim());
- res = cgeoapplication.getInstance().getResources();
-
- geocode = "";
- if (0 == action.length() || action.equalsIgnoreCase("pending")) {
- actionForDisplay = res.getString(R.string.go4cache_looking_around);
- } else if (action.equalsIgnoreCase("tweeting")) {
- actionForDisplay = res.getString(R.string.go4cache_tweeting);
- } else if (matcherGeocode.find()) {
- if (null != matcherGeocode.group(1)) {
- geocode = matcherGeocode.group(1).trim().toUpperCase();
- }
- if (null != matcherGeocode.group(3)) {
- actionForDisplay = res.getString(R.string.go4cache_heading_to) + " " + geocode + " (" + matcherGeocode.group(3).trim() + ")";
- } else {
- actionForDisplay = res.getString(R.string.go4cache_heading_to) + " " + geocode;
- }
- } else {
- actionForDisplay = action;
- }
- }
-
- public String getAction() {
- if (null == actionForDisplay) {
- getGeocodeAndAction();
- }
- return actionForDisplay + getTime() + ".";
- }
-
- private String getTime() {
- int minutes = (int) ((System.currentTimeMillis() - date.getTime()) / 60000);
- if (minutes < 0) {
- minutes = 0;
- }
- return " (" + res.getQuantityString(R.plurals.go4cache_time_minutes, minutes, minutes) + ")";
- }
-
- public String getGeocode() {
- if (null == geocode) {
- getGeocodeAndAction();
- }
- return geocode;
- }
-} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index d2910c4..aa9ed1b 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -22,8 +22,6 @@ import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.Viewport;
-import cgeo.geocaching.go4cache.Go4Cache;
-import cgeo.geocaching.go4cache.Go4CacheUser;
import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapActivityImpl;
@@ -33,7 +31,6 @@ import cgeo.geocaching.maps.interfaces.MapProvider;
import cgeo.geocaching.maps.interfaces.MapSource;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
import cgeo.geocaching.maps.interfaces.OnMapDragListener;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.GeoDirHandler;
@@ -151,21 +148,16 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// map status data
private boolean followMyLocation = false;
private Viewport viewport = null;
- private Viewport viewportUsers = null;
private int zoom = -100;
// threads
private LoadTimer loadTimer = null;
- private Go4CacheTimer go4CacheTimer = null;
private LoadDetails loadDetailsThread = null;
/** Time of last {@link LoadRunnable} run */
private volatile long loadThreadRun = 0L;
- /** Time of last {@link Go4CacheRunnable} run */
- private volatile long go4CacheThreadRun = 0L;
//Interthread communication flag
private volatile boolean downloaded = false;
// overlays
private CachesOverlay overlayCaches = null;
- private OtherCachersOverlay overlayGo4Cache = null;
private ScaleOverlay overlayScale = null;
private PositionOverlay overlayPosition = null;
// data for overlays
@@ -206,10 +198,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
private static ThreadPoolExecutor downloadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, downloadQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
private static BlockingQueue<Runnable> loadQueue = new ArrayBlockingQueue<Runnable>(1);
private static ThreadPoolExecutor loadExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, loadQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
- private static BlockingQueue<Runnable> Go4CacheQueue = new ArrayBlockingQueue<Runnable>(1);
- private static ThreadPoolExecutor Go4CacheExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, Go4CacheQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
- private static BlockingQueue<Runnable> go4CacheDisplayQueue = new ArrayBlockingQueue<Runnable>(1);
- private static ThreadPoolExecutor go4CacheDisplayExecutor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, go4CacheDisplayQueue, new ThreadPoolExecutor.DiscardOldestPolicy());
// handlers
/** Updates the titles */
@@ -433,10 +421,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// initialize overlays
mapView.clearOverlays();
- if (Settings.isPublicLoc() && overlayGo4Cache == null) {
- overlayGo4Cache = mapView.createAddUsersOverlay(activity, getResources().getDrawable(R.drawable.user_location));
- }
-
if (overlayCaches == null) {
overlayCaches = mapView.createAddMapOverlay(mapView.getContext(), getResources().getDrawable(R.drawable.marker));
}
@@ -498,8 +482,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
public void onResume() {
super.onResume();
- app.setAction(StringUtils.defaultIfBlank(geocodeIntent, null));
-
addGeoDirObservers();
if (!CollectionUtils.isEmpty(dirtyCaches)) {
@@ -532,11 +514,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
loadTimer = null;
}
- if (go4CacheTimer != null) {
- go4CacheTimer.stopIt();
- go4CacheTimer = null;
- }
-
deleteGeoDirObservers();
savePrefs();
@@ -975,7 +952,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
/**
- * Starts the {@link LoadTimer} and {@link Go4CacheTimer}.
+ * Starts the {@link LoadTimer}.
*/
public synchronized void startTimer() {
@@ -991,15 +968,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
loadTimer = new LoadTimer();
loadTimer.start();
}
-
- if (Settings.isPublicLoc()) {
- if (go4CacheTimer != null) {
- go4CacheTimer.stopIt();
- go4CacheTimer = null;
- }
- go4CacheTimer = new Go4CacheTimer();
- go4CacheTimer.start();
- }
}
/**
@@ -1082,60 +1050,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
/**
- * Timer triggering every 250 ms to start the {@link Go4CacheRunnable} for displaying user.
- */
-
- private class Go4CacheTimer extends Thread {
-
- public Go4CacheTimer() {
- super("Users Timer");
- }
-
- private volatile boolean stop = false;
-
- public void stopIt() {
- stop = true;
- }
-
- @Override
- public void run() {
- while (!stop) {
- try {
- sleep(250);
-
- if (mapView != null) {
- // get current viewport
- final Viewport viewportNow = mapView.getViewport();
-
- // check if map moved or zoomed
- boolean moved = false;
-
- long currentTime = System.currentTimeMillis();
-
- if (60000 < (currentTime - go4CacheThreadRun)) {
- moved = true;
- } else if (viewportUsers == null) {
- moved = true;
- } else if (mapMoved(viewportUsers, viewportNow) && !viewportUsers.includes(viewportNow)) {
- moved = true;
- }
-
- // save new values
- if (moved && (1000 < (currentTime - go4CacheThreadRun))) {
- viewportUsers = viewportNow;
- Go4CacheExecutor.execute(new Go4CacheRunnable(viewportUsers));
- }
- }
-
- yield();
- } catch (Exception e) {
- Log.w("cgeomap.LoadUsersTimer.run: " + e.toString());
- }
- }
- }
- }
-
- /**
* Worker thread that loads caches and waypoints from the database and then spawns the {@link DownloadRunnable}.
* started by {@link LoadTimer}
*/
@@ -1217,7 +1131,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
/**
* Worker thread downloading caches from the internet.
- * Started by {@link LoadRunnable}. Duplicate Code with {@link Go4CacheRunnable}
+ * Started by {@link LoadRunnable}.
*/
private class DownloadRunnable extends DoRunnable {
@@ -1337,66 +1251,6 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
}
- /**
- * Thread to load users from Go 4 Cache
- */
-
- private class Go4CacheRunnable extends DoRunnable {
-
- public Go4CacheRunnable(final Viewport viewport) {
- super(viewport);
- }
-
- @Override
- public void run() {
- go4CacheThreadRun = System.currentTimeMillis();
- List<Go4CacheUser> go4CacheUsers = Go4Cache.getGeocachersInViewport(Settings.getUsername(), viewport.resize(1.5));
- go4CacheDisplayExecutor.execute(new Go4CacheDisplayRunnable(go4CacheUsers, viewport));
- }
- }
-
- /**
- * Thread to display users of Go 4 Cache started from {@link Go4CacheRunnable}
- */
- private class Go4CacheDisplayRunnable extends DoRunnable {
-
- private List<Go4CacheUser> users = null;
-
- public Go4CacheDisplayRunnable(List<Go4CacheUser> usersIn, final Viewport viewport) {
- super(viewport);
- users = usersIn;
- }
-
- @Override
- public void run() {
- if (mapView == null || CollectionUtils.isEmpty(users)) {
- return;
- }
-
- // display users
- List<OtherCachersOverlayItemImpl> items = new ArrayList<OtherCachersOverlayItemImpl>();
-
- int counter = 0;
- OtherCachersOverlayItemImpl item;
-
- for (Go4CacheUser userOne : users) {
- if (userOne.getCoords() == null) {
- continue;
- }
-
- item = mapItemFactory.getOtherCachersOverlayItemBase(activity, userOne);
- items.add(item);
-
- counter++;
- if ((counter % 10) == 0) {
- overlayGo4Cache.updateItems(items);
- displayHandler.sendEmptyMessage(INVALIDATE_MAP);
- }
- }
-
- overlayGo4Cache.updateItems(items);
- }
- }
/**
* Thread to display one point. Started on opening if in single mode.
diff --git a/main/src/cgeo/geocaching/maps/OtherCachersOverlay.java b/main/src/cgeo/geocaching/maps/OtherCachersOverlay.java
deleted file mode 100644
index f8e4e17..0000000
--- a/main/src/cgeo/geocaching/maps/OtherCachersOverlay.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package cgeo.geocaching.maps;
-
-import cgeo.geocaching.CacheDetailActivity;
-import cgeo.geocaching.cgeoapplication;
-import cgeo.geocaching.go4cache.Go4CacheUser;
-import cgeo.geocaching.maps.interfaces.ItemizedOverlayImpl;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-import cgeo.geocaching.utils.Log;
-
-import org.apache.commons.lang3.StringUtils;
-
-import android.app.AlertDialog;
-import android.content.Context;
-import android.content.DialogInterface;
-import android.graphics.Canvas;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class OtherCachersOverlay extends AbstractItemizedOverlay {
-
- private List<OtherCachersOverlayItemImpl> items = new ArrayList<OtherCachersOverlayItemImpl>();
- private Context context = null;
-
- public OtherCachersOverlay(ItemizedOverlayImpl ovlImplIn, Context contextIn) {
- super(ovlImplIn);
- populate();
-
- context = contextIn;
- }
-
- protected void updateItems(OtherCachersOverlayItemImpl item) {
- final List<OtherCachersOverlayItemImpl> itemsPre = new ArrayList<OtherCachersOverlayItemImpl>();
- itemsPre.add(item);
-
- updateItems(itemsPre);
- }
-
- public void updateItems(List<OtherCachersOverlayItemImpl> itemsPre) {
- if (itemsPre == null) {
- return;
- }
-
- for (OtherCachersOverlayItemImpl item : itemsPre) {
- item.setMarker(boundCenter(item.getMarker(0)));
- }
-
- items.clear();
-
- if (itemsPre.size() > 0) {
- items = new ArrayList<OtherCachersOverlayItemImpl>(itemsPre);
- }
-
- setLastFocusedItemIndex(-1); // to reset tap during data change
- populate();
- }
-
- @Override
- public boolean onTap(int index) {
- try {
- if (items.size() <= index) {
- return false;
- }
-
- final OtherCachersOverlayItemImpl item = items.get(index);
- final Go4CacheUser user = item.getUser();
-
- final String geocode = user.getGeocode();
- final int icon = user.getIconId();
-
- final AlertDialog.Builder dialog = new AlertDialog.Builder(context);
- if (icon > -1) {
- dialog.setIcon(icon);
- }
- dialog.setTitle(user.getUsername());
- dialog.setMessage(user.getAction());
- dialog.setCancelable(true);
- if (StringUtils.isNotBlank(geocode)) {
- dialog.setPositiveButton(geocode, new cacheDetails(geocode));
- }
- dialog.setNeutralButton(cgeoapplication.getInstance().getResources().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
-
- @Override
- public void onClick(DialogInterface dialog, int id) {
- dialog.cancel();
- }
- });
-
- dialog.create().show();
-
- return true;
- } catch (Exception e) {
- Log.e("cgUsersOverlay.onTap: " + e.toString());
- }
-
- return false;
- }
-
- @Override
- public void draw(Canvas canvas, MapViewImpl mapView, boolean shadow) {
- super.draw(canvas, mapView, false);
- }
-
- @Override
- public OtherCachersOverlayItemImpl createItem(int index) {
- try {
- return items.get(index);
- } catch (Exception e) {
- Log.e("cgUsersOverlay.createItem: " + e.toString());
- }
-
- return null;
- }
-
- @Override
- public int size() {
- try {
- return items.size();
- } catch (Exception e) {
- Log.e("cgUsersOverlay.size: " + e.toString());
- }
-
- return 0;
- }
-
- private class cacheDetails implements DialogInterface.OnClickListener {
-
- private String geocode = null;
-
- public cacheDetails(String geocodeIn) {
- geocode = geocodeIn;
- }
-
- @Override
- public void onClick(DialogInterface dialog, int id) {
- if (geocode != null) {
- CacheDetailActivity.startActivity(context, geocode);
- }
-
- dialog.cancel();
- }
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/OtherCachersOverlayItem.java b/main/src/cgeo/geocaching/maps/OtherCachersOverlayItem.java
deleted file mode 100644
index 9844e83..0000000
--- a/main/src/cgeo/geocaching/maps/OtherCachersOverlayItem.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package cgeo.geocaching.maps;
-
-import cgeo.geocaching.R;
-import cgeo.geocaching.go4cache.Go4CacheUser;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-public class OtherCachersOverlayItem {
- private final Context context;
- private final Go4CacheUser user;
-
- public OtherCachersOverlayItem(Context contextIn, Go4CacheUser userIn) {
- context = contextIn;
- user = userIn;
- }
-
- public Drawable getMarker() {
- Drawable marker;
-
- if (user != null && user.getDate() != null && user.getDate().getTime() >= (System.currentTimeMillis() - (20 * 60 * 1000))) {
- marker = context.getResources().getDrawable(R.drawable.user_location_active);
- } else {
- marker = context.getResources().getDrawable(R.drawable.user_location);
- }
-
- marker.setBounds(0, 0, marker.getIntrinsicWidth(), marker.getIntrinsicHeight());
- marker.setAlpha(190);
-
- return marker;
- }
-
- public Go4CacheUser getUser() {
- return user;
- }
-} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapItemFactory.java b/main/src/cgeo/geocaching/maps/google/GoogleMapItemFactory.java
index 1a10023..f40c799 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapItemFactory.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapItemFactory.java
@@ -3,13 +3,9 @@ package cgeo.geocaching.maps.google;
import cgeo.geocaching.IWaypoint;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.go4cache.Go4CacheUser;
import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapItemFactory;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-
-import android.content.Context;
public class GoogleMapItemFactory implements MapItemFactory {
@@ -22,9 +18,4 @@ public class GoogleMapItemFactory implements MapItemFactory {
public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, final CacheType type) {
return new GoogleCacheOverlayItem(coordinate, type);
}
-
- @Override
- public OtherCachersOverlayItemImpl getOtherCachersOverlayItemBase(Context context, Go4CacheUser userOne) {
- return new GoogleOtherCachersOverlayItem(context, userOne);
- }
}
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
index c575177..f43b6a4 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
@@ -5,7 +5,6 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import cgeo.geocaching.Settings;
import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
-import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
import cgeo.geocaching.maps.ScaleOverlay;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
@@ -120,13 +119,6 @@ public class GoogleMapView extends MapView implements MapViewImpl {
}
@Override
- public OtherCachersOverlay createAddUsersOverlay(Context context, Drawable markerIn) {
- GoogleOtherCachersOverlay ovl = new GoogleOtherCachersOverlay(context, markerIn);
- getOverlays().add(ovl);
- return ovl.getBase();
- }
-
- @Override
public PositionOverlay createAddPositionOverlay(Activity activity) {
GoogleOverlay ovl = new GoogleOverlay(activity, overlayType.PositionOverlay);
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlay.java b/main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlay.java
deleted file mode 100644
index 4c330c9..0000000
--- a/main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlay.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package cgeo.geocaching.maps.google;
-
-import cgeo.geocaching.maps.OtherCachersOverlay;
-import cgeo.geocaching.maps.interfaces.ItemizedOverlayImpl;
-import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-
-import com.google.android.maps.ItemizedOverlay;
-import com.google.android.maps.MapView;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Point;
-import android.graphics.drawable.Drawable;
-
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class GoogleOtherCachersOverlay extends ItemizedOverlay<GoogleOtherCachersOverlayItem> implements ItemizedOverlayImpl {
-
- private OtherCachersOverlay base;
- private Lock lock = new ReentrantLock();
-
- public GoogleOtherCachersOverlay(Context contextIn, Drawable markerIn) {
- super(boundCenter(markerIn));
- base = new OtherCachersOverlay(this, contextIn);
- }
-
- @Override
- public OtherCachersOverlay getBase() {
- return base;
- }
-
- @Override
- protected GoogleOtherCachersOverlayItem createItem(int i) {
- if (base == null) {
- return null;
- }
-
- return (GoogleOtherCachersOverlayItem) base.createItem(i);
- }
-
- @Override
- public int size() {
- if (base == null) {
- return 0;
- }
-
- return base.size();
- }
-
- @Override
- protected boolean onTap(int arg0) {
- if (base == null) {
- return false;
- }
-
- return base.onTap(arg0);
- }
-
- @Override
- public void draw(Canvas canvas, MapView mapView, boolean shadow) {
- base.draw(canvas, (MapViewImpl) mapView, shadow);
- }
-
- @Override
- public void superPopulate() {
- populate();
- }
-
- @Override
- public Drawable superBoundCenter(Drawable markerIn) {
- return super.boundCenter(markerIn);
- }
-
- @Override
- public Drawable superBoundCenterBottom(Drawable marker) {
- return super.boundCenterBottom(marker);
- }
-
- @Override
- public void superSetLastFocusedItemIndex(int i) {
- super.setLastFocusedIndex(i);
- }
-
- @Override
- public boolean superOnTap(int index) {
- return super.onTap(index);
- }
-
- @Override
- public void superDraw(Canvas canvas, MapViewImpl mapView, boolean shadow) {
- super.draw(canvas, (MapView) mapView, shadow);
- }
-
- @Override
- public void superDrawOverlayBitmap(Canvas canvas, Point drawPosition,
- MapProjectionImpl projection, byte drawZoomLevel) {
- // Nothing to do here
- }
-
- @Override
- public void lock() {
- lock.lock();
- }
-
- @Override
- public void unlock() {
- lock.unlock();
- }
-
- @Override
- public MapViewImpl getMapViewImpl() {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlayItem.java b/main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlayItem.java
deleted file mode 100644
index 0e3067a..0000000
--- a/main/src/cgeo/geocaching/maps/google/GoogleOtherCachersOverlayItem.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cgeo.geocaching.maps.google;
-
-import cgeo.geocaching.go4cache.Go4CacheUser;
-import cgeo.geocaching.maps.OtherCachersOverlayItem;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-
-import com.google.android.maps.GeoPoint;
-import com.google.android.maps.OverlayItem;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-public class GoogleOtherCachersOverlayItem extends OverlayItem implements OtherCachersOverlayItemImpl {
- final private OtherCachersOverlayItem item;
-
- public GoogleOtherCachersOverlayItem(Context context, Go4CacheUser user) {
- super(new GeoPoint(user.getCoords().getLatitudeE6(), user.getCoords().getLongitudeE6()), user.getUsername(), "");
- item = new OtherCachersOverlayItem(context, user);
- }
-
- @Override
- public Drawable getMarker(int state) {
- final Drawable marker = item.getMarker();
- setMarker(marker);
- return marker;
- }
-
- @Override
- public Go4CacheUser getUser() {
- return item.getUser();
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapItemFactory.java b/main/src/cgeo/geocaching/maps/interfaces/MapItemFactory.java
index c38739d..e02d472 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapItemFactory.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapItemFactory.java
@@ -3,9 +3,6 @@ package cgeo.geocaching.maps.interfaces;
import cgeo.geocaching.IWaypoint;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.go4cache.Go4CacheUser;
-
-import android.content.Context;
public interface MapItemFactory {
@@ -13,6 +10,4 @@ public interface MapItemFactory {
public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint iWaypoint, final CacheType type);
- public OtherCachersOverlayItemImpl getOtherCachersOverlayItemBase(Context context,
- Go4CacheUser userOne);
}
diff --git a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
index 1bafc57..ad481cb 100644
--- a/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
+++ b/main/src/cgeo/geocaching/maps/interfaces/MapViewImpl.java
@@ -2,7 +2,6 @@ package cgeo.geocaching.maps.interfaces;
import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
-import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
import cgeo.geocaching.maps.ScaleOverlay;
@@ -48,8 +47,6 @@ public interface MapViewImpl {
CachesOverlay createAddMapOverlay(Context context, Drawable drawable);
- OtherCachersOverlay createAddUsersOverlay(Context context, Drawable markerIn);
-
ScaleOverlay createAddScaleOverlay(Activity activity);
PositionOverlay createAddPositionOverlay(Activity activity);
diff --git a/main/src/cgeo/geocaching/maps/interfaces/OtherCachersOverlayItemImpl.java b/main/src/cgeo/geocaching/maps/interfaces/OtherCachersOverlayItemImpl.java
deleted file mode 100644
index 453c8a9..0000000
--- a/main/src/cgeo/geocaching/maps/interfaces/OtherCachersOverlayItemImpl.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package cgeo.geocaching.maps.interfaces;
-
-import cgeo.geocaching.go4cache.Go4CacheUser;
-
-/**
- * Common functions of the provider-specific
- * UserOverlayItem implementations
- */
-public interface OtherCachersOverlayItemImpl extends OverlayItemImpl {
-
- public Go4CacheUser getUser();
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapItemFactory.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapItemFactory.java
index 0df7894..10fcb03 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapItemFactory.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapItemFactory.java
@@ -3,13 +3,9 @@ package cgeo.geocaching.maps.mapsforge;
import cgeo.geocaching.IWaypoint;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.go4cache.Go4CacheUser;
import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapItemFactory;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-
-import android.content.Context;
public class MapsforgeMapItemFactory implements MapItemFactory {
@@ -23,9 +19,4 @@ public class MapsforgeMapItemFactory implements MapItemFactory {
return new MapsforgeCacheOverlayItem(coordinate, type);
}
- @Override
- public OtherCachersOverlayItemImpl getOtherCachersOverlayItemBase(Context context, Go4CacheUser userOne) {
- return new MapsforgeOtherCachersOverlayItem(context, userOne);
- }
-
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index c24a798..3dd58a7 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -5,7 +5,6 @@ import cgeo.geocaching.Settings;
import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
import cgeo.geocaching.maps.MapProviderFactory;
-import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
import cgeo.geocaching.maps.ScaleOverlay;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
@@ -108,13 +107,6 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
@Override
- public OtherCachersOverlay createAddUsersOverlay(Context context, Drawable markerIn) {
- MapsforgeOtherCachersOverlay ovl = new MapsforgeOtherCachersOverlay(context, markerIn);
- getOverlays().add(ovl);
- return ovl.getBase();
- }
-
- @Override
public PositionOverlay createAddPositionOverlay(Activity activity) {
MapsforgeOverlay ovl = new MapsforgeOverlay(activity, overlayType.PositionOverlay);
getOverlays().add(ovl);
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlay.java
deleted file mode 100644
index 66aa13e..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlay.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package cgeo.geocaching.maps.mapsforge;
-
-import cgeo.geocaching.maps.OtherCachersOverlay;
-import cgeo.geocaching.maps.interfaces.ItemizedOverlayImpl;
-import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-
-import org.mapsforge.android.maps.Projection;
-import org.mapsforge.android.maps.overlay.ItemizedOverlay;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Point;
-import android.graphics.drawable.Drawable;
-
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class MapsforgeOtherCachersOverlay extends ItemizedOverlay<MapsforgeOtherCachersOverlayItem> implements ItemizedOverlayImpl {
-
- private OtherCachersOverlay base;
- private Lock lock = new ReentrantLock();
-
- public MapsforgeOtherCachersOverlay(Context contextIn, Drawable markerIn) {
- super(boundCenter(markerIn));
- base = new OtherCachersOverlay(this, contextIn);
- }
-
- @Override
- public OtherCachersOverlay getBase() {
- return base;
- }
-
- @Override
- protected MapsforgeOtherCachersOverlayItem createItem(int i) {
- if (base == null) {
- return null;
- }
-
- return (MapsforgeOtherCachersOverlayItem) base.createItem(i);
- }
-
- @Override
- public int size() {
- if (base == null) {
- return 0;
- }
-
- return base.size();
- }
-
- @Override
- protected boolean onTap(int arg0) {
- if (base == null) {
- return false;
- }
-
- return base.onTap(arg0);
- }
-
- @Override
- protected void drawOverlayBitmap(Canvas canvas, Point drawPosition,
- Projection projection, byte drawZoomLevel) {
-
- base.drawOverlayBitmap(canvas, drawPosition, new MapsforgeMapProjection(projection), drawZoomLevel);
- }
-
- @Override
- public void superPopulate() {
- populate();
- }
-
- @Override
- public Drawable superBoundCenter(Drawable markerIn) {
- return super.boundCenter(markerIn);
- }
-
- @Override
- public Drawable superBoundCenterBottom(Drawable marker) {
- return super.boundCenterBottom(marker);
- }
-
- @Override
- public void superSetLastFocusedItemIndex(int i) {
- // Nothing to do here
- }
-
- @Override
- public boolean superOnTap(int index) {
- return super.onTap(index);
- }
-
- @Override
- public void superDraw(Canvas canvas, MapViewImpl mapView, boolean shadow) {
- // Nothing to do here
- }
-
- @Override
- public void superDrawOverlayBitmap(Canvas canvas, Point drawPosition,
- MapProjectionImpl projection, byte drawZoomLevel) {
-
- super.drawOverlayBitmap(canvas, drawPosition, (Projection) projection.getImpl(), drawZoomLevel);
- }
-
- @Override
- public void lock() {
- lock.lock();
- }
-
- @Override
- public void unlock() {
- lock.unlock();
- }
-
- @Override
- public MapViewImpl getMapViewImpl() {
- return (MapViewImpl) internalMapView;
- }
-
-} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java
deleted file mode 100644
index f80664e..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOtherCachersOverlayItem.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cgeo.geocaching.maps.mapsforge;
-
-import cgeo.geocaching.go4cache.Go4CacheUser;
-import cgeo.geocaching.maps.OtherCachersOverlayItem;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-
-import org.mapsforge.android.maps.overlay.OverlayItem;
-import org.mapsforge.core.GeoPoint;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-public class MapsforgeOtherCachersOverlayItem extends OverlayItem implements OtherCachersOverlayItemImpl {
- private final OtherCachersOverlayItem item;
-
- public MapsforgeOtherCachersOverlayItem(Context context, Go4CacheUser user) {
- super(new GeoPoint(user.getCoords().getLatitudeE6(), user.getCoords().getLongitudeE6()), user.getUsername(), "");
- item = new OtherCachersOverlayItem(context, user);
- }
-
- @Override
- public Drawable getMarker(int state) {
- Drawable marker = item.getMarker();
- setMarker(marker);
- return marker;
- }
-
- @Override
- public Go4CacheUser getUser() {
- return item.getUser();
- }
-}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java
index 863cbca..5c64592 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapItemFactory024.java
@@ -3,13 +3,9 @@ package cgeo.geocaching.maps.mapsforge.v024;
import cgeo.geocaching.IWaypoint;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.go4cache.Go4CacheUser;
import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl;
import cgeo.geocaching.maps.interfaces.GeoPointImpl;
import cgeo.geocaching.maps.interfaces.MapItemFactory;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-
-import android.content.Context;
public class MapsforgeMapItemFactory024 implements MapItemFactory {
@@ -22,10 +18,4 @@ public class MapsforgeMapItemFactory024 implements MapItemFactory {
public CachesOverlayItemImpl getCachesOverlayItem(final IWaypoint coordinate, final CacheType type) {
return new MapsforgeCacheOverlayItem(coordinate, type);
}
-
- @Override
- public OtherCachersOverlayItemImpl getOtherCachersOverlayItemBase(Context context, Go4CacheUser userOne) {
- return new MapsforgeOtherCachersOverlayItem(context, userOne);
- }
-
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
index e53d976..a459804 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
@@ -4,7 +4,6 @@ import cgeo.geocaching.R;
import cgeo.geocaching.Settings;
import cgeo.geocaching.geopoint.Viewport;
import cgeo.geocaching.maps.CachesOverlay;
-import cgeo.geocaching.maps.OtherCachersOverlay;
import cgeo.geocaching.maps.PositionOverlay;
import cgeo.geocaching.maps.ScaleOverlay;
import cgeo.geocaching.maps.interfaces.GeneralOverlay;
@@ -103,13 +102,6 @@ public class MapsforgeMapView024 extends MapView implements MapViewImpl {
}
@Override
- public OtherCachersOverlay createAddUsersOverlay(Context context, Drawable markerIn) {
- MapsforgeOtherCachersOverlay ovl = new MapsforgeOtherCachersOverlay(context, markerIn);
- getOverlays().add(ovl);
- return ovl.getBase();
- }
-
- @Override
public PositionOverlay createAddPositionOverlay(Activity activity) {
MapsforgeOverlay ovl = new MapsforgeOverlay(activity, overlayType.PositionOverlay);
getOverlays().add(ovl);
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlay.java
deleted file mode 100644
index 64ce8b0..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlay.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.maps.OtherCachersOverlay;
-import cgeo.geocaching.maps.interfaces.ItemizedOverlayImpl;
-import cgeo.geocaching.maps.interfaces.MapProjectionImpl;
-import cgeo.geocaching.maps.interfaces.MapViewImpl;
-
-import org.mapsforge.android.mapsold.ItemizedOverlay;
-import org.mapsforge.android.mapsold.Projection;
-
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Point;
-import android.graphics.drawable.Drawable;
-
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-public class MapsforgeOtherCachersOverlay extends ItemizedOverlay<MapsforgeOtherCachersOverlayItem> implements ItemizedOverlayImpl {
-
- private OtherCachersOverlay base;
- private Lock lock = new ReentrantLock();
-
- public MapsforgeOtherCachersOverlay(Context contextIn, Drawable markerIn) {
- super(boundCenter(markerIn));
- base = new OtherCachersOverlay(this, contextIn);
- }
-
- @Override
- public OtherCachersOverlay getBase() {
- return base;
- }
-
- @Override
- protected MapsforgeOtherCachersOverlayItem createItem(int i) {
- if (base == null) {
- return null;
- }
-
- return (MapsforgeOtherCachersOverlayItem) base.createItem(i);
- }
-
- @Override
- public int size() {
- if (base == null) {
- return 0;
- }
-
- return base.size();
- }
-
- @Override
- protected boolean onTap(int arg0) {
- if (base == null) {
- return false;
- }
-
- return base.onTap(arg0);
- }
-
- @Override
- protected void drawOverlayBitmap(Canvas canvas, Point drawPosition,
- Projection projection, byte drawZoomLevel) {
-
- base.drawOverlayBitmap(canvas, drawPosition, new MapsforgeMapProjection(projection), drawZoomLevel);
- }
-
- @Override
- public void superPopulate() {
- populate();
- }
-
- @Override
- public Drawable superBoundCenter(Drawable markerIn) {
- return super.boundCenter(markerIn);
- }
-
- @Override
- public Drawable superBoundCenterBottom(Drawable marker) {
- return super.boundCenterBottom(marker);
- }
-
- @Override
- public void superSetLastFocusedItemIndex(int i) {
- // Nothing to do here
- }
-
- @Override
- public boolean superOnTap(int index) {
- return super.onTap(index);
- }
-
- @Override
- public void superDraw(Canvas canvas, MapViewImpl mapView, boolean shadow) {
- // Nothing to do here
- }
-
- @Override
- public void superDrawOverlayBitmap(Canvas canvas, Point drawPosition,
- MapProjectionImpl projection, byte drawZoomLevel) {
-
- super.drawOverlayBitmap(canvas, drawPosition, (Projection) projection.getImpl(), drawZoomLevel);
- }
-
- @Override
- public void lock() {
- lock.lock();
- }
-
- @Override
- public void unlock() {
- lock.unlock();
- }
-
- @Override
- public MapViewImpl getMapViewImpl() {
- return (MapViewImpl) internalMapView;
- }
-
-} \ No newline at end of file
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlayItem.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlayItem.java
deleted file mode 100644
index ec38500..0000000
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeOtherCachersOverlayItem.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package cgeo.geocaching.maps.mapsforge.v024;
-
-import cgeo.geocaching.go4cache.Go4CacheUser;
-import cgeo.geocaching.maps.OtherCachersOverlayItem;
-import cgeo.geocaching.maps.interfaces.OtherCachersOverlayItemImpl;
-
-import org.mapsforge.android.mapsold.GeoPoint;
-import org.mapsforge.android.mapsold.OverlayItem;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-
-public class MapsforgeOtherCachersOverlayItem extends OverlayItem implements OtherCachersOverlayItemImpl {
- private final OtherCachersOverlayItem item;
-
- public MapsforgeOtherCachersOverlayItem(Context context, Go4CacheUser user) {
- super(new GeoPoint(user.getCoords().getLatitudeE6(), user.getCoords().getLongitudeE6()), user.getUsername(), "");
- item = new OtherCachersOverlayItem(context, user);
- }
-
- @Override
- public Drawable getMarker(int state) {
- Drawable marker = item.getMarker();
- setMarker(marker);
- return marker;
- }
-
- @Override
- public Go4CacheUser getUser() {
- return item.getUser();
- }
-}
diff --git a/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java b/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
index ef198dd..22ee0fb 100644
--- a/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
+++ b/main/src/cgeo/geocaching/twitter/TwitterAuthorizationActivity.java
@@ -10,6 +10,7 @@ import cgeo.geocaching.utils.Log;
import ch.boye.httpclientandroidlib.client.entity.UrlEncodedFormEntity;
import ch.boye.httpclientandroidlib.util.EntityUtils;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -90,9 +91,6 @@ public class TwitterAuthorizationActivity extends AbstractActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- // init
- app.setAction("setting up");
-
setTheme();
setContentView(R.layout.auth);
setTitle(res.getString(R.string.auth_twitter));