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
|
package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeonavigate;
import cgeo.geocaching.geopoint.Geopoint;
import android.app.Activity;
class CompassApp extends AbstractNavigationApp {
CompassApp() {
super(getString(R.string.compass_title), null);
}
@Override
public boolean isInstalled() {
return true;
}
@Override
public boolean invoke(Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
if (cache != null && cache.getGeocode() != null) {
cgeonavigate.startActivity(activity, cache.getGeocode(), cache.getName(), cache.getCoords(), null);
return true;
}
if (waypoint != null && waypoint.getCoords() != null) {
cgeonavigate.startActivity(activity, waypoint.getPrefix() + "/" + waypoint.getLookup(), waypoint.getName(), waypoint.getCoords(), null);
return true;
}
if (coords != null) {
cgeonavigate.startActivity(activity, getString(R.string.navigation_direct_navigation), getString(R.string.navigation_target), coords, null);
return true;
}
// search is not handled here
return false;
}
}
|