blob: 4fa73c7b30adc42d990b976a0d51ae5d503e50ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.geopoint.Geopoint;
import cgeo.geocaching.geopoint.GeopointFormatter.Format;
import android.app.Activity;
import android.content.Intent;
import java.util.ArrayList;
class RMapsApp extends AbstractNavigationApp {
private static final String INTENT = "com.robert.maps.action.SHOW_POINTS";
RMapsApp() {
super(getString(R.string.cache_menu_rmaps), INTENT);
}
@Override
public boolean invoke(cgGeo geo, Activity activity, cgCache cache,
final SearchResult search, cgWaypoint waypoint, final Geopoint coords) {
try {
final ArrayList<String> locations = new ArrayList<String>();
if (cache != null && cache.getCoords() != null) {
locations.add(cache.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA)
+ ";" + cache.getGeocode()
+ ";" + cache.getName());
} else if (waypoint != null && waypoint.getCoords() != null) {
locations.add(waypoint.getCoords().format(Format.LAT_LON_DECDEGREE_COMMA)
+ ";" + waypoint.getLookup()
+ ";" + waypoint.getName());
}
if (!locations.isEmpty()) {
final Intent intent = new Intent(INTENT);
intent.putStringArrayListExtra("locations", locations);
activity.startActivity(intent);
return true;
}
} catch (Exception e) {
// nothing
}
return false;
}
}
|