blob: 266acfdd32bb59bc1e4ad86d03cf5bea6e3c7381 (
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.ILogable;
import cgeo.geocaching.R;
import cgeo.geocaching.StaticMapsActivity;
import cgeo.geocaching.StaticMapsProvider;
import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
import cgeo.geocaching.geopoint.Geopoint;
import org.apache.commons.lang3.StringUtils;
import android.app.Activity;
abstract class AbstractStaticMapsApp extends AbstractNavigationApp {
public AbstractStaticMapsApp(String name) {
super(name, null);
}
@Override
public boolean isInstalled() {
return true;
}
protected static boolean hasStaticMap(cgCache cache) {
if (cache != null) {
String geocode = cache.getGeocode();
if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
return StaticMapsProvider.doesExistStaticMapForCache(geocode);
}
}
return false;
}
protected static boolean hasStaticMap(cgWaypoint waypoint) {
if (waypoint != null) {
String geocode = waypoint.getGeocode();
int id = waypoint.getId();
if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
return StaticMapsProvider.doesExistStaticMapForWaypoint(geocode, id);
}
}
return false;
}
protected static boolean invoke(final Activity activity, final cgCache cache, final cgWaypoint waypoint, final boolean download) {
final ILogable logable = cache != null && cache.getListId() != 0 ? cache : waypoint;
final String geocode = StringUtils.upperCase(logable.getGeocode());
if (geocode == null) {
ActivityMixin.showToast(activity, getString(R.string.err_detail_no_map_static));
return true;
}
StaticMapsActivity.startActivity(activity, geocode, download, waypoint);
return true;
}
@Override
public boolean isEnabled(Geopoint geopoint) {
return false;
}
}
|