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

import cgeo.geocaching.Geocache;
import cgeo.geocaching.R;
import cgeo.geocaching.Waypoint;
import cgeo.geocaching.geopoint.Geopoint;

import com.mapswithme.maps.api.MapsWithMeApi;

import android.app.Activity;

public class MapsWithMeApp extends AbstractPointNavigationApp {

    protected MapsWithMeApp() {
        super(getString(R.string.cache_menu_mapswithme), R.id.cache_app_mapswithme, null);
    }

    @Override
    public void navigate(Activity activity, Geopoint coords) {
        navigate(activity, coords, getString(R.string.unknown));
    }

    @Override
    public void navigate(Activity activity, Geocache cache) {
        navigate(activity, cache.getCoords(), cache.getName());
    }

    private static void navigate(Activity activity, Geopoint coords, String label) {
        MapsWithMeApi.showPointOnMap(activity, coords.getLatitude(), coords.getLongitude(), label);
    }

    @Override
    public void navigate(Activity activity, Waypoint waypoint) {
        navigate(activity, waypoint.getCoords(), waypoint.getName());
    }

    @Override
    public boolean isInstalled() {
        // the library can handle the app not being installed
        return true;
    }

}