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

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import cgeo.geocaching.R;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgGeo;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeosmaps;
import cgeo.geocaching.activity.ActivityMixin;

class StaticMapApp extends AbstractNavigationApp implements
		NavigationApp {

	StaticMapApp(final Resources res) {
		super(res.getString(R.string.cache_menu_map_static), null);
	}

	@Override
	public boolean isInstalled(Context context) {
		return true;
	}

	@Override
	public boolean invoke(cgGeo geo, Activity activity, Resources res,
			cgCache cache,
			Long searchId, cgWaypoint waypoint, Double latitude, Double longitude) {

		if (cache == null || cache.reason == 0) {
			ActivityMixin.showToast(activity, res.getString(R.string.err_detail_no_map_static));
			return true;
		}

		if (cache.geocode != null) {
			Intent smapsIntent = new Intent(activity, cgeosmaps.class);
			smapsIntent.putExtra("geocode", cache.geocode.toUpperCase());
			activity.startActivity(smapsIntent);
			return true;
		}
		return false;
	}

}