aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/apps/cache/navi/InternalMap.java
blob: 4936842bab3eee40d62ec4e785f87a6ffa4abdf5 (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
package cgeo.geocaching.apps.cache.navi;

import java.util.UUID;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
import cgeo.geocaching.cgSettings;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.geopoint.Geopoint;

class InternalMap extends AbstractInternalMap implements
		NavigationApp {

	InternalMap(Resources res) {
		super(res.getString(R.string.cache_menu_map), null);
	}

	@Override
	public boolean invoke(cgGeo geo, Activity activity, Resources res,
			cgCache cache,
			final UUID searchId, cgWaypoint waypoint, final Geopoint coords) {
		cgSettings settings = getSettings(activity);
		Intent mapIntent = new Intent(activity, settings.getMapFactory().getMapClass());
		if (cache != null) {
			mapIntent.putExtra("detail", false);
			mapIntent.putExtra("geocode", cache.geocode);
		}
		if (searchId != null) {
			mapIntent.putExtra("detail", true);
			mapIntent.putExtra("searchid", searchId.toString());
		}
		if (waypoint != null) {
			mapIntent.putExtra("latitude", waypoint.coords.getLatitude());
			mapIntent.putExtra("longitude", waypoint.coords.getLongitude());
			mapIntent.putExtra("wpttype", waypoint.type);
		}

		activity.startActivity(mapIntent);
		return true;
	}

}