aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/apps/cache/navi/InternalMap.java
blob: b0eb5c81bdf32d264cc4f103b434a84bdc4b49f2 (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 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.cgWarning;
import cgeo.geocaching.cgWaypoint;

import com.google.android.apps.analytics.GoogleAnalyticsTracker;

class InternalMap extends AbstractInternalMap implements
		NavigationApp {

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

	@Override
	public boolean invoke(cgGeo geo, Activity activity, Resources res,
			cgWarning warning, GoogleAnalyticsTracker tracker, cgCache cache,
			Long searchId, cgWaypoint waypoint, Double latitude, Double longitude) {
		cgSettings settings = getSettings(activity);
		Intent mapIntent = new Intent(activity, settings.getMapFactory().getMapClass());
		if (searchId != null) {
			mapIntent.putExtra("detail", true);
			mapIntent.putExtra("searchid", searchId);
		}
		if (waypoint != null) {
			mapIntent.putExtra("latitude", waypoint.latitude);
			mapIntent.putExtra("longitude", waypoint.longitude);
			mapIntent.putExtra("wpttype", waypoint.type);
		}
		if (cache != null) {
			mapIntent.putExtra("latitude", cache.latitude);
			mapIntent.putExtra("longitude", cache.longitude);
		}

		activity.startActivity(mapIntent);
		return true;
	}

}